var arcShape = new THREE.Shape();
arcShape.moveTo( 50, 10 );
arcShape.absarc( 10, 10, 40, 0, Math.PI*2, false );
var map1 = new THREE.ImageUtils.loadTexture( 'moon.jpg' );
var geometry = new THREE.ExtrudeGeometry( arcShape, extrudeSettings );
var new3D = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { map: map1 } ) );
new3D.receiveShadow = true;
obj3Dmassive.add( new3D );
纹理(512x512):http://f3.s.qip.ru/cMfvUhNj.png
结果:http://f3.s.qip.ru/cMfvUhNh.png
如何填充纹理图?
答案 0 :(得分:2)
如果您只有直线挤出路径,则可以将纹理应用于拉伸形状,而无需自定义UV生成器。例如
var extrudeSettings = {
bevelEnabled: false,
steps: 1,
amount: 20, //extrusion depth, don't define an extrudePath
material:0, //material index of the front and back face
extrudeMaterial : 1 //material index of the side faces
};
var geometry = shape.extrude(extrudeSettings);
var mesh = new THREE.Mesh(geometry,
new THREE.MeshFaceMaterial([materialFace, materialSide]));
这对于千篇一律的形状很方便。
答案 1 :(得分:1)
你很幸运。您尝试做的事情已在以下示例中完成:
https://github.com/mrdoob/three.js/blob/master/examples/webgl_geometry_extrude_uvs2.html
您必须指定自己的UV生成器功能。此示例显示了如何执行此操作。
请记住,这只是一个例子。它可能不正确 - 或者在您的情况下易于实施。