Function isObjectCulled

Synopsis

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

bool isObjectCulled(const BoundingBox &box) const

Description

Check if an object should be culled

Parameters:

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

Source

Lines 242-257 in Source/Falcor/Scene/Camera/Camera.cpp. Line 227 in Source/Falcor/Scene/Camera/Camera.h.

bool Camera::isObjectCulled(const BoundingBox& 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 signedExtent = box.extent * mFrustumPlanes[plane].sign;
        float dr = glm::dot(box.center + signedExtent, mFrustumPlanes[plane].xyz);
        isInside = isInside && (dr > mFrustumPlanes[plane].negW);
    }
    return !isInside;
}





Add Discussion as Guest

Log in to DocsForge