-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAG-Manager.html
More file actions
848 lines (732 loc) · 38.3 KB
/
Copy pathAG-Manager.html
File metadata and controls
848 lines (732 loc) · 38.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>AG Manager - Göktuğ Portfolio</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.7/gsap.min.js"></script>
<script type="importmap">
{
"imports": {
"three": "https://cdn.jsdelivr.net/npm/three@0.170.0/build/three.module.min.js"
}
}
</script>
<style>
body { margin: 0; overflow: hidden; background-color: #f8fafc; color: #0f172a; font-family: 'Inter', system-ui, sans-serif; touch-action: none; -webkit-user-select: none; user-select: none; }
canvas { display: block; width: 100vw; height: 100vh; }
#ui-layer { pointer-events: none; }
.pointer-events-auto { pointer-events: auto; }
.glass-panel { background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(12px); border: 1px solid rgba(255, 255, 255, 0.3); }
</style>
</head>
<body>
<div id="canvas-container" class="absolute inset-0 z-0"></div>
<div id="ui-layer" class="absolute inset-0 z-10 flex flex-col justify-between p-4 sm:p-8">
<!-- Header -->
<header class="flex justify-between items-start pointer-events-auto">
<div class="glass-panel p-4 rounded-xl shadow-lg border border-slate-200">
<span class="text-[10px] font-bold uppercase tracking-widest text-slate-500 mb-1 block">Diğer</span>
<h1 class="text-2xl sm:text-3xl font-bold tracking-tight text-slate-900">AG Manager</h1>
<div class="h-1 w-12 rounded-full mt-2" style="background-color: 0x94a3b8;"></div>
</div>
<a href="../ecosystem.html" class="glass-panel px-4 py-2 rounded-lg shadow-md border border-slate-200 text-slate-700 font-medium text-sm hover:bg-white transition-all flex items-center gap-2">
<svg width="16" height="16" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M15 8H1M1 8L8 15M1 8L8 1"></path></svg>
Ekosisteme Dön
</a>
</header>
<!-- Right Panel (Project Details) -->
<div id="project-details" class="absolute right-4 sm:right-8 top-24 bottom-24 w-80 sm:w-96 glass-panel shadow-2xl rounded-2xl p-6 pointer-events-auto overflow-y-auto border border-slate-200/50">
<h3 class="text-xs font-bold uppercase tracking-wider text-slate-400 mb-4">Teknik Detaylar</h3>
<div class="prose prose-slate prose-sm">
<p class="text-slate-600 leading-relaxed">High-performance desktop hub for managing multiple AI accounts (Gemini, Claude, etc.) from a single interface using gRPC.</p>
</div>
<div class="mt-8">
<h3 class="text-xs font-bold uppercase tracking-wider text-slate-400 mb-4">Tech Stack</h3>
<div class="flex flex-wrap gap-2">
<span class="bg-slate-100 text-slate-600 px-3 py-1 rounded-full text-[10px] font-bold border border-slate-200">Electron</span>
<span class="bg-slate-100 text-slate-600 px-3 py-1 rounded-full text-[10px] font-bold border border-slate-200">NestJS</span>
<span class="bg-slate-100 text-slate-600 px-3 py-1 rounded-full text-[10px] font-bold border border-slate-200">gRPC</span>
<span class="bg-slate-100 text-slate-600 px-3 py-1 rounded-full text-[10px] font-bold border border-slate-200">React 19</span>
<span class="bg-slate-100 text-slate-600 px-3 py-1 rounded-full text-[10px] font-bold border border-slate-200">Drizzle ORM</span>
<span class="bg-slate-100 text-slate-600 px-3 py-1 rounded-full text-[10px] font-bold border border-slate-200">SQLite</span>
</div>
</div>
<div class="mt-auto pt-8 border-t border-slate-100 flex gap-2">
<div class="flex-1 p-3 bg-slate-50 rounded-lg border border-slate-100">
<span class="text-[10px] text-slate-400 uppercase font-bold block mb-1">Karmaşıklık</span>
<span class="text-lg font-bold text-slate-800">8/10</span>
</div>
<div class="flex-1 p-3 bg-slate-50 rounded-lg border border-slate-100">
<span class="text-[10px] text-slate-400 uppercase font-bold block mb-1">Tema</span>
<span class="text-lg font-bold text-slate-800 uppercase">code</span>
</div>
</div>
</div>
<!-- Footer Navigation -->
<footer class="flex justify-center pointer-events-auto">
<div class="glass-panel p-2 rounded-full shadow-lg border border-slate-200 flex gap-2">
<button class="px-6 py-2 rounded-full bg-slate-100 text-slate-400 text-xs font-bold cursor-not-allowed uppercase tracking-wider">
Önceki Proje
</button>
<button class="px-6 py-2 rounded-full bg-slate-100 text-slate-400 text-xs font-bold cursor-not-allowed uppercase tracking-wider">
Sonraki Proje
</button>
</div>
</footer>
</div>
<script type="module">
import * as THREE from 'three';
// --- TEMPLATE CONSTANTS ---
const PROJ_COLOR = 0x94a3b8;
const PROJ_THEME = 'code';
const COMPLEXITY = 8;
// --- THREE.JS SETUP ---
const container = document.getElementById('canvas-container');
const scene = new THREE.Scene();
scene.fog = new THREE.FogExp2(0xf8fafc, 0.002);
const aspect = window.innerWidth / window.innerHeight;
const d = 60; // Zoomed in for single room
const camera = new THREE.OrthographicCamera(-d * aspect, d * aspect, d, -d, 1, 1000);
const cameraTarget = new THREE.Vector3(0, 5, 0);
camera.up.set(0, 1, 0);
camera.position.set(100, 70, 100);
camera.lookAt(cameraTarget);
const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
container.appendChild(renderer.domElement);
// --- LIGHTING ---
const ambientLight = new THREE.AmbientLight(0xffffff, 0.5);
scene.add(ambientLight);
const dirLight = new THREE.DirectionalLight(0xffffff, 0.6);
dirLight.position.set(50, 100, 20);
dirLight.castShadow = true;
dirLight.shadow.mapSize.width = 1024;
dirLight.shadow.mapSize.height = 1024;
dirLight.shadow.bias = -0.0005;
scene.add(dirLight);
const fillLight = new THREE.DirectionalLight(0xe2e8f0, 0.4);
fillLight.position.set(-50, 20, -50);
scene.add(fillLight);
const animatedWorkers = [];
// --- PROP GENERATORS ---
const m = {
prop: new THREE.MeshStandardMaterial({ color: new THREE.Color(PROJ_COLOR).lerp(new THREE.Color(0x475569), 0.7), roughness: 0.8 }),
dark: new THREE.MeshStandardMaterial({ color: 0x1e293b, roughness: 0.5 }),
white: new THREE.MeshStandardMaterial({ color: 0xf8fafc, roughness: 0.2 }),
green: new THREE.MeshStandardMaterial({ color: 0x16a34a, roughness: 0.6 }),
glow: new THREE.MeshStandardMaterial({ color: 0xffffff, emissive: PROJ_COLOR, emissiveIntensity: 0.6 }),
holo: new THREE.MeshPhysicalMaterial({ color: PROJ_COLOR, transmission: 0.8, opacity: 0.4, transparent: true, emissive: PROJ_COLOR, emissiveIntensity: 0.4 }),
accent: new THREE.MeshStandardMaterial({ color: new THREE.Color(PROJ_COLOR), roughness: 0.5 }),
};
function createPlant(m) {
const g = new THREE.Group();
const pot = new THREE.Mesh(new THREE.CylinderGeometry(0.6, 0.8, 1.2, 6), m.prop);
pot.position.y = 0.6; pot.castShadow = true;
const leaf = new THREE.Mesh(new THREE.SphereGeometry(1.1, 6, 5), m.green);
leaf.position.y = 2.5; leaf.castShadow = true;
g.add(pot, leaf);
return g;
}
function createBookshelf(m) {
const g = new THREE.Group();
const shelf = new THREE.Mesh(new THREE.BoxGeometry(3, 5.5, 1.2), m.prop);
shelf.position.y = 2.75; shelf.castShadow = true;
const books = new THREE.Mesh(new THREE.BoxGeometry(2.6, 4.5, 0.8), m.accent);
books.position.y = 2.75;
g.add(shelf, books);
return g;
}
function createChair(m) {
const g = new THREE.Group();
const seat = new THREE.Mesh(new THREE.BoxGeometry(1.4, 0.3, 1.4), m.dark);
seat.position.y = 1.5; seat.castShadow = true;
const back = new THREE.Mesh(new THREE.BoxGeometry(1.4, 1.5, 0.25), m.dark);
back.position.set(0, 2.5, -0.55); back.castShadow = true;
g.add(seat, back);
return g;
}
function createCoffeeMachine(m) {
const g = new THREE.Group();
const body = new THREE.Mesh(new THREE.BoxGeometry(1.4, 2.2, 1.2), m.dark);
body.position.y = 1.1; body.castShadow = true;
const light = new THREE.Mesh(new THREE.BoxGeometry(0.8, 0.2, 0.1), m.glow);
light.position.set(0, 1.8, 0.65);
g.add(body, light);
return g;
}
function createTrashBin(m) {
const g = new THREE.Group();
const bin = new THREE.Mesh(new THREE.CylinderGeometry(0.5, 0.6, 1.5, 6), m.prop);
bin.position.y = 0.75; bin.castShadow = true;
g.add(bin);
return g;
}
function createWaterCooler(m) {
const g = new THREE.Group();
const body = new THREE.Mesh(new THREE.BoxGeometry(1.2, 3.5, 1.2), m.prop);
body.position.y = 1.75; body.castShadow = true;
const bottle = new THREE.Mesh(new THREE.CylinderGeometry(0.45, 0.45, 1.2, 6), m.glow);
bottle.position.y = 4;
g.add(body, bottle);
return g;
}
function createMeetingTable(m) {
const g = new THREE.Group();
const top = new THREE.Mesh(new THREE.CylinderGeometry(3, 3, 0.25, 8), m.prop);
top.position.y = 2; top.castShadow = true;
const leg = new THREE.Mesh(new THREE.CylinderGeometry(0.5, 0.7, 2, 6), m.prop);
leg.position.y = 1; leg.castShadow = true;
g.add(top, leg);
return g;
}
// === SERVER ===
function createServerRack(m) {
const g = new THREE.Group();
const rack = new THREE.Mesh(new THREE.BoxGeometry(3, 6, 3), m.prop);
rack.position.y = 3; rack.castShadow = true;
// LED strips
for (let i = 0; i < 8; i++) {
const led = new THREE.Mesh(new THREE.BoxGeometry(0.1, 0.1, 0.1), m.glow);
led.position.set(1.45, 1 + i * 0.6, 1.2);
g.add(led);
}
// Internal Light
const light = new THREE.PointLight(PROJ_COLOR, 12, 25);
light.position.set(0, 3, 1.6);
g.add(light);
// Cables hanging from back
for (let i = 0; i < 5; i++) {
const cable = new THREE.Mesh(new THREE.CylinderGeometry(0.05, 0.05, 4, 6), m.dark);
cable.position.set((Math.random() - 0.5) * 2, 2, -1.55);
cable.rotation.z = (Math.random() - 0.5) * 0.2;
g.add(cable);
}
g.add(rack);
return g;
}
function createCoolingUnit(m) {
const g = new THREE.Group();
const body = new THREE.Mesh(new THREE.BoxGeometry(3, 5, 2.5), m.prop);
body.position.y = 2.5; body.castShadow = true;
const fan = new THREE.Mesh(new THREE.CylinderGeometry(1, 1, 0.2, 8), m.dark);
fan.position.set(0, 3.5, 1.3); fan.rotation.x = Math.PI / 2;
g.add(body, fan);
return g;
}
function createNetworkSwitch(m) {
const g = new THREE.Group();
const body = new THREE.Mesh(new THREE.BoxGeometry(4, 0.8, 2.5), m.prop);
body.position.y = 2; body.castShadow = true;
// Front LEDs
for (let i = 0; i < 12; i++) {
const led = new THREE.Mesh(new THREE.BoxGeometry(0.08, 0.08, 0.08), m.glow);
led.position.set(-1.8 + i * 0.3, 2.2, 1.26);
g.add(led);
}
// Small Ports
const ports = new THREE.Mesh(new THREE.BoxGeometry(3.5, 0.15, 0.1), m.dark);
ports.position.set(0, 2.0, 1.26);
const stand = new THREE.Mesh(new THREE.BoxGeometry(0.3, 2, 2), m.prop);
stand.position.set(0, 1, -1);
g.add(body, ports, stand);
return g;
}
function createUPS(m) {
const g = new THREE.Group();
const body = new THREE.Mesh(new THREE.BoxGeometry(2.5, 4, 2), m.prop);
body.position.y = 2; body.castShadow = true;
const screen = new THREE.Mesh(new THREE.BoxGeometry(1.2, 0.6, 0.1), m.glow);
screen.position.set(0, 3.5, 1.05);
g.add(body, screen);
return g;
}
function createCableRack(m) {
const g = new THREE.Group();
const post = new THREE.Mesh(new THREE.BoxGeometry(0.3, 5, 0.3), m.prop);
post.position.y = 2.5; post.castShadow = true;
const cables = new THREE.Mesh(new THREE.BoxGeometry(3, 4, 0.8), m.accent);
cables.position.y = 2.5;
g.add(post, cables);
return g;
}
function createMonitorWall(m) {
const g = new THREE.Group();
const wall = new THREE.Mesh(new THREE.BoxGeometry(6, 4, 0.3), m.dark);
wall.position.y = 2.5; wall.castShadow = true;
const screen = new THREE.Mesh(new THREE.BoxGeometry(5.5, 3.5, 0.1), m.glow);
screen.position.set(0, 2.5, 0.2);
g.add(wall, screen);
return g;
}
// === CONTROL / INDUSTRIAL ===
function createCommandCenter(m) {
const g = new THREE.Group();
const desk = new THREE.Mesh(new THREE.BoxGeometry(7, 1.5, 3), m.prop);
desk.position.y = 0.75; desk.castShadow = true;
const screen = new THREE.Mesh(new THREE.BoxGeometry(6, 2.5, 0.2), m.glow);
screen.position.set(0, 3, -1);
g.add(desk, screen);
return g;
}
function createRadarAntenna(m) {
const g = new THREE.Group();
const stand = new THREE.Mesh(new THREE.CylinderGeometry(0.4, 0.6, 4, 6), m.prop);
stand.position.y = 2; stand.castShadow = true;
const dish = new THREE.Mesh(new THREE.CylinderGeometry(3, 3, 0.3, 8), m.prop);
dish.position.set(0, 4.2, 0.5); dish.rotation.x = 1.2; dish.castShadow = true;
g.add(stand, dish);
return g;
}
function createHologramTable(m) {
const g = new THREE.Group();
const base = new THREE.Mesh(new THREE.CylinderGeometry(2.5, 3, 1.5, 6), m.prop);
base.position.y = 0.75; base.castShadow = true;
const holo = new THREE.Mesh(new THREE.CylinderGeometry(1.8, 2, 3.5, 6), m.holo);
holo.position.y = 3.2;
// Hologram Light
const light = new THREE.PointLight(PROJ_COLOR, 15, 20);
light.position.y = 3.2;
g.add(base, holo, light);
return g;
}
function createOscilloscope(m) {
const g = new THREE.Group();
const body = new THREE.Mesh(new THREE.BoxGeometry(3, 2.2, 2), m.dark);
body.position.y = 1.1; body.castShadow = true;
const screen = new THREE.Mesh(new THREE.BoxGeometry(2, 1.4, 0.1), m.glow);
screen.position.set(0, 1.3, 1.05);
// Knobs
for (let i = 0; i < 3; i++) {
const knob = new THREE.Mesh(new THREE.CylinderGeometry(0.1, 0.1, 0.1, 8), m.prop);
knob.position.set(1.2, 0.6 + i * 0.4, 1.05);
knob.rotation.x = Math.PI / 2;
g.add(knob);
}
g.add(body, screen);
return g;
}
function createTestBench(m) {
const g = new THREE.Group();
const top = new THREE.Mesh(new THREE.BoxGeometry(5, 0.3, 2.5), m.prop);
top.position.y = 2; top.castShadow = true;
const pcb = new THREE.Mesh(new THREE.BoxGeometry(2, 0.1, 1.5), m.green);
pcb.position.set(0.5, 2.3, 0);
// Wires
for (let i = 0; i < 3; i++) {
const wire = new THREE.Mesh(new THREE.CylinderGeometry(0.02, 0.02, 1.5, 4), m.accent);
wire.position.set(-1.5 + i * 0.2, 2.15, 0.8);
wire.rotation.z = Math.PI / 2;
g.add(wire);
}
// Soldering Iron
const ironHandle = new THREE.Mesh(new THREE.CylinderGeometry(0.08, 0.08, 0.8, 8), m.dark);
ironHandle.position.set(-2, 2.25, -0.5); ironHandle.rotation.z = 0.5;
const ironTip = new THREE.Mesh(new THREE.CylinderGeometry(0.02, 0.05, 0.4, 8), m.white);
ironTip.position.set(-1.8, 2.4, -0.5); ironTip.rotation.z = 0.5;
// Multimeter
const multi = new THREE.Mesh(new THREE.BoxGeometry(0.8, 1.2, 0.4), m.accent);
multi.position.set(2, 2.6, -0.8);
const multiScreen = new THREE.Mesh(new THREE.BoxGeometry(0.6, 0.4, 0.1), m.glow);
multiScreen.position.set(2, 2.9, -0.58);
g.add(top, pcb, ironHandle, ironTip, multi, multiScreen);
return g;
}
function createSolderingStation(m) {
const g = new THREE.Group();
const base = new THREE.Mesh(new THREE.BoxGeometry(2, 0.5, 1.5), m.dark);
base.position.y = 0.25; base.castShadow = true;
const screen = new THREE.Mesh(new THREE.BoxGeometry(0.8, 0.5, 0.1), m.glow);
screen.position.set(-0.4, 0.7, 0.8);
g.add(base, screen);
return g;
}
function createControlPanel(m) {
const g = new THREE.Group();
const panel = new THREE.Mesh(new THREE.BoxGeometry(4, 3, 0.5), m.prop);
panel.position.y = 2; panel.rotation.x = -0.15; panel.castShadow = true;
const screen = new THREE.Mesh(new THREE.BoxGeometry(3, 2, 0.1), m.glow);
screen.position.set(0, 2.2, 0.35); screen.rotation.x = -0.15;
g.add(panel, screen);
return g;
}
// === CODE / DEV ===
function createDesk(m) {
const g = new THREE.Group();
const top = new THREE.Mesh(new THREE.BoxGeometry(4.5, 0.3, 2.2), m.prop);
top.position.y = 2; top.castShadow = true;
const monitor = new THREE.Mesh(new THREE.BoxGeometry(2.2, 1.4, 0.15), m.dark);
monitor.position.set(0, 3, -0.5); monitor.castShadow = true;
// Mousepad
const mousepad = new THREE.Mesh(new THREE.BoxGeometry(3.5, 0.05, 1.2), m.dark);
mousepad.position.set(0, 2.16, 0.2);
// Keyboard
const kbBase = new THREE.Mesh(new THREE.BoxGeometry(1.5, 0.1, 0.5), m.white);
kbBase.position.set(0, 2.2, 0.4);
const keys = new THREE.Mesh(new THREE.BoxGeometry(1.4, 0.05, 0.4), m.dark);
keys.position.set(0, 2.25, 0.4);
// Mouse
const mouse = new THREE.Mesh(new THREE.BoxGeometry(0.2, 0.1, 0.3), m.dark);
mouse.position.set(1.2, 2.2, 0.4);
// Coffee Cup
const cup = createCoffeeMug(m);
cup.position.set(-1.4, 2.15, 0.3);
cup.scale.set(0.6, 0.6, 0.6);
g.add(top, monitor, mousepad, kbBase, keys, mouse, cup);
return g;
}
function createDualMonitorDesk(m) {
const g = new THREE.Group();
const top = new THREE.Mesh(new THREE.BoxGeometry(5.5, 0.3, 2.5), m.prop);
top.position.y = 2; top.castShadow = true;
const m1 = new THREE.Mesh(new THREE.BoxGeometry(2, 1.3, 0.12), m.dark);
m1.position.set(-1.2, 3, -0.7); m1.rotation.y = 0.12; m1.castShadow = true;
const m2 = new THREE.Mesh(new THREE.BoxGeometry(2, 1.3, 0.12), m.dark);
m2.position.set(1.2, 3, -0.7); m2.rotation.y = -0.12; m2.castShadow = true;
// Mousepad
const mousepad = new THREE.Mesh(new THREE.BoxGeometry(4.5, 0.05, 1.4), m.dark);
mousepad.position.set(0, 2.16, 0.2);
// Keyboard
const kbBase = new THREE.Mesh(new THREE.BoxGeometry(1.8, 0.1, 0.6), m.white);
kbBase.position.set(0, 2.2, 0.4);
// Mouse
const mouse = new THREE.Mesh(new THREE.BoxGeometry(0.2, 0.1, 0.3), m.dark);
mouse.position.set(1.4, 2.2, 0.4);
// Coffee Cup
const cup = createCoffeeMug(m);
cup.position.set(-1.8, 2.15, 0.4);
cup.scale.set(0.6, 0.6, 0.6);
g.add(top, m1, m2, mousepad, kbBase, mouse, cup);
return g;
}
function createStandingDesk(m) {
const g = new THREE.Group();
const top = new THREE.Mesh(new THREE.BoxGeometry(4, 0.25, 2), m.prop);
top.position.y = 3; top.castShadow = true;
const monitor = new THREE.Mesh(new THREE.BoxGeometry(2.5, 1.5, 0.12), m.dark);
monitor.position.set(0, 4.2, -0.5); monitor.castShadow = true;
g.add(top, monitor);
return g;
}
function createWhiteboard(m) {
const g = new THREE.Group();
const board = new THREE.Mesh(new THREE.BoxGeometry(4.5, 3, 0.2), m.white);
board.position.y = 3.5; board.castShadow = true;
const frame = new THREE.Mesh(new THREE.BoxGeometry(4.8, 3.3, 0.15), m.prop);
frame.position.y = 3.5;
g.add(frame, board);
return g;
}
function createLaptopStation(m) {
const g = new THREE.Group();
const top = new THREE.Mesh(new THREE.BoxGeometry(3.5, 0.25, 2), m.prop);
top.position.y = 2; top.castShadow = true;
const laptop = new THREE.Mesh(new THREE.BoxGeometry(1.8, 0.08, 1.2), m.dark);
laptop.position.set(0, 2.2, 0);
g.add(top, laptop);
return g;
}
function createPrinter(m) {
const g = new THREE.Group();
const body = new THREE.Mesh(new THREE.BoxGeometry(2.5, 1.5, 2), m.prop);
body.position.y = 0.75; body.castShadow = true;
const tray = new THREE.Mesh(new THREE.BoxGeometry(2, 0.1, 1.5), m.dark);
tray.position.set(0, 0.1, 1.2);
g.add(body, tray);
return g;
}
// === AUDIO / MUSIC ===
function createSpeaker(m) {
const g = new THREE.Group();
const body = new THREE.Mesh(new THREE.BoxGeometry(1.5, 2.5, 1.5), m.dark);
body.position.y = 1.25; body.castShadow = true;
// Driver Rings
const driverOuter = new THREE.Mesh(new THREE.TorusGeometry(0.4, 0.05, 8, 24), m.prop);
driverOuter.position.set(0, 1.5, 0.75); driverOuter.rotation.x = Math.PI / 2;
const driverInner = new THREE.Mesh(new THREE.SphereGeometry(0.2, 8, 8), m.dark);
driverInner.position.set(0, 1.5, 0.7);
const tweeterOuter = new THREE.Mesh(new THREE.TorusGeometry(0.15, 0.03, 8, 16), m.prop);
tweeterOuter.position.set(0, 2.1, 0.75); tweeterOuter.rotation.x = Math.PI / 2;
g.add(body, driverOuter, driverInner, tweeterOuter);
return g;
}
function createKeyboard(m) {
const g = new THREE.Group();
const body = new THREE.Mesh(new THREE.BoxGeometry(4.5, 0.3, 1.2), m.white);
body.position.y = 0.15; body.castShadow = true;
// Black Keys
for (let i = 0; i < 12; i++) {
if ([1,2,4,5,6,8,9,11].includes(i)) {
const blackKey = new THREE.Mesh(new THREE.BoxGeometry(0.1, 0.15, 0.5), m.dark);
blackKey.position.set(-2 + i * 0.35, 0.3, -0.1);
g.add(blackKey);
}
}
const keys = new THREE.Mesh(new THREE.BoxGeometry(4.3, 0.1, 0.8), m.dark);
keys.position.set(0, 0.25, 0.1);
g.add(body);
return g;
}
function createMicrophone(m) {
const g = new THREE.Group();
const stand = new THREE.Mesh(new THREE.CylinderGeometry(0.1, 0.1, 4, 6), m.dark);
stand.position.y = 2; stand.castShadow = true;
const base = new THREE.Mesh(new THREE.CylinderGeometry(0.6, 0.6, 0.2, 8), m.dark);
base.position.y = 0.1;
// Mic Head with Wireframe (Cage)
const micBody = new THREE.Mesh(new THREE.CylinderGeometry(0.25, 0.25, 0.6, 8), m.prop);
micBody.position.y = 4.0;
const micHead = new THREE.Mesh(new THREE.SphereGeometry(0.3, 12, 12), new THREE.MeshStandardMaterial({ color: 0x334155, wireframe: true }));
micHead.position.y = 4.4;
// Pop Filter
const filterStand = new THREE.Mesh(new THREE.CylinderGeometry(0.02, 0.02, 0.4, 4), m.dark);
filterStand.position.set(0, 4.2, 0.4);
const filter = new THREE.Mesh(new THREE.TorusGeometry(0.3, 0.02, 8, 24), m.dark);
filter.position.set(0, 4.4, 0.5);
g.add(stand, base, micBody, micHead, filterStand, filter);
return g;
}
// === DESIGN / CREATIVE ===
function createStudioSetup(m) {
const g = new THREE.Group();
const top = new THREE.Mesh(new THREE.BoxGeometry(5.5, 0.3, 2.8), m.prop);
top.position.y = 2; top.castShadow = true;
const monitor = new THREE.Mesh(new THREE.BoxGeometry(3.2, 1.5, 0.15), m.dark);
monitor.position.set(0, 3, -0.8); monitor.castShadow = true;
const sp1 = new THREE.Mesh(new THREE.BoxGeometry(1, 1.4, 1), m.dark);
sp1.position.set(-2.2, 3, -0.5); sp1.castShadow = true;
const sp2 = new THREE.Mesh(new THREE.BoxGeometry(1, 1.4, 1), m.dark);
sp2.position.set(2.2, 3, -0.5); sp2.castShadow = true;
// Studio Light
const light = new THREE.PointLight(PROJ_COLOR, 10, 20);
light.position.set(0, 3.5, 0);
g.add(top, monitor, sp1, sp2, light);
return g;
}
function createDrawingTablet(m) {
const g = new THREE.Group();
const top = new THREE.Mesh(new THREE.BoxGeometry(4.5, 0.25, 2.5), m.prop);
top.position.y = 2; top.castShadow = true;
const tablet = new THREE.Mesh(new THREE.BoxGeometry(2.2, 0.1, 1.4), m.glow);
tablet.position.set(0, 2.2, 0.2); tablet.rotation.x = -0.15;
g.add(top, tablet);
return g;
}
function createCameraRig(m) {
const g = new THREE.Group();
const stand = new THREE.Mesh(new THREE.CylinderGeometry(0.15, 0.15, 4.5, 6), m.dark);
stand.position.y = 2.25; stand.castShadow = true;
const cam = new THREE.Mesh(new THREE.BoxGeometry(1.5, 1, 1.5), m.dark);
cam.position.y = 4.5; cam.castShadow = true;
g.add(stand, cam);
return g;
}
function createLightPanel(m) {
const g = new THREE.Group();
const stand = new THREE.Mesh(new THREE.CylinderGeometry(0.1, 0.1, 5, 6), m.prop);
stand.position.y = 2.5; stand.castShadow = true;
const panel = new THREE.Mesh(new THREE.BoxGeometry(2.2, 2.2, 0.15), m.glow);
panel.position.set(0, 4.5, 0.3); panel.rotation.x = -0.2;
g.add(stand, panel);
return g;
}
function createEasel(m) {
const g = new THREE.Group();
const stand = new THREE.Mesh(new THREE.BoxGeometry(0.2, 5, 0.2), m.prop);
stand.position.y = 2.5; stand.castShadow = true;
const canvas = new THREE.Mesh(new THREE.BoxGeometry(3, 2.5, 0.1), m.white);
canvas.position.set(0, 3.5, 0.3); canvas.castShadow = true;
g.add(stand, canvas);
return g;
}
// === NEW DECOR ===
function createRug(m, bounds = {w: 12, d: 8}) {
const g = new THREE.Group();
const rug = new THREE.Mesh(new THREE.BoxGeometry(bounds.w, 0.05, bounds.d), m.accent);
rug.position.y = 0.025;
g.add(rug);
return g;
}
function createWallPoster(m) {
const g = new THREE.Group();
const frame = new THREE.Mesh(new THREE.BoxGeometry(3, 4, 0.1), m.dark);
frame.position.y = 6;
const content = new THREE.Mesh(new THREE.BoxGeometry(2.6, 3.6, 0.05), m.glow);
content.position.set(0, 6, 0.06);
g.add(frame, content);
return g;
}
function createCoffeeMug(m) {
const g = new THREE.Group();
const body = new THREE.Mesh(new THREE.CylinderGeometry(0.2, 0.2, 0.5, 8), m.white);
body.position.y = 0.25;
const handle = new THREE.Mesh(new THREE.TorusGeometry(0.15, 0.04, 8, 12), m.white);
handle.position.set(0.2, 0.25, 0);
g.add(body, handle);
return g;
}
// --- ROOM GENERATION ---
function createOfficeShape(type, colorCode) {
const group = new THREE.Group();
const baseColor = new THREE.Color(colorCode).lerp(new THREE.Color(0xffffff), 0.4);
const mat = new THREE.MeshStandardMaterial({ color: baseColor, roughness: 0.2, metalness: 0.1 });
const h = 0.6;
const geo = new THREE.BoxGeometry(50, h, 50);
const mesh = new THREE.Mesh(geo, mat);
mesh.position.y = h / 2; mesh.castShadow = true; mesh.receiveShadow = true;
group.add(mesh);
group.userData.bounds = { w: 50, d: 50 };
return group;
}
function addComplexityProps(officeGroup, complexity, bounds, theme) {
function pick(arr) { return arr[Math.floor(Math.random() * arr.length)]; }
// Registry of all available prop generators
const propRegistry = {
createPlant, createBookshelf, createChair, createCoffeeMachine, createTrashBin,
createWaterCooler, createMeetingTable, createServerRack, createCoolingUnit,
createNetworkSwitch, createUPS, createCableRack, createMonitorWall,
createCommandCenter, createRadarAntenna, createHologramTable, createOscilloscope,
createTestBench, createSolderingStation, createControlPanel, createDesk,
createDualMonitorDesk, createStandingDesk, createWhiteboard, createLaptopStation,
createPrinter, createStudioSetup, createDrawingTablet, createCameraRig,
createLightPanel, createEasel, createSpeaker, createKeyboard, createMicrophone,
createRug, createWallPoster, createCoffeeMug
};
// 1. Add Rug at center
const rug = createRug(m, { w: 18, d: 14 });
rug.position.set(0, 0.6, 0);
officeGroup.add(rug);
// 2. Add Wall Posters (Simulated walls at edges)
for (let i = 0; i < 3; i++) {
const poster = createWallPoster(m);
const side = Math.floor(Math.random() * 2); // 0: Back, 1: Left
if (side === 0) {
poster.position.set((Math.random() - 0.5) * 40, 0.6, -24.8);
} else {
poster.position.set(-24.8, 0.6, (Math.random() - 0.5) * 40);
poster.rotation.y = Math.PI / 2;
}
officeGroup.add(poster);
}
const customPropNames = ["createCoolingUnit","createDualMonitorDesk","createStandingDesk","createServerRack","createCableRack","createDesk"];
const propList = customPropNames.map(name => () => propRegistry[name](m));
const shared = [() => createPlant(m), () => createCoffeeMachine(m), () => createChair(m), () => createTrashBin(m), () => createWaterCooler(m)];
const propCount = Math.floor(complexity * 1.5);
const used = new Set();
// 3. Grid-based layout for custom props to avoid overlap
const gridSize = 4;
const cells = [];
for (let x = -2; x <= 2; x++) {
for (let z = -2; z <= 2; z++) {
if (Math.abs(x) > 0.5 || Math.abs(z) > 0.5) { // Skip center for meeting table
cells.push({ x: x * 10, z: z * 10 });
}
}
}
cells.sort(() => Math.random() - 0.5);
for (let i = 0; i < Math.min(propCount, cells.length); i++) {
const fn = (used.size < propList.length) ? propList[Array.from({length: propList.length}, (_, i) => i).find(idx => !used.has(idx))] : pick(propList);
if (used.size < propList.length) used.add(propList.indexOf(fn));
const p = fn();
p.scale.set(1.8, 1.8, 1.8);
p.rotation.y = Math.random() * Math.PI * 2;
const cell = cells[i];
p.position.set(cell.x + (Math.random() - 0.5) * 4, 0.6, cell.z + (Math.random() - 0.5) * 4);
officeGroup.add(p);
}
// Fill rest randomly
for (let i = 0; i < 5; i++) {
const p = pick(shared)();
p.scale.set(1.5, 1.5, 1.5);
p.rotation.y = Math.random() * Math.PI * 2;
p.position.set((Math.random() - 0.5) * (bounds.w - 12), 0.6, (Math.random() - 0.5) * (bounds.d - 12));
officeGroup.add(p);
}
const table = createMeetingTable(m);
table.scale.set(2, 2, 2);
table.position.set(0, 0.6, 0);
officeGroup.add(table);
// Workers
const workerMat = new THREE.MeshStandardMaterial({ color: new THREE.Color(PROJ_COLOR).lerp(new THREE.Color(0x000000), 0.2), roughness: 0.3 });
for (let j = 0; j < 3; j++) {
const workerMesh = new THREE.Mesh(new THREE.SphereGeometry(1.8, 8, 8), workerMat);
workerMesh.position.set((Math.random() - 0.5) * (bounds.w - 5), 1.6, (Math.random() - 0.5) * (bounds.d - 5));
workerMesh.castShadow = true;
officeGroup.add(workerMesh);
animatedWorkers.push({
mesh: workerMesh, bounds: bounds,
speedX: (Math.random() - 0.5) * 0.1, speedZ: (Math.random() - 0.5) * 0.1
});
}
}
// --- BUILD SCENE ---
const officeRoom = createOfficeShape('square', PROJ_COLOR);
addComplexityProps(officeRoom, COMPLEXITY, officeRoom.userData.bounds, PROJ_THEME);
scene.add(officeRoom);
// Glass Shell
const glassMat = new THREE.MeshPhysicalMaterial({ color: 0xffffff, transmission: 0.95, opacity: 0.05, transparent: true, roughness: 0.05, ior: 1.5, depthWrite: false });
const glassMesh = new THREE.Mesh(new THREE.BoxGeometry(52, 14, 52), glassMat);
glassMesh.position.y = 7;
scene.add(glassMesh);
const ground = new THREE.Mesh(new THREE.PlaneGeometry(200, 200), new THREE.MeshStandardMaterial({ color: 0xe2e8f0, roughness: 0.9 }));
ground.rotation.x = -Math.PI / 2;
ground.position.y = -0.1;
ground.receiveShadow = true;
scene.add(ground);
// --- CONTROLS ---
let isDragging = false;
let previousMousePosition = { x: 0, y: 0 };
container.addEventListener('mousedown', () => isDragging = true);
window.addEventListener('mouseup', () => isDragging = false);
window.addEventListener('mousemove', (e) => {
if (isDragging) {
const deltaMove = { x: e.offsetX - previousMousePosition.x, y: e.offsetY - previousMousePosition.y };
officeRoom.rotation.y += deltaMove.x * 0.01;
glassMesh.rotation.y = officeRoom.rotation.y;
}
previousMousePosition = { x: e.offsetX, y: e.offsetY };
});
// Touch support
container.addEventListener('touchstart', (e) => {
isDragging = true;
previousMousePosition = { x: e.touches[0].clientX, y: e.touches[0].clientY };
}, { passive: true });
window.addEventListener('touchend', () => isDragging = false);
window.addEventListener('touchmove', (e) => {
if (isDragging) {
const deltaMove = { x: e.touches[0].clientX - previousMousePosition.x, y: e.touches[0].clientY - previousMousePosition.y };
officeRoom.rotation.y += deltaMove.x * 0.01;
glassMesh.rotation.y = officeRoom.rotation.y;
previousMousePosition = { x: e.touches[0].clientX, y: e.touches[0].clientY };
}
}, { passive: false });
// --- RENDER LOOP ---
function animate() {
requestAnimationFrame(animate);
if (!isDragging) {
officeRoom.rotation.y += 0.002;
glassMesh.rotation.y = officeRoom.rotation.y;
}
animatedWorkers.forEach(w => {
w.mesh.position.x += w.speedX;
w.mesh.position.z += w.speedZ;
if (Math.abs(w.mesh.position.x) > (w.bounds.w/2 - 2)) w.speedX *= -1;
if (Math.abs(w.mesh.position.z) > (w.bounds.d/2 - 2)) w.speedZ *= -1;
});
renderer.render(scene, camera);
}
window.addEventListener('resize', () => {
const aspect = window.innerWidth / window.innerHeight;
camera.left = -d * aspect;
camera.right = d * aspect;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
});
animate();
</script>
</body>
</html>