Crazy Eddie's GUI System  0.8.4
GeometryBuffer.h
00001 /***********************************************************************
00002     created:    Tue Mar 10 2009
00003     author:     Paul D Turner (parts based on code by Keith Mok)
00004 *************************************************************************/
00005 /***************************************************************************
00006  *   Copyright (C) 2004 - 2009 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 _CEGUIDirectFBGeometryBuffer_h_
00028 #define _CEGUIDirectFBGeometryBuffer_h_
00029 
00030 #include "CEGUI/GeometryBuffer.h"
00031 #include "CEGUI/Rect.h"
00032 #include "CEGUI/Quaternion.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 Vector3f& v);
00055     void setRotation(const Quaternion& r);
00056     void setPivot(const Vector3f& p);
00057     void setClippingRegion(const Rectf& 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     void setClippingActive(const bool active);
00068     bool isClippingActive() const;
00069 
00070 protected:
00072     void updateMatrix() const;
00073 
00075     struct BatchInfo
00076     {
00077         IDirectFBSurface* texture;
00078         uint vertexCount;
00079         bool clip;
00080     };
00081 
00083     DirectFBRenderer& d_owner;
00085     DirectFBTexture* d_activeTexture;
00087     typedef std::vector<BatchInfo> BatchList;
00089     BatchList d_batches;
00091     typedef std::vector<DFBVertex> VertexList;
00093     VertexList d_vertices;
00095     Rectf d_clipRect;
00097     bool d_clippingActive;
00099     Vector3f d_translation;
00101     Quaternion d_rotation;
00103     Vector3f d_pivot;
00105     RenderEffect* d_effect;
00107     mutable s32 d_matrix[9];
00109     mutable bool d_matrixValid;
00110 };
00111 
00112 } // End of  CEGUI namespace section
00113 
00114 #endif  // end of guard _CEGUIDirectFBGeometryBuffer_h_
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends