Crazy Eddie's GUI System
0.8.4
|
00001 /*********************************************************************** 00002 created: Mon Feb 9 2009 00003 author: Paul D Turner 00004 *************************************************************************/ 00005 /*************************************************************************** 00006 * Copyright (C) 2004 - 2011 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 _CEGUIDirect3D9GeometryBuffer_h_ 00028 #define _CEGUIDirect3D9GeometryBuffer_h_ 00029 00030 #include "../../GeometryBuffer.h" 00031 #include "CEGUI/RendererModules/Direct3D9/Renderer.h" 00032 #include "../../Rect.h" 00033 #include "../../Quaternion.h" 00034 #include <d3dx9.h> 00035 #include <utility> 00036 #include <vector> 00037 00038 #if defined(_MSC_VER) 00039 # pragma warning(push) 00040 # pragma warning(disable : 4251) 00041 #endif 00042 00043 // Start of CEGUI namespace section 00044 namespace CEGUI 00045 { 00046 class Direct3D9Texture; 00047 00052 class DIRECT3D9_GUIRENDERER_API Direct3D9GeometryBuffer : public GeometryBuffer 00053 { 00054 public: 00056 Direct3D9GeometryBuffer(Direct3D9Renderer& owner, LPDIRECT3DDEVICE9 device); 00057 00059 const D3DXMATRIX* getMatrix() const; 00060 00061 // implementation of abstract members from GeometryBuffer 00062 void draw() const; 00063 void setTranslation(const Vector3f& t); 00064 void setRotation(const Quaternion& r); 00065 void setPivot(const Vector3f& p); 00066 void setClippingRegion(const Rectf& region); 00067 void appendVertex(const Vertex& vertex); 00068 void appendGeometry(const Vertex* const vbuff, uint vertex_count); 00069 void setActiveTexture(Texture* texture); 00070 void reset(); 00071 Texture* getActiveTexture() const; 00072 uint getVertexCount() const; 00073 uint getBatchCount() const; 00074 void setRenderEffect(RenderEffect* effect); 00075 RenderEffect* getRenderEffect(); 00076 void setClippingActive(const bool active); 00077 bool isClippingActive() const; 00078 00079 protected: 00081 void performBatchManagement(); 00083 void updateMatrix() const; 00084 00086 struct D3DVertex 00087 { 00089 FLOAT x, y, z; 00091 DWORD diffuse; 00093 float tu, tv; 00094 }; 00095 00097 struct BatchInfo 00098 { 00099 LPDIRECT3DTEXTURE9 texture; 00100 uint vertexCount; 00101 bool clip; 00102 }; 00103 00105 Direct3D9Renderer& d_owner; 00107 Direct3D9Texture* d_activeTexture; 00109 typedef std::vector<BatchInfo> BatchList; 00111 BatchList d_batches; 00113 typedef std::vector<D3DVertex> VertexList; 00115 VertexList d_vertices; 00117 Rectf d_clipRect; 00119 bool d_clippingActive; 00121 Vector3f d_translation; 00123 Quaternion d_rotation; 00125 Vector3f d_pivot; 00127 RenderEffect* d_effect; 00129 LPDIRECT3DDEVICE9 d_device; 00131 mutable D3DXMATRIX d_matrix; 00133 mutable bool d_matrixValid; 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 _CEGUIDirect3D9GeometryBuffer_h_