ScummVM API documentation
vertex_buffer_tgl.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef HPL_VERTEXBUFFER_TGL_H
23#define HPL_VERTEXBUFFER_TGL_H
24
25#include "hpl1/engine/graphics/VertexBuffer.h"
26
27#ifdef USE_TINYGL
28
29namespace hpl {
30
31class VertexBufferTGL : public iVertexBuffer {
32public:
33 VertexBufferTGL(iLowLevelGraphics *apLowLevelGraphics, tVertexFlag aFlags,
34 eVertexBufferDrawType aDrawType, eVertexBufferUsageType aUsageType,
35 int alReserveVtxSize, int alReserveIdxSize);
36 ~VertexBufferTGL();
37
38 void AddVertex(tVertexFlag aType, const cVector3f &avVtx);
39 void AddColor(tVertexFlag aType, const cColor &aColor);
40 void AddIndex(unsigned int alIndex);
41
42 bool Compile(tVertexCompileFlag aFlags);
43 void UpdateData(tVertexFlag aTypes, bool abIndices);
44
45 void CreateShadowDouble(bool abUpdateData);
46
47 void Transform(const cMatrixf &mtxTransform);
48
49 void Draw(eVertexBufferDrawType aDrawType);
50 void DrawIndices(unsigned int *apIndices, int alCount,
51 eVertexBufferDrawType aDrawType = eVertexBufferDrawType_LastEnum);
52
53 void Bind();
54 void UnBind();
55
56 iVertexBuffer *CreateCopy(eVertexBufferUsageType aUsageType);
57
58 cBoundingVolume CreateBoundingVolume();
59
60 float *GetArray(tVertexFlag aType);
61 unsigned int *GetIndices();
62
63 void ResizeArray(tVertexFlag aType, int alSize);
64 void ResizeIndices(int alSize);
65
66 // For debugging purposes
67 int GetVertexNum();
68 int GetIndexNum();
69
70 cVector3f GetVector3(tVertexFlag aType, unsigned alIdx);
71 cVector3f GetVector4(tVertexFlag aType, unsigned alIdx);
72 cColor GetColor(tVertexFlag aType, unsigned alIdx);
73 unsigned int GetIndex(tVertexFlag aType, unsigned alIdx);
74
75private:
76 void SetVertexStates(tVertexFlag aFlags);
77
78 tFloatVec mvVertexArray[klNumOfVertexFlags];
79 tUIntVec mvIndexArray;
80
81 bool mbTangents;
82
83 bool mbHasShadowDouble;
84};
85
86} // namespace hpl
87
88#endif // USE_TINYGL
89
90#endif // HPL_RENDERER3D_OGL_H