0
私はいくつかの代わりに木片のように見えるように材料を整列させたいと思います。 [1枚]three.jsメッシュ回転素材
テクスチャ/マテリアルを回転させるにはどうすればよいですか?あるいは、個々のジオメトリではなく、このobject3dをマテリアルに設定できますか?
ありがとうございます。
私はこれを試しましたが、運がありません! イメージはランダムな色で読み込まれます。
var material;
var loader = new THREE.TextureLoader;
var onLoad = function(_texture) {
var imgWidth = imgHeight = 128;
var mapCanvas = document.createElement('canvas');
mapCanvas.width = mapCanvas.height = 128;
// document.body.appendChild(mapCanvas);
var ctx = mapCanvas.getContext('2d');
var img = new Image;
img.onload = function() {
ctx.translate(imgWidth/2, imgHeight/2);
ctx.rotate(Math.PI/4);
ctx.translate(-imgWidth/2, -imgHeight/2);
ctx.drawImage(img, 0, 0, imgWidth, imgHeight);
}
img.src = 'http://remote.plancher2000.com:82/1-2-2-5-Bois.jpg';
var texture = new THREE.Texture(mapCanvas);
texture.needsUpdate = true;
material = new THREE.MeshBasicMaterial({map : texture, side:THREE.DoubleSide});
material.needsUpdate = true;
};
...
mesh[no] = new THREE.Mesh(geometry, material);
loader.load(image, onLoad, onProgress, onError);
[この質問をチェック](http://stackoverflow.com/questions/16727547/three-js-rotate-texture)、私はそれがあなたが探していると思います。 – guardabrazo
見栄えは良いですが、TextureLoader()アプローチを使用しています。 –