Function isObjectCulled

Synopsis

#include <Source/Falcor/Scene/Camera/Camera.h>

bool isObjectCulled(const AABB &box) const

Description

Check if an object should be culled

Parameters

[ in ] box - Bounding box of the object to check

Source

Lines 246-261 in Source/Falcor/Scene/Camera/Camera.cpp. Line 232 in Source/Falcor/Scene/Camera/Camera.h.

bool Camera::isObjectCulled(const AABB& box) const
{
    calculateCameraParameters();
    bool isInside = true;
    // AABB vs. frustum test
    // See method 4b: https://fgiesen.wordpress.com/2010/10/17/view-frustum-culling/
    for (int plane = 0; plane < 6; plane++)
    {
        float3 signedHalfExtent = 0.5f * box.extent() * mFrustumPlanes[plane].sign;
        float dr = glm::dot(box.center() + signedHalfExtent, mFrustumPlanes[plane].xyz);
        isInside = isInside && (dr > mFrustumPlanes[plane].negW);
    }
    return !isInside;
}





Add Discussion as Guest

Log in