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