@umituz/web-virtual 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/README.md +63 -2
- package/package.json +78 -4
- package/src/components/EntityInspector.tsx +224 -0
- package/src/components/EntityPins.tsx +67 -0
- package/src/components/VirtualWorld.tsx +229 -0
- package/src/components/WorldControls.tsx +143 -0
- package/src/components/index.ts +4 -0
- package/src/core/environment.test.ts +55 -0
- package/src/core/environment.ts +120 -0
- package/src/core/events.ts +50 -0
- package/src/core/index.ts +4 -0
- package/src/core/registry.ts +80 -0
- package/src/core/types.ts +170 -0
- package/src/engine/camera.ts +111 -0
- package/src/engine/index.ts +6 -0
- package/src/engine/lighting.ts +81 -0
- package/src/engine/materials.ts +215 -0
- package/src/engine/performance.ts +79 -0
- package/src/engine/raycaster.ts +51 -0
- package/src/engine/renderer.ts +227 -0
- package/src/entities/architecture/OfficeArchitectureBuilder.ts +172 -0
- package/src/entities/furniture/DeskBuilder.ts +280 -0
- package/src/entities/index.ts +4 -0
- package/src/entities/people/AvatarBuilder.ts +116 -0
- package/src/entities/props/PlantBuilder.ts +58 -0
- package/src/index.ts +6 -0
- package/src/presets/factoryPreset.ts +168 -0
- package/src/presets/farmPreset.ts +158 -0
- package/src/presets/hospitalPreset.ts +117 -0
- package/src/presets/index.ts +5 -0
- package/src/presets/officePreset.ts +415 -0
- package/src/presets/schoolPreset.ts +111 -0
- package/src/styles/virtual.css +190 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import * as THREE from 'three'
|
|
2
|
+
import type { WorldEntity } from '../../core/types'
|
|
3
|
+
import type { MaterialPalette } from '../../engine/materials'
|
|
4
|
+
|
|
5
|
+
export interface CreatedAvatar {
|
|
6
|
+
group: THREE.Group
|
|
7
|
+
animate: (delta: number, elapsed: number) => void
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function createStylizedAvatar(
|
|
11
|
+
entity: WorldEntity,
|
|
12
|
+
materials: MaterialPalette,
|
|
13
|
+
): CreatedAvatar {
|
|
14
|
+
const group = new THREE.Group()
|
|
15
|
+
group.name = `avatar-${entity.id}`
|
|
16
|
+
group.userData = { entityId: entity.id, type: 'person' }
|
|
17
|
+
|
|
18
|
+
// Material selection based on entity configuration
|
|
19
|
+
const skinMat = materials.getSkinMaterial()
|
|
20
|
+
const hairMat = materials.getHairMaterial(entity.avatarHair || '#1e1b4b')
|
|
21
|
+
const clothesMat = materials.getClothingMaterial(entity.avatarColor || '#2563eb')
|
|
22
|
+
const statusMat = materials.getStatusGlow(entity.status || 'idle')
|
|
23
|
+
|
|
24
|
+
// 1. Torso / Shirt
|
|
25
|
+
const torsoGeo = new THREE.CylinderGeometry(0.24, 0.28, 0.55, 12)
|
|
26
|
+
const torso = new THREE.Mesh(torsoGeo, clothesMat)
|
|
27
|
+
torso.position.set(0, 0.75, 0)
|
|
28
|
+
torso.castShadow = true
|
|
29
|
+
torso.userData = { entityId: entity.id }
|
|
30
|
+
group.add(torso)
|
|
31
|
+
|
|
32
|
+
// 2. Neck
|
|
33
|
+
const neckGeo = new THREE.CylinderGeometry(0.08, 0.08, 0.1, 8)
|
|
34
|
+
const neck = new THREE.Mesh(neckGeo, skinMat)
|
|
35
|
+
neck.position.set(0, 1.05, 0)
|
|
36
|
+
neck.userData = { entityId: entity.id }
|
|
37
|
+
group.add(neck)
|
|
38
|
+
|
|
39
|
+
// 3. Head
|
|
40
|
+
const headGeo = new THREE.SphereGeometry(0.2, 16, 16)
|
|
41
|
+
const head = new THREE.Mesh(headGeo, skinMat)
|
|
42
|
+
head.position.set(0, 1.25, 0)
|
|
43
|
+
head.castShadow = true
|
|
44
|
+
head.userData = { entityId: entity.id }
|
|
45
|
+
group.add(head)
|
|
46
|
+
|
|
47
|
+
// 4. Stylized Hair
|
|
48
|
+
const hairGeo = new THREE.SphereGeometry(0.21, 14, 14, 0, Math.PI * 2, 0, Math.PI / 2)
|
|
49
|
+
const hair = new THREE.Mesh(hairGeo, hairMat)
|
|
50
|
+
hair.position.set(0, 1.28, 0)
|
|
51
|
+
hair.rotation.x = -0.15
|
|
52
|
+
hair.userData = { entityId: entity.id }
|
|
53
|
+
group.add(hair)
|
|
54
|
+
|
|
55
|
+
// 5. Arms (positioned over desk typing)
|
|
56
|
+
const leftArmGeo = new THREE.CylinderGeometry(0.06, 0.06, 0.38, 8)
|
|
57
|
+
const leftArm = new THREE.Mesh(leftArmGeo, clothesMat)
|
|
58
|
+
leftArm.position.set(-0.28, 0.72, 0.15)
|
|
59
|
+
leftArm.rotation.x = Math.PI / 3.5
|
|
60
|
+
leftArm.rotation.z = 0.2
|
|
61
|
+
leftArm.userData = { entityId: entity.id }
|
|
62
|
+
group.add(leftArm)
|
|
63
|
+
|
|
64
|
+
const rightArmGeo = new THREE.CylinderGeometry(0.06, 0.06, 0.38, 8)
|
|
65
|
+
const rightArm = new THREE.Mesh(rightArmGeo, clothesMat)
|
|
66
|
+
rightArm.position.set(0.28, 0.72, 0.15)
|
|
67
|
+
rightArm.rotation.x = Math.PI / 3.5
|
|
68
|
+
rightArm.rotation.z = -0.2
|
|
69
|
+
rightArm.userData = { entityId: entity.id }
|
|
70
|
+
group.add(rightArm)
|
|
71
|
+
|
|
72
|
+
// 6. Sitting Legs
|
|
73
|
+
const legsGeo = new THREE.BoxGeometry(0.36, 0.15, 0.42)
|
|
74
|
+
const legs = new THREE.Mesh(legsGeo, clothesMat)
|
|
75
|
+
legs.position.set(0, 0.45, 0.1)
|
|
76
|
+
legs.userData = { entityId: entity.id }
|
|
77
|
+
group.add(legs)
|
|
78
|
+
|
|
79
|
+
// 7. Status Halo Ring (hovering above head)
|
|
80
|
+
const haloGeo = new THREE.RingGeometry(0.12, 0.16, 24)
|
|
81
|
+
const halo = new THREE.Mesh(haloGeo, statusMat)
|
|
82
|
+
halo.position.set(0, 1.55, 0)
|
|
83
|
+
halo.rotation.x = -Math.PI / 2
|
|
84
|
+
halo.userData = { entityId: entity.id }
|
|
85
|
+
group.add(halo)
|
|
86
|
+
|
|
87
|
+
// Dynamic animation callback
|
|
88
|
+
const initialTorsoY = torso.position.y
|
|
89
|
+
const isWorking = entity.status === 'running' || entity.status === 'working'
|
|
90
|
+
|
|
91
|
+
const animate = (_delta: number, elapsed: number) => {
|
|
92
|
+
// Subtle breathing animation
|
|
93
|
+
const breath = Math.sin(elapsed * 2.5 + Number(entity.pinNumber || 0)) * 0.015
|
|
94
|
+
torso.position.y = initialTorsoY + breath
|
|
95
|
+
head.position.y = 1.25 + breath
|
|
96
|
+
|
|
97
|
+
if (isWorking) {
|
|
98
|
+
// Typing agitation
|
|
99
|
+
const typing1 = Math.sin(elapsed * 12 + Number(entity.pinNumber || 0)) * 0.06
|
|
100
|
+
const typing2 = Math.cos(elapsed * 14 + Number(entity.pinNumber || 0)) * 0.06
|
|
101
|
+
leftArm.rotation.x = Math.PI / 3.5 + typing1
|
|
102
|
+
rightArm.rotation.x = Math.PI / 3.5 + typing2
|
|
103
|
+
|
|
104
|
+
// Pulsing halo
|
|
105
|
+
halo.scale.setScalar(1 + Math.sin(elapsed * 4) * 0.2)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Position the group
|
|
110
|
+
group.position.set(entity.position[0], entity.position[1], entity.position[2])
|
|
111
|
+
if (entity.rotation) {
|
|
112
|
+
group.rotation.set(entity.rotation[0], entity.rotation[1], entity.rotation[2])
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return { group, animate }
|
|
116
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as THREE from 'three'
|
|
2
|
+
import type { MaterialPalette } from '../../engine/materials'
|
|
3
|
+
|
|
4
|
+
export function createFicusPlant(materials: MaterialPalette): THREE.Group {
|
|
5
|
+
const group = new THREE.Group()
|
|
6
|
+
|
|
7
|
+
const potMat = materials.getTerracottaPotMaterial()
|
|
8
|
+
const leafMat = materials.getPlantLeavesMaterial()
|
|
9
|
+
const trunkMat = materials.getExecutiveWoodMaterial()
|
|
10
|
+
|
|
11
|
+
// Terracotta pot
|
|
12
|
+
const potGeo = new THREE.CylinderGeometry(0.32, 0.22, 0.55, 16)
|
|
13
|
+
const pot = new THREE.Mesh(potGeo, potMat)
|
|
14
|
+
pot.position.set(0, 0.275, 0)
|
|
15
|
+
pot.castShadow = true
|
|
16
|
+
group.add(pot)
|
|
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)
|
|
24
|
+
|
|
25
|
+
// Trunks
|
|
26
|
+
const t1 = new THREE.Mesh(new THREE.CylinderGeometry(0.04, 0.05, 1.2, 8), trunkMat)
|
|
27
|
+
t1.position.set(0, 1.0, 0)
|
|
28
|
+
t1.rotation.z = -0.08
|
|
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)
|
|
38
|
+
|
|
39
|
+
const cluster1 = new THREE.Mesh(leafClusterGeo, leafMat)
|
|
40
|
+
cluster1.position.set(-0.1, 1.5, 0.05)
|
|
41
|
+
cluster1.scale.set(1.2, 1.0, 1.1)
|
|
42
|
+
cluster1.castShadow = true
|
|
43
|
+
group.add(cluster1)
|
|
44
|
+
|
|
45
|
+
const cluster2 = new THREE.Mesh(leafClusterGeo, leafMat)
|
|
46
|
+
cluster2.position.set(0.18, 1.35, -0.08)
|
|
47
|
+
cluster2.scale.set(1.0, 1.1, 1.0)
|
|
48
|
+
cluster2.castShadow = true
|
|
49
|
+
group.add(cluster2)
|
|
50
|
+
|
|
51
|
+
const cluster3 = new THREE.Mesh(leafClusterGeo, leafMat)
|
|
52
|
+
cluster3.position.set(0, 1.75, 0)
|
|
53
|
+
cluster3.scale.set(0.9, 0.9, 0.9)
|
|
54
|
+
cluster3.castShadow = true
|
|
55
|
+
group.add(cluster3)
|
|
56
|
+
|
|
57
|
+
return group
|
|
58
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import * as THREE from 'three'
|
|
2
|
+
import type { WorldPreset, WorldEntity, WorldZone } from '../core/types'
|
|
3
|
+
import { MaterialPalette } from '../engine/materials'
|
|
4
|
+
|
|
5
|
+
export const DEFAULT_FACTORY_ZONES: WorldZone[] = [
|
|
6
|
+
{
|
|
7
|
+
id: 'assembly_line',
|
|
8
|
+
name: 'Robotik Montaj Hattı',
|
|
9
|
+
color: '#0284c7',
|
|
10
|
+
description: 'Yüksek hızlı robotik montaj ve parça birleştirme bandı.',
|
|
11
|
+
cameraFocus: [-6, 1.2, 0],
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
id: 'quality_control',
|
|
15
|
+
name: 'Kalite Kontrol & Optik Test',
|
|
16
|
+
color: '#10b981',
|
|
17
|
+
description: 'Ürün tarama, hata tespiti ve paket onay istasyonu.',
|
|
18
|
+
cameraFocus: [6, 1.0, -4],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: 'warehouse_racks',
|
|
22
|
+
name: 'Lojistik & Raf Deposu',
|
|
23
|
+
color: '#f59e0b',
|
|
24
|
+
description: 'Otomatik paletleme ve dikey depolama alanı.',
|
|
25
|
+
cameraFocus: [6, 2.0, 5],
|
|
26
|
+
},
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
export const DEFAULT_FACTORY_ENTITIES: WorldEntity[] = [
|
|
30
|
+
{
|
|
31
|
+
id: 'factory-op-1',
|
|
32
|
+
type: 'person',
|
|
33
|
+
name: 'Serkan — Hat Şefi',
|
|
34
|
+
role: 'Üretim Akış Gözetmeni',
|
|
35
|
+
department: 'İmalat',
|
|
36
|
+
zoneId: 'assembly_line',
|
|
37
|
+
status: 'working',
|
|
38
|
+
pinNumber: 1,
|
|
39
|
+
position: [-6, 0, 2],
|
|
40
|
+
avatarColor: '#0369a1',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: 'robot-arm-1',
|
|
44
|
+
type: 'equipment',
|
|
45
|
+
name: 'Robot Kolu RX-4',
|
|
46
|
+
role: 'Hassas Kaynak & Montaj',
|
|
47
|
+
department: 'Robotik',
|
|
48
|
+
zoneId: 'assembly_line',
|
|
49
|
+
status: 'running',
|
|
50
|
+
pinNumber: 2,
|
|
51
|
+
position: [-6, 0, -2],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: 'factory-inspector',
|
|
55
|
+
type: 'person',
|
|
56
|
+
name: 'Ebru — Kalite Mühendisi',
|
|
57
|
+
role: 'Tolerans Doğrulama',
|
|
58
|
+
department: 'Kalite',
|
|
59
|
+
zoneId: 'quality_control',
|
|
60
|
+
status: 'idle',
|
|
61
|
+
pinNumber: 3,
|
|
62
|
+
position: [6, 0, -4],
|
|
63
|
+
avatarColor: '#047857',
|
|
64
|
+
},
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
export const factoryPreset: WorldPreset = {
|
|
68
|
+
id: 'preset-factory',
|
|
69
|
+
name: 'Smart Industrial Automation Plant',
|
|
70
|
+
type: 'factory',
|
|
71
|
+
description: 'Industrial manufacturing facility equipped with conveyor belts, assembly robots, and warehouse racks.',
|
|
72
|
+
dimensions: {
|
|
73
|
+
width: 38,
|
|
74
|
+
height: 8,
|
|
75
|
+
depth: 22,
|
|
76
|
+
},
|
|
77
|
+
camera: {
|
|
78
|
+
position: [26, 22, 26],
|
|
79
|
+
target: [0, 0, 0],
|
|
80
|
+
fov: 42,
|
|
81
|
+
},
|
|
82
|
+
lighting: {
|
|
83
|
+
ambientColor: '#f8fafc',
|
|
84
|
+
ambientIntensity: 0.8,
|
|
85
|
+
sunColor: '#e0f2fe',
|
|
86
|
+
sunIntensity: 1.1,
|
|
87
|
+
sunPosition: [20, 28, 15],
|
|
88
|
+
shadows: true,
|
|
89
|
+
},
|
|
90
|
+
theme: {
|
|
91
|
+
name: 'industrial-steel',
|
|
92
|
+
floorColor: '#334155',
|
|
93
|
+
wallColor: '#64748b',
|
|
94
|
+
wallFrameColor: '#0f172a',
|
|
95
|
+
accentColor: '#0284c7',
|
|
96
|
+
backgroundColor: '#090d16',
|
|
97
|
+
nightBackgroundColor: '#020617',
|
|
98
|
+
},
|
|
99
|
+
zones: DEFAULT_FACTORY_ZONES,
|
|
100
|
+
defaultEntities: DEFAULT_FACTORY_ENTITIES,
|
|
101
|
+
|
|
102
|
+
buildScene: (scene: THREE.Scene, options) => {
|
|
103
|
+
const materials = new MaterialPalette()
|
|
104
|
+
|
|
105
|
+
// 1. Concrete floor
|
|
106
|
+
const floorGeo = new THREE.PlaneGeometry(38, 22)
|
|
107
|
+
const floorMat = materials.getDarkSlate(options.theme?.floorColor || '#334155')
|
|
108
|
+
const floor = new THREE.Mesh(floorGeo, floorMat)
|
|
109
|
+
floor.rotation.x = -Math.PI / 2
|
|
110
|
+
floor.receiveShadow = true
|
|
111
|
+
scene.add(floor)
|
|
112
|
+
|
|
113
|
+
// 2. Conveyor Belt
|
|
114
|
+
const conveyorGroup = new THREE.Group()
|
|
115
|
+
conveyorGroup.position.set(-6, 0, 0)
|
|
116
|
+
|
|
117
|
+
const beltBed = new THREE.Mesh(
|
|
118
|
+
new THREE.BoxGeometry(2.5, 0.6, 14),
|
|
119
|
+
materials.getFrameMaterial('#1e293b'),
|
|
120
|
+
)
|
|
121
|
+
beltBed.position.set(0, 0.3, 0)
|
|
122
|
+
beltBed.castShadow = true
|
|
123
|
+
conveyorGroup.add(beltBed)
|
|
124
|
+
|
|
125
|
+
const beltSurface = new THREE.Mesh(
|
|
126
|
+
new THREE.PlaneGeometry(2.1, 13.8),
|
|
127
|
+
materials.getTileFloor('#475569'),
|
|
128
|
+
)
|
|
129
|
+
beltSurface.rotation.x = -Math.PI / 2
|
|
130
|
+
beltSurface.position.set(0, 0.61, 0)
|
|
131
|
+
conveyorGroup.add(beltSurface)
|
|
132
|
+
scene.add(conveyorGroup)
|
|
133
|
+
|
|
134
|
+
// 3. Storage Racks
|
|
135
|
+
const rackGroup = new THREE.Group()
|
|
136
|
+
rackGroup.position.set(8, 0, 4)
|
|
137
|
+
|
|
138
|
+
for (let level = 1; level <= 3; level++) {
|
|
139
|
+
const shelf = new THREE.Mesh(
|
|
140
|
+
new THREE.BoxGeometry(8, 0.08, 2.5),
|
|
141
|
+
materials.getFrameMaterial('#eab308'),
|
|
142
|
+
)
|
|
143
|
+
shelf.position.set(0, level * 1.4, 0)
|
|
144
|
+
shelf.castShadow = true
|
|
145
|
+
rackGroup.add(shelf)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Rack vertical posts
|
|
149
|
+
const postMat = materials.getMetalLegMaterial()
|
|
150
|
+
const p1 = new THREE.Mesh(new THREE.BoxGeometry(0.1, 4.5, 0.1), postMat)
|
|
151
|
+
p1.position.set(-3.9, 2.25, -1.2)
|
|
152
|
+
rackGroup.add(p1)
|
|
153
|
+
|
|
154
|
+
const p2 = p1.clone()
|
|
155
|
+
p2.position.set(3.9, 2.25, -1.2)
|
|
156
|
+
rackGroup.add(p2)
|
|
157
|
+
|
|
158
|
+
const p3 = p1.clone()
|
|
159
|
+
p3.position.set(-3.9, 2.25, 1.2)
|
|
160
|
+
rackGroup.add(p3)
|
|
161
|
+
|
|
162
|
+
const p4 = p1.clone()
|
|
163
|
+
p4.position.set(3.9, 2.25, 1.2)
|
|
164
|
+
rackGroup.add(p4)
|
|
165
|
+
|
|
166
|
+
scene.add(rackGroup)
|
|
167
|
+
},
|
|
168
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import * as THREE from 'three'
|
|
2
|
+
import type { WorldPreset, WorldEntity, WorldZone } from '../core/types'
|
|
3
|
+
import { MaterialPalette } from '../engine/materials'
|
|
4
|
+
|
|
5
|
+
export const DEFAULT_FARM_ZONES: WorldZone[] = [
|
|
6
|
+
{
|
|
7
|
+
id: 'greenhouse',
|
|
8
|
+
name: 'Topraksız Tarım & Sera',
|
|
9
|
+
color: '#22c55e',
|
|
10
|
+
description: 'Otomatik sulama ve iklim kontrollü sera alanı.',
|
|
11
|
+
cameraFocus: [-8, 1, -5],
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
id: 'crop_fields',
|
|
15
|
+
name: 'Açık Tarım Tarlaları',
|
|
16
|
+
color: '#84cc16',
|
|
17
|
+
description: 'Mevsimlik organik tarım ekim parseli.',
|
|
18
|
+
cameraFocus: [6, 0.5, -4],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: 'barn_storage',
|
|
22
|
+
name: 'Lojistik Hangar & Depo',
|
|
23
|
+
color: '#b45309',
|
|
24
|
+
description: 'Mahsul toplama, paketleme ve traktör park alanı.',
|
|
25
|
+
cameraFocus: [0, 1.5, 6],
|
|
26
|
+
},
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
export const DEFAULT_FARM_ENTITIES: WorldEntity[] = [
|
|
30
|
+
{
|
|
31
|
+
id: 'farm-worker-1',
|
|
32
|
+
type: 'person',
|
|
33
|
+
name: 'Ahmet — Sera Operatörü',
|
|
34
|
+
role: 'İklim Kontrolü & Sulama',
|
|
35
|
+
department: 'Sera Operasyonları',
|
|
36
|
+
zoneId: 'greenhouse',
|
|
37
|
+
status: 'working',
|
|
38
|
+
pinNumber: 1,
|
|
39
|
+
position: [-8, 0, -5],
|
|
40
|
+
avatarColor: '#15803d',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: 'farm-tractor-1',
|
|
44
|
+
type: 'vehicle',
|
|
45
|
+
name: 'Otonom Traktör Alpha',
|
|
46
|
+
role: 'Parsel Sürüm & İlaçlama',
|
|
47
|
+
department: 'Filo Yönetimi',
|
|
48
|
+
zoneId: 'crop_fields',
|
|
49
|
+
status: 'running',
|
|
50
|
+
pinNumber: 2,
|
|
51
|
+
position: [6, 0, -4],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: 'farm-worker-2',
|
|
55
|
+
type: 'person',
|
|
56
|
+
name: 'Mehmet — Hasat Sorumlusu',
|
|
57
|
+
role: 'Paketleme & Depolama',
|
|
58
|
+
department: 'Lojistik',
|
|
59
|
+
zoneId: 'barn_storage',
|
|
60
|
+
status: 'idle',
|
|
61
|
+
pinNumber: 3,
|
|
62
|
+
position: [0, 0, 6],
|
|
63
|
+
avatarColor: '#b45309',
|
|
64
|
+
},
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
export const farmPreset: WorldPreset = {
|
|
68
|
+
id: 'preset-farm',
|
|
69
|
+
name: 'Smart Agriculture & Greenhouse Complex',
|
|
70
|
+
type: 'farm',
|
|
71
|
+
description: 'Agricultural farm featuring climate-controlled greenhouses, open crop fields, and automated machinery.',
|
|
72
|
+
dimensions: {
|
|
73
|
+
width: 40,
|
|
74
|
+
height: 8,
|
|
75
|
+
depth: 25,
|
|
76
|
+
},
|
|
77
|
+
camera: {
|
|
78
|
+
position: [28, 25, 28],
|
|
79
|
+
target: [0, 0, 0],
|
|
80
|
+
fov: 42,
|
|
81
|
+
},
|
|
82
|
+
lighting: {
|
|
83
|
+
ambientColor: '#f0fdf4',
|
|
84
|
+
ambientIntensity: 0.9,
|
|
85
|
+
sunColor: '#fef08a',
|
|
86
|
+
sunIntensity: 1.25,
|
|
87
|
+
sunPosition: [25, 35, 20],
|
|
88
|
+
shadows: true,
|
|
89
|
+
},
|
|
90
|
+
theme: {
|
|
91
|
+
name: 'farm-nature',
|
|
92
|
+
floorColor: '#365314',
|
|
93
|
+
woodFloorColor: '#78350f',
|
|
94
|
+
wallColor: '#fef9c3',
|
|
95
|
+
wallFrameColor: '#1c1917',
|
|
96
|
+
glassColor: '#bbf7d0',
|
|
97
|
+
glassOpacity: 0.22,
|
|
98
|
+
accentColor: '#22c55e',
|
|
99
|
+
backgroundColor: '#0c1a0e',
|
|
100
|
+
nightBackgroundColor: '#020d04',
|
|
101
|
+
},
|
|
102
|
+
zones: DEFAULT_FARM_ZONES,
|
|
103
|
+
defaultEntities: DEFAULT_FARM_ENTITIES,
|
|
104
|
+
|
|
105
|
+
buildScene: (scene: THREE.Scene, options) => {
|
|
106
|
+
const materials = new MaterialPalette()
|
|
107
|
+
|
|
108
|
+
// 1. Soil ground
|
|
109
|
+
const groundGeo = new THREE.PlaneGeometry(40, 25)
|
|
110
|
+
const soilMat = materials.getDarkSlate(options.theme?.floorColor || '#365314')
|
|
111
|
+
const ground = new THREE.Mesh(groundGeo, soilMat)
|
|
112
|
+
ground.rotation.x = -Math.PI / 2
|
|
113
|
+
ground.receiveShadow = true
|
|
114
|
+
scene.add(ground)
|
|
115
|
+
|
|
116
|
+
// 2. Greenhouse structure
|
|
117
|
+
const ghGroup = new THREE.Group()
|
|
118
|
+
ghGroup.position.set(-10, 0, -5)
|
|
119
|
+
|
|
120
|
+
const ghFloor = new THREE.Mesh(
|
|
121
|
+
new THREE.PlaneGeometry(12, 10),
|
|
122
|
+
materials.getTileFloor('#a3e635'),
|
|
123
|
+
)
|
|
124
|
+
ghFloor.rotation.x = -Math.PI / 2
|
|
125
|
+
ghFloor.position.set(0, 0.01, 0)
|
|
126
|
+
ghGroup.add(ghFloor)
|
|
127
|
+
|
|
128
|
+
// Glass arches
|
|
129
|
+
const glassMat = materials.getGlassMaterial('#86efac', 0.25)
|
|
130
|
+
const domeGeo = new THREE.CylinderGeometry(5, 5, 12, 16, 1, false, 0, Math.PI)
|
|
131
|
+
const dome = new THREE.Mesh(domeGeo, glassMat)
|
|
132
|
+
dome.rotation.z = Math.PI / 2
|
|
133
|
+
dome.position.set(0, 3, 0)
|
|
134
|
+
ghGroup.add(dome)
|
|
135
|
+
scene.add(ghGroup)
|
|
136
|
+
|
|
137
|
+
// 3. Barn / Storage building
|
|
138
|
+
const barnGroup = new THREE.Group()
|
|
139
|
+
barnGroup.position.set(0, 0, 7)
|
|
140
|
+
const barnWalls = new THREE.Mesh(
|
|
141
|
+
new THREE.BoxGeometry(14, 4, 8),
|
|
142
|
+
materials.getWallMaterial('#7f1d1d'),
|
|
143
|
+
)
|
|
144
|
+
barnWalls.position.set(0, 2, 0)
|
|
145
|
+
barnWalls.castShadow = true
|
|
146
|
+
barnGroup.add(barnWalls)
|
|
147
|
+
|
|
148
|
+
// Roof
|
|
149
|
+
const roof = new THREE.Mesh(
|
|
150
|
+
new THREE.ConeGeometry(8, 2, 4),
|
|
151
|
+
materials.getFrameMaterial('#1c1917'),
|
|
152
|
+
)
|
|
153
|
+
roof.position.set(0, 5, 0)
|
|
154
|
+
roof.rotation.y = Math.PI / 4
|
|
155
|
+
barnGroup.add(roof)
|
|
156
|
+
scene.add(barnGroup)
|
|
157
|
+
},
|
|
158
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import * as THREE from 'three'
|
|
2
|
+
import type { WorldPreset, WorldEntity, WorldZone } from '../core/types'
|
|
3
|
+
import { MaterialPalette } from '../engine/materials'
|
|
4
|
+
|
|
5
|
+
export const DEFAULT_HOSPITAL_ZONES: WorldZone[] = [
|
|
6
|
+
{
|
|
7
|
+
id: 'triage_er',
|
|
8
|
+
name: 'Acil Müdahale & Triyaj',
|
|
9
|
+
color: '#ef4444',
|
|
10
|
+
description: 'İlk değerlendirme ve acil müdahale ünitesi.',
|
|
11
|
+
cameraFocus: [-8, 1.2, 0],
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
id: 'consultation',
|
|
15
|
+
name: 'Poliklinik & Uzman Hekim Odası',
|
|
16
|
+
color: '#06b6d4',
|
|
17
|
+
description: 'Hasta muayene ve klinik tanı alanı.',
|
|
18
|
+
cameraFocus: [4, 1.0, -4],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: 'icu_ward',
|
|
22
|
+
name: 'Yoğun Bakım & İzleme Servisi',
|
|
23
|
+
color: '#3b82f6',
|
|
24
|
+
description: 'Yaşamsal bulgu monitörleri ve hasta yatakları.',
|
|
25
|
+
cameraFocus: [6, 1.0, 5],
|
|
26
|
+
},
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
export const DEFAULT_HOSPITAL_ENTITIES: WorldEntity[] = [
|
|
30
|
+
{
|
|
31
|
+
id: 'doctor-1',
|
|
32
|
+
type: 'person',
|
|
33
|
+
name: 'Dr. Selin — Başhekim',
|
|
34
|
+
role: 'Klinik Direktörü & Tıbbi Karar',
|
|
35
|
+
department: 'Cerrahi',
|
|
36
|
+
zoneId: 'consultation',
|
|
37
|
+
status: 'working',
|
|
38
|
+
pinNumber: 1,
|
|
39
|
+
position: [4, 0, -4],
|
|
40
|
+
avatarColor: '#0284c7',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: 'nurse-1',
|
|
44
|
+
type: 'person',
|
|
45
|
+
name: 'Hemşire Burak — Triyaj Uzmanı',
|
|
46
|
+
role: 'Hasta Karşılama & Vital İzlem',
|
|
47
|
+
department: 'Acil',
|
|
48
|
+
zoneId: 'triage_er',
|
|
49
|
+
status: 'idle',
|
|
50
|
+
pinNumber: 2,
|
|
51
|
+
position: [-8, 0, 0],
|
|
52
|
+
avatarColor: '#059669',
|
|
53
|
+
},
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
export const hospitalPreset: WorldPreset = {
|
|
57
|
+
id: 'preset-hospital',
|
|
58
|
+
name: 'Smart Healthcare & Hospital Medical Center',
|
|
59
|
+
type: 'hospital',
|
|
60
|
+
description: 'Healthcare facility with triage stations, medical consultation rooms, and intensive care monitoring.',
|
|
61
|
+
dimensions: {
|
|
62
|
+
width: 36,
|
|
63
|
+
height: 6,
|
|
64
|
+
depth: 20,
|
|
65
|
+
},
|
|
66
|
+
camera: {
|
|
67
|
+
position: [26, 24, 26],
|
|
68
|
+
target: [0, 0, 0],
|
|
69
|
+
fov: 40,
|
|
70
|
+
},
|
|
71
|
+
lighting: {
|
|
72
|
+
ambientColor: '#ffffff',
|
|
73
|
+
ambientIntensity: 0.9,
|
|
74
|
+
sunColor: '#f0fdfa',
|
|
75
|
+
sunIntensity: 1.1,
|
|
76
|
+
shadows: true,
|
|
77
|
+
},
|
|
78
|
+
theme: {
|
|
79
|
+
name: 'clinical-hygiene',
|
|
80
|
+
floorColor: '#f0fdfa',
|
|
81
|
+
wallColor: '#f8fafc',
|
|
82
|
+
wallFrameColor: '#0f766e',
|
|
83
|
+
glassColor: '#99f6e4',
|
|
84
|
+
accentColor: '#0d9488',
|
|
85
|
+
backgroundColor: '#042f2e',
|
|
86
|
+
},
|
|
87
|
+
zones: DEFAULT_HOSPITAL_ZONES,
|
|
88
|
+
defaultEntities: DEFAULT_HOSPITAL_ENTITIES,
|
|
89
|
+
|
|
90
|
+
buildScene: (scene: THREE.Scene, options) => {
|
|
91
|
+
const materials = new MaterialPalette()
|
|
92
|
+
|
|
93
|
+
// Sterile Floor
|
|
94
|
+
const floor = new THREE.Mesh(
|
|
95
|
+
new THREE.PlaneGeometry(36, 20),
|
|
96
|
+
materials.getTileFloor(options.theme?.floorColor || '#f0fdfa'),
|
|
97
|
+
)
|
|
98
|
+
floor.rotation.x = -Math.PI / 2
|
|
99
|
+
floor.receiveShadow = true
|
|
100
|
+
scene.add(floor)
|
|
101
|
+
|
|
102
|
+
// Red Cross / Medical Logo on Wall
|
|
103
|
+
const crossH = new THREE.Mesh(
|
|
104
|
+
new THREE.BoxGeometry(2.4, 0.6, 0.05),
|
|
105
|
+
materials.getWallMaterial('#ef4444'),
|
|
106
|
+
)
|
|
107
|
+
crossH.position.set(0, 2.5, -9.9)
|
|
108
|
+
scene.add(crossH)
|
|
109
|
+
|
|
110
|
+
const crossV = new THREE.Mesh(
|
|
111
|
+
new THREE.BoxGeometry(0.6, 2.4, 0.05),
|
|
112
|
+
materials.getWallMaterial('#ef4444'),
|
|
113
|
+
)
|
|
114
|
+
crossV.position.set(0, 2.5, -9.9)
|
|
115
|
+
scene.add(crossV)
|
|
116
|
+
},
|
|
117
|
+
}
|