提交 954e55a5 编写于 作者: M Mr.doob

ExtrudeGeometry: Simplified code.

上级 2b953ca1
...@@ -631,19 +631,15 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) { ...@@ -631,19 +631,15 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
THREE.ExtrudeGeometry.WorldUVGenerator = { THREE.ExtrudeGeometry.WorldUVGenerator = {
generateTopUV: function( geometry, extrudedShape, extrudeOptions, indexA, indexB, indexC ) { generateTopUV: function( geometry, extrudedShape, extrudeOptions, indexA, indexB, indexC ) {
var ax = geometry.vertices[ indexA ].x,
ay = geometry.vertices[ indexA ].y, var a = geometry.vertices[ indexA ];
var b = geometry.vertices[ indexB ];
bx = geometry.vertices[ indexB ].x, var c = geometry.vertices[ indexC ];
by = geometry.vertices[ indexB ].y,
cx = geometry.vertices[ indexC ].x,
cy = geometry.vertices[ indexC ].y;
return [ return [
new THREE.Vector2( ax, ay ), new THREE.Vector2( a.x, a.y ),
new THREE.Vector2( bx, by ), new THREE.Vector2( b.x, b.y ),
new THREE.Vector2( cx, cy ) new THREE.Vector2( c.x, c.y )
]; ];
}, },
...@@ -658,43 +654,25 @@ THREE.ExtrudeGeometry.WorldUVGenerator = { ...@@ -658,43 +654,25 @@ THREE.ExtrudeGeometry.WorldUVGenerator = {
indexA, indexB, indexC, indexD, stepIndex, stepsLength, indexA, indexB, indexC, indexD, stepIndex, stepsLength,
contourIndex1, contourIndex2 ) { contourIndex1, contourIndex2 ) {
var ax = geometry.vertices[ indexA ].x, var a = geometry.vertices[ indexA ];
ay = geometry.vertices[ indexA ].y, var b = geometry.vertices[ indexB ];
az = geometry.vertices[ indexA ].z, var c = geometry.vertices[ indexC ];
var d = geometry.vertices[ indexD ];
bx = geometry.vertices[ indexB ].x,
by = geometry.vertices[ indexB ].y,
bz = geometry.vertices[ indexB ].z,
cx = geometry.vertices[ indexC ].x, if ( Math.abs( a.y - b.y ) < 0.01 ) {
cy = geometry.vertices[ indexC ].y,
cz = geometry.vertices[ indexC ].z,
dx = geometry.vertices[ indexD ].x,
dy = geometry.vertices[ indexD ].y,
dz = geometry.vertices[ indexD ].z;
if ( Math.abs( ay - by ) < 0.01 ) {
return [ return [
new THREE.Vector2( ax, 1 - az ), new THREE.Vector2( a.x, 1 - a.z ),
new THREE.Vector2( bx, 1 - bz ), new THREE.Vector2( b.x, 1 - b.z ),
new THREE.Vector2( cx, 1 - cz ), new THREE.Vector2( c.x, 1 - c.z ),
new THREE.Vector2( dx, 1 - dz ) new THREE.Vector2( d.x, 1 - d.z )
]; ];
} else { } else {
return [ return [
new THREE.Vector2( ay, 1 - az ), new THREE.Vector2( a.y, 1 - a.z ),
new THREE.Vector2( by, 1 - bz ), new THREE.Vector2( b.y, 1 - b.z ),
new THREE.Vector2( cy, 1 - cz ), new THREE.Vector2( c.y, 1 - c.z ),
new THREE.Vector2( dy, 1 - dz ) new THREE.Vector2( d.y, 1 - d.z )
]; ];
} }
} }
}; };
THREE.ExtrudeGeometry.__v1 = new THREE.Vector2();
THREE.ExtrudeGeometry.__v2 = new THREE.Vector2();
THREE.ExtrudeGeometry.__v3 = new THREE.Vector2();
THREE.ExtrudeGeometry.__v4 = new THREE.Vector2();
THREE.ExtrudeGeometry.__v5 = new THREE.Vector2();
THREE.ExtrudeGeometry.__v6 = new THREE.Vector2();
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册