ManaPlus
Public Member Functions | Data Fields
OpenGLGraphicsVertexes Class Reference

#include <openglgraphicsvertexes.h>

Public Member Functions

 OpenGLGraphicsVertexes ()
 
 ~OpenGLGraphicsVertexes ()
 
GLfloat * switchFloatTexArray ()
 
GLint * switchIntVertArray ()
 
GLint * switchIntTexArray ()
 
GLshort * switchShortVertArray ()
 
std::vector< GLfloat * > * getFloatTexPool ()
 
std::vector< GLint * > * getIntVertPool ()
 
std::vector< GLshort * > * getShortVertPool ()
 
std::vector< GLint * > * getIntTexPool ()
 
void switchVp (const int n)
 
GLfloat * continueFloatTexArray ()
 
GLint * continueIntVertArray ()
 
GLshort * continueShortVertArray ()
 
GLint * continueIntTexArray ()
 
int continueVp ()
 
void updateVp (const int n)
 
std::vector< int > * getVp ()
 
void init ()
 
void clear ()
 

Data Fields

int ptr
 
GLfloat * mFloatTexArray
 
GLint * mIntTexArray
 
GLint * mIntVertArray
 
GLshort * mShortVertArray
 
std::vector< int > mVp
 
std::vector< GLfloat * > mFloatTexPool
 
std::vector< GLint * > mIntVertPool
 
std::vector< GLshort * > mShortVertPool
 
std::vector< GLint * > mIntTexPool
 
std::vector< GLuint > mVbo
 

Detailed Description

Definition at line 43 of file openglgraphicsvertexes.h.

Constructor & Destructor Documentation

◆ OpenGLGraphicsVertexes()

OpenGLGraphicsVertexes::OpenGLGraphicsVertexes ( )

Definition at line 31 of file openglgraphicsvertexes.cpp.

31  :
32  ptr(0),
33  mFloatTexArray(nullptr),
34  mIntTexArray(nullptr),
35  mIntVertArray(nullptr),
36  mShortVertArray(nullptr),
37  mVp(),
38  mFloatTexPool(),
39  mIntVertPool(),
41  mIntTexPool(),
42  mVbo()
43 {
44  mFloatTexPool.reserve(30);
45  mIntVertPool.reserve(30);
46  mShortVertPool.reserve(30);
47  mIntTexPool.reserve(30);
48  mVp.reserve(30);
49  mVbo.reserve(30);
50 }

References mFloatTexPool, mIntTexPool, mIntVertPool, mShortVertPool, mVbo, and mVp.

◆ ~OpenGLGraphicsVertexes()

OpenGLGraphicsVertexes::~OpenGLGraphicsVertexes ( )

Definition at line 52 of file openglgraphicsvertexes.cpp.

53 {
54  clear();
55 }

References clear().

Member Function Documentation

◆ clear()

void OpenGLGraphicsVertexes::clear ( )

Definition at line 57 of file openglgraphicsvertexes.cpp.

58 {
59  for (STD_VECTOR<GLfloat*>::iterator it = mFloatTexPool.begin();
60  it != mFloatTexPool.end(); ++ it)
61  {
62  delete [] (*it);
63  }
64  mFloatTexPool.clear();
65 
66  for (STD_VECTOR<GLint*>::iterator it = mIntVertPool.begin();
67  it != mIntVertPool.end(); ++ it)
68  {
69  delete [] (*it);
70  }
71  mIntVertPool.clear();
72 
73  for (STD_VECTOR<GLshort*>::iterator it = mShortVertPool.begin();
74  it != mShortVertPool.end(); ++ it)
75  {
76  delete [] (*it);
77  }
78  mShortVertPool.clear();
79 
80  for (STD_VECTOR<GLint*>::iterator it = mIntTexPool.begin();
81  it != mIntTexPool.end(); ++ it)
82  {
83  delete [] (*it);
84  }
85  mIntTexPool.clear();
86 
87  const int sz = CAST_S32(mVbo.size());
88  if (sz > 0)
89  {
90  mainGraphics->removeArray(sz, &mVbo[0]);
91  mVbo.clear();
92  }
93 
94  mVp.clear();
95  if (ptr != 0)
96  {
97  ptr = 0;
98  delete []mFloatTexArray;
99  mFloatTexArray = nullptr;
100  delete []mIntTexArray;
101  mIntTexArray = nullptr;
102  delete []mIntVertArray;
103  mIntVertArray = nullptr;
104  delete []mShortVertArray;
105  mShortVertArray = nullptr;
106  }
107 }

References CAST_S32, mainGraphics, mFloatTexArray, mFloatTexPool, mIntTexArray, mIntTexPool, mIntVertArray, mIntVertPool, mShortVertArray, mShortVertPool, mVbo, mVp, ptr, and Graphics::removeArray().

Referenced by init(), and ~OpenGLGraphicsVertexes().

◆ continueFloatTexArray()

GLfloat * OpenGLGraphicsVertexes::continueFloatTexArray ( )

Definition at line 168 of file openglgraphicsvertexes.cpp.

169 {
170  if (mFloatTexPool.empty())
171  {
172  mFloatTexArray = new GLfloat[CAST_SIZE(vertexBufSize) * 4 + 30];
173  mFloatTexPool.push_back(mFloatTexArray);
174  }
175  else
176  {
177  mFloatTexArray = mFloatTexPool.back();
178  }
179  return mFloatTexArray;
180 }

References CAST_SIZE, mFloatTexArray, mFloatTexPool, and vertexBufSize.

◆ continueIntTexArray()

GLint * OpenGLGraphicsVertexes::continueIntTexArray ( )

Definition at line 210 of file openglgraphicsvertexes.cpp.

211 {
212  if (mIntTexPool.empty())
213  {
214  mIntTexArray = new GLint[CAST_SIZE(vertexBufSize * 4 + 30)];
215  mIntTexPool.push_back(mIntTexArray);
216  }
217  else
218  {
219  mIntTexArray = mIntTexPool.back();
220  }
221  return mIntTexArray;
222 }

References CAST_SIZE, mIntTexArray, mIntTexPool, and vertexBufSize.

◆ continueIntVertArray()

GLint * OpenGLGraphicsVertexes::continueIntVertArray ( )

Definition at line 182 of file openglgraphicsvertexes.cpp.

183 {
184  if (mIntVertPool.empty())
185  {
186  mIntVertArray = new GLint[CAST_SIZE(vertexBufSize * 4 + 30)];
187  mIntVertPool.push_back(mIntVertArray);
188  }
189  else
190  {
191  mIntVertArray = mIntVertPool.back();
192  }
193  return mIntVertArray;
194 }

References CAST_SIZE, mIntVertArray, mIntVertPool, and vertexBufSize.

◆ continueShortVertArray()

GLshort * OpenGLGraphicsVertexes::continueShortVertArray ( )

Definition at line 196 of file openglgraphicsvertexes.cpp.

197 {
198  if (mShortVertPool.empty())
199  {
200  mShortVertArray = new GLshort[CAST_SIZE(vertexBufSize) * 4 + 30];
201  mShortVertPool.push_back(mShortVertArray);
202  }
203  else
204  {
206  }
207  return mShortVertArray;
208 }

References CAST_SIZE, mShortVertArray, mShortVertPool, and vertexBufSize.

◆ continueVp()

int OpenGLGraphicsVertexes::continueVp ( )

Definition at line 147 of file openglgraphicsvertexes.cpp.

148 {
149  if (mVp.empty())
150  {
151  return 0;
152  }
153  else
154  {
155  const int val = mVp.back();
156  mVp.pop_back();
157  return val;
158  }
159 }

References mVp.

◆ getFloatTexPool()

std::vector<GLfloat*>* OpenGLGraphicsVertexes::getFloatTexPool ( )
inline

Definition at line 60 of file openglgraphicsvertexes.h.

61  { return &mFloatTexPool; }

References mFloatTexPool.

◆ getIntTexPool()

std::vector<GLint*>* OpenGLGraphicsVertexes::getIntTexPool ( )
inline

Definition at line 69 of file openglgraphicsvertexes.h.

70  { return &mIntTexPool; }

References mIntTexPool.

◆ getIntVertPool()

std::vector<GLint*>* OpenGLGraphicsVertexes::getIntVertPool ( )
inline

Definition at line 63 of file openglgraphicsvertexes.h.

64  { return &mIntVertPool; }

References mIntVertPool.

◆ getShortVertPool()

std::vector<GLshort*>* OpenGLGraphicsVertexes::getShortVertPool ( )
inline

Definition at line 66 of file openglgraphicsvertexes.h.

67  { return &mShortVertPool; }

References mShortVertPool.

◆ getVp()

std::vector<int>* OpenGLGraphicsVertexes::getVp ( )
inline

Definition at line 86 of file openglgraphicsvertexes.h.

87  { return &mVp; }

References mVp.

◆ init()

void OpenGLGraphicsVertexes::init ( )

Definition at line 109 of file openglgraphicsvertexes.cpp.

110 {
111  clear();
112 }

References clear().

Referenced by MapLayer::updateOGL().

◆ switchFloatTexArray()

GLfloat * OpenGLGraphicsVertexes::switchFloatTexArray ( )

Definition at line 114 of file openglgraphicsvertexes.cpp.

115 {
116  mFloatTexArray = new GLfloat[CAST_SIZE(vertexBufSize * 4 + 30)];
117  mFloatTexPool.push_back(mFloatTexArray);
118  return mFloatTexArray;
119 }

References CAST_SIZE, mFloatTexArray, mFloatTexPool, and vertexBufSize.

◆ switchIntTexArray()

GLint * OpenGLGraphicsVertexes::switchIntTexArray ( )

Definition at line 135 of file openglgraphicsvertexes.cpp.

136 {
137  mIntTexArray = new GLint[CAST_SIZE(vertexBufSize * 4 + 30)];
138  mIntTexPool.push_back(mIntTexArray);
139  return mIntTexArray;
140 }

References CAST_SIZE, mIntTexArray, mIntTexPool, and vertexBufSize.

◆ switchIntVertArray()

GLint * OpenGLGraphicsVertexes::switchIntVertArray ( )

Definition at line 121 of file openglgraphicsvertexes.cpp.

122 {
123  mIntVertArray = new GLint[CAST_SIZE(vertexBufSize * 4 + 30)];
124  mIntVertPool.push_back(mIntVertArray);
125  return mIntVertArray;
126 }

References CAST_SIZE, mIntVertArray, mIntVertPool, and vertexBufSize.

◆ switchShortVertArray()

GLshort * OpenGLGraphicsVertexes::switchShortVertArray ( )

Definition at line 128 of file openglgraphicsvertexes.cpp.

129 {
130  mShortVertArray = new GLshort[CAST_SIZE(vertexBufSize * 4 + 30)];
131  mShortVertPool.push_back(mShortVertArray);
132  return mShortVertArray;
133 }

References CAST_SIZE, mShortVertArray, mShortVertPool, and vertexBufSize.

◆ switchVp()

void OpenGLGraphicsVertexes::switchVp ( const int  n)

Definition at line 142 of file openglgraphicsvertexes.cpp.

143 {
144  mVp.push_back(n);
145 }

◆ updateVp()

void OpenGLGraphicsVertexes::updateVp ( const int  n)

Definition at line 161 of file openglgraphicsvertexes.cpp.

162 {
163  if (!mVp.empty())
164  mVp.pop_back();
165  mVp.push_back(n);
166 }

Field Documentation

◆ mFloatTexArray

GLfloat* OpenGLGraphicsVertexes::mFloatTexArray

Definition at line 95 of file openglgraphicsvertexes.h.

Referenced by clear(), continueFloatTexArray(), and switchFloatTexArray().

◆ mFloatTexPool

std::vector<GLfloat*> OpenGLGraphicsVertexes::mFloatTexPool

◆ mIntTexArray

GLint* OpenGLGraphicsVertexes::mIntTexArray

Definition at line 96 of file openglgraphicsvertexes.h.

Referenced by clear(), continueIntTexArray(), and switchIntTexArray().

◆ mIntTexPool

std::vector<GLint*> OpenGLGraphicsVertexes::mIntTexPool

◆ mIntVertArray

GLint* OpenGLGraphicsVertexes::mIntVertArray

Definition at line 97 of file openglgraphicsvertexes.h.

Referenced by clear(), continueIntVertArray(), and switchIntVertArray().

◆ mIntVertPool

std::vector<GLint*> OpenGLGraphicsVertexes::mIntVertPool

◆ mShortVertArray

GLshort* OpenGLGraphicsVertexes::mShortVertArray

Definition at line 98 of file openglgraphicsvertexes.h.

Referenced by clear(), continueShortVertArray(), and switchShortVertArray().

◆ mShortVertPool

std::vector<GLshort*> OpenGLGraphicsVertexes::mShortVertPool

◆ mVbo

std::vector<GLuint> OpenGLGraphicsVertexes::mVbo

◆ mVp

std::vector<int> OpenGLGraphicsVertexes::mVp

◆ ptr

int OpenGLGraphicsVertexes::ptr

Definition at line 93 of file openglgraphicsvertexes.h.

Referenced by clear().


The documentation for this class was generated from the following files:
OpenGLGraphicsVertexes::mFloatTexPool
std::vector< GLfloat * > mFloatTexPool
Definition: openglgraphicsvertexes.h:100
CAST_SIZE
#define CAST_SIZE
Definition: cast.h:33
OpenGLGraphicsVertexes::clear
void clear()
Definition: openglgraphicsvertexes.cpp:57
vertexBufSize
unsigned int vertexBufSize
Definition: openglgraphicsvertexes.cpp:29
OpenGLGraphicsVertexes::ptr
int ptr
Definition: openglgraphicsvertexes.h:93
OpenGLGraphicsVertexes::mShortVertPool
std::vector< GLshort * > mShortVertPool
Definition: openglgraphicsvertexes.h:102
OpenGLGraphicsVertexes::mIntVertArray
GLint * mIntVertArray
Definition: openglgraphicsvertexes.h:97
OpenGLGraphicsVertexes::mIntTexArray
GLint * mIntTexArray
Definition: openglgraphicsvertexes.h:96
mainGraphics
Graphics * mainGraphics
Definition: graphics.cpp:108
OpenGLGraphicsVertexes::mShortVertArray
GLshort * mShortVertArray
Definition: openglgraphicsvertexes.h:98
OpenGLGraphicsVertexes::mVbo
std::vector< GLuint > mVbo
Definition: openglgraphicsvertexes.h:104
OpenGLGraphicsVertexes::mVp
std::vector< int > mVp
Definition: openglgraphicsvertexes.h:99
CAST_S32
#define CAST_S32
Definition: cast.h:29
OpenGLGraphicsVertexes::mFloatTexArray
GLfloat * mFloatTexArray
Definition: openglgraphicsvertexes.h:95
Graphics::removeArray
virtual void removeArray(const uint32_t sz, uint32_t *const arr)
Definition: graphics.h:475
OpenGLGraphicsVertexes::mIntVertPool
std::vector< GLint * > mIntVertPool
Definition: openglgraphicsvertexes.h:101
OpenGLGraphicsVertexes::mIntTexPool
std::vector< GLint * > mIntTexPool
Definition: openglgraphicsvertexes.h:103