Crazy Eddie's GUI System  0.8.4
GeometryBufferBase.h
00001 /***********************************************************************
00002     created:    Tue Apr 30 2013
00003     authors:    Paul D Turner <paul@cegui.org.uk>
00004                 Lukas E Meindl
00005 *************************************************************************/
00006 /***************************************************************************
00007  *   Copyright (C) 2004 - 2013 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 _CEGUIGeometryBufferBase_h_
00029 #define _CEGUIGeometryBufferBase_h_
00030 
00031 #include "../../GeometryBuffer.h"
00032 #include "CEGUI/RendererModules/OpenGL/RendererBase.h"
00033 #include "../../Rect.h"
00034 #include "../../Quaternion.h"
00035 
00036 #include <utility>
00037 #include <vector>
00038 
00039 #if defined(_MSC_VER)
00040 #   pragma warning(push)
00041 #   pragma warning(disable : 4251)
00042 #endif
00043 
00044 namespace CEGUI
00045 {
00046 class OpenGLTexture;
00047 
00052 class OPENGL_GUIRENDERER_API OpenGLGeometryBufferBase : public GeometryBuffer
00053 {
00054 public:
00056     OpenGLGeometryBufferBase(OpenGLRendererBase& owner);
00057     virtual ~OpenGLGeometryBufferBase();
00058 
00059     // implementation of abstract members from GeometryBuffer
00060     void setTranslation(const Vector3f& t);
00061     void setRotation(const Quaternion& r);
00062     void setPivot(const Vector3f& p);
00063     void setClippingRegion(const Rectf& region);
00064     void appendVertex(const Vertex& vertex);
00065     void appendGeometry(const Vertex* const vbuff, uint vertex_count);
00066     void setActiveTexture(Texture* texture);
00067     void reset();
00068     Texture* getActiveTexture() const;
00069     uint getVertexCount() const;
00070     uint getBatchCount() const;
00071     void setRenderEffect(RenderEffect* effect);
00072     RenderEffect* getRenderEffect();
00073     void setClippingActive(const bool active);
00074     bool isClippingActive() const;
00075 
00077     const mat4Pimpl* getMatrix() const;
00078 
00079 protected:
00081     void performBatchManagement();
00082 
00084     void updateMatrix() const;
00085 
00087     struct GLVertex
00088     {
00089         float tex[2];
00090         float colour[4];
00091         float position[3];
00092     };
00093 
00095     struct BatchInfo
00096     {
00097         uint texture;
00098         uint vertexCount;
00099         bool clip;
00100     };
00101 
00103     OpenGLRendererBase* d_owner;
00105     OpenGLTexture* d_activeTexture;
00107     typedef std::vector<BatchInfo> BatchList;
00109     BatchList d_batches;
00111     typedef std::vector<GLVertex> VertexList;
00113     VertexList d_vertices;
00115     Rectf d_clipRect;
00117     bool d_clippingActive;
00119     Vector3f d_translation;
00121     Quaternion d_rotation;
00123     Vector3f d_pivot;
00125     RenderEffect* d_effect;
00127     mutable mat4Pimpl*              d_matrix;
00129     mutable bool                    d_matrixValid;
00130 };
00131 
00132 }
00133 
00134 #if defined(_MSC_VER)
00135 #   pragma warning(pop)
00136 #endif
00137 
00138 #endif
00139 
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends