diff --git a/examples/webgl_extrude_material.html b/examples/webgl_extrude_material.html new file mode 100644 index 0000000000000000000000000000000000000000..5ba3799c4ee46dbd083d0e38bfcf6b01fa6e0ac7 --- /dev/null +++ b/examples/webgl_extrude_material.html @@ -0,0 +1,217 @@ + + + + three.js webgl - geometry - extrusion materials + + + + + + + + + + + + + + + + diff --git a/src/extras/geometries/ExtrudeGeometry.js b/src/extras/geometries/ExtrudeGeometry.js index 419cf66706c6863a49dcf4f1c4875cbcc9ed7854..1fb37c5ddcc8a55879ae8fa8c1c65a99af0a4b12 100644 --- a/src/extras/geometries/ExtrudeGeometry.js +++ b/src/extras/geometries/ExtrudeGeometry.js @@ -22,8 +22,8 @@ * extrudePath: // path to extrude shape along * bendPath: // path to bend the geometry around * - * material: // material for front and back faces - * extrudeMaterial: // material for extrusion and beveled faces + * material: // material index for front and back faces + * extrudeMaterial: // material index for extrusion and beveled faces * * } **/ @@ -621,7 +621,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) { f4( a, b, c, d ); - if ( extrudeMaterial ) { + if ( extrudeMaterial !== undefined ) { var v1 = s / sl; var v2 = ( s + 1 ) / sl; @@ -664,21 +664,21 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) { scope.faces.push( new THREE.Face3( a, b, c, null, null, material ) ); //normal, color, materials - if ( material ) { + if ( material !== undefined ) { var mx = shapebb.minX, my = shapebb.minY; var uy = shapebb.maxY; // - shapebb.minY; var ux = shapebb.maxX; // - shapebb.minX; - var ax = scope.vertices[ a ].position.x, - ay = scope.vertices[ a ].position.y, + var ax = scope.vertices[ a ].position.x - mx, + ay = scope.vertices[ a ].position.y - my, - bx = scope.vertices[ b ].position.x, - by = scope.vertices[ b ].position.y, + bx = scope.vertices[ b ].position.x - mx, + by = scope.vertices[ b ].position.y - my, - cx = scope.vertices[ c ].position.x, - cy = scope.vertices[ c ].position.y; + cx = scope.vertices[ c ].position.x - mx, + cy = scope.vertices[ c ].position.y - my; scope.faceVertexUvs[ 0 ].push( [