00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
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
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
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
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 }
00137
00138 #if defined(_MSC_VER)
00139 # pragma warning(pop)
00140 #endif
00141
00142 #endif // end of guard _CEGUIDirect3D11GeometryBuffer_h_