Geometry - BoxGeometry
boxgeometry인자로
x크기,y크기,z크기,x분할수,y분할수,z분할수
이렇게 인자를 받는데
x분할수,y분할수,z분할수 를 생략시 기본값은 1이다
_setupModel() {
const geometry = new THREE.BoxGeometry(1, 1, 1);
const fillMaterial = new THREE.MeshPhongMaterial({ color: 0x515151 });
const cube = new THREE.Mesh(geometry, fillMaterial);
const lineMaterial = new THREE.LineBasicMaterial({ color: 0xffff00 });
const line = new THREE.LineSegments(
new THREE.WireframeGeometry(geometry),
lineMaterial
);
const group = new THREE.Group();
group.add(cube);
group.add(line);
this._scene.add(group);
this._cube = group;
}
세그먼트 수를 2로 늘려보자
_setupModel() {
const geometry = new THREE.BoxGeometry(1, 1, 1, 2, 2, 2);
const fillMaterial = new THREE.MeshPhongMaterial({ color: 0x515151 });
const cube = new THREE.Mesh(geometry, fillMaterial);
const lineMaterial = new THREE.LineBasicMaterial({ color: 0xffff00 });
const line = new THREE.LineSegments(
new THREE.WireframeGeometry(geometry),
lineMaterial
);
const group = new THREE.Group();
group.add(cube);
group.add(line);
this._scene.add(group);
this._cube = group;
}
반응형
'웹 개발 > 🧊 ThreeJS' 카테고리의 다른 글
Three.js | Geometry - ConeGeometry (0) | 2024.05.06 |
---|---|
Three.js | Geometry - CircleGeometry (0) | 2024.05.06 |
Three.js | Geometry & OrbitControls (0) | 2024.05.06 |
Three.js | 기본 구성 요소와 코드 (0) | 2024.05.06 |
Three.js | 개발환경구성 & 실행 (0) | 2024.05.05 |