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

Add automatic updating of mesh bounding box when importing, view centering improvements #335

Open
wants to merge 4 commits into
base: 1.0.6.4
Choose a base branch
from

Conversation

CosmicDreamsOfCode
Copy link
Contributor

  • MeshSet AABB is now updated when importing a custom mesh
  • You can now view the MeshSet AABB in the Mesh tab (mostly for debugging, its readonly, but nice to have ig)
  • Slight refactor of viewport bb code to have an update method, this is used when centering the view so it will actually center to the correct point after a custom mesh is imported without reopening the asset

@CosmicDreamsOfCode
Copy link
Contributor Author

Realised last night that this may have issue with multi-section and lod models. Closing to investigate.

@CosmicDreamsOfCode
Copy link
Contributor Author

i think i fixed it, should take the largest bbox out of all sections and lods, including unrenderable ones

vertexPositions.Add(new Vector3(position.X, position.Y, position.Z));

}
boundingBox = AABBFromPoints(vertexPositions).Item2;
Copy link
Collaborator

Choose a reason for hiding this comment

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

why not merge the bounding box here already?


}
boundingBox = AABBFromPoints(vertexPositions).Item2;
//meshSet.BoundingBox = AABBFromPoints(vertexPositions).Item1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

also remove commented out stuff u added

@@ -1653,6 +1673,7 @@ public void ImportFBX(string filename, MeshSet inMeshSet, EbxAsset asset, EbxAss
meshSet.ClearPartData();
List<BoundingBox> partBbox = new List<BoundingBox>();
List<LinearTransform> transforms = new List<LinearTransform>();
AxisAlignedBox AABBToWrite = new AxisAlignedBox();
Copy link
Collaborator

Choose a reason for hiding this comment

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

why have a local variable here, just assign it to meshSet.BoundingBox directly

retVal.min = min;
retVal.max = max;

return retVal;
Copy link
Collaborator

Choose a reason for hiding this comment

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

u could also use just return new AxisAlignedBox() { min = new Vec3() { x = ... }, max = ... }, but doesnt really matter that much

@wannkunstbeikor
Copy link
Collaborator

other than that it looks, good to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants