aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/source/Irrlicht/CD3D9ShaderMaterialRenderer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/source/Irrlicht/CD3D9ShaderMaterialRenderer.h')
-rw-r--r--src/others/irrlicht-1.8.1/source/Irrlicht/CD3D9ShaderMaterialRenderer.h102
1 files changed, 102 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/source/Irrlicht/CD3D9ShaderMaterialRenderer.h b/src/others/irrlicht-1.8.1/source/Irrlicht/CD3D9ShaderMaterialRenderer.h
new file mode 100644
index 0000000..2c2bb19
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/source/Irrlicht/CD3D9ShaderMaterialRenderer.h
@@ -0,0 +1,102 @@
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_D3D9_SHADER_MATERIAL_RENDERER_H_INCLUDED__
6#define __C_D3D9_SHADER_MATERIAL_RENDERER_H_INCLUDED__
7
8#include "IrrCompileConfig.h"
9#ifdef _IRR_WINDOWS_
10
11#ifdef _IRR_COMPILE_WITH_DIRECT3D_9_
12#if defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
13#include "irrMath.h" // needed by borland for sqrtf define
14#endif
15#include <d3dx9shader.h>
16
17#include "IMaterialRenderer.h"
18
19namespace irr
20{
21namespace video
22{
23
24class IVideoDriver;
25class IShaderConstantSetCallBack;
26class IMaterialRenderer;
27
28//! Class for using vertex and pixel shaders with D3D9
29class CD3D9ShaderMaterialRenderer : public IMaterialRenderer
30{
31public:
32
33 //! Public constructor
34 CD3D9ShaderMaterialRenderer(IDirect3DDevice9* d3ddev, video::IVideoDriver* driver,
35 s32& outMaterialTypeNr, const c8* vertexShaderProgram, const c8* pixelShaderProgram,
36 IShaderConstantSetCallBack* callback, IMaterialRenderer* baseMaterial, s32 userData);
37
38 //! Destructor
39 ~CD3D9ShaderMaterialRenderer();
40
41 virtual void OnSetMaterial(const video::SMaterial& material, const video::SMaterial& lastMaterial,
42 bool resetAllRenderstates, video::IMaterialRendererServices* services);
43
44 virtual void OnUnsetMaterial();
45
46 virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype);
47
48 //! Returns if the material is transparent.
49 virtual bool isTransparent() const;
50
51protected:
52
53 //! constructor only for use by derived classes who want to
54 //! create a fall back material for example.
55 CD3D9ShaderMaterialRenderer(IDirect3DDevice9* d3ddev,
56 video::IVideoDriver* driver,
57 IShaderConstantSetCallBack* callback,
58 IMaterialRenderer* baseMaterial,
59 s32 userData=0);
60
61 void init(s32& outMaterialTypeNr, const c8* vertexShaderProgram, const c8* pixelShaderProgram);
62 bool createPixelShader(const c8* pxsh);
63 bool createVertexShader(const char* vtxsh);
64
65 HRESULT stubD3DXAssembleShader(LPCSTR pSrcData, UINT SrcDataLen,
66 CONST D3DXMACRO* pDefines, LPD3DXINCLUDE pInclude,
67 DWORD Flags, LPD3DXBUFFER* ppShader,
68 LPD3DXBUFFER* ppErrorMsgs);
69
70 HRESULT stubD3DXAssembleShaderFromFile(LPCSTR pSrcFile,
71 CONST D3DXMACRO* pDefines, LPD3DXINCLUDE pInclude, DWORD Flags,
72 LPD3DXBUFFER* ppShader, LPD3DXBUFFER* ppErrorMsgs);
73
74 HRESULT stubD3DXCompileShader(LPCSTR pSrcData, UINT SrcDataLen, CONST D3DXMACRO* pDefines,
75 LPD3DXINCLUDE pInclude, LPCSTR pFunctionName,
76 LPCSTR pProfile, DWORD Flags, LPD3DXBUFFER* ppShader,
77 LPD3DXBUFFER* ppErrorMsgs, LPD3DXCONSTANTTABLE* ppConstantTable);
78
79 HRESULT stubD3DXCompileShaderFromFile(LPCSTR pSrcFile, CONST D3DXMACRO* pDefines,
80 LPD3DXINCLUDE pInclude, LPCSTR pFunctionName,
81 LPCSTR pProfile, DWORD Flags, LPD3DXBUFFER* ppShader, LPD3DXBUFFER* ppErrorMsgs,
82 LPD3DXCONSTANTTABLE* ppConstantTable);
83
84 IDirect3DDevice9* pID3DDevice;
85 video::IVideoDriver* Driver;
86 IShaderConstantSetCallBack* CallBack;
87 IMaterialRenderer* BaseMaterial;
88
89 IDirect3DVertexShader9* VertexShader;
90 IDirect3DVertexShader9* OldVertexShader;
91 IDirect3DPixelShader9* PixelShader;
92 s32 UserData;
93};
94
95
96} // end namespace video
97} // end namespace irr
98
99#endif
100#endif
101#endif
102