2012-05-29 2 views
2

돌출 :ThreeJS 비트 맵 텍스처 내가 성공적으로 <code>THREE.Shape</code> 개체를 사용하여 모서리가 둥근 큐브를 그리기있어

var shape = new THREE.Shape(); 
x = width/2; 
y = height/2; 
shape.moveTo(x - radius, y); 

//*** Top right 
x = -width/2; 
y = height/2; 
shape.lineTo(x + radius, y); 
if (tr) shape.quadraticCurveTo(x, y, x, y - radius); 
else shape.lineTo(x, y); 

//*** Bottom right 
x = -width/2; 
y = -height/2; 
shape.lineTo(x, y + radius); 
if (br) shape.quadraticCurveTo(x, y, x + radius, y); 
else shape.lineTo(x, y); 

//*** Bottom left 
x = width/2; 
y = -height/2; 
shape.lineTo(x - radius, y); 
if (bl) shape.quadraticCurveTo(x, y, x, y + radius); 
else shape.lineTo(x, y); 

//*** Top left 
x = width/2; 
y = height/2; 
shape.lineTo(x, y - radius); 
if (tl) shape.quadraticCurveTo(x, y, x - radius, y); 
else shape.lineTo(x, y); 

var extrude = this.shape.extrude({amount: extr || 0, bevelEnabled: false}); 
this.mesh = new THREE.Mesh(extrude, mat); 
문제는 내가 CubeGeometry 당신이 하듯이 메시를 치료 필요가있다

그리고 비트 맵 (그리고 결국 비디오) 텍스처로 텍스처링합니다. 현재 결과는 큐브의 앞면이 네 개의 동일한 세그먼트로 나뉘며 비트 맵의 ​​픽셀 데이터 인 것으로 보이는 단일 색상이 각각 나타납니다. 이 경우 큐브의 전면에만 관심이 있습니다.

답변

1

자 이제 UV 좌표를 직접 작성해야합니다.

지오메트리의 경계 상자를 계산해야합니다. 이 데이터를 사용하면 각면에 대해 0 - 1 자외선을 생성 할 수 있어야합니다.

+0

죄송합니다. 업데이트를 잊어 버렸습니다. 이것이 제가 끝내 준 것입니다. – flashtml5