Crazy Eddies GUI System  0.7.2
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 - 2010 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:
88  static Direct3D10Renderer& bootstrapSystem(ID3D10Device* device);
89 
105  static void destroySystem();
106 
111  static Direct3D10Renderer& create(ID3D10Device* device);
112 
120  static void destroy(Direct3D10Renderer& renderer);
121 
123  ID3D10Device& getDirect3DDevice() const;
124 
126  void bindTechniquePass(const BlendMode mode);
128  void setCurrentTextureShaderResource(ID3D10ShaderResourceView* srv);
130  void setProjectionMatrix(D3DXMATRIX& matrix);
132  void setWorldMatrix(D3DXMATRIX& matrix);
133 
134  // Implement interface from Renderer
135  RenderingRoot& getDefaultRenderingRoot();
136  GeometryBuffer& createGeometryBuffer();
137  void destroyGeometryBuffer(const GeometryBuffer& buffer);
138  void destroyAllGeometryBuffers();
139  TextureTarget* createTextureTarget();
140  void destroyTextureTarget(TextureTarget* target);
141  void destroyAllTextureTargets();
142  Texture& createTexture();
143  Texture& createTexture(const String& filename, const String& resourceGroup);
144  Texture& createTexture(const Size& size);
145  void destroyTexture(Texture& texture);
146  void destroyAllTextures();
147  void beginRendering();
148  void endRendering();
149  void setDisplaySize(const Size& sz);
150  const Size& getDisplaySize() const;
151  const Vector2& getDisplayDPI() const;
152  uint getMaxTextureSize() const;
153  const String& getIdentifierString() const;
154 
155 protected:
157  Direct3D10Renderer(ID3D10Device* device);
158 
161 
163  Size getViewportSize();
164 
168  ID3D10Device* d_device;
178  typedef std::vector<TextureTarget*> TextureTargetList;
182  typedef std::vector<Direct3D10GeometryBuffer*> GeometryBufferList;
186  typedef std::vector<Direct3D10Texture*> TextureList;
190  ID3D10Effect* d_effect;
192  ID3D10EffectTechnique* d_normalTechnique;
194  ID3D10EffectTechnique* d_premultipliedTechnique;
196  ID3D10InputLayout* d_inputLayout;
198  ID3D10EffectShaderResourceVariable* d_boundTextureVariable;
200  ID3D10EffectMatrixVariable* d_worldMatrixVariable;
202  ID3D10EffectMatrixVariable* d_projectionMatrixVariable;
203 };
204 
205 
206 } // End of CEGUI namespace section
207 
208 #if defined(_MSC_VER)
209 # pragma warning(pop)
210 #endif
211 
212 #endif // end of guard _CEGUIDirect3D10Renderer_h_