Crazy Eddies GUI System 0.7.6
|
00001 /*********************************************************************** 00002 filename: CEGUIDirect3D11GeometryBuffer.h 00003 created: Wed May 5 2010 00004 *************************************************************************/ 00005 /*************************************************************************** 00006 * Copyright (C) 2004 - 2010 Paul D Turner & The CEGUI Development Team 00007 * 00008 * Permission is hereby granted, free of charge, to any person obtaining 00009 * a copy of this software and associated documentation files (the 00010 * "Software"), to deal in the Software without restriction, including 00011 * without limitation the rights to use, copy, modify, merge, publish, 00012 * distribute, sublicense, and/or sell copies of the Software, and to 00013 * permit persons to whom the Software is furnished to do so, subject to 00014 * the following conditions: 00015 * 00016 * The above copyright notice and this permission notice shall be 00017 * included in all copies or substantial portions of the Software. 00018 * 00019 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00020 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00021 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00022 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00023 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00024 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00025 * OTHER DEALINGS IN THE SOFTWARE. 00026 ***************************************************************************/ 00027 #ifndef _CEGUIDirect3D11GeometryBuffer_h_ 00028 #define _CEGUIDirect3D11GeometryBuffer_h_ 00029 00030 #include "../../CEGUIGeometryBuffer.h" 00031 #include "CEGUIDirect3D11Renderer.h" 00032 #include "../../CEGUIRect.h" 00033 00034 00035 00036 00037 #if defined(_MSC_VER) 00038 # pragma warning(push) 00039 # pragma warning(disable : 4251) 00040 #endif 00041 00042 // Start of CEGUI namespace section 00043 namespace CEGUI 00044 { 00045 class Direct3D11Texture; 00046 00048 class D3D11_GUIRENDERER_API Direct3D11GeometryBuffer : public GeometryBuffer 00049 { 00050 public: 00052 Direct3D11GeometryBuffer(Direct3D11Renderer& owner); 00053 00055 ~Direct3D11GeometryBuffer(); 00056 00058 const D3DXMATRIX* getMatrix() const; 00059 00060 // Implement GeometryBuffer interface. 00061 void draw() const; 00062 void setTranslation(const Vector3& v); 00063 void setRotation(const Vector3& r); 00064 void setPivot(const Vector3& p); 00065 void setClippingRegion(const Rect& region); 00066 void appendVertex(const Vertex& vertex); 00067 void appendGeometry(const Vertex* const vbuff, uint vertex_count); 00068 void setActiveTexture(Texture* texture); 00069 void reset(); 00070 Texture* getActiveTexture() const; 00071 uint getVertexCount() const; 00072 uint getBatchCount() const; 00073 void setRenderEffect(RenderEffect* effect); 00074 RenderEffect* getRenderEffect(); 00075 00076 protected: 00078 void updateMatrix() const; 00080 void syncHardwareBuffer() const; 00082 void allocateVertexBuffer(const size_t count) const; 00084 void cleanupVertexBuffer() const; 00085 00087 struct D3DVertex 00088 { 00090 FLOAT x, y, z; 00092 DWORD diffuse; 00094 float tu, tv; 00095 }; 00096 00097 // Direct3D11Renderer object that created and owns this GeometryBuffer. 00098 Direct3D11Renderer& d_owner; 00100 IDevice11& d_device; 00102 Direct3D11Texture* d_activeTexture; 00104 mutable ID3D11Buffer* d_vertexBuffer; 00106 mutable UINT d_bufferSize; 00108 mutable bool d_bufferSynched; 00110 typedef std::pair<const ID3D11ShaderResourceView*, uint> BatchInfo; 00112 typedef std::vector<BatchInfo> BatchList; 00114 BatchList d_batches; 00116 typedef std::vector<D3DVertex> VertexList; 00118 VertexList d_vertices; 00120 Rect d_clipRect; 00122 Vector3 d_translation; 00124 Vector3 d_rotation; 00126 Vector3 d_pivot; 00128 RenderEffect* d_effect; 00130 mutable D3DXMATRIX d_matrix; 00132 mutable bool d_matrixValid; 00133 }; 00134 00135 00136 } // End of CEGUI namespace section 00137 00138 #if defined(_MSC_VER) 00139 # pragma warning(pop) 00140 #endif 00141 00142 #endif // end of guard _CEGUIDirect3D11GeometryBuffer_h_