The best listener for updating scene and visibility.

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
nanophoto
Gnoblar
Posts: 7
Joined: Wed May 04, 2022 7:35 am
x 2

The best listener for updating scene and visibility.

Post by nanophoto »

I am implementing viewer which has multiple scenemanager. And one scenemanager has multiple render targets.
And I want to know the best listers and callback for following task.

1.For updating mesh.
Is it correct to use "Listener::preUpdateSceneGraph"?

2.For switching scene node visibility per render target.
Is it correct to use "RenderTargetListener::preRenderTargetUpdate"?
A scene node is visible some render targets and invisible other render targets.

I want to know the best lister and callback for these purpose.

rpgplayerrobin
Gnoll
Posts: 619
Joined: Wed Mar 18, 2009 3:03 am
x 354

Re: The best listener for updating scene and visibility.

Post by rpgplayerrobin »

If you want to show an object in one render target and not the next, or even sometimes render something in both, you can do it.

Here are some other forum posts about it:
viewtopic.php?p=547392&hilit=setvisibilityflags#p547392
viewtopic.php?p=467952&hilit=hide+entit ... et#p467952

You basically use "setVisibilityMask" for the Viewport of the RenderTarget, and then you also use "setVisibilityFlags" for each object/entity you want to render in just one of the two render targets.

I don't know exactly what you mean with updating a mesh, but if you just want to do it each frame before the render is triggered, just use "RenderTargetListener::preRenderTargetUpdate".

nanophoto
Gnoblar
Posts: 7
Joined: Wed May 04, 2022 7:35 am
x 2

Re: The best listener for updating scene and visibility.

Post by nanophoto »

Thank you rpgplayerrobin.

About Visibility
Basically I would consider using "setVisibilityMask".
However, due to application specifications, there are some cases where are difficult to control with VisiblityMask.
For example, a situation where the user can freely toggle the visibility of entities ON/OFF for each RenderTargets.
A situation where the number of RenderTargets cannot be limited and more than 32 RenderTargets are allowed. (This is very rare, but it cannot be restricted.)
In such a case, I'm thinking of switching ON/OFF finely with RenderTargetListener::preRenderTargetUpdate.

About Updating Mesh
This means adding entities, removing entities, adding sub-meshes, etc. However, I realized that it would be simpler and more efficient to update on "FrameListern::frameStarted" event, before drawing each frame.

Thank you very much for your advice.

rpgplayerrobin
Gnoll
Posts: 619
Joined: Wed Mar 18, 2009 3:03 am
x 354

Re: The best listener for updating scene and visibility.

Post by rpgplayerrobin »

About Updating Mesh
This means adding entities, removing entities, adding sub-meshes, etc. However, I realized that it would be simpler and more efficient to update on "FrameListern::frameStarted" event, before drawing each frame.

Yeah, just handle it at one place instead of in each render target.

About Visibility
Basically I would consider using "setVisibilityMask".
However, due to application specifications, there are some cases where are difficult to control with VisiblityMask.
For example, a situation where the user can freely toggle the visibility of entities ON/OFF for each RenderTargets.
A situation where the number of RenderTargets cannot be limited and more than 32 RenderTargets are allowed. (This is very rare, but it cannot be restricted.)
In such a case, I'm thinking of switching ON/OFF finely with RenderTargetListener::preRenderTargetUpdate.

Then you should have a unique identifier per Render Target (which you can probably figure out some way) and then just update the visibility of objects you want in preRenderTargetUpdate and possibly set them back in postRenderTargetUpdate (if you need to set them back).

nanophoto
Gnoblar
Posts: 7
Joined: Wed May 04, 2022 7:35 am
x 2

Re: The best listener for updating scene and visibility.

Post by nanophoto »

Thank you rpgplayerrobin.

I set unique identifier to render target, and switch visibility in preRenderTarget and postRenderTarget.
That worked fine.
Thank you.

Post Reply