Fixed uvs creating on Sphere.

Fixed uv handling on Projector (forcing channel 0 by now)
This commit is contained in:
Mr.doob
2011-03-20 20:42:46 +00:00
parent 617c9b78b3
commit f03db768cb
3 changed files with 16 additions and 12 deletions
+1 -1
View File
@@ -97,7 +97,7 @@
<script type="text/javascript" src="../src/extras/geometries/TorusKnot.js"></script>
<script type="text/javascript" src="../src/extras/io/Loader.js"></script>
<script type="text/javascript" src="../src/extras/objects/MarchingCubes.js"></script>
<script type="text/javascript" src="obj/Qrcode.js"></script>
<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
+4 -2
View File
@@ -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 ] );
}
+11 -9
View File
@@ -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 );