|
@@ -87,8 +87,8 @@
|
|
|
// Colors with BufferGeometry
|
|
|
|
|
|
var buffGeometry0 = new THREE.BufferGeometry(),
|
|
|
- buffGeometry1 = new THREE.BufferGeometry(),
|
|
|
- buffGeometry2 = new THREE.BufferGeometry();
|
|
|
+ buffGeometry1 = new THREE.BufferGeometry(),
|
|
|
+ buffGeometry2 = new THREE.BufferGeometry();
|
|
|
|
|
|
var subdivisions = 6;
|
|
|
|
|
@@ -120,71 +120,71 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
- buffGeometry0.addAttribute( 'position', new THREE.Float32BufferAttribute( position, 3 ) );
|
|
|
- buffGeometry1.addAttribute( 'position', new THREE.Float32BufferAttribute( position, 3 ) );
|
|
|
- buffGeometry2.addAttribute( 'position', new THREE.Float32BufferAttribute( position, 3 ) );
|
|
|
+ buffGeometry0.addAttribute( 'position', new THREE.Float32BufferAttribute( position, 3 ) );
|
|
|
+ buffGeometry1.addAttribute( 'position', new THREE.Float32BufferAttribute( position, 3 ) );
|
|
|
+ buffGeometry2.addAttribute( 'position', new THREE.Float32BufferAttribute( position, 3 ) );
|
|
|
|
|
|
- buffGeometry0.addAttribute( 'color', new THREE.Float32BufferAttribute( colorArray0, 3 ) );
|
|
|
- buffGeometry1.addAttribute( 'color', new THREE.Float32BufferAttribute( colorArray1, 3 ) );
|
|
|
- buffGeometry2.addAttribute( 'color', new THREE.Float32BufferAttribute( colorArray2, 3 ) );
|
|
|
+ buffGeometry0.addAttribute( 'color', new THREE.Float32BufferAttribute( colorArray0, 3 ) );
|
|
|
+ buffGeometry1.addAttribute( 'color', new THREE.Float32BufferAttribute( colorArray1, 3 ) );
|
|
|
+ buffGeometry2.addAttribute( 'color', new THREE.Float32BufferAttribute( colorArray2, 3 ) );
|
|
|
|
|
|
// Colors with Geometry
|
|
|
|
|
|
- var geometry0 = new THREE.Geometry(),
|
|
|
- geometry2 = new THREE.Geometry(),
|
|
|
- geometry3 = new THREE.Geometry();
|
|
|
+ var geometry0 = new THREE.Geometry(),
|
|
|
+ geometry2 = new THREE.Geometry(),
|
|
|
+ geometry3 = new THREE.Geometry();
|
|
|
|
|
|
- var colors0 = [],
|
|
|
- colors1 = [],
|
|
|
- colors2 = [];
|
|
|
+ var colors0 = [],
|
|
|
+ colors1 = [],
|
|
|
+ colors2 = [];
|
|
|
|
|
|
- for ( i = 0; i < hilbertPoints.length; i++ ) {
|
|
|
+ for ( i = 0; i < hilbertPoints.length; i++ ) {
|
|
|
|
|
|
- geometry0.vertices.push( hilbertPoints[ i ] );
|
|
|
+ geometry0.vertices.push( hilbertPoints[ i ] );
|
|
|
|
|
|
- colors0[ i ] = new THREE.Color( 0xffffff );
|
|
|
- colors0[ i ].setHSL( 0.6, 1.0, Math.max( 0, ( 200 - hilbertPoints[ i ].x ) / 400 ) * 0.5 + 0.5 );
|
|
|
+ colors0[ i ] = new THREE.Color( 0xffffff );
|
|
|
+ colors0[ i ].setHSL( 0.6, 1.0, Math.max( 0, ( 200 - hilbertPoints[ i ].x ) / 400 ) * 0.5 + 0.5 );
|
|
|
|
|
|
- colors1[ i ] = new THREE.Color( 0xffffff );
|
|
|
- colors1[ i ].setHSL( 0.3, 1.0, Math.max( 0, ( 200 + hilbertPoints[ i ].x ) / 400 ) * 0.5 );
|
|
|
+ colors1[ i ] = new THREE.Color( 0xffffff );
|
|
|
+ colors1[ i ].setHSL( 0.3, 1.0, Math.max( 0, ( 200 + hilbertPoints[ i ].x ) / 400 ) * 0.5 );
|
|
|
|
|
|
- colors2[ i ] = new THREE.Color( 0xffffff );
|
|
|
- colors2[ i ].setHSL( i / hilbertPoints.length, 1.0, 0.5 );
|
|
|
+ colors2[ i ] = new THREE.Color( 0xffffff );
|
|
|
+ colors2[ i ].setHSL( i / hilbertPoints.length, 1.0, 0.5 );
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- geometry2.vertices = geometry3.vertices = geometry0.vertices;
|
|
|
+ geometry2.vertices = geometry3.vertices = geometry0.vertices;
|
|
|
|
|
|
- geometry0.colors = colors0;
|
|
|
- geometry2.colors = colors1;
|
|
|
- geometry3.colors = colors2;
|
|
|
+ geometry0.colors = colors0;
|
|
|
+ geometry2.colors = colors1;
|
|
|
+ geometry3.colors = colors2;
|
|
|
|
|
|
- // Create lines and add to scene
|
|
|
+ // Create lines and add to scene
|
|
|
|
|
|
- material = new THREE.LineBasicMaterial( { color: 0xffffff, opacity: 1, linewidth: 3, vertexColors: THREE.VertexColors } );
|
|
|
+ material = new THREE.LineBasicMaterial( { color: 0xffffff, opacity: 1, linewidth: 3, vertexColors: THREE.VertexColors } );
|
|
|
|
|
|
- var line, p, scale = 0.3, d = 225;
|
|
|
- var parameters = [
|
|
|
- [ material, scale * 1.5, [ - d, - d / 2, 0 ], buffGeometry0 ],
|
|
|
- [ material, scale * 1.5, [ 0, - d / 2, 0 ], buffGeometry1 ],
|
|
|
- [ material, scale * 1.5, [ d, - d / 2, 0 ], buffGeometry2 ],
|
|
|
+ var line, p, scale = 0.3, d = 225;
|
|
|
+ var parameters = [
|
|
|
+ [ material, scale * 1.5, [ - d, - d / 2, 0 ], buffGeometry0 ],
|
|
|
+ [ material, scale * 1.5, [ 0, - d / 2, 0 ], buffGeometry1 ],
|
|
|
+ [ material, scale * 1.5, [ d, - d / 2, 0 ], buffGeometry2 ],
|
|
|
|
|
|
- [ material, scale * 1.5, [ - d, d / 2, 0 ], geometry0 ],
|
|
|
- [ material, scale * 1.5, [ 0, d / 2, 0 ], geometry2 ],
|
|
|
- [ material, scale * 1.5, [ d, d / 2, 0 ], geometry3 ],
|
|
|
- ];
|
|
|
+ [ material, scale * 1.5, [ - d, d / 2, 0 ], geometry0 ],
|
|
|
+ [ material, scale * 1.5, [ 0, d / 2, 0 ], geometry2 ],
|
|
|
+ [ material, scale * 1.5, [ d, d / 2, 0 ], geometry3 ],
|
|
|
+ ];
|
|
|
|
|
|
- for ( i = 0; i < parameters.length; i++ ) {
|
|
|
+ for ( i = 0; i < parameters.length; i++ ) {
|
|
|
|
|
|
- p = parameters[ i ];
|
|
|
- line = new THREE.Line( p[ 3 ], p[ 0 ] );
|
|
|
- line.scale.x = line.scale.y = line.scale.z = p[ 1 ];
|
|
|
- line.position.x = p[ 2 ][ 0 ];
|
|
|
- line.position.y = p[ 2 ][ 1 ];
|
|
|
- line.position.z = p[ 2 ][ 2 ];
|
|
|
- scene.add( line );
|
|
|
+ p = parameters[ i ];
|
|
|
+ line = new THREE.Line( p[ 3 ], p[ 0 ] );
|
|
|
+ line.scale.x = line.scale.y = line.scale.z = p[ 1 ];
|
|
|
+ line.position.x = p[ 2 ][ 0 ];
|
|
|
+ line.position.y = p[ 2 ][ 1 ];
|
|
|
+ line.position.z = p[ 2 ][ 2 ];
|
|
|
+ scene.add( line );
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
// Input Event Listeners
|
|
|
|