diff options
Diffstat (limited to 'libraries/irrlicht-1.8/include/IMaterialRendererServices.h')
-rw-r--r-- | libraries/irrlicht-1.8/include/IMaterialRendererServices.h | 230 |
1 files changed, 115 insertions, 115 deletions
diff --git a/libraries/irrlicht-1.8/include/IMaterialRendererServices.h b/libraries/irrlicht-1.8/include/IMaterialRendererServices.h index 9f045b5..dafad09 100644 --- a/libraries/irrlicht-1.8/include/IMaterialRendererServices.h +++ b/libraries/irrlicht-1.8/include/IMaterialRendererServices.h | |||
@@ -1,115 +1,115 @@ | |||
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_MATERIAL_RENDERER_SERVICES_H_INCLUDED__ | 5 | #ifndef __I_MATERIAL_RENDERER_SERVICES_H_INCLUDED__ |
6 | #define __I_MATERIAL_RENDERER_SERVICES_H_INCLUDED__ | 6 | #define __I_MATERIAL_RENDERER_SERVICES_H_INCLUDED__ |
7 | 7 | ||
8 | #include "SMaterial.h" | 8 | #include "SMaterial.h" |
9 | #include "S3DVertex.h" | 9 | #include "S3DVertex.h" |
10 | 10 | ||
11 | namespace irr | 11 | namespace irr |
12 | { | 12 | { |
13 | namespace video | 13 | namespace video |
14 | { | 14 | { |
15 | 15 | ||
16 | class IVideoDriver; | 16 | class IVideoDriver; |
17 | 17 | ||
18 | 18 | ||
19 | //! Interface providing some methods for changing advanced, internal states of a IVideoDriver. | 19 | //! Interface providing some methods for changing advanced, internal states of a IVideoDriver. |
20 | class IMaterialRendererServices | 20 | class IMaterialRendererServices |
21 | { | 21 | { |
22 | public: | 22 | public: |
23 | 23 | ||
24 | //! Destructor | 24 | //! Destructor |
25 | virtual ~IMaterialRendererServices() {} | 25 | virtual ~IMaterialRendererServices() {} |
26 | 26 | ||
27 | //! Can be called by an IMaterialRenderer to make its work easier. | 27 | //! Can be called by an IMaterialRenderer to make its work easier. |
28 | /** Sets all basic renderstates if needed. | 28 | /** Sets all basic renderstates if needed. |
29 | Basic render states are diffuse, ambient, specular, and emissive color, | 29 | Basic render states are diffuse, ambient, specular, and emissive color, |
30 | specular power, bilinear and trilinear filtering, wireframe mode, | 30 | specular power, bilinear and trilinear filtering, wireframe mode, |
31 | grouraudshading, lighting, zbuffer, zwriteenable, backfaceculling and | 31 | grouraudshading, lighting, zbuffer, zwriteenable, backfaceculling and |
32 | fog enabling. | 32 | fog enabling. |
33 | \param material The new material to be used. | 33 | \param material The new material to be used. |
34 | \param lastMaterial The material used until now. | 34 | \param lastMaterial The material used until now. |
35 | \param resetAllRenderstates Set to true if all renderstates should be | 35 | \param resetAllRenderstates Set to true if all renderstates should be |
36 | set, regardless of their current state. */ | 36 | set, regardless of their current state. */ |
37 | virtual void setBasicRenderStates(const SMaterial& material, | 37 | virtual void setBasicRenderStates(const SMaterial& material, |
38 | const SMaterial& lastMaterial, | 38 | const SMaterial& lastMaterial, |
39 | bool resetAllRenderstates) = 0; | 39 | bool resetAllRenderstates) = 0; |
40 | 40 | ||
41 | //! Sets a constant for the vertex shader based on a name. | 41 | //! Sets a constant for the vertex shader based on a name. |
42 | /** This can be used if you used a high level shader language like GLSL | 42 | /** This can be used if you used a high level shader language like GLSL |
43 | or HLSL to create a shader. Example: If you created a shader which has | 43 | or HLSL to create a shader. Example: If you created a shader which has |
44 | variables named 'mWorldViewProj' (containing the WorldViewProjection | 44 | variables named 'mWorldViewProj' (containing the WorldViewProjection |
45 | matrix) and another one named 'fTime' containing one float, you can set | 45 | matrix) and another one named 'fTime' containing one float, you can set |
46 | them in your IShaderConstantSetCallBack derived class like this: | 46 | them in your IShaderConstantSetCallBack derived class like this: |
47 | \code | 47 | \code |
48 | virtual void OnSetConstants(video::IMaterialRendererServices* services, s32 userData) | 48 | virtual void OnSetConstants(video::IMaterialRendererServices* services, s32 userData) |
49 | { | 49 | { |
50 | video::IVideoDriver* driver = services->getVideoDriver(); | 50 | video::IVideoDriver* driver = services->getVideoDriver(); |
51 | 51 | ||
52 | f32 time = (f32)os::Timer::getTime()/100000.0f; | 52 | f32 time = (f32)os::Timer::getTime()/100000.0f; |
53 | services->setVertexShaderConstant("fTime", &time, 1); | 53 | services->setVertexShaderConstant("fTime", &time, 1); |
54 | 54 | ||
55 | core::matrix4 worldViewProj(driver->getTransform(video::ETS_PROJECTION)); | 55 | core::matrix4 worldViewProj(driver->getTransform(video::ETS_PROJECTION)); |
56 | worldViewProj *= driver->getTransform(video::ETS_VIEW); | 56 | worldViewProj *= driver->getTransform(video::ETS_VIEW); |
57 | worldViewProj *= driver->getTransform(video::ETS_WORLD); | 57 | worldViewProj *= driver->getTransform(video::ETS_WORLD); |
58 | services->setVertexShaderConstant("mWorldViewProj", worldViewProj.M, 16); | 58 | services->setVertexShaderConstant("mWorldViewProj", worldViewProj.M, 16); |
59 | } | 59 | } |
60 | \endcode | 60 | \endcode |
61 | \param name Name of the variable | 61 | \param name Name of the variable |
62 | \param floats Pointer to array of floats | 62 | \param floats Pointer to array of floats |
63 | \param count Amount of floats in array. | 63 | \param count Amount of floats in array. |
64 | \return True if successful. | 64 | \return True if successful. |
65 | */ | 65 | */ |
66 | virtual bool setVertexShaderConstant(const c8* name, const f32* floats, int count) = 0; | 66 | virtual bool setVertexShaderConstant(const c8* name, const f32* floats, int count) = 0; |
67 | 67 | ||
68 | //! Bool interface for the above. | 68 | //! Bool interface for the above. |
69 | virtual bool setVertexShaderConstant(const c8* name, const bool* bools, int count) = 0; | 69 | virtual bool setVertexShaderConstant(const c8* name, const bool* bools, int count) = 0; |
70 | 70 | ||
71 | //! Int interface for the above. | 71 | //! Int interface for the above. |
72 | virtual bool setVertexShaderConstant(const c8* name, const s32* ints, int count) = 0; | 72 | virtual bool setVertexShaderConstant(const c8* name, const s32* ints, int count) = 0; |
73 | 73 | ||
74 | //! Sets a vertex shader constant. | 74 | //! Sets a vertex shader constant. |
75 | /** Can be used if you created a shader using pixel/vertex shader | 75 | /** Can be used if you created a shader using pixel/vertex shader |
76 | assembler or ARB_fragment_program or ARB_vertex_program. | 76 | assembler or ARB_fragment_program or ARB_vertex_program. |
77 | \param data: Data to be set in the constants | 77 | \param data: Data to be set in the constants |
78 | \param startRegister: First register to be set | 78 | \param startRegister: First register to be set |
79 | \param constantAmount: Amount of registers to be set. One register consists of 4 floats. */ | 79 | \param constantAmount: Amount of registers to be set. One register consists of 4 floats. */ |
80 | virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) = 0; | 80 | virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) = 0; |
81 | 81 | ||
82 | //! Sets a constant for the pixel shader based on a name. | 82 | //! Sets a constant for the pixel shader based on a name. |
83 | /** This can be used if you used a high level shader language like GLSL | 83 | /** This can be used if you used a high level shader language like GLSL |
84 | or HLSL to create a shader. See setVertexShaderConstant() for an | 84 | or HLSL to create a shader. See setVertexShaderConstant() for an |
85 | example on how to use this. | 85 | example on how to use this. |
86 | \param name Name of the variable | 86 | \param name Name of the variable |
87 | \param floats Pointer to array of floats | 87 | \param floats Pointer to array of floats |
88 | \param count Amount of floats in array. | 88 | \param count Amount of floats in array. |
89 | \return True if successful. */ | 89 | \return True if successful. */ |
90 | virtual bool setPixelShaderConstant(const c8* name, const f32* floats, int count) = 0; | 90 | virtual bool setPixelShaderConstant(const c8* name, const f32* floats, int count) = 0; |
91 | 91 | ||
92 | //! Bool interface for the above. | 92 | //! Bool interface for the above. |
93 | virtual bool setPixelShaderConstant(const c8* name, const bool* bools, int count) = 0; | 93 | virtual bool setPixelShaderConstant(const c8* name, const bool* bools, int count) = 0; |
94 | 94 | ||
95 | //! Int interface for the above. | 95 | //! Int interface for the above. |
96 | virtual bool setPixelShaderConstant(const c8* name, const s32* ints, int count) = 0; | 96 | virtual bool setPixelShaderConstant(const c8* name, const s32* ints, int count) = 0; |
97 | 97 | ||
98 | //! Sets a pixel shader constant. | 98 | //! Sets a pixel shader constant. |
99 | /** Can be used if you created a shader using pixel/vertex shader | 99 | /** Can be used if you created a shader using pixel/vertex shader |
100 | assembler or ARB_fragment_program or ARB_vertex_program. | 100 | assembler or ARB_fragment_program or ARB_vertex_program. |
101 | \param data Data to be set in the constants | 101 | \param data Data to be set in the constants |
102 | \param startRegister First register to be set. | 102 | \param startRegister First register to be set. |
103 | \param constantAmount Amount of registers to be set. One register consists of 4 floats. */ | 103 | \param constantAmount Amount of registers to be set. One register consists of 4 floats. */ |
104 | virtual void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) = 0; | 104 | virtual void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) = 0; |
105 | 105 | ||
106 | //! Get pointer to the IVideoDriver interface | 106 | //! Get pointer to the IVideoDriver interface |
107 | /** \return Pointer to the IVideoDriver interface */ | 107 | /** \return Pointer to the IVideoDriver interface */ |
108 | virtual IVideoDriver* getVideoDriver() = 0; | 108 | virtual IVideoDriver* getVideoDriver() = 0; |
109 | }; | 109 | }; |
110 | 110 | ||
111 | } // end namespace video | 111 | } // end namespace video |
112 | } // end namespace irr | 112 | } // end namespace irr |
113 | 113 | ||
114 | #endif | 114 | #endif |
115 | 115 | ||