@umituz/web-virtual 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/ASSET_CREDITS.md +45 -0
- package/assets/models/characters/character-female-a.glb +0 -0
- package/assets/models/characters/character-female-b.glb +0 -0
- package/assets/models/characters/character-male-a.glb +0 -0
- package/assets/models/characters/character-male-b.glb +0 -0
- package/assets/models/decor/lampRoundFloor.glb +0 -0
- package/assets/models/decor/plantSmall1.glb +0 -0
- package/assets/models/decor/pottedPlant.glb +0 -0
- package/assets/models/decor/trashcan.glb +0 -0
- package/assets/models/equipment/computerKeyboard.glb +0 -0
- package/assets/models/equipment/computerMouse.glb +0 -0
- package/assets/models/equipment/computerScreen.glb +0 -0
- package/assets/models/equipment/laptop.glb +0 -0
- package/assets/models/furniture/bookcaseOpen.glb +0 -0
- package/assets/models/furniture/chairDesk.glb +0 -0
- package/assets/models/furniture/desk.glb +0 -0
- package/assets/models/furniture/deskCorner.glb +0 -0
- package/assets/models/furniture/loungeChair.glb +0 -0
- package/assets/models/furniture/loungeSofa.glb +0 -0
- package/assets/models/furniture/table.glb +0 -0
- package/assets/models/furniture/tableCoffee.glb +0 -0
- package/package.json +2 -1
- package/src/components/EntityPins.tsx +0 -1
- package/src/engine/assetCatalog.test.ts +29 -0
- package/src/engine/assetCatalog.ts +222 -0
- package/src/engine/index.ts +2 -0
- package/src/engine/modelLoader.ts +126 -0
- package/src/entities/furniture/DeskBuilder.ts +197 -201
- package/src/entities/people/AvatarBuilder.ts +150 -208
- package/src/entities/props/PlantBuilder.ts +33 -36
- package/src/presets/officePreset.ts +37 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as THREE from 'three'
|
|
2
2
|
import type { WorldEntity } from '../../core/types'
|
|
3
3
|
import type { MaterialPalette } from '../../engine/materials'
|
|
4
|
+
import { ModelLoader } from '../../engine/modelLoader'
|
|
4
5
|
|
|
5
6
|
export interface CreatedAvatar {
|
|
6
7
|
group: THREE.Group
|
|
@@ -21,15 +22,10 @@ export function createStylizedAvatar(
|
|
|
21
22
|
: parseInt(String(entity.pinNumber || '1'), 10) || 1
|
|
22
23
|
const seed = (pinNum * 2.39996) + ((entity.id.charCodeAt(0) || 1) * 0.15)
|
|
23
24
|
|
|
24
|
-
// Material
|
|
25
|
-
const skinMat = materials.getSkinMaterial()
|
|
26
|
-
const hairMat = materials.getHairMaterial(entity.avatarHair || '#1e1b4b')
|
|
27
|
-
const clothesMat = materials.getClothingMaterial(entity.avatarColor || '#2563eb')
|
|
28
|
-
const pantsMat = materials.getDarkSlate('#1e293b')
|
|
25
|
+
// Status Material
|
|
29
26
|
const statusMat = materials.getStatusGlow(entity.status || 'idle')
|
|
30
27
|
|
|
31
|
-
// Seated offset relative to workstation center (chair seat is at z = +0.
|
|
32
|
-
// For executive desk (slot-1), chair is at z = +0.65
|
|
28
|
+
// Seated offset relative to workstation center (chair seat is at z = +0.44)
|
|
33
29
|
const isExecutive = entity.id === 'slot-1' || entity.zoneId === 'executive'
|
|
34
30
|
const seatZ = isExecutive ? 0.62 : 0.44
|
|
35
31
|
|
|
@@ -46,172 +42,121 @@ export function createStylizedAvatar(
|
|
|
46
42
|
clickProxy.userData = { entityId: entity.id }
|
|
47
43
|
avatarRoot.add(clickProxy)
|
|
48
44
|
|
|
49
|
-
// 2.
|
|
50
|
-
const
|
|
51
|
-
|
|
45
|
+
// 2. Real 3D Model Container
|
|
46
|
+
const modelsContainer = new THREE.Group()
|
|
47
|
+
modelsContainer.name = `character-real-${entity.id}`
|
|
48
|
+
avatarRoot.add(modelsContainer)
|
|
49
|
+
|
|
50
|
+
// Bone node references for procedural animation
|
|
51
|
+
let realHead: THREE.Object3D | null = null
|
|
52
|
+
let realTorso: THREE.Object3D | null = null
|
|
53
|
+
let realLeftArm: THREE.Object3D | null = null
|
|
54
|
+
let realRightArm: THREE.Object3D | null = null
|
|
55
|
+
|
|
56
|
+
// 3. Fallback Placeholder Geometry (shown while 3D GLB model loads)
|
|
57
|
+
const placeholderGroup = new THREE.Group()
|
|
58
|
+
placeholderGroup.name = 'character-placeholder'
|
|
59
|
+
|
|
60
|
+
const skinMat = materials.getSkinMaterial()
|
|
61
|
+
const hairMat = materials.getHairMaterial(entity.avatarHair || '#1e1b4b')
|
|
62
|
+
const clothesMat = materials.getClothingMaterial(entity.avatarColor || '#2563eb')
|
|
63
|
+
const pantsMat = materials.getDarkSlate('#1e293b')
|
|
64
|
+
|
|
65
|
+
const thighs = new THREE.Mesh(new THREE.BoxGeometry(0.36, 0.12, 0.38), pantsMat)
|
|
52
66
|
thighs.position.set(0, 0.48, -0.16)
|
|
53
67
|
thighs.userData = { entityId: entity.id }
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
//
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
headGroup.add(sweep)
|
|
131
|
-
} else if (hairStyle === 1) {
|
|
132
|
-
// Textured fringe / pompadour
|
|
133
|
-
const hairCapGeo = new THREE.SphereGeometry(0.18, 14, 14, 0, Math.PI * 2, 0, Math.PI * 0.52)
|
|
134
|
-
const hairCap = new THREE.Mesh(hairCapGeo, hairMat)
|
|
135
|
-
hairCap.position.set(0, 0.035, 0)
|
|
136
|
-
headGroup.add(hairCap)
|
|
137
|
-
|
|
138
|
-
const fringeGeo = new THREE.CylinderGeometry(0.14, 0.15, 0.08, 10)
|
|
139
|
-
const fringe = new THREE.Mesh(fringeGeo, hairMat)
|
|
140
|
-
fringe.position.set(0, 0.14, -0.05)
|
|
141
|
-
fringe.rotation.x = -0.3
|
|
142
|
-
headGroup.add(fringe)
|
|
143
|
-
} else {
|
|
144
|
-
// Elegant top bun / sleek bob
|
|
145
|
-
const hairBobGeo = new THREE.SphereGeometry(0.182, 14, 14, 0, Math.PI * 2, 0, Math.PI * 0.6)
|
|
146
|
-
const hairBob = new THREE.Mesh(hairBobGeo, hairMat)
|
|
147
|
-
hairBob.position.set(0, 0.02, 0)
|
|
148
|
-
headGroup.add(hairBob)
|
|
149
|
-
|
|
150
|
-
const bunGeo = new THREE.SphereGeometry(0.08, 12, 12)
|
|
151
|
-
const bun = new THREE.Mesh(bunGeo, hairMat)
|
|
152
|
-
bun.position.set(0, 0.16, 0.12)
|
|
153
|
-
headGroup.add(bun)
|
|
154
|
-
}
|
|
68
|
+
placeholderGroup.add(thighs)
|
|
69
|
+
|
|
70
|
+
const torsoPlaceholder = new THREE.Group()
|
|
71
|
+
torsoPlaceholder.position.set(0, 0.6, 0)
|
|
72
|
+
placeholderGroup.add(torsoPlaceholder)
|
|
73
|
+
|
|
74
|
+
const torsoMesh = new THREE.Mesh(new THREE.CylinderGeometry(0.20, 0.17, 0.44, 12), clothesMat)
|
|
75
|
+
torsoMesh.position.set(0, 0.22, 0)
|
|
76
|
+
torsoMesh.castShadow = true
|
|
77
|
+
torsoMesh.userData = { entityId: entity.id }
|
|
78
|
+
torsoPlaceholder.add(torsoMesh)
|
|
79
|
+
|
|
80
|
+
const headMesh = new THREE.Mesh(new THREE.SphereGeometry(0.17, 16, 16), skinMat)
|
|
81
|
+
headMesh.position.set(0, 0.66, 0)
|
|
82
|
+
headMesh.castShadow = true
|
|
83
|
+
headMesh.userData = { entityId: entity.id }
|
|
84
|
+
torsoPlaceholder.add(headMesh)
|
|
85
|
+
|
|
86
|
+
const hairMesh = new THREE.Mesh(
|
|
87
|
+
new THREE.SphereGeometry(0.178, 14, 14, 0, Math.PI * 2, 0, Math.PI * 0.55),
|
|
88
|
+
hairMat,
|
|
89
|
+
)
|
|
90
|
+
hairMesh.position.set(0, 0.69, 0)
|
|
91
|
+
hairMesh.rotation.x = -0.1
|
|
92
|
+
torsoPlaceholder.add(hairMesh)
|
|
93
|
+
|
|
94
|
+
avatarRoot.add(placeholderGroup)
|
|
95
|
+
|
|
96
|
+
// 4. Select character model variety across 4 distinct models
|
|
97
|
+
const charModels = [
|
|
98
|
+
'character:male-a',
|
|
99
|
+
'character:female-a',
|
|
100
|
+
'character:male-b',
|
|
101
|
+
'character:female-b',
|
|
102
|
+
]
|
|
103
|
+
const selectedCharId = charModels[pinNum % charModels.length] || 'character:male-a'
|
|
104
|
+
|
|
105
|
+
// Load Real 3D Character Model
|
|
106
|
+
const loader = ModelLoader.getInstance()
|
|
107
|
+
void loader.load(selectedCharId).then((charModel) => {
|
|
108
|
+
if (charModel) {
|
|
109
|
+
placeholderGroup.visible = false
|
|
110
|
+
|
|
111
|
+
// Scale and position character seated on chair
|
|
112
|
+
charModel.scale.set(1.65, 1.65, 1.65)
|
|
113
|
+
charModel.position.set(0, 0.44, -0.05)
|
|
114
|
+
charModel.traverse((node) => {
|
|
115
|
+
if (node instanceof THREE.Mesh) {
|
|
116
|
+
node.castShadow = true
|
|
117
|
+
node.receiveShadow = true
|
|
118
|
+
}
|
|
119
|
+
node.userData = { entityId: entity.id }
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
// Locate anatomical bone nodes
|
|
123
|
+
realHead = charModel.getObjectByName('head') || null
|
|
124
|
+
realTorso = charModel.getObjectByName('torso') || null
|
|
125
|
+
realLeftArm = charModel.getObjectByName('arm-left') || null
|
|
126
|
+
realRightArm = charModel.getObjectByName('arm-right') || null
|
|
127
|
+
|
|
128
|
+
const legLeft = charModel.getObjectByName('leg-left')
|
|
129
|
+
const legRight = charModel.getObjectByName('leg-right')
|
|
130
|
+
|
|
131
|
+
// Bend legs forward at 90 degrees into natural seated posture
|
|
132
|
+
if (legLeft) legLeft.rotation.x = -Math.PI / 2.2
|
|
133
|
+
if (legRight) legRight.rotation.x = -Math.PI / 2.2
|
|
134
|
+
|
|
135
|
+
// Position arms forward resting on desk
|
|
136
|
+
if (realLeftArm) {
|
|
137
|
+
realLeftArm.rotation.x = Math.PI / 2.6
|
|
138
|
+
realLeftArm.rotation.z = -0.15
|
|
139
|
+
}
|
|
140
|
+
if (realRightArm) {
|
|
141
|
+
realRightArm.rotation.x = Math.PI / 2.6
|
|
142
|
+
realRightArm.rotation.z = 0.15
|
|
143
|
+
}
|
|
155
144
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
const leftUpperArm = new THREE.Mesh(new THREE.CylinderGeometry(0.05, 0.045, 0.26, 8), clothesMat)
|
|
162
|
-
leftUpperArm.position.set(0, -0.12, -0.04)
|
|
163
|
-
leftUpperArm.rotation.x = 0.35
|
|
164
|
-
leftShoulder.add(leftUpperArm)
|
|
165
|
-
|
|
166
|
-
const leftElbow = new THREE.Group()
|
|
167
|
-
leftElbow.position.set(0, -0.24, -0.08)
|
|
168
|
-
leftShoulder.add(leftElbow)
|
|
169
|
-
|
|
170
|
-
const leftForearm = new THREE.Mesh(new THREE.CylinderGeometry(0.042, 0.038, 0.24, 8), clothesMat)
|
|
171
|
-
leftForearm.position.set(0, 0.02, -0.12)
|
|
172
|
-
leftForearm.rotation.x = -Math.PI / 2.3
|
|
173
|
-
leftElbow.add(leftForearm)
|
|
174
|
-
|
|
175
|
-
const leftHand = new THREE.Mesh(new THREE.SphereGeometry(0.04, 8, 8), skinMat)
|
|
176
|
-
leftHand.position.set(0, 0.02, -0.24)
|
|
177
|
-
leftHand.userData = { entityId: entity.id }
|
|
178
|
-
leftElbow.add(leftHand)
|
|
179
|
-
|
|
180
|
-
// 8. Articulated Right Arm (Shoulder -> Forearm -> Hand on Keyboard / Mouse)
|
|
181
|
-
const rightShoulder = new THREE.Group()
|
|
182
|
-
rightShoulder.position.set(0.21, 0.38, 0)
|
|
183
|
-
torsoGroup.add(rightShoulder)
|
|
184
|
-
|
|
185
|
-
const rightUpperArm = new THREE.Mesh(new THREE.CylinderGeometry(0.05, 0.045, 0.26, 8), clothesMat)
|
|
186
|
-
rightUpperArm.position.set(0, -0.12, -0.04)
|
|
187
|
-
rightUpperArm.rotation.x = 0.35
|
|
188
|
-
rightShoulder.add(rightUpperArm)
|
|
189
|
-
|
|
190
|
-
const rightElbow = new THREE.Group()
|
|
191
|
-
rightElbow.position.set(0, -0.24, -0.08)
|
|
192
|
-
rightShoulder.add(rightElbow)
|
|
193
|
-
|
|
194
|
-
const rightForearm = new THREE.Mesh(new THREE.CylinderGeometry(0.042, 0.038, 0.24, 8), clothesMat)
|
|
195
|
-
rightForearm.position.set(0, 0.02, -0.12)
|
|
196
|
-
rightForearm.rotation.x = -Math.PI / 2.3
|
|
197
|
-
rightElbow.add(rightForearm)
|
|
198
|
-
|
|
199
|
-
const rightHand = new THREE.Mesh(new THREE.SphereGeometry(0.04, 8, 8), skinMat)
|
|
200
|
-
rightHand.position.set(0, 0.02, -0.24)
|
|
201
|
-
rightHand.userData = { entityId: entity.id }
|
|
202
|
-
rightElbow.add(rightHand)
|
|
203
|
-
|
|
204
|
-
// 9. Floating Status Pin Indicator (Compact, elegant glow disk)
|
|
145
|
+
modelsContainer.add(charModel)
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
// 5. Floating Status Pin Indicator (Compact, elegant glow disk)
|
|
205
150
|
const statusHalo = new THREE.Mesh(
|
|
206
151
|
new THREE.RingGeometry(0.07, 0.11, 24),
|
|
207
152
|
statusMat,
|
|
208
153
|
)
|
|
209
|
-
statusHalo.position.set(0, 1.
|
|
154
|
+
statusHalo.position.set(0, 1.7, 0)
|
|
210
155
|
statusHalo.rotation.x = -Math.PI / 2
|
|
211
156
|
statusHalo.userData = { entityId: entity.id }
|
|
212
|
-
|
|
157
|
+
avatarRoot.add(statusHalo)
|
|
213
158
|
|
|
214
|
-
//
|
|
159
|
+
// 6. Realistic Procedural Animation Function
|
|
215
160
|
const baseTorsoY = 0.6
|
|
216
161
|
const isWorking = entity.status === 'running' || entity.status === 'working'
|
|
217
162
|
const isAwaiting = entity.status === 'awaiting_approval'
|
|
@@ -219,62 +164,59 @@ export function createStylizedAvatar(
|
|
|
219
164
|
const glanceFreq = 0.22 + ((seed * 3) % 0.15)
|
|
220
165
|
|
|
221
166
|
const animate = (_delta: number, elapsed: number) => {
|
|
222
|
-
//
|
|
167
|
+
// Breathing cycle
|
|
223
168
|
const breath = Math.sin(elapsed * breathFreq + seed) * 0.007
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
169
|
+
torsoPlaceholder.position.y = baseTorsoY + breath
|
|
170
|
+
|
|
171
|
+
if (realTorso) {
|
|
172
|
+
realTorso.position.y = breath * 0.5
|
|
173
|
+
realTorso.rotation.x = Math.sin(elapsed * breathFreq + seed) * 0.012
|
|
174
|
+
}
|
|
227
175
|
|
|
228
|
-
//
|
|
229
|
-
// Smooth transitions between center screen, secondary screen and keyboard
|
|
176
|
+
// Natural Gaze between dual monitors
|
|
230
177
|
const glanceCycle = Math.sin(elapsed * glanceFreq + seed)
|
|
231
|
-
const keyboardLook = Math.cos(elapsed * (glanceFreq * 1.7) + seed)
|
|
232
178
|
|
|
233
179
|
if (isWorking) {
|
|
234
|
-
//
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
rightElbow.position.x = 0
|
|
180
|
+
// Active working glances & typing
|
|
181
|
+
if (realHead) {
|
|
182
|
+
realHead.rotation.y = glanceCycle * 0.28
|
|
183
|
+
realHead.rotation.x = -0.04
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (realLeftArm) {
|
|
187
|
+
realLeftArm.rotation.x = Math.PI / 2.6 + Math.sin(elapsed * 12 + seed) * 0.03
|
|
188
|
+
}
|
|
189
|
+
if (realRightArm) {
|
|
190
|
+
const mouseCycle = Math.sin(elapsed * 0.9 + seed)
|
|
191
|
+
if (mouseCycle > 0.3) {
|
|
192
|
+
// Slide arm to mouse
|
|
193
|
+
realRightArm.rotation.x = Math.PI / 2.8
|
|
194
|
+
realRightArm.rotation.y = 0.18
|
|
195
|
+
} else {
|
|
196
|
+
// Typing on keyboard
|
|
197
|
+
realRightArm.rotation.x = Math.PI / 2.6 + Math.cos(elapsed * 14 + seed) * 0.03
|
|
198
|
+
realRightArm.rotation.y = 0
|
|
199
|
+
}
|
|
255
200
|
}
|
|
256
201
|
|
|
257
|
-
// Status indicator pulsing
|
|
258
202
|
statusHalo.scale.setScalar(1 + Math.sin(elapsed * 3.5 + seed) * 0.15)
|
|
259
203
|
} else if (isAwaiting) {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
leftElbow.rotation.x = 0
|
|
265
|
-
rightElbow.rotation.x = 0
|
|
266
|
-
rightShoulder.rotation.y = 0
|
|
267
|
-
rightElbow.position.x = 0
|
|
204
|
+
if (realHead) {
|
|
205
|
+
realHead.rotation.y = Math.sin(elapsed * 0.4 + seed) * 0.15
|
|
206
|
+
realHead.rotation.z = 0.12 // thoughtful tilt
|
|
207
|
+
}
|
|
268
208
|
statusHalo.scale.setScalar(1 + Math.sin(elapsed * 2) * 0.2)
|
|
269
209
|
} else {
|
|
270
|
-
// Idle
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
210
|
+
// Idle
|
|
211
|
+
if (realHead) {
|
|
212
|
+
realHead.rotation.y = glanceCycle * 0.18
|
|
213
|
+
realHead.rotation.z = 0
|
|
214
|
+
}
|
|
215
|
+
if (realLeftArm) realLeftArm.rotation.x = Math.PI / 2.6
|
|
216
|
+
if (realRightArm) {
|
|
217
|
+
realRightArm.rotation.x = Math.PI / 2.6
|
|
218
|
+
realRightArm.rotation.y = 0
|
|
219
|
+
}
|
|
278
220
|
statusHalo.scale.setScalar(1)
|
|
279
221
|
}
|
|
280
222
|
}
|
|
@@ -1,58 +1,55 @@
|
|
|
1
1
|
import * as THREE from 'three'
|
|
2
2
|
import type { MaterialPalette } from '../../engine/materials'
|
|
3
|
+
import { ModelLoader } from '../../engine/modelLoader'
|
|
3
4
|
|
|
4
5
|
export function createFicusPlant(materials: MaterialPalette): THREE.Group {
|
|
5
6
|
const group = new THREE.Group()
|
|
6
7
|
|
|
8
|
+
// Contact shadow under plant pot
|
|
9
|
+
const shadow = new THREE.Mesh(
|
|
10
|
+
new THREE.PlaneGeometry(0.7, 0.7),
|
|
11
|
+
materials.getContactShadowMaterial(),
|
|
12
|
+
)
|
|
13
|
+
shadow.rotation.x = -Math.PI / 2
|
|
14
|
+
shadow.position.set(0, 0.003, 0)
|
|
15
|
+
group.add(shadow)
|
|
16
|
+
|
|
17
|
+
const modelsContainer = new THREE.Group()
|
|
18
|
+
group.add(modelsContainer)
|
|
19
|
+
|
|
20
|
+
// Placeholder
|
|
21
|
+
const placeholder = new THREE.Group()
|
|
7
22
|
const potMat = materials.getTerracottaPotMaterial()
|
|
8
23
|
const leafMat = materials.getPlantLeavesMaterial()
|
|
9
24
|
const trunkMat = materials.getExecutiveWoodMaterial()
|
|
10
25
|
|
|
11
|
-
// Terracotta pot
|
|
12
26
|
const potGeo = new THREE.CylinderGeometry(0.32, 0.22, 0.55, 16)
|
|
13
27
|
const pot = new THREE.Mesh(potGeo, potMat)
|
|
14
28
|
pot.position.set(0, 0.275, 0)
|
|
15
29
|
pot.castShadow = true
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// Soil
|
|
19
|
-
const soilGeo = new THREE.CylinderGeometry(0.3, 0.3, 0.05, 16)
|
|
20
|
-
const soilMat = materials.getDarkSlate('#26180b')
|
|
21
|
-
const soil = new THREE.Mesh(soilGeo, soilMat)
|
|
22
|
-
soil.position.set(0, 0.53, 0)
|
|
23
|
-
group.add(soil)
|
|
30
|
+
placeholder.add(pot)
|
|
24
31
|
|
|
25
|
-
// Trunks
|
|
26
32
|
const t1 = new THREE.Mesh(new THREE.CylinderGeometry(0.04, 0.05, 1.2, 8), trunkMat)
|
|
27
33
|
t1.position.set(0, 1.0, 0)
|
|
28
|
-
t1
|
|
29
|
-
group.add(t1)
|
|
30
|
-
|
|
31
|
-
const t2 = new THREE.Mesh(new THREE.CylinderGeometry(0.03, 0.04, 1.0, 8), trunkMat)
|
|
32
|
-
t2.position.set(0.08, 0.9, 0.05)
|
|
33
|
-
t2.rotation.z = 0.12
|
|
34
|
-
group.add(t2)
|
|
35
|
-
|
|
36
|
-
// Foliage clusters
|
|
37
|
-
const leafClusterGeo = new THREE.DodecahedronGeometry(0.32, 1)
|
|
34
|
+
placeholder.add(t1)
|
|
38
35
|
|
|
39
|
-
const cluster1 = new THREE.Mesh(
|
|
40
|
-
cluster1.position.set(
|
|
41
|
-
cluster1.scale.set(1.2, 1.0, 1.1)
|
|
36
|
+
const cluster1 = new THREE.Mesh(new THREE.DodecahedronGeometry(0.38, 1), leafMat)
|
|
37
|
+
cluster1.position.set(0, 1.55, 0)
|
|
42
38
|
cluster1.castShadow = true
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
39
|
+
placeholder.add(cluster1)
|
|
40
|
+
|
|
41
|
+
group.add(placeholder)
|
|
42
|
+
|
|
43
|
+
// Real 3D Plant Model
|
|
44
|
+
const loader = ModelLoader.getInstance()
|
|
45
|
+
void loader.load('decor:pottedPlant').then((plantModel) => {
|
|
46
|
+
if (plantModel) {
|
|
47
|
+
placeholder.visible = false
|
|
48
|
+
plantModel.scale.set(1.4, 1.4, 1.4)
|
|
49
|
+
plantModel.position.set(0, 0, 0)
|
|
50
|
+
modelsContainer.add(plantModel)
|
|
51
|
+
}
|
|
52
|
+
})
|
|
56
53
|
|
|
57
54
|
return group
|
|
58
55
|
}
|
|
@@ -4,6 +4,7 @@ import { MaterialPalette } from '../engine/materials'
|
|
|
4
4
|
import { buildOfficeArchitecture } from '../entities/architecture/OfficeArchitectureBuilder'
|
|
5
5
|
import { createModernWorkstation, createExecutiveDesk, createConferenceTable } from '../entities/furniture/DeskBuilder'
|
|
6
6
|
import { createFicusPlant } from '../entities/props/PlantBuilder'
|
|
7
|
+
import { ModelLoader } from '../engine/modelLoader'
|
|
7
8
|
|
|
8
9
|
export const DEFAULT_OFFICE_ZONES: WorldZone[] = [
|
|
9
10
|
{
|
|
@@ -480,5 +481,41 @@ export const officePreset: WorldPreset = {
|
|
|
480
481
|
plant.position.set(coord[0], 0, coord[1])
|
|
481
482
|
scene.add(plant)
|
|
482
483
|
}
|
|
484
|
+
|
|
485
|
+
// 7. Executive Bookcases & Lounge Breakout Real 3D Models
|
|
486
|
+
const loader = ModelLoader.getInstance()
|
|
487
|
+
void loader.load('furniture:bookcaseOpen').then((bookcase) => {
|
|
488
|
+
if (bookcase) {
|
|
489
|
+
bookcase.scale.set(1.8, 1.8, 1.8)
|
|
490
|
+
bookcase.position.set(14.5, 0, -9.2)
|
|
491
|
+
scene.add(bookcase)
|
|
492
|
+
}
|
|
493
|
+
})
|
|
494
|
+
|
|
495
|
+
void loader.load('furniture:loungeSofa').then((sofa) => {
|
|
496
|
+
if (sofa) {
|
|
497
|
+
sofa.scale.set(1.5, 1.5, 1.5)
|
|
498
|
+
sofa.position.set(6.5, 0, -2.5)
|
|
499
|
+
sofa.rotation.y = Math.PI / 2
|
|
500
|
+
scene.add(sofa)
|
|
501
|
+
}
|
|
502
|
+
})
|
|
503
|
+
|
|
504
|
+
void loader.load('furniture:tableCoffee').then((coffeeTable) => {
|
|
505
|
+
if (coffeeTable) {
|
|
506
|
+
coffeeTable.scale.set(1.4, 1.4, 1.4)
|
|
507
|
+
coffeeTable.position.set(5.2, 0, -2.5)
|
|
508
|
+
scene.add(coffeeTable)
|
|
509
|
+
}
|
|
510
|
+
})
|
|
511
|
+
|
|
512
|
+
void loader.load('furniture:loungeChair').then((armchair) => {
|
|
513
|
+
if (armchair) {
|
|
514
|
+
armchair.scale.set(1.4, 1.4, 1.4)
|
|
515
|
+
armchair.position.set(5.2, 0, -1.2)
|
|
516
|
+
armchair.rotation.y = Math.PI
|
|
517
|
+
scene.add(armchair)
|
|
518
|
+
}
|
|
519
|
+
})
|
|
483
520
|
},
|
|
484
521
|
}
|