From 7028cbe09c688437910a25623098762bf0fa592d Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Mon, 28 Mar 2016 22:28:34 +1000 Subject: Move Irrlicht to src/others. --- ...1video_1_1_i_shader_constant_set_call_back.html | 247 +++++++++++++++++++++ 1 file changed, 247 insertions(+) create mode 100644 src/others/irrlicht-1.8.1/doc/html/classirr_1_1video_1_1_i_shader_constant_set_call_back.html (limited to 'src/others/irrlicht-1.8.1/doc/html/classirr_1_1video_1_1_i_shader_constant_set_call_back.html') diff --git a/src/others/irrlicht-1.8.1/doc/html/classirr_1_1video_1_1_i_shader_constant_set_call_back.html b/src/others/irrlicht-1.8.1/doc/html/classirr_1_1video_1_1_i_shader_constant_set_call_back.html new file mode 100644 index 0000000..244a98c --- /dev/null +++ b/src/others/irrlicht-1.8.1/doc/html/classirr_1_1video_1_1_i_shader_constant_set_call_back.html @@ -0,0 +1,247 @@ + + +
+ +Interface making it possible to set constants for gpu programs every frame. + More...
+ +#include <IShaderConstantSetCallBack.h>
Interface making it possible to set constants for gpu programs every frame.
+Implement this interface in an own class and pass a pointer to it to one of the methods in IGPUProgrammingServices when creating a shader. The OnSetConstants method will be called every frame now.
+ +Definition at line 21 of file IShaderConstantSetCallBack.h.
+virtual void irr::video::IShaderConstantSetCallBack::OnSetConstants | +( | +IMaterialRendererServices * | +services, | +
+ | + | s32 | +userData | +
+ | ) | + [pure virtual] |
+
Called by the engine when the vertex and/or pixel shader constants for an material renderer should be set.
+Implement the IShaderConstantSetCallBack in an own class and implement your own OnSetConstants method using the given IMaterialRendererServices interface. Pass a pointer to this class to one of the methods in IGPUProgrammingServices when creating a shader. The OnSetConstants method will now be called every time before geometry is being drawn using your shader material. A sample implementation would look like this:
+virtual void OnSetConstants(video::IMaterialRendererServices* services, s32 userData) + { + video::IVideoDriver* driver = services->getVideoDriver(); + + // set clip matrix at register 4 + core::matrix4 worldViewProj(driver->getTransform(video::ETS_PROJECTION)); + worldViewProj *= driver->getTransform(video::ETS_VIEW); + worldViewProj *= driver->getTransform(video::ETS_WORLD); + services->setVertexShaderConstant(&worldViewProj.M[0], 4, 4); + // for high level shading languages, this would be another solution: + //services->setVertexShaderConstant("mWorldViewProj", worldViewProj.M, 16); + + // set some light color at register 9 + video::SColorf col(0.0f,1.0f,1.0f,0.0f); + services->setVertexShaderConstant(reinterpret_cast<const f32*>(&col), 9, 1); + // for high level shading languages, this would be another solution: + //services->setVertexShaderConstant("myColor", reinterpret_cast<f32*>(&col), 4); + } +
services,: | Pointer to an interface providing methods to set the constants for the shader. |
userData,: | Userdata int which can be specified when creating the shader. |
virtual void irr::video::IShaderConstantSetCallBack::OnSetMaterial | +( | +const SMaterial & | +material | ) | + [inline, virtual] |
+
Called to let the callBack know the used material (optional method)
+class MyCallBack : public IShaderConstantSetCallBack + { + const video::SMaterial *UsedMaterial; + + OnSetMaterial(const video::SMaterial& material) + { + UsedMaterial=&material; + } + + OnSetConstants(IMaterialRendererServices* services, s32 userData) + { + services->setVertexShaderConstant("myColor", reinterpret_cast<f32*>(&UsedMaterial->color), 4); + } + } +
Definition at line 44 of file IShaderConstantSetCallBack.h.
+ +