提交 46bdbd01 编写于 作者: M Mr.doob

Updated builds.

上级 fd014860
......@@ -7600,19 +7600,9 @@ THREE.Object3D.prototype = {
},
get renderDepth () {
console.warn( 'THREE.Object3D: .renderDepth has been renamed to .renderOrder.' );
return this.renderOrder;
},
set renderDepth ( value ) {
console.warn( 'THREE.Object3D: .renderDepth has been renamed to .renderOrder.' );
this.renderOrder = value;
console.warn( 'THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.' );
},
......@@ -17802,7 +17792,7 @@ THREE.LensFlare.prototype.add = function ( texture, size, distance, blending, co
distance: distance, // distance (0-1) from light source (0=at light source)
x: 0, y: 0, z: 0, // screen position (-1 => 1) z = 0 is in front z = 1 is back
scale: 1, // scale
rotation: 1, // rotation
rotation: 0, // rotation
opacity: opacity, // opacity
color: color, // color
blending: blending // blending
......@@ -34225,6 +34215,8 @@ THREE.EdgesHelper.prototype.constructor = THREE.EdgesHelper;
THREE.FaceNormalsHelper = function ( object, size, hex, linewidth ) {
// FaceNormalsHelper only supports THREE.Geometry
this.object = object;
this.size = ( size !== undefined ) ? size : 1;
......@@ -34233,18 +34225,34 @@ THREE.FaceNormalsHelper = function ( object, size, hex, linewidth ) {
var width = ( linewidth !== undefined ) ? linewidth : 1;
var geometry = new THREE.Geometry();
//
var faces = this.object.geometry.faces;
var nNormals = 0;
for ( var i = 0, l = faces.length; i < l; i ++ ) {
var objGeometry = this.object.geometry;
if ( objGeometry instanceof THREE.Geometry ) {
nNormals = objGeometry.faces.length;
} else {
geometry.vertices.push( new THREE.Vector3(), new THREE.Vector3() );
console.warn( 'THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.' );
}
//
var geometry = new THREE.BufferGeometry();
var positions = new THREE.Float32Attribute( nNormals * 2 * 3, 3 );
geometry.addAttribute( 'position', positions );
THREE.LineSegments.call( this, geometry, new THREE.LineBasicMaterial( { color: color, linewidth: width } ) );
//
this.matrixAutoUpdate = false;
this.normalMatrix = new THREE.Matrix3();
......@@ -34256,42 +34264,62 @@ THREE.FaceNormalsHelper = function ( object, size, hex, linewidth ) {
THREE.FaceNormalsHelper.prototype = Object.create( THREE.LineSegments.prototype );
THREE.FaceNormalsHelper.prototype.constructor = THREE.FaceNormalsHelper;
THREE.FaceNormalsHelper.prototype.update = function () {
THREE.FaceNormalsHelper.prototype.update = ( function () {
var vertices = this.geometry.vertices;
var v1 = new THREE.Vector3();
var v2 = new THREE.Vector3();
var object = this.object;
var objectVertices = object.geometry.vertices;
var objectFaces = object.geometry.faces;
var objectWorldMatrix = object.matrixWorld;
return function() {
object.updateMatrixWorld( true );
this.object.updateMatrixWorld( true );
this.normalMatrix.getNormalMatrix( this.object.matrixWorld );
var matrixWorld = this.object.matrixWorld;
var position = this.geometry.attributes.position;
//
var objGeometry = this.object.geometry;
var vertices = objGeometry.vertices;
var faces = objGeometry.faces;
this.normalMatrix.getNormalMatrix( objectWorldMatrix );
var idx = 0;
for ( var i = 0, i2 = 0, l = objectFaces.length; i < l; i ++, i2 += 2 ) {
for ( var i = 0, l = faces.length; i < l; i ++ ) {
var face = objectFaces[ i ];
var face = faces[ i ];
var normal = face.normal;
vertices[ i2 ].copy( objectVertices[ face.a ] )
.add( objectVertices[ face.b ] )
.add( objectVertices[ face.c ] )
v1.copy( vertices[ face.a ] )
.add( vertices[ face.b ] )
.add( vertices[ face.c ] )
.divideScalar( 3 )
.applyMatrix4( objectWorldMatrix );
.applyMatrix4( matrixWorld );
v2.copy( normal ).applyMatrix3( this.normalMatrix ).normalize().multiplyScalar( this.size ).add( v1 );
position.setXYZ( idx, v1.x, v1.y, v1.z );
idx = idx + 1;
vertices[ i2 + 1 ].copy( face.normal )
.applyMatrix3( this.normalMatrix )
.normalize()
.multiplyScalar( this.size )
.add( vertices[ i2 ] );
position.setXYZ( idx, v2.x, v2.y, v2.z );
idx = idx + 1;
}
this.geometry.verticesNeedUpdate = true;
position.needsUpdate = true;
return this;
};
}
}());
// File:src/extras/helpers/GridHelper.js
......@@ -34655,24 +34683,34 @@ THREE.VertexNormalsHelper = function ( object, size, hex, linewidth ) {
var width = ( linewidth !== undefined ) ? linewidth : 1;
var geometry = new THREE.Geometry();
//
var faces = object.geometry.faces;
var nNormals = 0;
for ( var i = 0, l = faces.length; i < l; i ++ ) {
var objGeometry = this.object.geometry;
var face = faces[ i ];
if ( objGeometry instanceof THREE.Geometry ) {
for ( var j = 0, jl = face.vertexNormals.length; j < jl; j ++ ) {
nNormals = objGeometry.faces.length * 3;
geometry.vertices.push( new THREE.Vector3(), new THREE.Vector3() );
} else if ( objGeometry instanceof THREE.BufferGeometry ) {
}
nNormals = objGeometry.attributes.normal.count
}
//
var geometry = new THREE.BufferGeometry();
var positions = new THREE.Float32Attribute( nNormals * 2 * 3, 3 );
geometry.addAttribute( 'position', positions );
THREE.LineSegments.call( this, geometry, new THREE.LineBasicMaterial( { color: color, linewidth: width } ) );
//
this.matrixAutoUpdate = false;
this.normalMatrix = new THREE.Matrix3();
......@@ -34684,25 +34722,32 @@ THREE.VertexNormalsHelper = function ( object, size, hex, linewidth ) {
THREE.VertexNormalsHelper.prototype = Object.create( THREE.LineSegments.prototype );
THREE.VertexNormalsHelper.prototype.constructor = THREE.VertexNormalsHelper;
THREE.VertexNormalsHelper.prototype.update = ( function ( object ) {
THREE.VertexNormalsHelper.prototype.update = ( function () {
var v1 = new THREE.Vector3();
var v2 = new THREE.Vector3();
return function( object ) {
return function() {
var keys = [ 'a', 'b', 'c', 'd' ];
var keys = [ 'a', 'b', 'c' ];
this.object.updateMatrixWorld( true );
this.normalMatrix.getNormalMatrix( this.object.matrixWorld );
var vertices = this.geometry.vertices;
var matrixWorld = this.object.matrixWorld;
var position = this.geometry.attributes.position;
//
var objGeometry = this.object.geometry;
var verts = this.object.geometry.vertices;
if ( objGeometry instanceof THREE.Geometry ) {
var faces = this.object.geometry.faces;
var vertices = objGeometry.vertices;
var worldMatrix = this.object.matrixWorld;
var faces = objGeometry.faces;
var idx = 0;
......@@ -34712,26 +34757,57 @@ THREE.VertexNormalsHelper.prototype.update = ( function ( object ) {
for ( var j = 0, jl = face.vertexNormals.length; j < jl; j ++ ) {
var vertexId = face[ keys[ j ] ];
var vertex = verts[ vertexId ];
var vertex = vertices[ face[ keys[ j ] ] ];
var normal = face.vertexNormals[ j ];
vertices[ idx ].copy( vertex ).applyMatrix4( worldMatrix );
v1.copy( vertex ).applyMatrix4( matrixWorld );
v2.copy( normal ).applyMatrix3( this.normalMatrix ).normalize().multiplyScalar( this.size ).add( v1 );
v1.copy( normal ).applyMatrix3( this.normalMatrix ).normalize().multiplyScalar( this.size );
position.setXYZ( idx, v1.x, v1.y, v1.z );
v1.add( vertices[ idx ] );
idx = idx + 1;
vertices[ idx ].copy( v1 );
position.setXYZ( idx, v2.x, v2.y, v2.z );
idx = idx + 1;
}
}
this.geometry.verticesNeedUpdate = true;
} else if ( objGeometry instanceof THREE.BufferGeometry ) {
var objPos = objGeometry.attributes.position;
var objNorm = objGeometry.attributes.normal;
var idx = 0;
// for simplicity, ignore index and drawcalls, and render every normal
for ( var j = 0, jl = objPos.count; j < jl; j ++ ) {
v1.set( objPos.getX( j ), objPos.getY( j ), objPos.getZ( j ) ).applyMatrix4( matrixWorld );
v2.set( objNorm.getX( j ), objNorm.getY( j ), objNorm.getZ( j ) );
v2.applyMatrix3( this.normalMatrix ).normalize().multiplyScalar( this.size ).add( v1 );
position.setXYZ( idx, v1.x, v1.y, v1.z );
idx = idx + 1;
position.setXYZ( idx, v2.x, v2.y, v2.z );
idx = idx + 1;
}
}
position.needsUpdate = true;
return this;
......@@ -34756,25 +34832,34 @@ THREE.VertexTangentsHelper = function ( object, size, hex, linewidth ) {
var width = ( linewidth !== undefined ) ? linewidth : 1;
var geometry = new THREE.Geometry();
//
var faces = object.geometry.faces;
var nTangents = 0;
for ( var i = 0, l = faces.length; i < l; i ++ ) {
var objGeometry = this.object.geometry;
var face = faces[ i ];
if ( objGeometry instanceof THREE.Geometry ) {
for ( var j = 0, jl = face.vertexTangents.length; j < jl; j ++ ) {
nTangents = objGeometry.faces.length * 3;
geometry.vertices.push( new THREE.Vector3() );
geometry.vertices.push( new THREE.Vector3() );
} else if ( objGeometry instanceof THREE.BufferGeometry ) {
}
nTangents = objGeometry.attributes.tangent.count
}
//
var geometry = new THREE.BufferGeometry();
var positions = new THREE.Float32Attribute( nTangents * 2 * 3, 3 );
geometry.addAttribute( 'position', positions );
THREE.LineSegments.call( this, geometry, new THREE.LineBasicMaterial( { color: color, linewidth: width } ) );
//
this.matrixAutoUpdate = false;
this.update();
......@@ -34787,20 +34872,27 @@ THREE.VertexTangentsHelper.prototype.constructor = THREE.VertexTangentsHelper;
THREE.VertexTangentsHelper.prototype.update = ( function ( object ) {
var v1 = new THREE.Vector3();
var v2 = new THREE.Vector3();
return function( object ) {
return function() {
var keys = [ 'a', 'b', 'c', 'd' ];
var keys = [ 'a', 'b', 'c' ];
this.object.updateMatrixWorld( true );
var vertices = this.geometry.vertices;
var matrixWorld = this.object.matrixWorld;
var position = this.geometry.attributes.position;
//
var objGeometry = this.object.geometry;
var verts = this.object.geometry.vertices;
if ( objGeometry instanceof THREE.Geometry ) {
var faces = this.object.geometry.faces;
var vertices = objGeometry.vertices;
var worldMatrix = this.object.matrixWorld;
var faces = objGeometry.faces;
var idx = 0;
......@@ -34810,26 +34902,59 @@ THREE.VertexTangentsHelper.prototype.update = ( function ( object ) {
for ( var j = 0, jl = face.vertexTangents.length; j < jl; j ++ ) {
var vertexId = face[ keys[ j ] ];
var vertex = verts[ vertexId ];
var vertex = vertices[ face[ keys[ j ] ] ];
var tangent = face.vertexTangents[ j ];
vertices[ idx ].copy( vertex ).applyMatrix4( worldMatrix );
v1.copy( vertex ).applyMatrix4( matrixWorld );
v2.set( tangent.x, tangent.y, tangent.z ); // tangent.w used for bitangents only
v1.copy( tangent ).transformDirection( worldMatrix ).multiplyScalar( this.size );
v2.transformDirection( matrixWorld ).multiplyScalar( this.size ).add( v1 );
position.setXYZ( idx, v1.x, v1.y, v1.z );
v1.add( vertices[ idx ] );
idx = idx + 1;
vertices[ idx ].copy( v1 );
position.setXYZ( idx, v2.x, v2.y, v2.z );
idx = idx + 1;
}
}
this.geometry.verticesNeedUpdate = true;
} else if ( objGeometry instanceof THREE.BufferGeometry ) {
var objPos = objGeometry.attributes.position;
var objTan = objGeometry.attributes.tangent;
var idx = 0;
// for simplicity, ignore index and drawcalls, and render every tangent
for ( var j = 0, jl = objPos.count; j < jl; j ++ ) {
v1.set( objPos.getX( j ), objPos.getY( j ), objPos.getZ( j ) ).applyMatrix4( matrixWorld );
v2.set( objTan.getX( j ), objTan.getY( j ), objTan.getZ( j ) ); // tangent.w used for bitangents only
v2.transformDirection( matrixWorld ).multiplyScalar( this.size ).add( v1 );
position.setXYZ( idx, v1.x, v1.y, v1.z );
idx = idx + 1;
position.setXYZ( idx, v2.x, v2.y, v2.z );
idx = idx + 1;
}
}
position.needsUpdate = true;
return this;
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册