I want to do things (like AI, collisions...) to only objects visible by the camera.
Right now each frame, I'm iterating all my Backgrounds objects (a node and a mesh in my level) and test if their bounding box is visible by the camera, which I don't think is very efficient:
Code: Select all
for (unsigned int ib(0);ib<Backgrounds.size();++ib)
{
Backgrounds.at(ib)->isVisibleByCamera = level->CameraGame->camera->isVisible(Backgrounds.at(ib)->EntityMesh->getWorldBoundingBox(true));
}
Can I retrieve this information and use it instead of doing a camera->isVisible? (even if it's an data from the last frame)
Or is there a more efficient way to know or make a list of every entity visible by the camera?
S.