|
@@ -159,6 +159,17 @@ THREE.ConvexGeometry = function( vertices ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * XXX: Not sure if this is the correct approach. Need someone to review.
|
|
|
+ */
|
|
|
+ function vertexUv( vertex ) {
|
|
|
+
|
|
|
+ var mag = vertex.length();
|
|
|
+ return new THREE.UV( vertex.x / mag, vertex.y / mag );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
// Push vertices into `this.vertices`, skipping those inside the hull
|
|
|
var id = 0;
|
|
|
var newId = new Array( vertices.length ); // map from old vertex id to new id
|
|
@@ -192,6 +203,19 @@ THREE.ConvexGeometry = function( vertices ) {
|
|
|
) );
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ // Compute UVs
|
|
|
+ for ( var i = 0; i < this.faces.length; i++ ) {
|
|
|
+
|
|
|
+ var face = this.faces[ i ];
|
|
|
+
|
|
|
+ this.faceVertexUvs[ 0 ].push( [
|
|
|
+ vertexUv( this.vertices[ face.a ] ),
|
|
|
+ vertexUv( this.vertices[ face.b ] ),
|
|
|
+ vertexUv( this.vertices[ face.c ])
|
|
|
+ ] );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
|
|
|
this.computeCentroids();
|
|
@@ -201,4 +225,4 @@ THREE.ConvexGeometry = function( vertices ) {
|
|
|
};
|
|
|
|
|
|
THREE.ConvexGeometry.prototype = new THREE.Geometry();
|
|
|
-THREE.ConvexGeometry.prototype.constructor = THREE.ConvexGeometry;
|
|
|
+THREE.ConvexGeometry.prototype.constructor = THREE.ConvexGeometry;
|