1 回答
TA贡献1806条经验 获得超5个赞
不能修改geometry的尺寸,应该修改mesh的尺寸,mesh才是实体。
function createPeace(img) {
var mesh,
geometry = new THREE.PlaneGeometry( 1, 1 );
var texture = new THREE.TextureLoader().load( "models/20nian.png" ,function (texture) {
//贴图加载成功后想修改之前创建的 geometry 的宽高,而不想修改
var i = texture.image;
// geometry.parameters.width = i.naturalWidth/400;
// geometry.parameters.height = 3;
// console.log(geometry);
// geometry只是模型,mesh才是实体
mesh.scale.set(1 || your need, 1 || your need, 1 || your need); //mesh.scale.set(x轴方向的缩放倍数, y轴方向的缩放倍数, z轴方向的缩放倍数);
});
var material = new THREE.MeshBasicMaterial( {
color: 0xffff00,
side: THREE.DoubleSide,
map:texture
});
mesh = new THREE.Mesh( geometry, material );
mesh.lookAt(new THREE.Vector3(0,0,0));
return mesh;
}
添加回答
举报