Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -348,6 +348,28 @@ class LightingControl3D(gr.HTML):
|
|
| 348 |
});
|
| 349 |
const ledPanel = new THREE.Mesh(new THREE.BoxGeometry(0.6, 0.6, 0.1), ledMat);
|
| 350 |
lightGroup.add(ledPanel);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 351 |
|
| 352 |
const spotLight = new THREE.SpotLight(0xffffff, 10, 10, Math.PI / 3, 1, 1);
|
| 353 |
spotLight.position.set(0, 0, -0.05);
|
|
|
|
| 348 |
});
|
| 349 |
const ledPanel = new THREE.Mesh(new THREE.BoxGeometry(0.6, 0.6, 0.1), ledMat);
|
| 350 |
lightGroup.add(ledPanel);
|
| 351 |
+
|
| 352 |
+
// --- NEW CODE START: Add Light Rays ---
|
| 353 |
+
// Create a cone to simulate the light beam
|
| 354 |
+
const beamGeometry = new THREE.ConeGeometry(0.45, 4, 32, 1, true); // base radius, height, radialSegments, openEnded
|
| 355 |
+
// Translate the geometry so the tip of the cone sits at the light source
|
| 356 |
+
beamGeometry.translate(0, 2, 0);
|
| 357 |
+
// Rotate to point along the Z-axis (which looks at the target)
|
| 358 |
+
beamGeometry.rotateX(Math.PI / 2);
|
| 359 |
+
|
| 360 |
+
const beamMaterial = new THREE.MeshBasicMaterial({
|
| 361 |
+
color: 0xffffff,
|
| 362 |
+
transparent: true,
|
| 363 |
+
opacity: 0.15, // Low opacity for "ray" effect
|
| 364 |
+
side: THREE.DoubleSide,
|
| 365 |
+
depthWrite: false, // Prevents occlusion issues
|
| 366 |
+
blending: THREE.AdditiveBlending // Makes it look like light
|
| 367 |
+
});
|
| 368 |
+
|
| 369 |
+
const lightBeam = new THREE.Mesh(beamGeometry, beamMaterial);
|
| 370 |
+
lightBeam.position.set(0, 0, 0.1); // Slightly offset in front of panel
|
| 371 |
+
lightGroup.add(lightBeam);
|
| 372 |
+
// --- NEW CODE END ---
|
| 373 |
|
| 374 |
const spotLight = new THREE.SpotLight(0xffffff, 10, 10, Math.PI / 3, 1, 1);
|
| 375 |
spotLight.position.set(0, 0, -0.05);
|