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

Function TestVolumeContainment

TombEngine/Game/control/volume.cpp:24–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22 constexpr auto EVENT_STATE_MASK = SHRT_MAX;
23
24 bool TestVolumeContainment(const TriggerVolume& volume, const BoundingOrientedBox& box, int roomNumber)
25 {
26 float color = !volume.StateQueue.empty() ? 1.0f : 0.4f;
27
28 switch (volume.Type)
29 {
30 case VolumeType::Box:
31 if (roomNumber == Camera.pos.RoomNumber)
32 {
33 DrawDebugBox(volume.Box,
34 Vector4(color, 0.0f, color, 1.0f), RendererDebugPage::CollisionStats);
35 }
36 return volume.Box.Intersects(box);
37
38 case VolumeType::Sphere:
39 if (roomNumber == Camera.pos.RoomNumber)
40 {
41 DrawDebugSphere(volume.Sphere.Center, volume.Sphere.Radius,
42 Vector4(color, 0.0f, color, 1.0f), RendererDebugPage::CollisionStats);
43 }
44 return volume.Sphere.Intersects(box);
45
46 default:
47 TENLog(fmt::format("Unsupported volume type encountered in room {}.", roomNumber), LogLevel::Error);
48 return false;
49 }
50 }
51
52 BoundingOrientedBox ConstructRoughBox(ItemInfo& item, const CollisionSetupData& coll)
53 {

Callers 1

TestVolumesFunction · 0.85

Calls 7

DrawDebugBoxFunction · 0.85
DrawDebugSphereFunction · 0.85
TENLogFunction · 0.85
IntersectsMethod · 0.80
Vector4Function · 0.50
formatFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected