Skip to main content

AABBCullingStrategy.ixx File

Culling strategy based on AABB. More...

Included Headers

#include <cmath> #include <helios.engine.scene.types.CullingContext> #include <helios.ecs.types.EntityHandle> #include <helios.math>

Namespaces Index

namespacehelios
namespaceengine
namespacescene

Classes Index

classAABBCullingStrategy<TMemberHandle>

NAABB culling strategy implementation. More...

Description

Culling strategy based on AABB.

File Listing

The file content with the documentation metadata removed is:

1
5module;
6
7#include <cmath>
8
9export module helios.engine.scene.AABBCullingStrategy;
10
11
12import helios.math;
13
14import helios.ecs.types.EntityHandle;
15import helios.engine.scene.types.CullingContext;
16
17using namespace helios::ecs::types;
18using namespace helios::engine::scene::types;
19export namespace helios::engine::scene {
20
28 template<typename TMemberHandle>
30
31
32
33 public:
34
36
52
53 auto& planes = ctx.frustumPlanes;
54 auto& bounds = ctx.bounds;
55
56 const auto c = bounds.center();
57 const auto h = bounds.extent();
58
59 for (auto& plane : planes) {
60 const auto n = plane.normal;
61
62 const auto e = h[0] * std::abs(n[0]) + h[1] * std::abs(n[1]) + h[2] * std::abs(n[2]);
63
64 const auto s = c.dot(n) - plane.distance;
65
66 if (s + e < 0 ) { // OUTSIDE
67 return false;
68 }
69 }
70
71
72 return true; // INSIDE
73 }
74
75 };
76}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.