Crazy Eddie's GUI System  0.8.3
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
GeometryBufferBase.h
1 /***********************************************************************
2  filename: GeometryBufferBase.h
3  created: Tue Apr 30 2013
4  authors: Paul D Turner <paul@cegui.org.uk>
5  Lukas E Meindl
6 *************************************************************************/
7 /***************************************************************************
8  * Copyright (C) 2004 - 2013 Paul D Turner & The CEGUI Development Team
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining
11  * a copy of this software and associated documentation files (the
12  * "Software"), to deal in the Software without restriction, including
13  * without limitation the rights to use, copy, modify, merge, publish,
14  * distribute, sublicense, and/or sell copies of the Software, and to
15  * permit persons to whom the Software is furnished to do so, subject to
16  * the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be
19  * included in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27  * OTHER DEALINGS IN THE SOFTWARE.
28  ***************************************************************************/
29 #ifndef _CEGUIGeometryBufferBase_h_
30 #define _CEGUIGeometryBufferBase_h_
31 
32 #include "../../GeometryBuffer.h"
33 #include "CEGUI/RendererModules/OpenGL/RendererBase.h"
34 #include "../../Rect.h"
35 #include "../../Quaternion.h"
36 
37 #include <utility>
38 #include <vector>
39 
40 #if defined(_MSC_VER)
41 # pragma warning(push)
42 # pragma warning(disable : 4251)
43 #endif
44 
45 namespace CEGUI
46 {
47 class OpenGLTexture;
48 
53 class OPENGL_GUIRENDERER_API OpenGLGeometryBufferBase : public GeometryBuffer
54 {
55 public:
58  virtual ~OpenGLGeometryBufferBase();
59 
60  // implementation of abstract members from GeometryBuffer
61  void setTranslation(const Vector3f& t);
62  void setRotation(const Quaternion& r);
63  void setPivot(const Vector3f& p);
64  void setClippingRegion(const Rectf& region);
65  void appendVertex(const Vertex& vertex);
66  void appendGeometry(const Vertex* const vbuff, uint vertex_count);
67  void setActiveTexture(Texture* texture);
68  void reset();
69  Texture* getActiveTexture() const;
70  uint getVertexCount() const;
71  uint getBatchCount() const;
72  void setRenderEffect(RenderEffect* effect);
73  RenderEffect* getRenderEffect();
74  void setClippingActive(const bool active);
75  bool isClippingActive() const;
76 
78  const mat4Pimpl* getMatrix() const;
79 
80 protected:
82  void performBatchManagement();
83 
85  void updateMatrix() const;
86 
88  struct GLVertex
89  {
90  float tex[2];
91  float colour[4];
92  float position[3];
93  };
94 
96  struct BatchInfo
97  {
98  uint texture;
99  uint vertexCount;
100  bool clip;
101  };
102 
108  typedef std::vector<BatchInfo> BatchList;
112  typedef std::vector<GLVertex> VertexList;
128  mutable mat4Pimpl* d_matrix;
130  mutable bool d_matrixValid;
131 };
132 
133 }
134 
135 #if defined(_MSC_VER)
136 # pragma warning(pop)
137 #endif
138 
139 #endif
140