28 #ifndef HPL_VERTEXBUFFER_H 29 #define HPL_VERTEXBUFFER_H 31 #include "hpl1/engine/graphics/GraphicsTypes.h" 32 #include "hpl1/engine/math/BoundingVolume.h" 33 #include "hpl1/engine/math/MathTypes.h" 34 #include "hpl1/engine/system/SystemTypes.h" 38 class cBoundingVolume;
40 enum eVertexBufferDrawType {
41 eVertexBufferDrawType_Tri,
42 eVertexBufferDrawType_Quad,
43 eVertexBufferDrawType_Lines,
44 eVertexBufferDrawType_LastEnum
47 enum eVertexBufferUsageType {
48 eVertexBufferUsageType_Static,
49 eVertexBufferUsageType_Dynamic,
50 eVertexBufferUsageType_Stream,
51 eVertexBufferUsageType_LastEnum
54 typedef tFlag tVertexFlag;
56 #define eVertexFlag_Normal (0x00000001) 57 #define eVertexFlag_Position (0x00000002) 58 #define eVertexFlag_Color0 (0x00000004) 59 #define eVertexFlag_Color1 (0x00000008) 60 #define eVertexFlag_Texture0 (0x00000010) 61 #define eVertexFlag_Texture1 (0x00000020) 62 #define eVertexFlag_Texture2 (0x00000040) 63 #define eVertexFlag_Texture3 (0x00000080) 64 #define eVertexFlag_Texture4 (0x00000100) 66 #define klNumOfVertexFlags (9) 68 const tVertexFlag kvVertexFlags[] = {eVertexFlag_Normal, eVertexFlag_Position, eVertexFlag_Color0,
69 eVertexFlag_Color1, eVertexFlag_Texture0, eVertexFlag_Texture1, eVertexFlag_Texture2,
70 eVertexFlag_Texture3, eVertexFlag_Texture4};
72 const int kvVertexElements[] = {
84 typedef tFlag tVertexCompileFlag;
86 #define eVertexCompileFlag_CreateTangents (0x00000001) 88 class iLowLevelGraphics;
93 eVertexBufferDrawType aDrawType, eVertexBufferUsageType aUsageType,
94 int alReserveVtxSize,
int alReserveIdxSize) : mVertexFlags(aFlags), mpLowLevelGraphics(apLowLevelGraphics),
95 mDrawType(aDrawType), mUsageType(aUsageType), mlElementNum(-1),
100 tVertexFlag GetFlags() {
return mVertexFlags; }
102 virtual void AddVertex(tVertexFlag aType,
const cVector3f &avVtx) = 0;
103 virtual void AddColor(tVertexFlag aType,
const cColor &aColor) = 0;
104 virtual void AddIndex(
unsigned int alIndex) = 0;
106 virtual bool Compile(tVertexCompileFlag aFlags) = 0;
107 virtual void UpdateData(tVertexFlag aTypes,
bool abIndices) = 0;
120 virtual void Draw(eVertexBufferDrawType aDrawType = eVertexBufferDrawType_LastEnum) = 0;
121 virtual void DrawIndices(
unsigned int *apIndices,
int alCount,
122 eVertexBufferDrawType aDrawType = eVertexBufferDrawType_LastEnum) = 0;
124 virtual void Bind() = 0;
125 virtual void UnBind() = 0;
127 virtual iVertexBuffer *CreateCopy(eVertexBufferUsageType aUsageType) = 0;
131 virtual float *GetArray(tVertexFlag aType) = 0;
132 virtual unsigned int *GetIndices() = 0;
134 virtual int GetVertexNum() = 0;
135 virtual int GetIndexNum() = 0;
140 virtual void ResizeArray(tVertexFlag aType,
int alSize) = 0;
141 virtual void ResizeIndices(
int alSize) = 0;
144 virtual cVector3f GetVector3(tVertexFlag aType,
unsigned alIdx) = 0;
145 virtual cVector3f GetVector4(tVertexFlag aType,
unsigned alIdx) = 0;
146 virtual cColor GetColor(tVertexFlag aType,
unsigned alIdx) = 0;
147 virtual unsigned int GetIndex(tVertexFlag aType,
unsigned alIdx) = 0;
154 int GetElementNum() {
return mlElementNum; }
156 tVertexFlag GetVertexFlags() {
return mVertexFlags; }
158 bool HasTangents() {
return mbTangents; }
159 void SetTangents(
bool abX) { mbTangents = abX; }
162 tVertexFlag mVertexFlags;
163 eVertexBufferDrawType mDrawType;
164 eVertexBufferUsageType mUsageType;
174 #endif // HPL_RENDERER3D_H virtual void ResizeArray(tVertexFlag aType, int alSize)=0
virtual void CreateShadowDouble(bool abUpdateData)=0
Definition: VertexBuffer.h:90
Definition: BoundingVolume.h:71
virtual void Transform(const cMatrixf &mtxTransform)=0
void SetElementNum(int alNum)
Definition: VertexBuffer.h:153
Definition: LowLevelGraphics.h:200