BLUE
PHP 7.4.33
Path:
/var/www/uibuilder.cmshelp.dk/httpdocs/node_modules/three/examples/jsm/helpers
Run
Logout
Edit File
Size: 2.00 KB
Close
/var/www/uibuilder.cmshelp.dk/httpdocs/node_modules/three/examples/jsm/helpers/RectAreaLightHelper.js
Text
Base64
import { BackSide, BufferGeometry, Float32BufferAttribute, Line, LineBasicMaterial, Mesh, MeshBasicMaterial } from 'three'; /** * This helper must be added as a child of the light */ class RectAreaLightHelper extends Line { constructor( light, color ) { const positions = [ 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, - 1, 0, 1, 1, 0 ]; const geometry = new BufferGeometry(); geometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) ); geometry.computeBoundingSphere(); const material = new LineBasicMaterial( { fog: false } ); super( geometry, material ); this.light = light; this.color = color; // optional hardwired color for the helper this.type = 'RectAreaLightHelper'; // const positions2 = [ 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, - 1, 0, 1, - 1, 0 ]; const geometry2 = new BufferGeometry(); geometry2.setAttribute( 'position', new Float32BufferAttribute( positions2, 3 ) ); geometry2.computeBoundingSphere(); this.add( new Mesh( geometry2, new MeshBasicMaterial( { side: BackSide, fog: false } ) ) ); } updateMatrixWorld() { this.scale.set( 0.5 * this.light.width, 0.5 * this.light.height, 1 ); if ( this.color !== undefined ) { this.material.color.set( this.color ); this.children[ 0 ].material.color.set( this.color ); } else { this.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); // prevent hue shift const c = this.material.color; const max = Math.max( c.r, c.g, c.b ); if ( max > 1 ) c.multiplyScalar( 1 / max ); this.children[ 0 ].material.color.copy( this.material.color ); } // ignore world scale on light this.matrixWorld.extractRotation( this.light.matrixWorld ).scale( this.scale ).copyPosition( this.light.matrixWorld ); this.children[ 0 ].matrixWorld.copy( this.matrixWorld ); } dispose() { this.geometry.dispose(); this.material.dispose(); this.children[ 0 ].geometry.dispose(); this.children[ 0 ].material.dispose(); } } export { RectAreaLightHelper };
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 10
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
LightProbeHelper.js
2.64 KB
lrw-r--r--
2025-03-28 11:04:38
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
LightProbeHelperGPU.js
1.27 KB
lrw-r--r--
2025-03-28 11:04:38
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
OctreeHelper.js
1.93 KB
lrw-r--r--
2025-03-28 11:04:38
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
PositionalAudioHelper.js
2.65 KB
lrw-r--r--
2025-03-28 11:04:39
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
RectAreaLightHelper.js
2.00 KB
lrw-r--r--
2025-03-28 11:04:39
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
TextureHelper.js
4.33 KB
lrw-r--r--
2025-03-28 11:04:39
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
TextureHelperGPU.js
3.63 KB
lrw-r--r--
2025-03-28 11:04:39
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
VertexNormalsHelper.js
1.81 KB
lrw-r--r--
2025-03-28 11:04:39
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
VertexTangentsHelper.js
1.62 KB
lrw-r--r--
2025-03-28 11:04:39
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ViewHelper.js
8.41 KB
lrw-r--r--
2025-03-28 11:04:39
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).