|
@@ -102,21 +102,28 @@
|
|
|
|
|
|
scene = new THREE.Scene();
|
|
scene = new THREE.Scene();
|
|
|
|
|
|
- geometry = new THREE.BufferGeometry();
|
|
|
|
- var material = new THREE.LineBasicMaterial({ vertexColors: THREE.VertexColors });
|
|
|
|
|
|
+
|
|
|
|
+ group = new THREE.Group();
|
|
|
|
+ scene.add( group );
|
|
|
|
+
|
|
|
|
+ var helper = new THREE.BoxHelper( new THREE.Mesh( new THREE.BoxGeometry( r, r, r ) ) );
|
|
|
|
+ helper.material.color.setHex( 0x080808 );
|
|
|
|
+ helper.material.blending = THREE.AdditiveBlending;
|
|
|
|
+ helper.material.transparent = true;
|
|
|
|
+ group.add( helper );
|
|
|
|
|
|
var segments = maxParticleCount * maxParticleCount;
|
|
var segments = maxParticleCount * maxParticleCount;
|
|
|
|
|
|
positions = new Float32Array( segments * 3 );
|
|
positions = new Float32Array( segments * 3 );
|
|
colors = new Float32Array( segments * 3 );
|
|
colors = new Float32Array( segments * 3 );
|
|
|
|
|
|
- var pMaterial = new THREE.PointCloudMaterial({
|
|
|
|
|
|
+ var pMaterial = new THREE.PointCloudMaterial( {
|
|
color: 0xFFFFFF,
|
|
color: 0xFFFFFF,
|
|
size: 3,
|
|
size: 3,
|
|
blending: THREE.AdditiveBlending,
|
|
blending: THREE.AdditiveBlending,
|
|
transparent: true,
|
|
transparent: true,
|
|
sizeAttenuation: false
|
|
sizeAttenuation: false
|
|
- });
|
|
|
|
|
|
+ } );
|
|
|
|
|
|
particles = new THREE.BufferGeometry();
|
|
particles = new THREE.BufferGeometry();
|
|
particlePositions = new Float32Array( maxParticleCount * 3 );
|
|
particlePositions = new Float32Array( maxParticleCount * 3 );
|
|
@@ -132,10 +139,10 @@
|
|
particlePositions[ i * 3 + 2 ] = z;
|
|
particlePositions[ i * 3 + 2 ] = z;
|
|
|
|
|
|
// add it to the geometry
|
|
// add it to the geometry
|
|
- particlesData.push({
|
|
|
|
|
|
+ particlesData.push( {
|
|
velocity: new THREE.Vector3( -1 + Math.random() * 2, -1 + Math.random() * 2, -1 + Math.random() * 2 ),
|
|
velocity: new THREE.Vector3( -1 + Math.random() * 2, -1 + Math.random() * 2, -1 + Math.random() * 2 ),
|
|
numConnections: 0
|
|
numConnections: 0
|
|
- });
|
|
|
|
|
|
+ } );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -145,18 +152,16 @@
|
|
index: 0
|
|
index: 0
|
|
} );
|
|
} );
|
|
|
|
|
|
- particles.addAttribute( 'position', new THREE.BufferAttribute( particlePositions, 3 ) );
|
|
|
|
|
|
+ particles.addAttribute( 'position', new THREE.DynamicBufferAttribute( particlePositions, 3 ) );
|
|
|
|
|
|
// create the particle system
|
|
// create the particle system
|
|
pointCloud = new THREE.PointCloud( particles, pMaterial );
|
|
pointCloud = new THREE.PointCloud( particles, pMaterial );
|
|
-
|
|
|
|
- group = new THREE.Object3D();
|
|
|
|
-
|
|
|
|
- // add it to the scene
|
|
|
|
group.add( pointCloud );
|
|
group.add( pointCloud );
|
|
|
|
|
|
- geometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
|
|
|
|
- geometry.addAttribute( 'color', new THREE.BufferAttribute( colors, 3 ) );
|
|
|
|
|
|
+ var geometry = new THREE.BufferGeometry();
|
|
|
|
+
|
|
|
|
+ geometry.addAttribute( 'position', new THREE.DynamicBufferAttribute( positions, 3 ) );
|
|
|
|
+ geometry.addAttribute( 'color', new THREE.DynamicBufferAttribute( colors, 3 ) );
|
|
|
|
|
|
geometry.computeBoundingSphere();
|
|
geometry.computeBoundingSphere();
|
|
|
|
|
|
@@ -166,15 +171,19 @@
|
|
index: 0
|
|
index: 0
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
+ var material = new THREE.LineBasicMaterial( {
|
|
|
|
+ vertexColors: THREE.VertexColors,
|
|
|
|
+ blending: THREE.AdditiveBlending,
|
|
|
|
+ transparent: true
|
|
|
|
+ } );
|
|
|
|
+
|
|
linesMesh = new THREE.Line( geometry, material, THREE.LinePieces );
|
|
linesMesh = new THREE.Line( geometry, material, THREE.LinePieces );
|
|
group.add( linesMesh );
|
|
group.add( linesMesh );
|
|
|
|
|
|
- scene.add( group );
|
|
|
|
-
|
|
|
|
//
|
|
//
|
|
|
|
|
|
renderer = new THREE.WebGLRenderer( { antialias: true } );
|
|
renderer = new THREE.WebGLRenderer( { antialias: true } );
|
|
- renderer.setPixelRatio( window.devicePixelRatio )
|
|
|
|
|
|
+ renderer.setPixelRatio( window.devicePixelRatio );
|
|
renderer.setSize( window.innerWidth, window.innerHeight );
|
|
renderer.setSize( window.innerWidth, window.innerHeight );
|
|
|
|
|
|
renderer.gammaInput = true;
|
|
renderer.gammaInput = true;
|
|
@@ -249,7 +258,7 @@
|
|
particleData.numConnections++;
|
|
particleData.numConnections++;
|
|
particleDataB.numConnections++;
|
|
particleDataB.numConnections++;
|
|
|
|
|
|
- var alpha = 1.0 - dist / effectController.minDistance + 0.2;
|
|
|
|
|
|
+ var alpha = 1.0 - dist / effectController.minDistance;
|
|
|
|
|
|
positions[ vertexpos++ ] = particlePositions[ i * 3 ];
|
|
positions[ vertexpos++ ] = particlePositions[ i * 3 ];
|
|
positions[ vertexpos++ ] = particlePositions[ i * 3 + 1 ];
|
|
positions[ vertexpos++ ] = particlePositions[ i * 3 + 1 ];
|