| 164 | } |
| 165 | |
| 166 | function 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 | |
| 193 | RunRegression().then( res => console.log("FINISHED")); |