aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/include/IShaderConstantSetCallBack.h
diff options
context:
space:
mode:
authorDavid Walter Seikel2013-01-13 18:54:10 +1000
committerDavid Walter Seikel2013-01-13 18:54:10 +1000
commit959831f4ef5a3e797f576c3de08cd65032c997ad (patch)
treee7351908be5995f0b325b2ebeaa02d5a34b82583 /libraries/irrlicht-1.8/include/IShaderConstantSetCallBack.h
parentAdd info about changes to Irrlicht. (diff)
downloadSledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.zip
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.gz
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.bz2
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.xz
Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard.
Diffstat (limited to 'libraries/irrlicht-1.8/include/IShaderConstantSetCallBack.h')
-rw-r--r--libraries/irrlicht-1.8/include/IShaderConstantSetCallBack.h170
1 files changed, 85 insertions, 85 deletions
diff --git a/libraries/irrlicht-1.8/include/IShaderConstantSetCallBack.h b/libraries/irrlicht-1.8/include/IShaderConstantSetCallBack.h
index fdf9e9a..f88393f 100644
--- a/libraries/irrlicht-1.8/include/IShaderConstantSetCallBack.h
+++ b/libraries/irrlicht-1.8/include/IShaderConstantSetCallBack.h
@@ -1,85 +1,85 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt 1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine". 2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h 3// For conditions of distribution and use, see copyright notice in irrlicht.h
4 4
5#ifndef __I_SHADER_CONSTANT_SET_CALLBACT_H_INCLUDED__ 5#ifndef __I_SHADER_CONSTANT_SET_CALLBACT_H_INCLUDED__
6#define __I_SHADER_CONSTANT_SET_CALLBACT_H_INCLUDED__ 6#define __I_SHADER_CONSTANT_SET_CALLBACT_H_INCLUDED__
7 7
8#include "IReferenceCounted.h" 8#include "IReferenceCounted.h"
9 9
10namespace irr 10namespace irr
11{ 11{
12namespace video 12namespace video
13{ 13{
14 class IMaterialRendererServices; 14 class IMaterialRendererServices;
15 class SMaterial; 15 class SMaterial;
16 16
17//! Interface making it possible to set constants for gpu programs every frame. 17//! Interface making it possible to set constants for gpu programs every frame.
18/** Implement this interface in an own class and pass a pointer to it to one of 18/** Implement this interface in an own class and pass a pointer to it to one of
19the methods in IGPUProgrammingServices when creating a shader. The 19the methods in IGPUProgrammingServices when creating a shader. The
20OnSetConstants method will be called every frame now. */ 20OnSetConstants method will be called every frame now. */
21class IShaderConstantSetCallBack : public virtual IReferenceCounted 21class IShaderConstantSetCallBack : public virtual IReferenceCounted
22{ 22{
23public: 23public:
24 24
25 //! Called to let the callBack know the used material (optional method) 25 //! Called to let the callBack know the used material (optional method)
26 /** 26 /**
27 \code 27 \code
28 class MyCallBack : public IShaderConstantSetCallBack 28 class MyCallBack : public IShaderConstantSetCallBack
29 { 29 {
30 const video::SMaterial *UsedMaterial; 30 const video::SMaterial *UsedMaterial;
31 31
32 OnSetMaterial(const video::SMaterial& material) 32 OnSetMaterial(const video::SMaterial& material)
33 { 33 {
34 UsedMaterial=&material; 34 UsedMaterial=&material;
35 } 35 }
36 36
37 OnSetConstants(IMaterialRendererServices* services, s32 userData) 37 OnSetConstants(IMaterialRendererServices* services, s32 userData)
38 { 38 {
39 services->setVertexShaderConstant("myColor", reinterpret_cast<f32*>(&UsedMaterial->color), 4); 39 services->setVertexShaderConstant("myColor", reinterpret_cast<f32*>(&UsedMaterial->color), 4);
40 } 40 }
41 } 41 }
42 \endcode 42 \endcode
43 */ 43 */
44 virtual void OnSetMaterial(const SMaterial& material) { } 44 virtual void OnSetMaterial(const SMaterial& material) { }
45 45
46 //! Called by the engine when the vertex and/or pixel shader constants for an material renderer should be set. 46 //! Called by the engine when the vertex and/or pixel shader constants for an material renderer should be set.
47 /** 47 /**
48 Implement the IShaderConstantSetCallBack in an own class and implement your own 48 Implement the IShaderConstantSetCallBack in an own class and implement your own
49 OnSetConstants method using the given IMaterialRendererServices interface. 49 OnSetConstants method using the given IMaterialRendererServices interface.
50 Pass a pointer to this class to one of the methods in IGPUProgrammingServices 50 Pass a pointer to this class to one of the methods in IGPUProgrammingServices
51 when creating a shader. The OnSetConstants method will now be called every time 51 when creating a shader. The OnSetConstants method will now be called every time
52 before geometry is being drawn using your shader material. A sample implementation 52 before geometry is being drawn using your shader material. A sample implementation
53 would look like this: 53 would look like this:
54 \code 54 \code
55 virtual void OnSetConstants(video::IMaterialRendererServices* services, s32 userData) 55 virtual void OnSetConstants(video::IMaterialRendererServices* services, s32 userData)
56 { 56 {
57 video::IVideoDriver* driver = services->getVideoDriver(); 57 video::IVideoDriver* driver = services->getVideoDriver();
58 58
59 // set clip matrix at register 4 59 // set clip matrix at register 4
60 core::matrix4 worldViewProj(driver->getTransform(video::ETS_PROJECTION)); 60 core::matrix4 worldViewProj(driver->getTransform(video::ETS_PROJECTION));
61 worldViewProj *= driver->getTransform(video::ETS_VIEW); 61 worldViewProj *= driver->getTransform(video::ETS_VIEW);
62 worldViewProj *= driver->getTransform(video::ETS_WORLD); 62 worldViewProj *= driver->getTransform(video::ETS_WORLD);
63 services->setVertexShaderConstant(&worldViewProj.M[0], 4, 4); 63 services->setVertexShaderConstant(&worldViewProj.M[0], 4, 4);
64 // for high level shading languages, this would be another solution: 64 // for high level shading languages, this would be another solution:
65 //services->setVertexShaderConstant("mWorldViewProj", worldViewProj.M, 16); 65 //services->setVertexShaderConstant("mWorldViewProj", worldViewProj.M, 16);
66 66
67 // set some light color at register 9 67 // set some light color at register 9
68 video::SColorf col(0.0f,1.0f,1.0f,0.0f); 68 video::SColorf col(0.0f,1.0f,1.0f,0.0f);
69 services->setVertexShaderConstant(reinterpret_cast<const f32*>(&col), 9, 1); 69 services->setVertexShaderConstant(reinterpret_cast<const f32*>(&col), 9, 1);
70 // for high level shading languages, this would be another solution: 70 // for high level shading languages, this would be another solution:
71 //services->setVertexShaderConstant("myColor", reinterpret_cast<f32*>(&col), 4); 71 //services->setVertexShaderConstant("myColor", reinterpret_cast<f32*>(&col), 4);
72 } 72 }
73 \endcode 73 \endcode
74 \param services: Pointer to an interface providing methods to set the constants for the shader. 74 \param services: Pointer to an interface providing methods to set the constants for the shader.
75 \param userData: Userdata int which can be specified when creating the shader. 75 \param userData: Userdata int which can be specified when creating the shader.
76 */ 76 */
77 virtual void OnSetConstants(IMaterialRendererServices* services, s32 userData) = 0; 77 virtual void OnSetConstants(IMaterialRendererServices* services, s32 userData) = 0;
78}; 78};
79 79
80 80
81} // end namespace video 81} // end namespace video
82} // end namespace irr 82} // end namespace irr
83 83
84#endif 84#endif
85 85