9 #ifndef GlobeEngine_ArrayTriangle_h
10 #define GlobeEngine_ArrayTriangle_h
13 #include "OpenGL_Includes.h"
30 memcpy ( this->
data, _data, 3 * D *
sizeof(T) );
36 memcpy ( this->
data, _data, 3 * D *
sizeof(T) );
43 friend std::ostream& operator<< (std::ostream &out, const ArrayTriangle<D,T> &triangle) {
45 out <<
"Array: " << triangle.data[0];
46 for (
int i=1; i < l; i++)
48 out <<
", " << triangle.data[i];
70 this->
data[0] = _p1.
x();
71 this->
data[1] = _p1.
y();
72 this->
data[2] = _p2.
x();
73 this->
data[3] = _p2.
y();
74 this->
data[4] = _p3.
x();
75 this->
data[5] = _p3.
y();
79 for(
short i=0; i < 2; i++)
81 this->
data[i*2] = _data[i].
x();
82 this->
data[i*2+1] = _data[i].
y();
109 this->
data[0] = _p1.
x();
110 this->
data[1] = _p1.
y();
111 this->
data[2] = _p1.
z();
112 this->
data[3] = _p2.
x();
113 this->
data[4] = _p2.
y();
114 this->
data[5] = _p2.
z();
115 this->
data[6] = _p3.
x();
116 this->
data[7] = _p3.
y();
117 this->
data[8] = _p3.
z();
121 for(
short i=0; i < 3; i++)
123 this->
data[i*3] = _data[i].
x();
124 this->
data[i*3+1] = _data[i].
y();
125 this->
data[i*3+2] = _data[i].
z();
152 this->
data[0] = _p1.
x();
153 this->
data[1] = _p1.
y();
154 this->
data[2] = _p1.
z();
155 this->
data[3] = _p1.
w();
156 this->
data[4] = _p2.
x();
157 this->
data[5] = _p2.
y();
158 this->
data[6] = _p2.
z();
159 this->
data[7] = _p2.
w();
160 this->
data[8] = _p3.
x();
161 this->
data[9] = _p3.
y();
162 this->
data[10] = _p3.
z();
163 this->
data[11] = _p3.
w();
167 for(
short i=0; i < 4; i++)
169 this->
data[i*4] = _data[i].
x();
170 this->
data[i*4+1] = _data[i].
y();
171 this->
data[i*4+2] = _data[i].
z();
172 this->
data[i*4+3] = _data[i].
z();
196 allocateMemory(_triangleCount);
197 memcpy ( this->
data, _data, _triangleCount * 3 * D *
sizeof(T) );
205 allocateMemory(_triangleCount);
208 void setAt(
int _idx,
const T _data){
209 this->
data[_idx] = _data;
213 memcpy(this->
data[_startIndex], _data, _pointCount * 3 * D *
sizeof(T));
217 allocateMemory(_triangleCount);
218 memcpy(this->
data, _data, _triangleCount * 3 * D *
sizeof(T) );
229 friend std::ostream& operator<< (std::ostream &out, const TriangleArray<D,T> &triangle) {
230 int l = triangle.getTriangleCount() * 3 * D;
231 out <<
"Array: " << triangle.data[0];
232 for (
int i=1; i < l; i++)
234 out <<
", " << triangle.data[i];
240 void allocateMemory(
int _triangleCount){
243 data =
new T(_triangleCount * 3 * D);
const T * getArray()
Definition: ArrayTriangle.h:221
T y() const
Definition: VBOVertex.h:247
ArrayTriangle4D(const ge::VBOVertex4< T > *_data)
Definition: ArrayTriangle.h:147
ArrayTriangle4D< GLint > ArrayTriangle4Di
Definition: ArrayTriangle.h:181
T x() const
Definition: VBOVertex.h:79
void set(const ge::VBOVertex4< T > _p1, const ge::VBOVertex4< T > _p2, const ge::VBOVertex4< T > _p3)
Definition: ArrayTriangle.h:151
void set(const ge::VBOVertex3< T > _p1, const ge::VBOVertex3< T > _p2, const ge::VBOVertex3< T > _p3)
Definition: ArrayTriangle.h:108
ArrayTriangle4D< GLushort > ArrayTriangle4Dus
Definition: ArrayTriangle.h:180
void set(const ge::Vertex2< T > _p1, const ge::Vertex2< T > _p2, const ge::Vertex2< T > _p3)
Definition: ArrayTriangle.h:69
ArrayTriangle2D< GLint > ArrayTriangle2Di
Definition: ArrayTriangle.h:91
Definition: ArrayTriangle.h:24
Definition: AvalancheTrainingSimulationEngine.h:39
~TriangleArray()
Definition: ArrayTriangle.h:200
TriangleArray< 3, GLdouble > TriangleArray3Dd
Definition: ArrayTriangle.h:260
ArrayTriangle3D< GLshort > ArrayTriangle3Ds
Definition: ArrayTriangle.h:132
ArrayTriangle3D< GLubyte > ArrayTriangle3Dub
Definition: ArrayTriangle.h:131
ArrayTriangle4D< GLdouble > ArrayTriangle4Dd
Definition: ArrayTriangle.h:184
void set(const ge::VBOVertex3< T > *_data)
Definition: ArrayTriangle.h:120
ArrayTriangle2D< GLfloat > ArrayTriangle2Df
Definition: ArrayTriangle.h:93
ArrayTriangle4D< GLubyte > ArrayTriangle4Dub
Definition: ArrayTriangle.h:178
void set(const ge::Vertex2< T > *_data)
Definition: ArrayTriangle.h:78
ArrayTriangle2D< GLuint > ArrayTriangle2Dui
Definition: ArrayTriangle.h:92
T y() const
Definition: VBOVertex.h:80
ArrayTriangle4D< GLfloat > ArrayTriangle4Df
Definition: ArrayTriangle.h:183
ArrayTriangle2D< GLshort > ArrayTriangle2Ds
Definition: ArrayTriangle.h:89
void setRangeArray(int _startIndex, int _pointCount, const T *_data)
Definition: ArrayTriangle.h:212
ArrayTriangle3D(const ge::VBOVertex3< T > _p1, const ge::VBOVertex3< T > _p2, const ge::VBOVertex3< T > _p3)
Definition: ArrayTriangle.h:100
Definition: ArrayTriangle.h:57
ArrayTriangle3D()
Definition: ArrayTriangle.h:99
Definition: ArrayTriangle.h:96
Definition: ArrayTriangle.h:139
ArrayTriangle()
Definition: ArrayTriangle.h:27
ArrayTriangle4D()
Definition: ArrayTriangle.h:142
ArrayTriangle2D< GLbyte > ArrayTriangle2Db
Definition: ArrayTriangle.h:87
T y() const
Definition: VBOVertex.h:132
ArrayTriangle3D< GLint > ArrayTriangle3Di
Definition: ArrayTriangle.h:134
T x() const
Definition: VBOVertex.h:246
T z() const
Definition: VBOVertex.h:133
ArrayTriangle3D(const ge::VBOVertex3< T > *_data)
Definition: ArrayTriangle.h:104
ArrayTriangle2D(const ge::Vertex2< T > *_data)
Definition: ArrayTriangle.h:65
T x() const
Definition: VBOVertex.h:131
ArrayTriangle4D< GLshort > ArrayTriangle4Ds
Definition: ArrayTriangle.h:179
ArrayTriangle3D< GLbyte > ArrayTriangle3Db
Definition: ArrayTriangle.h:130
ArrayTriangle2D< GLubyte > ArrayTriangle2Dub
Definition: ArrayTriangle.h:88
void set(const ge::VBOVertex4< T > *_data)
Definition: ArrayTriangle.h:166
~ArrayTriangle()
Definition: ArrayTriangle.h:33
ArrayTriangle3D< GLushort > ArrayTriangle3Dus
Definition: ArrayTriangle.h:133
ArrayTriangle3D< GLfloat > ArrayTriangle3Df
Definition: ArrayTriangle.h:136
Definition: VBOVertex.h:115
ArrayTriangle(const T *_data)
Definition: ArrayTriangle.h:29
void setAt(int _idx, const T _data)
Definition: ArrayTriangle.h:208
ArrayTriangle3D< GLdouble > ArrayTriangle3Dd
Definition: ArrayTriangle.h:137
int triangleCount
Definition: ArrayTriangle.h:256
T data[3 *D]
Definition: ArrayTriangle.h:54
ArrayTriangle4D< GLuint > ArrayTriangle4Dui
Definition: ArrayTriangle.h:182
T * data
Definition: ArrayTriangle.h:257
void setArray(const T *_data)
Definition: ArrayTriangle.h:35
ArrayTriangle2D< GLdouble > ArrayTriangle2Dd
Definition: ArrayTriangle.h:94
void create(int _triangleCount)
Definition: ArrayTriangle.h:204
const int getTriangleCount()
Definition: ArrayTriangle.h:225
ArrayTriangle4D< GLbyte > ArrayTriangle4Db
Definition: ArrayTriangle.h:177
T w() const
Definition: VBOVertex.h:249
Definition: ArrayTriangle.h:188
TriangleArray(int _triangleCount, const T *_data)
Definition: ArrayTriangle.h:195
ArrayTriangle2D()
Definition: ArrayTriangle.h:60
Definition: VBOVertex.h:51
ArrayTriangle2D< GLushort > ArrayTriangle2Dus
Definition: ArrayTriangle.h:90
TriangleArray()
Definition: ArrayTriangle.h:191
void setArray(int _triangleCount, const T *_data)
Definition: ArrayTriangle.h:216
Definition: VBOVertex.h:228
const T * getArray()
Definition: ArrayTriangle.h:39
ArrayTriangle3D< GLuint > ArrayTriangle3Dui
Definition: ArrayTriangle.h:135
ArrayTriangle2D(const ge::Vertex2< T > _p1, const ge::Vertex2< T > _p2, const ge::Vertex2< T > _p3)
Definition: ArrayTriangle.h:61
T z() const
Definition: VBOVertex.h:248
ArrayTriangle4D(const ge::VBOVertex4< T > _p1, const ge::VBOVertex4< T > _p2, const ge::VBOVertex4< T > _p3)
Definition: ArrayTriangle.h:143