A way to know if a node or entity is visible by the camera?

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
User avatar
suny
Greenskin
Posts: 137
Joined: Thu Mar 12, 2020 5:53 pm
x 60

A way to know if a node or entity is visible by the camera?

Post by suny »

Hi,

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));
}
But I understood that Ogre is doing this operation each frame (findingVisibleObjects) before rendering.
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.
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 449
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 156

Re: A way to know if a node or entity is visible by the camera?

Post by sercero »

You will probably have to read the source to see where the RenderSystem is keeping track of these objects.

I haven't been able to find anything, but perhaps you can find something here or in related pages.
https://ogrecave.github.io/ogre/api/1.1 ... ystem.html
Post Reply