|
@@ -19599,19 +19599,16 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
ntris = faces3.length * 1,
|
|
|
nlines = faces3.length * 3,
|
|
|
|
|
|
- material = getBufferMaterial( object, geometryGroup ),
|
|
|
-
|
|
|
- uvType = bufferGuessUVType( material ),
|
|
|
- normalType = bufferGuessNormalType( material ),
|
|
|
- vertexColorType = bufferGuessVertexColorType( material );
|
|
|
-
|
|
|
- // console.log( "uvType", uvType, "normalType", normalType, "vertexColorType", vertexColorType, object, geometryGroup, material );
|
|
|
+ material = getBufferMaterial( object, geometryGroup );
|
|
|
|
|
|
geometryGroup.__vertexArray = new Float32Array( nvertices * 3 );
|
|
|
+ geometryGroup.__normalArray = new Float32Array( nvertices * 3 );
|
|
|
+ geometryGroup.__colorArray = new Float32Array( nvertices * 3 );
|
|
|
+ geometryGroup.__uvArray = new Float32Array( nvertices * 2 );
|
|
|
|
|
|
- if ( normalType ) {
|
|
|
+ if ( geometry.faceVertexUvs.length > 1 ) {
|
|
|
|
|
|
- geometryGroup.__normalArray = new Float32Array( nvertices * 3 );
|
|
|
+ geometryGroup.__uv2Array = new Float32Array( nvertices * 2 );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -19621,28 +19618,6 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ( vertexColorType ) {
|
|
|
-
|
|
|
- geometryGroup.__colorArray = new Float32Array( nvertices * 3 );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if ( uvType ) {
|
|
|
-
|
|
|
- if ( geometry.faceVertexUvs.length > 0 ) {
|
|
|
-
|
|
|
- geometryGroup.__uvArray = new Float32Array( nvertices * 2 );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if ( geometry.faceVertexUvs.length > 1 ) {
|
|
|
-
|
|
|
- geometryGroup.__uv2Array = new Float32Array( nvertices * 2 );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
if ( object.geometry.skinWeights.length && object.geometry.skinIndices.length ) {
|
|
|
|
|
|
geometryGroup.__skinIndexArray = new Float32Array( nvertices * 4 );
|
|
@@ -19758,60 +19733,6 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
};
|
|
|
|
|
|
- function bufferGuessNormalType ( material ) {
|
|
|
-
|
|
|
- // only MeshBasicMaterial and MeshDepthMaterial don't need normals
|
|
|
-
|
|
|
- if ( ( material instanceof THREE.MeshBasicMaterial && ! material.envMap ) || material instanceof THREE.MeshDepthMaterial ) {
|
|
|
-
|
|
|
- return false;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if ( materialNeedsSmoothNormals( material ) ) {
|
|
|
-
|
|
|
- return THREE.SmoothShading;
|
|
|
-
|
|
|
- } else {
|
|
|
-
|
|
|
- return THREE.FlatShading;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- };
|
|
|
-
|
|
|
- function bufferGuessVertexColorType( material ) {
|
|
|
-
|
|
|
- if ( material.vertexColors ) {
|
|
|
-
|
|
|
- return material.vertexColors;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- return false;
|
|
|
-
|
|
|
- };
|
|
|
-
|
|
|
- function bufferGuessUVType( material ) {
|
|
|
-
|
|
|
- // material must use some texture to require uvs
|
|
|
-
|
|
|
- if ( material.map ||
|
|
|
- material.lightMap ||
|
|
|
- material.bumpMap ||
|
|
|
- material.normalMap ||
|
|
|
- material.specularMap ||
|
|
|
- material.alphaMap ||
|
|
|
- material instanceof THREE.ShaderMaterial ) {
|
|
|
-
|
|
|
- return true;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- return false;
|
|
|
-
|
|
|
- };
|
|
|
-
|
|
|
//
|
|
|
|
|
|
function initDirectBuffers( geometry ) {
|
|
@@ -20333,11 +20254,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- var normalType = bufferGuessNormalType( material ),
|
|
|
- vertexColorType = bufferGuessVertexColorType( material ),
|
|
|
- uvType = bufferGuessUVType( material ),
|
|
|
-
|
|
|
- needsSmoothNormals = ( normalType === THREE.SmoothShading );
|
|
|
+ var needsSmoothNormals = materialNeedsSmoothNormals( material );
|
|
|
|
|
|
var f, fl, fi, face,
|
|
|
vertexNormals, faceNormal, normal,
|
|
@@ -20598,7 +20515,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ( dirtyColors && vertexColorType ) {
|
|
|
+ if ( dirtyColors ) {
|
|
|
|
|
|
for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {
|
|
|
|
|
@@ -20607,7 +20524,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
vertexColors = face.vertexColors;
|
|
|
faceColor = face.color;
|
|
|
|
|
|
- if ( vertexColors.length === 3 && vertexColorType === THREE.VertexColors ) {
|
|
|
+ if ( vertexColors.length === 3 && material.vertexColors === THREE.VertexColors ) {
|
|
|
|
|
|
c1 = vertexColors[ 0 ];
|
|
|
c2 = vertexColors[ 1 ];
|
|
@@ -20682,7 +20599,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ( dirtyNormals && normalType ) {
|
|
|
+ if ( dirtyNormals ) {
|
|
|
|
|
|
for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {
|
|
|
|
|
@@ -20726,7 +20643,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ( dirtyUvs && obj_uvs && uvType ) {
|
|
|
+ if ( dirtyUvs && obj_uvs ) {
|
|
|
|
|
|
for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {
|
|
|
|
|
@@ -20758,7 +20675,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ( dirtyUvs && obj_uvs2 && uvType ) {
|
|
|
+ if ( dirtyUvs && obj_uvs2 ) {
|
|
|
|
|
|
for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {
|
|
|
|