Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Floor missing, wrong bounding boxes #250

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions CadRevealRvmProvider/Tessellation/RvmTessellator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,15 @@ TessellationLogObject tessellationLogObject
tessellationLogObject
);

return new TriangleMesh(mesh, p.TreeIndex, p.Color, p.AxisAlignedBoundingBox);
var boundingBox = p.AxisAlignedBoundingBox;
if (mesh.Vertices.Length > 0)
{
// Recalculating AABB, since some instances of the transformed (p.AxisAlignedBoundingBox) AABB were incorrect
// Guarded agaings meshes with zero vertices, to avoid throwing an exception
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Guarded agaings meshes with zero vertices, to avoid throwing an exception
// Guarded against meshes with zero vertices, to avoid throwing an exception. Empty meshes are filtered out later.

boundingBox = mesh.CalculateAxisAlignedBoundingBox();
}

return new TriangleMesh(mesh, p.TreeIndex, p.Color, boundingBox);
}

var facetGroupsNotInstanced = facetGroupInstancingResult
Expand Down Expand Up @@ -109,7 +117,7 @@ TessellationLogObject tessellationLogObject
item.Transform,
item.ProtoMesh.TreeIndex,
item.ProtoMesh.Color,
item.ProtoMesh.AxisAlignedBoundingBox
group.Mesh.CalculateAxisAlignedBoundingBox(item.Transform) // Recalculating AABB, since some instances of the transformed (item.ProtoMesh.AxisAlignedBoundingBox) AABB were incorrect
))
)
.ToArray();
Expand Down
Loading