提交 c3710826 编写于 作者: W WestLangley

Fixed UVs in LatheGeometry

上级 ce207788
...@@ -31736,7 +31736,7 @@ THREE.LatheGeometry = function ( points, segments, phiStart, phiLength ) { ...@@ -31736,7 +31736,7 @@ THREE.LatheGeometry = function ( points, segments, phiStart, phiLength ) {
phiStart = phiStart || 0; phiStart = phiStart || 0;
phiLength = phiLength || 2 * Math.PI; phiLength = phiLength || 2 * Math.PI;
var inversePointLength = 1.0 / points.length; var inversePointLength = 1.0 / ( points.length - 1 );
var inverseSegments = 1.0 / segments; var inverseSegments = 1.0 / segments;
for ( var i = 0, il = segments; i <= il; i ++ ) { for ( var i = 0, il = segments; i <= il; i ++ ) {
...@@ -31776,9 +31776,9 @@ THREE.LatheGeometry = function ( points, segments, phiStart, phiLength ) { ...@@ -31776,9 +31776,9 @@ THREE.LatheGeometry = function ( points, segments, phiStart, phiLength ) {
this.faces.push( new THREE.Face4( a, b, c, d ) ); this.faces.push( new THREE.Face4( a, b, c, d ) );
var u0 = 1 - i * inverseSegments; var u0 = i * inverseSegments;
var v0 = j * inversePointLength; var v0 = j * inversePointLength;
var u1 = u0 - inverseSegments; var u1 = u0 + inverseSegments;
var v1 = v0 + inversePointLength; var v1 = v0 + inversePointLength;
this.faceVertexUvs[ 0 ].push( [ this.faceVertexUvs[ 0 ].push( [
...@@ -31794,6 +31794,7 @@ THREE.LatheGeometry = function ( points, segments, phiStart, phiLength ) { ...@@ -31794,6 +31794,7 @@ THREE.LatheGeometry = function ( points, segments, phiStart, phiLength ) {
} }
this.mergeVertices();
this.computeCentroids(); this.computeCentroids();
this.computeFaceNormals(); this.computeFaceNormals();
this.computeVertexNormals(); this.computeVertexNormals();
......
...@@ -18,7 +18,7 @@ THREE.LatheGeometry = function ( points, segments, phiStart, phiLength ) { ...@@ -18,7 +18,7 @@ THREE.LatheGeometry = function ( points, segments, phiStart, phiLength ) {
phiStart = phiStart || 0; phiStart = phiStart || 0;
phiLength = phiLength || 2 * Math.PI; phiLength = phiLength || 2 * Math.PI;
var inversePointLength = 1.0 / points.length; var inversePointLength = 1.0 / ( points.length - 1 );
var inverseSegments = 1.0 / segments; var inverseSegments = 1.0 / segments;
for ( var i = 0, il = segments; i <= il; i ++ ) { for ( var i = 0, il = segments; i <= il; i ++ ) {
...@@ -58,9 +58,9 @@ THREE.LatheGeometry = function ( points, segments, phiStart, phiLength ) { ...@@ -58,9 +58,9 @@ THREE.LatheGeometry = function ( points, segments, phiStart, phiLength ) {
this.faces.push( new THREE.Face4( a, b, c, d ) ); this.faces.push( new THREE.Face4( a, b, c, d ) );
var u0 = 1 - i * inverseSegments; var u0 = i * inverseSegments;
var v0 = j * inversePointLength; var v0 = j * inversePointLength;
var u1 = u0 - inverseSegments; var u1 = u0 + inverseSegments;
var v1 = v0 + inversePointLength; var v1 = v0 + inversePointLength;
this.faceVertexUvs[ 0 ].push( [ this.faceVertexUvs[ 0 ].push( [
...@@ -76,6 +76,7 @@ THREE.LatheGeometry = function ( points, segments, phiStart, phiLength ) { ...@@ -76,6 +76,7 @@ THREE.LatheGeometry = function ( points, segments, phiStart, phiLength ) {
} }
this.mergeVertices();
this.computeCentroids(); this.computeCentroids();
this.computeFaceNormals(); this.computeFaceNormals();
this.computeVertexNormals(); this.computeVertexNormals();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册