MCPcopy Create free account
hub / github.com/OpenWebCAD/node-occ / makeFacesIndexes

Function makeFacesIndexes

lib/shape.js:106–123  ·  view source on GitHub ↗
(solid, jsonSolidMesh)

Source from the content-addressed store, hash-verified

104 return a;
105 }
106 function makeFacesIndexes(solid, jsonSolidMesh) {
107
108 const mesh = solid.mesh;
109 solid.getFaces().forEach(face => {
110
111 const indexes = mesh.getFaceTriangles(face);
112 const normalindexes = mesh.getFaceTriangleNormals(face);
113
114 const entry = {
115 name: solid.getShapeName(face),
116 indexes: toBase64(indexes),
117 normalIndexes: toBase64(normalindexes)
118 };
119 //xx entry.mesh.materials[0].colorDiffuse = [ Math.random(),Math.random(),Math.random()];
120 jsonSolidMesh.faces.push(entry);
121 });
122
123 }
124
125 assert(solid.hasOwnProperty("name"), "occ.buildSolidMesh : the solid must have a name");
126

Callers 1

shape.jsFile · 0.85

Calls 2

toBase64Function · 0.85
getShapeNameMethod · 0.80

Tested by

no test coverage detected