|
@@ -433,114 +433,102 @@
|
|
|
|
|
|
if ( object.isMesh ) {
|
|
|
|
|
|
- if ( geometry.isBufferGeometry ) {
|
|
|
+ let material = object.material;
|
|
|
+ const isMultiMaterial = Array.isArray( material );
|
|
|
+ const attributes = geometry.attributes;
|
|
|
+ const groups = geometry.groups;
|
|
|
+ if ( attributes.position === undefined ) continue;
|
|
|
+ const positions = attributes.position.array;
|
|
|
|
|
|
- let material = object.material;
|
|
|
- const isMultiMaterial = Array.isArray( material );
|
|
|
- const attributes = geometry.attributes;
|
|
|
- const groups = geometry.groups;
|
|
|
- if ( attributes.position === undefined ) continue;
|
|
|
- const positions = attributes.position.array;
|
|
|
-
|
|
|
- for ( let i = 0, l = positions.length; i < l; i += 3 ) {
|
|
|
-
|
|
|
- let x = positions[ i ];
|
|
|
- let y = positions[ i + 1 ];
|
|
|
- let z = positions[ i + 2 ];
|
|
|
- const morphTargets = geometry.morphAttributes.position;
|
|
|
+ for ( let i = 0, l = positions.length; i < l; i += 3 ) {
|
|
|
|
|
|
- if ( morphTargets !== undefined ) {
|
|
|
+ let x = positions[ i ];
|
|
|
+ let y = positions[ i + 1 ];
|
|
|
+ let z = positions[ i + 2 ];
|
|
|
+ const morphTargets = geometry.morphAttributes.position;
|
|
|
|
|
|
- const morphTargetsRelative = geometry.morphTargetsRelative;
|
|
|
- const morphInfluences = object.morphTargetInfluences;
|
|
|
+ if ( morphTargets !== undefined ) {
|
|
|
|
|
|
- for ( let t = 0, tl = morphTargets.length; t < tl; t ++ ) {
|
|
|
+ const morphTargetsRelative = geometry.morphTargetsRelative;
|
|
|
+ const morphInfluences = object.morphTargetInfluences;
|
|
|
|
|
|
- const influence = morphInfluences[ t ];
|
|
|
- if ( influence === 0 ) continue;
|
|
|
- const target = morphTargets[ t ];
|
|
|
+ for ( let t = 0, tl = morphTargets.length; t < tl; t ++ ) {
|
|
|
|
|
|
- if ( morphTargetsRelative ) {
|
|
|
+ const influence = morphInfluences[ t ];
|
|
|
+ if ( influence === 0 ) continue;
|
|
|
+ const target = morphTargets[ t ];
|
|
|
|
|
|
- x += target.getX( i / 3 ) * influence;
|
|
|
- y += target.getY( i / 3 ) * influence;
|
|
|
- z += target.getZ( i / 3 ) * influence;
|
|
|
+ if ( morphTargetsRelative ) {
|
|
|
|
|
|
- } else {
|
|
|
+ x += target.getX( i / 3 ) * influence;
|
|
|
+ y += target.getY( i / 3 ) * influence;
|
|
|
+ z += target.getZ( i / 3 ) * influence;
|
|
|
|
|
|
- x += ( target.getX( i / 3 ) - positions[ i ] ) * influence;
|
|
|
- y += ( target.getY( i / 3 ) - positions[ i + 1 ] ) * influence;
|
|
|
- z += ( target.getZ( i / 3 ) - positions[ i + 2 ] ) * influence;
|
|
|
+ } else {
|
|
|
|
|
|
- }
|
|
|
+ x += ( target.getX( i / 3 ) - positions[ i ] ) * influence;
|
|
|
+ y += ( target.getY( i / 3 ) - positions[ i + 1 ] ) * influence;
|
|
|
+ z += ( target.getZ( i / 3 ) - positions[ i + 2 ] ) * influence;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- renderList.pushVertex( x, y, z );
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- if ( attributes.normal !== undefined ) {
|
|
|
+ renderList.pushVertex( x, y, z );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
- const normals = attributes.normal.array;
|
|
|
+ if ( attributes.normal !== undefined ) {
|
|
|
|
|
|
- for ( let i = 0, l = normals.length; i < l; i += 3 ) {
|
|
|
+ const normals = attributes.normal.array;
|
|
|
|
|
|
- renderList.pushNormal( normals[ i ], normals[ i + 1 ], normals[ i + 2 ] );
|
|
|
+ for ( let i = 0, l = normals.length; i < l; i += 3 ) {
|
|
|
|
|
|
- }
|
|
|
+ renderList.pushNormal( normals[ i ], normals[ i + 1 ], normals[ i + 2 ] );
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ( attributes.color !== undefined ) {
|
|
|
+ }
|
|
|
|
|
|
- const colors = attributes.color.array;
|
|
|
+ if ( attributes.color !== undefined ) {
|
|
|
|
|
|
- for ( let i = 0, l = colors.length; i < l; i += 3 ) {
|
|
|
+ const colors = attributes.color.array;
|
|
|
|
|
|
- renderList.pushColor( colors[ i ], colors[ i + 1 ], colors[ i + 2 ] );
|
|
|
+ for ( let i = 0, l = colors.length; i < l; i += 3 ) {
|
|
|
|
|
|
- }
|
|
|
+ renderList.pushColor( colors[ i ], colors[ i + 1 ], colors[ i + 2 ] );
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ( attributes.uv !== undefined ) {
|
|
|
+ }
|
|
|
|
|
|
- const uvs = attributes.uv.array;
|
|
|
+ if ( attributes.uv !== undefined ) {
|
|
|
|
|
|
- for ( let i = 0, l = uvs.length; i < l; i += 2 ) {
|
|
|
+ const uvs = attributes.uv.array;
|
|
|
|
|
|
- renderList.pushUv( uvs[ i ], uvs[ i + 1 ] );
|
|
|
+ for ( let i = 0, l = uvs.length; i < l; i += 2 ) {
|
|
|
|
|
|
- }
|
|
|
+ renderList.pushUv( uvs[ i ], uvs[ i + 1 ] );
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ( geometry.index !== null ) {
|
|
|
-
|
|
|
- const indices = geometry.index.array;
|
|
|
-
|
|
|
- if ( groups.length > 0 ) {
|
|
|
-
|
|
|
- for ( let g = 0; g < groups.length; g ++ ) {
|
|
|
+ }
|
|
|
|
|
|
- const group = groups[ g ];
|
|
|
- material = isMultiMaterial === true ? object.material[ group.materialIndex ] : object.material;
|
|
|
- if ( material === undefined ) continue;
|
|
|
+ if ( geometry.index !== null ) {
|
|
|
|
|
|
- for ( let i = group.start, l = group.start + group.count; i < l; i += 3 ) {
|
|
|
+ const indices = geometry.index.array;
|
|
|
|
|
|
- renderList.pushTriangle( indices[ i ], indices[ i + 1 ], indices[ i + 2 ], material );
|
|
|
+ if ( groups.length > 0 ) {
|
|
|
|
|
|
- }
|
|
|
+ for ( let g = 0; g < groups.length; g ++ ) {
|
|
|
|
|
|
- }
|
|
|
+ const group = groups[ g ];
|
|
|
+ material = isMultiMaterial === true ? object.material[ group.materialIndex ] : object.material;
|
|
|
+ if ( material === undefined ) continue;
|
|
|
|
|
|
- } else {
|
|
|
-
|
|
|
- for ( let i = 0, l = indices.length; i < l; i += 3 ) {
|
|
|
+ for ( let i = group.start, l = group.start + group.count; i < l; i += 3 ) {
|
|
|
|
|
|
renderList.pushTriangle( indices[ i ], indices[ i + 1 ], indices[ i + 2 ], material );
|
|
|
|
|
@@ -550,25 +538,25 @@
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- if ( groups.length > 0 ) {
|
|
|
+ for ( let i = 0, l = indices.length; i < l; i += 3 ) {
|
|
|
|
|
|
- for ( let g = 0; g < groups.length; g ++ ) {
|
|
|
+ renderList.pushTriangle( indices[ i ], indices[ i + 1 ], indices[ i + 2 ], material );
|
|
|
|
|
|
- const group = groups[ g ];
|
|
|
- material = isMultiMaterial === true ? object.material[ group.materialIndex ] : object.material;
|
|
|
- if ( material === undefined ) continue;
|
|
|
+ }
|
|
|
|
|
|
- for ( let i = group.start, l = group.start + group.count; i < l; i += 3 ) {
|
|
|
+ }
|
|
|
|
|
|
- renderList.pushTriangle( i, i + 1, i + 2, material );
|
|
|
+ } else {
|
|
|
|
|
|
- }
|
|
|
+ if ( groups.length > 0 ) {
|
|
|
|
|
|
- }
|
|
|
+ for ( let g = 0; g < groups.length; g ++ ) {
|
|
|
|
|
|
- } else {
|
|
|
+ const group = groups[ g ];
|
|
|
+ material = isMultiMaterial === true ? object.material[ group.materialIndex ] : object.material;
|
|
|
+ if ( material === undefined ) continue;
|
|
|
|
|
|
- for ( let i = 0, l = positions.length / 3; i < l; i += 3 ) {
|
|
|
+ for ( let i = group.start, l = group.start + group.count; i < l; i += 3 ) {
|
|
|
|
|
|
renderList.pushTriangle( i, i + 1, i + 2, material );
|
|
|
|
|
@@ -576,12 +564,15 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
- }
|
|
|
+ } else {
|
|
|
+
|
|
|
+ for ( let i = 0, l = positions.length / 3; i < l; i += 3 ) {
|
|
|
|
|
|
- } else if ( geometry.isGeometry ) {
|
|
|
+ renderList.pushTriangle( i, i + 1, i + 2, material );
|
|
|
|
|
|
- console.error( 'THREE.Projector no longer supports Geometry. Use THREE.BufferGeometry instead.' );
|
|
|
- return;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -589,89 +580,71 @@
|
|
|
|
|
|
_modelViewProjectionMatrix.multiplyMatrices( _viewProjectionMatrix, _modelMatrix );
|
|
|
|
|
|
- if ( geometry.isBufferGeometry ) {
|
|
|
-
|
|
|
- const attributes = geometry.attributes;
|
|
|
+ const attributes = geometry.attributes;
|
|
|
|
|
|
- if ( attributes.position !== undefined ) {
|
|
|
+ if ( attributes.position !== undefined ) {
|
|
|
|
|
|
- const positions = attributes.position.array;
|
|
|
-
|
|
|
- for ( let i = 0, l = positions.length; i < l; i += 3 ) {
|
|
|
+ const positions = attributes.position.array;
|
|
|
|
|
|
- renderList.pushVertex( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] );
|
|
|
+ for ( let i = 0, l = positions.length; i < l; i += 3 ) {
|
|
|
|
|
|
- }
|
|
|
+ renderList.pushVertex( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] );
|
|
|
|
|
|
- if ( attributes.color !== undefined ) {
|
|
|
+ }
|
|
|
|
|
|
- const colors = attributes.color.array;
|
|
|
+ if ( attributes.color !== undefined ) {
|
|
|
|
|
|
- for ( let i = 0, l = colors.length; i < l; i += 3 ) {
|
|
|
+ const colors = attributes.color.array;
|
|
|
|
|
|
- renderList.pushColor( colors[ i ], colors[ i + 1 ], colors[ i + 2 ] );
|
|
|
+ for ( let i = 0, l = colors.length; i < l; i += 3 ) {
|
|
|
|
|
|
- }
|
|
|
+ renderList.pushColor( colors[ i ], colors[ i + 1 ], colors[ i + 2 ] );
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ( geometry.index !== null ) {
|
|
|
+ }
|
|
|
|
|
|
- const indices = geometry.index.array;
|
|
|
+ if ( geometry.index !== null ) {
|
|
|
|
|
|
- for ( let i = 0, l = indices.length; i < l; i += 2 ) {
|
|
|
+ const indices = geometry.index.array;
|
|
|
|
|
|
- renderList.pushLine( indices[ i ], indices[ i + 1 ] );
|
|
|
+ for ( let i = 0, l = indices.length; i < l; i += 2 ) {
|
|
|
|
|
|
- }
|
|
|
+ renderList.pushLine( indices[ i ], indices[ i + 1 ] );
|
|
|
|
|
|
- } else {
|
|
|
+ }
|
|
|
|
|
|
- const step = object.isLineSegments ? 2 : 1;
|
|
|
+ } else {
|
|
|
|
|
|
- for ( let i = 0, l = positions.length / 3 - 1; i < l; i += step ) {
|
|
|
+ const step = object.isLineSegments ? 2 : 1;
|
|
|
|
|
|
- renderList.pushLine( i, i + 1 );
|
|
|
+ for ( let i = 0, l = positions.length / 3 - 1; i < l; i += step ) {
|
|
|
|
|
|
- }
|
|
|
+ renderList.pushLine( i, i + 1 );
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- } else if ( geometry.isGeometry ) {
|
|
|
-
|
|
|
- console.error( 'THREE.Projector no longer supports Geometry. Use THREE.BufferGeometry instead.' );
|
|
|
- return;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
} else if ( object.isPoints ) {
|
|
|
|
|
|
_modelViewProjectionMatrix.multiplyMatrices( _viewProjectionMatrix, _modelMatrix );
|
|
|
|
|
|
- if ( geometry.isGeometry ) {
|
|
|
+ const attributes = geometry.attributes;
|
|
|
|
|
|
- console.error( 'THREE.Projector no longer supports Geometry. Use THREE.BufferGeometry instead.' );
|
|
|
- return;
|
|
|
+ if ( attributes.position !== undefined ) {
|
|
|
|
|
|
- } else if ( geometry.isBufferGeometry ) {
|
|
|
-
|
|
|
- const attributes = geometry.attributes;
|
|
|
-
|
|
|
- if ( attributes.position !== undefined ) {
|
|
|
-
|
|
|
- const positions = attributes.position.array;
|
|
|
-
|
|
|
- for ( let i = 0, l = positions.length; i < l; i += 3 ) {
|
|
|
+ const positions = attributes.position.array;
|
|
|
|
|
|
- _vector4.set( positions[ i ], positions[ i + 1 ], positions[ i + 2 ], 1 );
|
|
|
+ for ( let i = 0, l = positions.length; i < l; i += 3 ) {
|
|
|
|
|
|
- _vector4.applyMatrix4( _modelViewProjectionMatrix );
|
|
|
+ _vector4.set( positions[ i ], positions[ i + 1 ], positions[ i + 2 ], 1 );
|
|
|
|
|
|
- pushPoint( _vector4, object, camera );
|
|
|
+ _vector4.applyMatrix4( _modelViewProjectionMatrix );
|
|
|
|
|
|
- }
|
|
|
+ pushPoint( _vector4, object, camera );
|
|
|
|
|
|
}
|
|
|
|