我是Three.js中的新手,并且在Shape对象上使用图像纹理会出现问题。所以这是我的功能:
function addShape( shape, extrudeSettings, color, x, y, z, rx, ry, rz, s ) {
// 3d shape
var geometry = new THREE.ExtrudeGeometry( shape, extrudeSettings );
//var mesh = THREE.SceneUtils.createMultiMaterialObject( geometry, [ new THREE.MeshLambertMaterial( { map: OBJECT3D.tableLegTexture, ambient: color, shading: THREE.FlatShading } ) ] );
var mesh_mat = new THREE.MeshLambertMaterial( { map: OBJECT3D.tableLegTexture,ambient: 0x999999 } );
mesh = new THREE.Mesh(geometry, mesh_mat);
mesh.position.set( x, y, z );
mesh.rotation.set( rx, ry, rz );
//mesh.scale.set( s, s, s );
group.add( mesh );
}
function createBein(position) {
group = new THREE.Object3D();
group.position.y = 50;
if (position == "right") {
var circleRadius = 400;
var circleShape = new THREE.Shape();
circleShape.moveTo( 0, circleRadius );
circleShape.quadraticCurveTo( 40, circleRadius, 40, 0 );
circleShape.quadraticCurveTo( 40, -circleRadius, 0, -circleRadius );
circleShape.quadraticCurveTo( -40, -circleRadius, -40, 0 );
circleShape.quadraticCurveTo( -40, circleRadius, 0, circleRadius );
var extrudeSettings = { amount: OBJECT3D.heightTable };
extrudeSettings.bevelEnabled = false;
extrudeSettings.bevelSegments = 2;
extrudeSettings.steps = 1;
x_pos = 0;
y_pos = OBJECT3D.heightTable;
z_pos = 40-Math.round(OBJECT3D.lengthTableTop/2)+300;
rot_x = Math.PI/2;
rot_y = 0;
rot_z = Math.PI/2;
var result = addShape( circleShape, extrudeSettings, 0x999999, x_pos, y_pos, z_pos, rot_x, rot_y, rot_z, 1 ); // addShape( shape, extrudeSettings, color, x, y, z, rx, ry, rz, s )
return result;
}
}
在这里你可以看到结果:
tableleg的纹理应该看起来像桌面的纹理。 有谁知道如何解决这个纹理问题?