Crazy Eddies GUI System 0.7.6
|
00001 /*********************************************************************** 00002 filename: CEGUIDirect3D10Renderer.h 00003 created: Sat Mar 7 2009 00004 author: Paul D Turner (parts based on code by Rajko Stojadinovic) 00005 *************************************************************************/ 00006 /*************************************************************************** 00007 * Copyright (C) 2004 - 2010 Paul D Turner & The CEGUI Development Team 00008 * 00009 * Permission is hereby granted, free of charge, to any person obtaining 00010 * a copy of this software and associated documentation files (the 00011 * "Software"), to deal in the Software without restriction, including 00012 * without limitation the rights to use, copy, modify, merge, publish, 00013 * distribute, sublicense, and/or sell copies of the Software, and to 00014 * permit persons to whom the Software is furnished to do so, subject to 00015 * the following conditions: 00016 * 00017 * The above copyright notice and this permission notice shall be 00018 * included in all copies or substantial portions of the Software. 00019 * 00020 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00021 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00022 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00023 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00024 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00025 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00026 * OTHER DEALINGS IN THE SOFTWARE. 00027 ***************************************************************************/ 00028 #ifndef _CEGUIDirect3D10Renderer_h_ 00029 #define _CEGUIDirect3D10Renderer_h_ 00030 00031 #include "../../CEGUIRenderer.h" 00032 #include "../../CEGUISize.h" 00033 #include "../../CEGUIVector.h" 00034 #include <vector> 00035 00036 #if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC) 00037 # ifdef DIRECT3D10_GUIRENDERER_EXPORTS 00038 # define D3D10_GUIRENDERER_API __declspec(dllexport) 00039 # else 00040 # define D3D10_GUIRENDERER_API __declspec(dllimport) 00041 # endif 00042 #else 00043 # define D3D10_GUIRENDERER_API 00044 #endif 00045 00046 #if defined(_MSC_VER) 00047 # pragma warning(push) 00048 # pragma warning(disable : 4251) 00049 #endif 00050 00051 // D3D forward refs 00052 struct ID3D10Device; 00053 struct ID3D10Effect; 00054 struct ID3D10EffectTechnique; 00055 struct ID3D10InputLayout; 00056 struct ID3D10EffectShaderResourceVariable; 00057 struct ID3D10EffectMatrixVariable; 00058 struct ID3D10ShaderResourceView; 00059 struct D3DXMATRIX; 00060 00061 // Start of CEGUI namespace section 00062 namespace CEGUI 00063 { 00064 class Direct3D10GeometryBuffer; 00065 class Direct3D10Texture; 00066 00068 class D3D10_GUIRENDERER_API Direct3D10Renderer : public Renderer 00069 { 00070 public: 00088 static Direct3D10Renderer& bootstrapSystem(ID3D10Device* device); 00089 00105 static void destroySystem(); 00106 00111 static Direct3D10Renderer& create(ID3D10Device* device); 00112 00120 static void destroy(Direct3D10Renderer& renderer); 00121 00123 ID3D10Device& getDirect3DDevice() const; 00124 00126 void bindTechniquePass(const BlendMode mode); 00128 void setCurrentTextureShaderResource(ID3D10ShaderResourceView* srv); 00130 void setProjectionMatrix(D3DXMATRIX& matrix); 00132 void setWorldMatrix(D3DXMATRIX& matrix); 00133 00134 // Implement interface from Renderer 00135 RenderingRoot& getDefaultRenderingRoot(); 00136 GeometryBuffer& createGeometryBuffer(); 00137 void destroyGeometryBuffer(const GeometryBuffer& buffer); 00138 void destroyAllGeometryBuffers(); 00139 TextureTarget* createTextureTarget(); 00140 void destroyTextureTarget(TextureTarget* target); 00141 void destroyAllTextureTargets(); 00142 Texture& createTexture(); 00143 Texture& createTexture(const String& filename, const String& resourceGroup); 00144 Texture& createTexture(const Size& size); 00145 void destroyTexture(Texture& texture); 00146 void destroyAllTextures(); 00147 void beginRendering(); 00148 void endRendering(); 00149 void setDisplaySize(const Size& sz); 00150 const Size& getDisplaySize() const; 00151 const Vector2& getDisplayDPI() const; 00152 uint getMaxTextureSize() const; 00153 const String& getIdentifierString() const; 00154 00155 protected: 00157 Direct3D10Renderer(ID3D10Device* device); 00158 00160 ~Direct3D10Renderer(); 00161 00163 Size getViewportSize(); 00164 00166 static String d_rendererID; 00168 ID3D10Device* d_device; 00170 Size d_displaySize; 00172 Vector2 d_displayDPI; 00174 RenderTarget* d_defaultTarget; 00176 RenderingRoot* d_defaultRoot; 00178 typedef std::vector<TextureTarget*> TextureTargetList; 00180 TextureTargetList d_textureTargets; 00182 typedef std::vector<Direct3D10GeometryBuffer*> GeometryBufferList; 00184 GeometryBufferList d_geometryBuffers; 00186 typedef std::vector<Direct3D10Texture*> TextureList; 00188 TextureList d_textures; 00190 ID3D10Effect* d_effect; 00192 ID3D10EffectTechnique* d_normalTechnique; 00194 ID3D10EffectTechnique* d_premultipliedTechnique; 00196 ID3D10InputLayout* d_inputLayout; 00198 ID3D10EffectShaderResourceVariable* d_boundTextureVariable; 00200 ID3D10EffectMatrixVariable* d_worldMatrixVariable; 00202 ID3D10EffectMatrixVariable* d_projectionMatrixVariable; 00203 }; 00204 00205 00206 } // End of CEGUI namespace section 00207 00208 #if defined(_MSC_VER) 00209 # pragma warning(pop) 00210 #endif 00211 00212 #endif // end of guard _CEGUIDirect3D10Renderer_h_