diff --git a/examples/misc_ubiquity_test.html b/examples/misc_ubiquity_test.html index 1ea4a024..ec136559 100644 --- a/examples/misc_ubiquity_test.html +++ b/examples/misc_ubiquity_test.html @@ -97,7 +97,7 @@ - + diff --git a/src/extras/geometries/Sphere.js b/src/extras/geometries/Sphere.js index 206e9cd5..0a9a08e1 100644 --- a/src/extras/geometries/Sphere.js +++ b/src/extras/geometries/Sphere.js @@ -45,6 +45,8 @@ var Sphere = function ( radius, segmentsWidth, segmentsHeight ) { var n1, n2, n3, iVerNum = aVtc.length; + this.faceVertexUvs[ 0 ] = []; + for ( j = 0; j < iVerNum; j++ ) { var iHorNum = aVtc[ j ].length; @@ -80,7 +82,7 @@ var Sphere = function ( radius, segmentsWidth, segmentsHeight ) { this.faces.push( new THREE.Face3( aP1, aP2, aP3, [ new THREE.Vector3( n1.x, n1.y, n1.z ), new THREE.Vector3( n2.x, n2.y, n2.z ), new THREE.Vector3( n3.x, n3.y, n3.z ) ] ) ); - this.faceVertexUvs.push( [ aP1uv, aP2uv, aP3uv ] ); + this.faceVertexUvs[ 0 ].push( [ aP1uv, aP2uv, aP3uv ] ); } @@ -95,7 +97,7 @@ var Sphere = function ( radius, segmentsWidth, segmentsHeight ) { this.faces.push( new THREE.Face3( aP1, aP3, aP4, [ new THREE.Vector3( n1.x, n1.y, n1.z ), new THREE.Vector3( n2.x, n2.y, n2.z ), new THREE.Vector3( n3.x, n3.y, n3.z ) ] ) ); - this.faceVertexUvs.push( [ aP1uv, aP3uv, aP4uv ] ); + this.faceVertexUvs[ 0 ].push( [ aP1uv, aP3uv, aP4uv ] ); } diff --git a/src/renderers/Projector.js b/src/renderers/Projector.js index d17db175..2d22ab2a 100644 --- a/src/renderers/Projector.js +++ b/src/renderers/Projector.js @@ -99,7 +99,7 @@ THREE.Projector = function() { objectMatrix, objectMaterials, objectMatrixRotation, geometry, vertices, vertex, vertexPositionScreen, - faces, face, faceVertexNormals, normal, v1, v2, v3, v4; + faces, face, faceVertexNormals, faceVertexUvs, normal, v1, v2, v3, v4; _face3Count = 0; _lineCount = 0; @@ -192,18 +192,20 @@ THREE.Projector = function() { } - _face3.z = _face3.centroidScreen.z; + faceVertexUvs = geometry.faceVertexUvs[ 0 ][ f ]; + + if ( faceVertexUvs ) { + + _face3.uvs[ 0 ] = faceVertexUvs[ 0 ]; + _face3.uvs[ 1 ] = faceVertexUvs[ 1 ]; + _face3.uvs[ 2 ] = faceVertexUvs[ 2 ]; + + } _face3.meshMaterials = objectMaterials; _face3.faceMaterials = face.materials; - if ( object.geometry.faceUvs[ f ] ) { - - _face3.uvs[ 0 ] = object.geometry.faceUvs[ f ][ 0 ]; - _face3.uvs[ 1 ] = object.geometry.faceUvs[ f ][ 1 ]; - _face3.uvs[ 2 ] = object.geometry.faceUvs[ f ][ 2 ]; - - } + _face3.z = _face3.centroidScreen.z; renderList.push( _face3 );