~baltix/+junk/irrlicht-test

« back to all changes in this revision

Viewing changes to source/Irrlicht/CD3D9ShaderMaterialRenderer.h

  • Committer: Mantas Kriaučiūnas
  • Date: 2011-07-18 13:06:25 UTC
  • Revision ID: mantas@akl.lt-20110718130625-c5pvifp61e7kj1ol
Included whole irrlicht SVN libraries to work around launchpad recipe issue with quilt, see https://answers.launchpad.net/launchpad/+question/165193

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (C) 2002-2011 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
 
 
19
namespace irr
 
20
{
 
21
namespace video
 
22
{
 
23
 
 
24
class IVideoDriver;
 
25
class IShaderConstantSetCallBack;
 
26
class IMaterialRenderer;
 
27
 
 
28
//! Class for using vertex and pixel shaders with D3D9
 
29
class CD3D9ShaderMaterialRenderer : public IMaterialRenderer
 
30
{
 
31
public:
 
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
 
 
51
protected:
 
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