Buckets:
| import { LineSegments } from '../objects/LineSegments.js'; | |
| import { LineBasicMaterial } from '../materials/LineBasicMaterial.js'; | |
| import { Float32BufferAttribute } from '../core/BufferAttribute.js'; | |
| import { BufferGeometry } from '../core/BufferGeometry.js'; | |
| import { Color } from '../math/Color.js'; | |
| class GridHelper extends LineSegments { | |
| constructor( size = 10, divisions = 10, color1 = 0x444444, color2 = 0x888888 ) { | |
| color1 = new Color( color1 ); | |
| color2 = new Color( color2 ); | |
| const center = divisions / 2; | |
| const step = size / divisions; | |
| const halfSize = size / 2; | |
| const vertices = [], colors = []; | |
| for ( let i = 0, j = 0, k = - halfSize; i <= divisions; i ++, k += step ) { | |
| vertices.push( - halfSize, 0, k, halfSize, 0, k ); | |
| vertices.push( k, 0, - halfSize, k, 0, halfSize ); | |
| const color = i === center ? color1 : color2; | |
| color.toArray( colors, j ); j += 3; | |
| color.toArray( colors, j ); j += 3; | |
| color.toArray( colors, j ); j += 3; | |
| color.toArray( colors, j ); j += 3; | |
| } | |
| const geometry = new BufferGeometry(); | |
| geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); | |
| geometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) ); | |
| const material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } ); | |
| super( geometry, material ); | |
| this.type = 'GridHelper'; | |
| } | |
| dispose() { | |
| this.geometry.dispose(); | |
| this.material.dispose(); | |
| } | |
| } | |
| export { GridHelper }; | |
Xet Storage Details
- Size:
- 1.48 kB
- Xet hash:
- 26c082eb54c4b8b3b48c8f2484c4e5de7fe38dc3deaa7b4f71864995e0643645
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.