Crazy Eddies GUI System  0.7.9
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
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_
Class used as a two dimensional vector (aka a Point)
Definition: CEGUIVector.h:45
RenderTarget * d_defaultTarget
The default RenderTarget (used by d_defaultRoot)
Definition: CEGUIDirect3D10Renderer.h:174
static String d_rendererID
String holding the renderer identification text.
Definition: CEGUIDirect3D10Renderer.h:166
std::vector< Direct3D10Texture * > TextureList
container type used to hold Textures we create.
Definition: CEGUIDirect3D10Renderer.h:186
TextureTargetList d_textureTargets
Container used to track texture targets.
Definition: CEGUIDirect3D10Renderer.h:180
Abstract class defining the interface for objects that buffer geometry for later rendering.
Definition: CEGUIGeometryBuffer.h:42
Size d_displaySize
What the renderer considers to be the current display size.
Definition: CEGUIDirect3D10Renderer.h:170
Class that holds the size (width &amp; height) of something.
Definition: CEGUISize.h:43
Specialisation of RenderTarget interface that should be used as the base class for RenderTargets that...
Definition: CEGUITextureTarget.h:41
std::vector< Direct3D10GeometryBuffer * > GeometryBufferList
container type used to hold GeometryBuffers we create.
Definition: CEGUIDirect3D10Renderer.h:182
ID3D10Effect * d_effect
Effect (shader) used when rendering.
Definition: CEGUIDirect3D10Renderer.h:190
ID3D10Device * d_device
The D3D device we&#39;re using to render with.
Definition: CEGUIDirect3D10Renderer.h:168
std::vector< TextureTarget * > TextureTargetList
container type used to hold TextureTargets we create.
Definition: CEGUIDirect3D10Renderer.h:178
Abstract base class specifying the required interface for Texture objects.
Definition: CEGUITexture.h:50
ID3D10InputLayout * d_inputLayout
D3D10 input layout describing the vertex format we use.
Definition: CEGUIDirect3D10Renderer.h:196
Abstract class defining the basic required interface for Renderer objects.
Definition: CEGUIRenderer.h:80
RenderingRoot * d_defaultRoot
The default rendering root object.
Definition: CEGUIDirect3D10Renderer.h:176
ID3D10EffectShaderResourceVariable * d_boundTextureVariable
Variable to access current texture (actually shader resource view)
Definition: CEGUIDirect3D10Renderer.h:198
ID3D10EffectTechnique * d_premultipliedTechnique
Rendering technique that supplies BM_RTT_PREMULTIPLIED type rendering.
Definition: CEGUIDirect3D10Renderer.h:194
BlendMode
Enumerated type that contains the valid options that specify the type of blending that is to be perfo...
Definition: CEGUIRenderer.h:59
Vector2 d_displayDPI
What the renderer considers to be the current display DPI resolution.
Definition: CEGUIDirect3D10Renderer.h:172
Definition: CEGUIRenderingRoot.h:36
ID3D10EffectMatrixVariable * d_projectionMatrixVariable
Variable to access projection matrix used in geometry transformation.
Definition: CEGUIDirect3D10Renderer.h:202
Defines interface to some surface that can be rendered to. Concrete instances of objects that impleme...
Definition: CEGUIRenderTarget.h:42
ID3D10EffectTechnique * d_normalTechnique
Rendering technique that supplies BM_NORMAL type rendering.
Definition: CEGUIDirect3D10Renderer.h:192
GeometryBufferList d_geometryBuffers
Container used to track geometry buffers.
Definition: CEGUIDirect3D10Renderer.h:184
Renderer implementation using Direct3D 10.
Definition: CEGUIDirect3D10Renderer.h:68
TextureList d_textures
Container used to track textures.
Definition: CEGUIDirect3D10Renderer.h:188
ID3D10EffectMatrixVariable * d_worldMatrixVariable
Variable to access world matrix used in geometry transformation.
Definition: CEGUIDirect3D10Renderer.h:200
String class used within the GUI system.
Definition: CEGUIString.h:57