Download node_modules/three/src/helpers/PointLightHelper.js from SimWorld-AI/industrial-harbor-viewer: direct link, hf CLI and curl.
- Browser
- Download file 1.72 kB
-
https://huggingface.co/spaces/SimWorld-AI/industrial-harbor-viewer/resolve/main/node_modules/three/src/helpers/PointLightHelper.js
- Command line
-
hf download hf://spaces/SimWorld-AI/industrial-harbor-viewer/node_modules/three/src/helpers/PointLightHelper.js
-
curl -L -o PointLightHelper.js https://huggingface.co/spaces/SimWorld-AI/industrial-harbor-viewer/resolve/main/node_modules/three/src/helpers/PointLightHelper.js
1.72 kB
| import { Mesh } from '../objects/Mesh.js'; | |
| import { MeshBasicMaterial } from '../materials/MeshBasicMaterial.js'; | |
| import { SphereGeometry } from '../geometries/SphereGeometry.js'; | |
| class PointLightHelper extends Mesh { | |
| constructor( light, sphereSize, color ) { | |
| const geometry = new SphereGeometry( sphereSize, 4, 2 ); | |
| const material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } ); | |
| super( geometry, material ); | |
| this.light = light; | |
| this.color = color; | |
| this.type = 'PointLightHelper'; | |
| this.matrix = this.light.matrixWorld; | |
| this.matrixAutoUpdate = false; | |
| this.update(); | |
| /* | |
| // TODO: delete this comment? | |
| const distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 ); | |
| const distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } ); | |
| this.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial ); | |
| this.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial ); | |
| const d = light.distance; | |
| if ( d === 0.0 ) { | |
| this.lightDistance.visible = false; | |
| } else { | |
| this.lightDistance.scale.set( d, d, d ); | |
| } | |
| this.add( this.lightDistance ); | |
| */ | |
| } | |
| dispose() { | |
| this.geometry.dispose(); | |
| this.material.dispose(); | |
| } | |
| update() { | |
| this.light.updateWorldMatrix( true, false ); | |
| if ( this.color !== undefined ) { | |
| this.material.color.set( this.color ); | |
| } else { | |
| this.material.color.copy( this.light.color ); | |
| } | |
| /* | |
| const d = this.light.distance; | |
| if ( d === 0.0 ) { | |
| this.lightDistance.visible = false; | |
| } else { | |
| this.lightDistance.visible = true; | |
| this.lightDistance.scale.set( d, d, d ); | |
| } | |
| */ | |
| } | |
| } | |
| export { PointLightHelper }; | |