material.clone(), random colors
일반적으로 새로운 Mesh 를 만들 때, const mesh = new THREE.Mesh(geometry, material); 사용합니다. 그러나 여러개의 Mesh 를 생산하는 경우에 Geometry 는 같아도, 재질( Material )은 별도로 처리 하고자 할 때가 많습니다. const material = new THREE.MeshBasicMaterial({ color: 0xff0000 }); // 빨간색 재질const mesh1 = new THREE.Mesh(geometry, material); // 첫 번째 메쉬는 빨간색const mesh2 = new THREE.Mesh(geometry, material.clone()); // 복사된 재질을 사용// mesh2의 재질 색상을 바꿔도 mesh1에는..
three.js
2024. 9. 21. 19:37