diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CD3D8ShaderMaterialRenderer.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CD3D8ShaderMaterialRenderer.h b/libraries/irrlicht-1.8/source/Irrlicht/CD3D8ShaderMaterialRenderer.h new file mode 100644 index 0000000..02156a1 --- /dev/null +++ b/libraries/irrlicht-1.8/source/Irrlicht/CD3D8ShaderMaterialRenderer.h | |||
@@ -0,0 +1,82 @@ | |||
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 __C_D3D8_SHADER_MATERIAL_RENDERER_H_INCLUDED__ | ||
6 | #define __C_D3D8_SHADER_MATERIAL_RENDERER_H_INCLUDED__ | ||
7 | |||
8 | #include "IrrCompileConfig.h" | ||
9 | #ifdef _IRR_WINDOWS_API_ | ||
10 | |||
11 | #ifdef _IRR_COMPILE_WITH_DIRECT3D_8_ | ||
12 | #include <d3d8.h> | ||
13 | #include <d3dx8core.h> | ||
14 | |||
15 | #include "IMaterialRenderer.h" | ||
16 | #include "S3DVertex.h" | ||
17 | |||
18 | namespace irr | ||
19 | { | ||
20 | namespace video | ||
21 | { | ||
22 | |||
23 | class IVideoDriver; | ||
24 | class IShaderConstantSetCallBack; | ||
25 | class IMaterialRenderer; | ||
26 | |||
27 | //! Class for using vertex and pixel shaders with D3D8 | ||
28 | class CD3D8ShaderMaterialRenderer : public IMaterialRenderer | ||
29 | { | ||
30 | public: | ||
31 | |||
32 | //! Public constructor | ||
33 | CD3D8ShaderMaterialRenderer(IDirect3DDevice8* d3ddev, video::IVideoDriver* driver, | ||
34 | s32& outMaterialTypeNr, const c8* vertexShaderProgram, const c8* pixelShaderProgram, | ||
35 | IShaderConstantSetCallBack* callback, IMaterialRenderer* baseMaterial, s32 userData); | ||
36 | |||
37 | //! Destructor | ||
38 | ~CD3D8ShaderMaterialRenderer(); | ||
39 | |||
40 | virtual void OnSetMaterial(const video::SMaterial& material, const video::SMaterial& lastMaterial, | ||
41 | bool resetAllRenderstates, video::IMaterialRendererServices* services); | ||
42 | |||
43 | virtual void OnUnsetMaterial(); | ||
44 | |||
45 | virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype); | ||
46 | |||
47 | //! Returns if the material is transparent. | ||
48 | virtual bool isTransparent() const; | ||
49 | |||
50 | protected: | ||
51 | |||
52 | //! constructor only for use by derived classes who want to | ||
53 | //! create a fall back material for example. | ||
54 | CD3D8ShaderMaterialRenderer(IDirect3DDevice8* d3ddev, | ||
55 | video::IVideoDriver* driver, | ||
56 | IShaderConstantSetCallBack* callback, | ||
57 | IMaterialRenderer* baseMaterial, s32 userData=0); | ||
58 | |||
59 | void init(s32& outMaterialTypeNr, const c8* vertexShaderProgram, const c8* pixelShaderProgram, | ||
60 | E_VERTEX_TYPE type); | ||
61 | bool createPixelShader(const c8* pxsh); | ||
62 | bool createVertexShader(const char* vtxsh, E_VERTEX_TYPE type); | ||
63 | |||
64 | IDirect3DDevice8* pID3DDevice; | ||
65 | video::IVideoDriver* Driver; | ||
66 | IShaderConstantSetCallBack* CallBack; | ||
67 | IMaterialRenderer* BaseMaterial; | ||
68 | |||
69 | DWORD VertexShader; | ||
70 | DWORD OldVertexShader; | ||
71 | DWORD PixelShader; | ||
72 | s32 UserData; | ||
73 | }; | ||
74 | |||
75 | |||
76 | } // end namespace video | ||
77 | } // end namespace irr | ||
78 | |||
79 | #endif | ||
80 | #endif | ||
81 | #endif | ||
82 | |||