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

Method AssignSectors

TombEngine/Objects/Generic/Object/BridgeObject.cpp:213–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211 }
212
213 void BridgeObject::AssignSectors(const ItemInfo& item)
214 {
215 // Get AABB and OBB.
216 auto aabb = item.GetAabb();
217 auto obb = item.GetObb();
218
219 // Assign to sectors.
220 unsigned int searchDepth = (unsigned int)ceil(std::max({ obb.Extents.x, obb.Extents.y, obb.Extents.z }) / BLOCK(1));
221 auto sectors = GetNeighborSectors(item.Pose.Position, item.RoomNumber, searchDepth);
222 for (auto* sector : sectors)
223 {
224 // Test if AABB intersects sector.
225 if (!aabb.Intersects(sector->Aabb))
226 continue;
227
228 // Test if OBB intersects sector.
229 if (!obb.Intersects(sector->Aabb))
230 continue;
231
232 sector->AddBridge(item.Index);
233 }
234 }
235
236 void BridgeObject::DeassignSectors(const ItemInfo& item) const
237 {

Callers

nothing calls this directly

Calls 5

GetNeighborSectorsFunction · 0.85
IntersectsMethod · 0.80
AddBridgeMethod · 0.80
GetAabbMethod · 0.45
GetObbMethod · 0.45

Tested by

no test coverage detected