Crazy Eddies GUI System  0.7.1
CEGUIDirect3D10Renderer.h
1 /***********************************************************************
2  filename: CEGUIDirect3D10Renderer.h
3  created: Sat Mar 7 2009
4  author: Paul D Turner (parts based on code by Rajko Stojadinovic)
5 *************************************************************************/
6 /***************************************************************************
7  * Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining
10  * a copy of this software and associated documentation files (the
11  * "Software"), to deal in the Software without restriction, including
12  * without limitation the rights to use, copy, modify, merge, publish,
13  * distribute, sublicense, and/or sell copies of the Software, and to
14  * permit persons to whom the Software is furnished to do so, subject to
15  * the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be
18  * included in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26  * OTHER DEALINGS IN THE SOFTWARE.
27  ***************************************************************************/
28 #ifndef _CEGUIDirect3D10Renderer_h_
29 #define _CEGUIDirect3D10Renderer_h_
30 
31 #include "../../CEGUIRenderer.h"
32 #include "../../CEGUISize.h"
33 #include "../../CEGUIVector.h"
34 #include <vector>
35 
36 #if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC)
37 # ifdef DIRECT3D10_GUIRENDERER_EXPORTS
38 # define D3D10_GUIRENDERER_API __declspec(dllexport)
39 # else
40 # define D3D10_GUIRENDERER_API __declspec(dllimport)
41 # endif
42 #else
43 # define D3D10_GUIRENDERER_API
44 #endif
45 
46 #if defined(_MSC_VER)
47 # pragma warning(push)
48 # pragma warning(disable : 4251)
49 #endif
50 
51 // D3D forward refs
52 struct ID3D10Device;
53 struct ID3D10Effect;
54 struct ID3D10EffectTechnique;
55 struct ID3D10InputLayout;
56 struct ID3D10EffectShaderResourceVariable;
57 struct ID3D10EffectMatrixVariable;
58 struct ID3D10ShaderResourceView;
59 struct D3DXMATRIX;
60 
61 // Start of CEGUI namespace section
62 namespace CEGUI
63 {
64 class Direct3D10GeometryBuffer;
65 class Direct3D10Texture;
66 
68 class D3D10_GUIRENDERER_API Direct3D10Renderer : public Renderer
69 {
70 public:
75  static Direct3D10Renderer& create(ID3D10Device* device);
76 
84  static void destroy(Direct3D10Renderer& renderer);
85 
87  ID3D10Device& getDirect3DDevice() const;
88 
90  void bindTechniquePass();
92  void setCurrentTextureShaderResource(ID3D10ShaderResourceView* srv);
94  void setProjectionMatrix(D3DXMATRIX& matrix);
96  void setWorldMatrix(D3DXMATRIX& matrix);
97 
98  // Implement interface from Renderer
99  RenderingRoot& getDefaultRenderingRoot();
100  GeometryBuffer& createGeometryBuffer();
101  void destroyGeometryBuffer(const GeometryBuffer& buffer);
102  void destroyAllGeometryBuffers();
103  TextureTarget* createTextureTarget();
104  void destroyTextureTarget(TextureTarget* target);
105  void destroyAllTextureTargets();
106  Texture& createTexture();
107  Texture& createTexture(const String& filename, const String& resourceGroup);
108  Texture& createTexture(const Size& size);
109  void destroyTexture(Texture& texture);
110  void destroyAllTextures();
111  void beginRendering();
112  void endRendering();
113  void setDisplaySize(const Size& sz);
114  const Size& getDisplaySize() const;
115  const Vector2& getDisplayDPI() const;
116  uint getMaxTextureSize() const;
117  const String& getIdentifierString() const;
118 
119 protected:
121  Direct3D10Renderer(ID3D10Device* device);
122 
125 
127  Size getViewportSize();
128 
132  ID3D10Device* d_device;
142  typedef std::vector<TextureTarget*> TextureTargetList;
146  typedef std::vector<Direct3D10GeometryBuffer*> GeometryBufferList;
150  typedef std::vector<Direct3D10Texture*> TextureList;
154  ID3D10Effect* d_effect;
156  ID3D10EffectTechnique* d_technique;
158  ID3D10InputLayout* d_inputLayout;
160  ID3D10EffectShaderResourceVariable* d_boundTextureVariable;
162  ID3D10EffectMatrixVariable* d_worldMatrixVariable;
164  ID3D10EffectMatrixVariable* d_projectionMatrixVariable;
165 };
166 
167 
168 } // End of CEGUI namespace section
169 
170 #if defined(_MSC_VER)
171 # pragma warning(pop)
172 #endif
173 
174 #endif // end of guard _CEGUIDirect3D10Renderer_h_