mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-11 10:53:45 +01:00
20 lines
No EOL
533 B
JavaScript
20 lines
No EOL
533 B
JavaScript
|
|
export function createBoxGeometry(width, height, depth) {
|
|
return new THREE.BoxGeometry(width, height, depth);
|
|
}
|
|
|
|
export function createMeshGeometry(triangles) {
|
|
const geometry = new THREE.Geometry();
|
|
|
|
for (let tr of triangles) {
|
|
const a = geometry.vertices.length;
|
|
const b = a + 1;
|
|
const c = a + 2;
|
|
const face = new THREE.Face3(a, b, c);
|
|
tr.forEach(v => geometry.vertices.push(v.three()));
|
|
geometry.faces.push(face);
|
|
}
|
|
geometry.mergeVertices();
|
|
geometry.computeFaceNormals();
|
|
return geometry;
|
|
} |