提交 22cb5034 编写于 作者: M Mr.doob

Merge pull request #7018 from rfm1201/dev_6571

pull request for #6762
...@@ -130,7 +130,7 @@ THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, radialSegme ...@@ -130,7 +130,7 @@ THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, radialSegme
var uv2 = uvs[ 0 ][ x + 1 ].clone(); var uv2 = uvs[ 0 ][ x + 1 ].clone();
var uv3 = new THREE.Vector2( uv2.x, 0 ); var uv3 = new THREE.Vector2( uv2.x, 0 );
this.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ] ) ); this.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ], undefined, 1 ) );
this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3 ] ); this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3 ] );
} }
...@@ -157,7 +157,7 @@ THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, radialSegme ...@@ -157,7 +157,7 @@ THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, radialSegme
var uv2 = uvs[ heightSegments ][ x ].clone(); var uv2 = uvs[ heightSegments ][ x ].clone();
var uv3 = new THREE.Vector2( uv2.x, 1 ); var uv3 = new THREE.Vector2( uv2.x, 1 );
this.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ] ) ); this.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ], undefined, 2 ) );
this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3 ] ); this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3 ] );
} }
......
...@@ -38,7 +38,7 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) { ...@@ -38,7 +38,7 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) {
var v2 = p[ indices[ i + 1 ] ]; var v2 = p[ indices[ i + 1 ] ];
var v3 = p[ indices[ i + 2 ] ]; var v3 = p[ indices[ i + 2 ] ];
faces[ j ] = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] ); faces[ j ] = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ], undefined, j );
} }
...@@ -115,9 +115,9 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) { ...@@ -115,9 +115,9 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) {
// Approximate a curved face with recursively sub-divided triangles. // Approximate a curved face with recursively sub-divided triangles.
function make( v1, v2, v3 ) { function make( v1, v2, v3, materialIndex ) {
var face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] ); var face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ], undefined, materialIndex );
that.faces.push( face ); that.faces.push( face );
centroid.copy( v1 ).add( v2 ).add( v3 ).divideScalar( 3 ); centroid.copy( v1 ).add( v2 ).add( v3 ).divideScalar( 3 );
...@@ -143,6 +143,8 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) { ...@@ -143,6 +143,8 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) {
var c = prepare( that.vertices[ face.c ] ); var c = prepare( that.vertices[ face.c ] );
var v = []; var v = [];
var materialIndex = face.materialIndex;
// Construct all of the vertices for this subdivision. // Construct all of the vertices for this subdivision.
for ( var i = 0 ; i <= cols; i ++ ) { for ( var i = 0 ; i <= cols; i ++ ) {
...@@ -182,7 +184,8 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) { ...@@ -182,7 +184,8 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) {
make( make(
v[ i ][ k + 1 ], v[ i ][ k + 1 ],
v[ i + 1 ][ k ], v[ i + 1 ][ k ],
v[ i ][ k ] v[ i ][ k ],
materialIndex
); );
} else { } else {
...@@ -190,7 +193,8 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) { ...@@ -190,7 +193,8 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) {
make( make(
v[ i ][ k + 1 ], v[ i ][ k + 1 ],
v[ i + 1 ][ k + 1 ], v[ i + 1 ][ k + 1 ],
v[ i + 1 ][ k ] v[ i + 1 ][ k ],
materialIndex
); );
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册