Skip to main content

AABBCullingStrategy Class Template

NAABB culling strategy implementation. More...

Declaration​

template <typename TMemberHandle> class helios::engine::scene::AABBCullingStrategy<TMemberHandle> { ... }

Public Member Typedefs Index​

template <typename TMemberHandle>
usingMemberHandle_type = TMemberHandle

Public Member Functions Index​

template <typename TMemberHandle>
boolshouldRender (const CullingContext< TMemberHandle > &ctx) noexcept

Executes culling for the provided context. More...

Description​

NAABB culling strategy implementation.

This strategy performs visibility test based on the AABBs of the members.

Template Parameters
TStrongId

Strong-id type used by entity handles.

Definition at line 29 of file AABBCullingStrategy.ixx.

Public Member Typedefs​

MemberHandle_type​

template <typename TMemberHandle>
using helios::engine::scene::AABBCullingStrategy< TMemberHandle >::MemberHandle_type = TMemberHandle

Definition at line 35 of file AABBCullingStrategy.ixx.

Public Member Functions​

shouldRender()​

template <typename TMemberHandle>
bool helios::engine::scene::AABBCullingStrategy< TMemberHandle >::shouldRender (const CullingContext< TMemberHandle > & ctx)
inline noexcept

Executes culling for the provided context.

Executes culling based on the AABB available with the specified CullingContext. The implementation follows Miettinen (Real Time Rendering, 4th, pp. 970-971) and check if the distance s of the center of the AABB to the plane normal satisfies the following condition: If s plus the extent e of the AABB is < 0 for any plane, the AABB is outside. Otherwise, the represented member is rendered.

Parameters
ctx

Perspective camera context.

handle

Scene member handle that would be tested by culling strategies.

info

The

Definition at line 51 of file AABBCullingStrategy.ixx.

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 }

Reference helios::engine::scene::registerComponents.


The documentation for this class was generated from the following file:


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.