Shader Base Material
Re: Shader Base Material
Small note: If you code include files, be careful that if you set versions in your shaders those still have to be first line - even before includes (stuff like #version 430 compatibility).
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
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Shader Base Material
thanks for the heads up!
Re: Shader Base Material
I just run into the same problem that I needed the node per material (to figure out if I have non-uniform scaling). Turns out there is a pretty simple solution already: Use an ILightManager.
Like:
Set that in the SceneManager and then CurrentNode will always have the node rendered right now.
And then give your ShaderCallbacks access to that lightmanager.
This works nice unless you also need to know the current meshbuffer rendered, but I've not run into that yet.
Like:
Code: Select all
class MyLightManager : public irr::scene::ILightManager
{
public:
virtual void OnPreRender(irr::core::array<irr::scene::ISceneNode*>& lightList) {}
virtual void OnPostRender(void) {}
virtual void OnRenderPassPreRender(irr::scene::E_SCENE_NODE_RENDER_PASS renderPass) {}
virtual void OnRenderPassPostRender(irr::scene::E_SCENE_NODE_RENDER_PASS renderPass) {}
virtual void OnNodePreRender(irr::scene::ISceneNode* node)
{
CurrentNode = node;
}
virtual void OnNodePostRender(irr::scene::ISceneNode* node)
{
CurrentNode = 0;
}
irr::scene::ISceneNode* CurrentNode = 0;
};
And then give your ShaderCallbacks access to that lightmanager.
This works nice unless you also need to know the current meshbuffer rendered, but I've not run into that yet.
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
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Shader Base Material
interesting. I will look into that, thanks!