提交 83db2025 编写于 作者: W WestLangley

Geometry => BufferGeometry

上级 d97f3681
......@@ -451,16 +451,16 @@ THREE.Lut.prototype = {
var material = new THREE.LineBasicMaterial( { color: 0x000000, linewidth: 2 } );
var geometry = new THREE.Geometry();
var points = [];
if ( this.legend.layout == 'vertical' ) {
var linePosition = ( this.legend.position.y - ( this.legend.dimensions.height * 0.5 ) + 0.01 ) + ( this.legend.dimensions.height ) * ( ( value - this.minV ) / ( this.maxV - this.minV ) * 0.99 );
geometry.vertices.push( new THREE.Vector3( this.legend.position.x + this.legend.dimensions.width * 0.55, linePosition, this.legend.position.z ) );
points.push( new THREE.Vector3( this.legend.position.x + this.legend.dimensions.width * 0.55, linePosition, this.legend.position.z ) );
geometry.vertices.push( new THREE.Vector3( this.legend.position.x + this.legend.dimensions.width * 0.7, linePosition, this.legend.position.z ) );
points.push( new THREE.Vector3( this.legend.position.x + this.legend.dimensions.width * 0.7, linePosition, this.legend.position.z ) );
}
......@@ -468,12 +468,14 @@ THREE.Lut.prototype = {
var linePosition = ( this.legend.position.x - ( this.legend.dimensions.height * 0.5 ) + 0.01 ) + ( this.legend.dimensions.height ) * ( ( value - this.minV ) / ( this.maxV - this.minV ) * 0.99 );
geometry.vertices.push( new THREE.Vector3( linePosition, this.legend.position.y - this.legend.dimensions.width * 0.55, this.legend.position.z ) );
points.push( new THREE.Vector3( linePosition, this.legend.position.y - this.legend.dimensions.width * 0.55, this.legend.position.z ) );
geometry.vertices.push( new THREE.Vector3( linePosition, this.legend.position.y - this.legend.dimensions.width * 0.7, this.legend.position.z ) );
points.push( new THREE.Vector3( linePosition, this.legend.position.y - this.legend.dimensions.width * 0.7, this.legend.position.z ) );
}
var geometry = new THREE.BufferGeometry().setFromPoints( points );
var line = new THREE.Line( geometry, material );
lines[ i ] = line;
......
......@@ -40,26 +40,29 @@
document.body.appendChild( container );
camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 10000 );
camera.position.set( 100000, 0, 3200 );
camera.position.set( 0, 0, 1000 );
scene = new THREE.Scene();
var colors = [ 0x000000, 0xff0080, 0x8000ff, 0xffffff ];
var geometry = new THREE.Geometry();
var colorArray = [ new THREE.Color( 0xff0080 ), new THREE.Color( 0xffffff ), new THREE.Color( 0x8000ff ) ];
var positions = [];
var colors = [];
for ( var i = 0; i < 2000; i ++ ) {
for ( var i = 0; i < 100; i ++ ) {
var vertex = new THREE.Vector3();
vertex.x = Math.random() * 4000 - 2000;
vertex.y = Math.random() * 4000 - 2000;
vertex.z = Math.random() * 4000 - 2000;
geometry.vertices.push( vertex );
positions.push( 4000 * ( Math.random() - 0.5 ), 4000 * ( Math.random() - 0.5 ), 4000 * ( Math.random() - 0.5 ) );
geometry.colors.push( new THREE.Color( colors[ Math.floor( Math.random() * colors.length ) ] ) );
var clr = colorArray[ Math.floor( Math.random() * colorArray.length ) ];
colors.push( clr.r, clr.g, clr.b );
}
var material = new THREE.PointsMaterial( { size: 1, vertexColors: THREE. VertexColors, depthTest: false, opacity: 0.5, sizeAttenuation: false, transparent: true } );
var geometry = new THREE.BufferGeometry();
geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
geometry.addAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
var material = new THREE.PointsMaterial( { size: 4, vertexColors: THREE.VertexColors, depthTest: false, sizeAttenuation: false } );
var mesh = new THREE.Points( geometry, material );
scene.add( mesh );
......
......@@ -64,7 +64,7 @@
camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 0.1, 10 );
user.add( camera );
var geometry = new THREE.PlaneGeometry( 4, 4 );
var geometry = new THREE.PlaneBufferGeometry( 4, 4 );
var material = new THREE.MeshStandardMaterial( {
color: 0xeeeeee,
roughness: 1.0,
......@@ -91,11 +91,11 @@
scene.add( group );
var geometries = [
new THREE.BoxGeometry( 0.2, 0.2, 0.2 ),
new THREE.ConeGeometry( 0.2, 0.2, 64 ),
new THREE.CylinderGeometry( 0.2, 0.2, 0.2, 64 ),
new THREE.IcosahedronGeometry( 0.2, 3 ),
new THREE.TorusGeometry( 0.2, 0.04, 64, 32 )
new THREE.BoxBufferGeometry( 0.2, 0.2, 0.2 ),
new THREE.ConeBufferGeometry( 0.2, 0.2, 64 ),
new THREE.CylinderBufferGeometry( 0.2, 0.2, 0.2, 64 ),
new THREE.IcosahedronBufferGeometry( 0.2, 3 ),
new THREE.TorusBufferGeometry( 0.2, 0.04, 64, 32 )
];
for ( var i = 0; i < 50; i ++ ) {
......@@ -171,9 +171,7 @@
//
var geometry = new THREE.Geometry();
geometry.vertices.push( new THREE.Vector3( 0, 0, 0 ) );
geometry.vertices.push( new THREE.Vector3( 0, 0, - 1 ) );
var geometry = new THREE.BufferGeometry().setFromPoints( [ new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 0, 0, - 1 ) ] );
var line = new THREE.Line( geometry );
line.name = 'line';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册