MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / ScaleAabb

Method ScaleAabb

TombEngine/Game/StaticMesh.cpp:22–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20 }
21
22 void StaticMesh::ScaleAabb(GameBoundingBox& aabb) const
23 {
24 // Calculate scaled parameters.
25 auto center = aabb.GetCenter();
26 auto extents = aabb.GetExtents();
27 auto scaledExtents = extents * Pose.Scale;
28 auto scaledOffset = (center * Pose.Scale) - center;
29
30 // Scale AABB.
31 aabb.X1 = (center.x - scaledExtents.x) + scaledOffset.x;
32 aabb.X2 = (center.x + scaledExtents.x) + scaledOffset.x;
33 aabb.Y1 = (center.y - scaledExtents.y) + scaledOffset.y;
34 aabb.Y2 = (center.y + scaledExtents.y) + scaledOffset.y;
35 aabb.Z1 = (center.z - scaledExtents.z) + scaledOffset.z;
36 aabb.Z2 = (center.z + scaledExtents.z) + scaledOffset.z;
37 }
38
39 BoundingOrientedBox StaticMesh::GetObb() const
40 {

Callers

nothing calls this directly

Calls 2

GetCenterMethod · 0.80
GetExtentsMethod · 0.80

Tested by

no test coverage detected