MCPcopy Create free account
hub / github.com/ThatOpen/engine_web-ifc / ifcGeometryToBuffer

Function ifcGeometryToBuffer

tests/regression/regression.mjs:166–191  ·  view source on GitHub ↗
(color, vertexData, indexData)

Source from the content-addressed store, hash-verified

164}
165
166function ifcGeometryToBuffer(color, vertexData, indexData) {
167 const geometry = new THREE.BufferGeometry();
168 let posFloats = new Float32Array(vertexData.length / 2);
169 let normFloats = new Float32Array(vertexData.length / 2);
170 let colorFloats = new Float32Array(vertexData.length / 2);
171
172 for (let i = 0; i < vertexData.length; i += 6) {
173 posFloats[i / 2 + 0] = vertexData[i + 0];
174 posFloats[i / 2 + 1] = vertexData[i + 1];
175 posFloats[i / 2 + 2] = vertexData[i + 2];
176
177 normFloats[i / 2 + 0] = vertexData[i + 3];
178 normFloats[i / 2 + 1] = vertexData[i + 4];
179 normFloats[i / 2 + 2] = vertexData[i + 5];
180
181 colorFloats[i / 2 + 0] = color.x;
182 colorFloats[i / 2 + 1] = color.y;
183 colorFloats[i / 2 + 2] = color.z;
184 }
185
186 geometry.setAttribute("position", new THREE.BufferAttribute(posFloats, 3));
187 geometry.setAttribute("normal", new THREE.BufferAttribute(normFloats, 3));
188 geometry.setAttribute("color", new THREE.BufferAttribute(colorFloats, 3));
189 geometry.setIndex(new THREE.BufferAttribute(indexData, 1));
190 return geometry;
191}
192
193RunRegression().then( res => console.log("FINISHED"));

Callers 1

getBufferGeometryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected