Crazy Eddie's GUI System  0.8.4
GeometryBuffer.h
00001 /***********************************************************************
00002     created:    Thu Jan 8 2009
00003     author:     Paul D Turner
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 _CEGUIOpenGLESGeometryBuffer_h_
00028 #define _CEGUIOpenGLESGeometryBuffer_h_
00029 
00030 #include "CEGUI/GeometryBuffer.h"
00031 #include "CEGUI/RendererModules/OpenGLES/Renderer.h"
00032 #include "CEGUI/Rect.h"
00033 #include "CEGUI/Quaternion.h"
00034 
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 OpenGLESTexture;
00047 
00052 class OPENGLES_GUIRENDERER_API OpenGLESGeometryBuffer : public GeometryBuffer
00053 {
00054 public:
00056     OpenGLESGeometryBuffer();
00057 
00058     // implementation of abstract members from GeometryBuffer
00059     void draw() const;
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 
00075         const float* getMatrix() const;
00076 
00077 protected:
00079     void performBatchManagement();
00080 
00082     void updateMatrix() const;
00083 
00085     struct GLVertex
00086     {
00087         float tex[2];
00088         float colour[4];
00089         float position[3];
00090     };
00091 
00093     OpenGLESTexture* d_activeTexture;
00095     typedef std::pair<uint, uint> BatchInfo;
00097     typedef std::vector<BatchInfo> BatchList;
00099     BatchList d_batches;
00101     typedef std::vector<GLVertex> VertexList;
00103     VertexList d_vertices;
00105     Rectf d_clipRect;
00107     Vector3f d_translation;
00109     Quaternion d_rotation;
00111     Vector3f d_pivot;
00113     RenderEffect* d_effect;
00115     mutable float d_matrix[16];
00117     mutable bool d_matrixValid;
00118 };
00119 
00120 
00121 } // End of  CEGUI namespace section
00122 
00123 #if defined(_MSC_VER)
00124 #   pragma warning(pop)
00125 #endif
00126 
00127 #endif  // end of guard _CEGUIOpenGLESGeometryBuffer_h_
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends