|
@@ -173,45 +173,6 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
- function generateRegularPointcloud( color, width, length ) {
|
|
|
-
|
|
|
- var geometry = new THREE.Geometry();
|
|
|
-
|
|
|
- var colors = [];
|
|
|
-
|
|
|
- var k = 0;
|
|
|
-
|
|
|
- for ( var i = 0; i < width; i ++ ) {
|
|
|
-
|
|
|
- for ( var j = 0; j < length; j ++ ) {
|
|
|
-
|
|
|
- var u = i / width;
|
|
|
- var v = j / length;
|
|
|
- var x = u - 0.5;
|
|
|
- var y = ( Math.cos( u * Math.PI * 8 ) + Math.sin( v * Math.PI * 8 ) ) / 20;
|
|
|
- var z = v - 0.5;
|
|
|
- var v = new THREE.Vector3( x, y, z );
|
|
|
- geometry.vertices.push( v );
|
|
|
-
|
|
|
- var intensity = ( y + 0.1 ) * 7;
|
|
|
- colors[ k ] = ( color.clone().multiplyScalar( intensity ) );
|
|
|
-
|
|
|
- k ++;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- geometry.colors = colors;
|
|
|
- geometry.computeBoundingBox();
|
|
|
-
|
|
|
- var material = new THREE.PointsMaterial( { size: pointSize, vertexColors: THREE.VertexColors } );
|
|
|
- var pointcloud = new THREE.Points( geometry, material );
|
|
|
-
|
|
|
- return pointcloud;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
function init() {
|
|
|
|
|
|
var container = document.getElementById( 'container' );
|
|
@@ -221,7 +182,7 @@
|
|
|
clock = new THREE.Clock();
|
|
|
|
|
|
camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 10000 );
|
|
|
- camera.position.set( 10, 10, 10 );
|
|
|
+ camera.position.set( 15, 15, 15 );
|
|
|
camera.lookAt( scene.position );
|
|
|
camera.updateMatrix();
|
|
|
|
|
@@ -229,25 +190,20 @@
|
|
|
|
|
|
var pcBuffer = generatePointcloud( new THREE.Color( 1, 0, 0 ), width, length );
|
|
|
pcBuffer.scale.set( 10, 10, 10 );
|
|
|
- pcBuffer.position.set( - 5, 0, 5 );
|
|
|
+ pcBuffer.position.set( - 10, 0, 0 );
|
|
|
scene.add( pcBuffer );
|
|
|
|
|
|
var pcIndexed = generateIndexedPointcloud( new THREE.Color( 0, 1, 0 ), width, length );
|
|
|
pcIndexed.scale.set( 10, 10, 10 );
|
|
|
- pcIndexed.position.set( 5, 0, 5 );
|
|
|
+ pcIndexed.position.set( 0, 0, 0 );
|
|
|
scene.add( pcIndexed );
|
|
|
|
|
|
var pcIndexedOffset = generateIndexedWithOffsetPointcloud( new THREE.Color( 0, 1, 1 ), width, length );
|
|
|
pcIndexedOffset.scale.set( 10, 10, 10 );
|
|
|
- pcIndexedOffset.position.set( 5, 0, - 5 );
|
|
|
+ pcIndexedOffset.position.set( 10, 0, 0 );
|
|
|
scene.add( pcIndexedOffset );
|
|
|
|
|
|
- var pcRegular = generateRegularPointcloud( new THREE.Color( 1, 0, 1 ), width, length );
|
|
|
- pcRegular.scale.set( 10, 10, 10 );
|
|
|
- pcRegular.position.set( - 5, 0, - 5 );
|
|
|
- scene.add( pcRegular );
|
|
|
-
|
|
|
- pointclouds = [ pcBuffer, pcIndexed, pcIndexedOffset, pcRegular ];
|
|
|
+ pointclouds = [ pcBuffer, pcIndexed, pcIndexedOffset ];
|
|
|
|
|
|
//
|
|
|
|