ScummVM API documentation
VertexBufferOGL.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 /*
23  * Copyright (C) 2006-2010 - Frictional Games
24  *
25  * This file is part of HPL1 Engine.
26  */
27 
28 #ifndef HPL_VERTEXBUFFER_OGL_H
29 #define HPL_VERTEXBUFFER_OGL_H
30 
31 #include "common/scummsys.h"
32 #include "hpl1/engine/graphics/VertexBuffer.h"
33 #include "hpl1/opengl.h"
34 
35 #ifdef HPL1_USE_OPENGL
36 
37 namespace hpl {
38 
39 class cVertexBufferOGL : public iVertexBuffer {
40 public:
41  cVertexBufferOGL(iLowLevelGraphics *apLowLevelGraphics, tVertexFlag aFlags,
42  eVertexBufferDrawType aDrawType, eVertexBufferUsageType aUsageType,
43  int alReserveVtxSize, int alReserveIdxSize);
44  ~cVertexBufferOGL();
45 
46  void AddVertex(tVertexFlag aType, const cVector3f &avVtx);
47  void AddColor(tVertexFlag aType, const cColor &aColor);
48  void AddIndex(unsigned int alIndex);
49 
50  bool Compile(tVertexCompileFlag aFlags);
51  void UpdateData(tVertexFlag aTypes, bool abIndices);
52 
53  void CreateShadowDouble(bool abUpdateData);
54 
55  void Transform(const cMatrixf &mtxTransform);
56 
57  void Draw(eVertexBufferDrawType aDrawType);
58  void DrawIndices(unsigned int *apIndices, int alCount,
59  eVertexBufferDrawType aDrawType = eVertexBufferDrawType_LastEnum);
60 
61  void Bind();
62  void UnBind();
63 
64  iVertexBuffer *CreateCopy(eVertexBufferUsageType aUsageType);
65 
66  cBoundingVolume CreateBoundingVolume();
67 
68  float *GetArray(tVertexFlag aType);
69  unsigned int *GetIndices();
70 
71  void ResizeArray(tVertexFlag aType, int alSize);
72  void ResizeIndices(int alSize);
73 
74  // For debugging purposes
75  int GetVertexNum();
76  int GetIndexNum();
77 
78  cVector3f GetVector3(tVertexFlag aType, unsigned alIdx);
79  cVector3f GetVector4(tVertexFlag aType, unsigned alIdx);
80  cColor GetColor(tVertexFlag aType, unsigned alIdx);
81  unsigned int GetIndex(tVertexFlag aType, unsigned alIdx);
82 
83 private:
84  void SetVertexStates(tVertexFlag aFlags);
85 
86  tFloatVec mvVertexArray[klNumOfVertexFlags];
87  tUIntVec mvIndexArray;
88 
89  bool mbTangents;
90 
91  bool mbHasShadowDouble;
92 };
93 
94 } // namespace hpl
95 
96 #endif // HPL1_USE_OPENGL
97 #endif // HPL_RENDERER3D_OGL_H
Definition: AI.h:36