0
私はキャンバスを描いているので、3D空間でプレーンにマッピングしたいです。何らかの理由で、私が見るのは緑色の矩形です。キャンバスのテクスチャをプレーンにマップする
webglレンダラの隣にキャンバスがあり、テクスチャが作成される前にキャンバスが描画されていることがわかりました。
this.geom = new THREE.Geometry();//, side:THREE.DoubleSide
this.tex = new THREE.Texture(canvas2d);
//this.tex.needsUpdate = false;
//color: 0x0033ff,
this.material = new THREE.MeshBasicMaterial({ map:this.tex, side:THREE.DoubleSide });
for(var i = 0; i < this.array.length;i++) {
this.geom.vertices.push(new THREE.Vector3(this.array[i].x, 0, this.array[i].y));
this.geom.vertices.push(new THREE.Vector3(this.array[i].x, this.h3d , this.array[i].y));
}
for(var i = 0; i < this.geom.vertices.length-3; i++) {
this.geom.faces.push(new THREE.Face3(i+0,i+2,i+1));
this.geom.faces.push(new THREE.Face3(i+2,i+3,i+1));
}
this.material.map.needsUpdate = true;
var cube = new THREE.Mesh(this.geom, this.material);
scene.add(cube);