Crazy Eddies GUI System  0.7.6
CEGUIDirectFBGeometryBuffer.h
00001 /***********************************************************************
00002     filename:   CEGUIDirectFBGeometryBuffer.h
00003     created:    Tue Mar 10 2009
00004     author:     Paul D Turner (parts based on code by Keith Mok)
00005 *************************************************************************/
00006 /***************************************************************************
00007  *   Copyright (C) 2004 - 2009 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 _CEGUIDirectFBGeometryBuffer_h_
00029 #define _CEGUIDirectFBGeometryBuffer_h_
00030 
00031 #include "../../CEGUIGeometryBuffer.h"
00032 #include "../../CEGUIRect.h"
00033 #include <directfb.h>
00034 #include <vector>
00035 
00036 
00037 // Start of CEGUI namespace section
00038 namespace CEGUI
00039 {
00040 class DirectFBRenderer;
00041 class DirectFBTexture;
00042 
00044 class DirectFBGeometryBuffer : public GeometryBuffer
00045 {
00046 public:
00048     DirectFBGeometryBuffer(DirectFBRenderer& owner);
00050     ~DirectFBGeometryBuffer();
00051 
00052     // Implement GeometryBuffer interface.
00053     void draw() const;
00054     void setTranslation(const Vector3& v);
00055     void setRotation(const Vector3& r);
00056     void setPivot(const Vector3& p);
00057     void setClippingRegion(const Rect& region);
00058     void appendVertex(const Vertex& vertex);
00059     void appendGeometry(const Vertex* const vbuff, uint vertex_count);
00060     void setActiveTexture(Texture* texture);
00061     void reset();
00062     Texture* getActiveTexture() const;
00063     uint getVertexCount() const;
00064     uint getBatchCount() const;
00065     void setRenderEffect(RenderEffect* effect);
00066     RenderEffect* getRenderEffect();
00067 
00068 protected:
00070     void updateMatrix() const;
00071 
00073     DirectFBRenderer& d_owner;
00075     DirectFBTexture* d_activeTexture;
00077     typedef std::pair<IDirectFBSurface*, uint> BatchInfo;
00079     typedef std::vector<BatchInfo> BatchList;
00081     BatchList d_batches;
00083     typedef std::vector<DFBVertex> VertexList;
00085     VertexList d_vertices;
00087     Rect d_clipRect;
00089     Vector3 d_translation;
00091     Vector3 d_rotation;
00093     Vector3 d_pivot;
00095     RenderEffect* d_effect;
00097     mutable s32 d_matrix[9];
00099     mutable bool d_matrixValid;
00100 };
00101 
00102 } // End of  CEGUI namespace section
00103 
00104 #endif  // end of guard _CEGUIDirectFBGeometryBuffer_h_