|
@@ -1,7 +1,8 @@
|
|
|
/**
|
|
|
* @author clockworkgeek / https://github.com/clockworkgeek
|
|
|
* @author timothypratley / https://github.com/timothypratley
|
|
|
- */
|
|
|
+ * @author WestLangley / http://github.com/WestLangley
|
|
|
+*/
|
|
|
|
|
|
THREE.PolyhedronGeometry = function ( vertices, faces, radius, detail ) {
|
|
|
|
|
@@ -37,8 +38,36 @@ THREE.PolyhedronGeometry = function ( vertices, faces, radius, detail ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ // Handle case when face straddles the seam
|
|
|
+
|
|
|
+ for ( var i = 0, l = this.faceVertexUvs[ 0 ].length; i < l; i ++ ) {
|
|
|
+
|
|
|
+ var uvs = this.faceVertexUvs[ 0 ][ i ];
|
|
|
+
|
|
|
+ var x0 = uvs[ 0 ].x;
|
|
|
+ var x1 = uvs[ 1 ].x;
|
|
|
+ var x2 = uvs[ 2 ].x;
|
|
|
+
|
|
|
+ var max = Math.max( x0, Math.max( x1, x2 ) );
|
|
|
+ var min = Math.min( x0, Math.min( x1, x2 ) );
|
|
|
+
|
|
|
+ if ( max > 0.9 && min < 0.1 ) { // 0.9 is somewhat arbitrary
|
|
|
+
|
|
|
+ if ( x0 < 0.2 ) uvs[ 0 ].x += 1;
|
|
|
+ if ( x1 < 0.2 ) uvs[ 1 ].x += 1;
|
|
|
+ if ( x2 < 0.2 ) uvs[ 2 ].x += 1;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // Merge vertices
|
|
|
+
|
|
|
this.mergeVertices();
|
|
|
|
|
|
+
|
|
|
// Apply radius
|
|
|
|
|
|
for ( var i = 0, l = this.vertices.length; i < l; i ++ ) {
|
|
@@ -180,7 +209,7 @@ THREE.PolyhedronGeometry = function ( vertices, faces, radius, detail ) {
|
|
|
|
|
|
if ( ( azimuth < 0 ) && ( uv.x === 1 ) ) uv = new THREE.Vector2( uv.x - 1, uv.y );
|
|
|
if ( ( vector.x === 0 ) && ( vector.z === 0 ) ) uv = new THREE.Vector2( azimuth / 2 / Math.PI + 0.5, uv.y );
|
|
|
- return uv;
|
|
|
+ return uv.clone();
|
|
|
|
|
|
}
|
|
|
|