Does IShaderConstantSetCallback() get called for each camera?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
n00bc0de
Posts: 85
Joined: Tue Oct 04, 2022 1:21 am

Does IShaderConstantSetCallback() get called for each camera?

Post by n00bc0de »

If I have multiple camera's rendering the scene from the different views, does the callback for that shader get called for each camera?
CuteAlien
Admin
Posts: 9838
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Does IShaderConstantSetCallback() get called for each camera?

Post by CuteAlien »

It means you render the scene several times, so yes - everything is called for each camera.

IShaderConstantSetCallBack::OnSetMaterial is called every time the video driver had another active material and switches to the shader material to which the callback belongs.
IShaderConstantSetCallBack::OnSetConstants is called on every draw call in the driver - so every time you send any graphic primitives to the GPU and the shader material to which the callback belongs is active.
And relatively new in trunk is a IShaderConstantSetCallBack::OnCreate function which is only called once after adding the shader material.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
n00bc0de
Posts: 85
Joined: Tue Oct 04, 2022 1:21 am

Re: Does IShaderConstantSetCallback() get called for each camera?

Post by n00bc0de »

Thanks for the info. I came across some cool shaders in this repo: https://github.com/netpipe/IrrlichtDemos

I was wanting to integrate some of them into RCBasic but when I was looking through the shader constants in some of them, it was using the active camera position for the light source and the active camera can change constantly before the render step. I just wanted to make sure it was able to call it for each camera.
Post Reply