fromGraphNode method
void
fromGraphNode(
- Object3D group
Implementation
void fromGraphNode(Object3D group) {
group.updateWorldMatrix(true, true);
group.traverse((object) {
if (object.type == 'Mesh') {
Mesh obj = object;
late BufferGeometry geometry;
bool isTemp = false;
if (obj.geometry!.index != null) {
isTemp = true;
geometry = obj.geometry!.clone().toNonIndexed();
} else {
geometry = obj.geometry!;
}
BufferAttribute positionAttribute = geometry.getAttribute('position');
for (int i = 0; i < positionAttribute.count; i += 3) {
Vector3 v1 = Vector3().fromBufferAttribute(positionAttribute, i);
Vector3 v2 = Vector3().fromBufferAttribute(positionAttribute, i + 1);
Vector3 v3 = Vector3().fromBufferAttribute(positionAttribute, i + 2);
v1.applyMatrix4(obj.matrixWorld);
v2.applyMatrix4(obj.matrixWorld);
v3.applyMatrix4(obj.matrixWorld);
addTriangle(Triangle(v1, v2, v3));
}
if (isTemp) {
geometry.dispose();
}
}
});
build();
}