1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#ifndef MESH_H
#define MESH_H
#include "../Graphics/VertexBuffer.h"
#include "../Utilities/Type.h"
// Ïà¶ÔVertexBuffer¸ü¼Óuplevel
class Mesh
{
public:
Mesh(bool readable = false);
~Mesh();
void IsReadable();
void SetVertices(float* data);
void SetNormals(float* data);
void SetTangents(float* data);
void SetColors(float* data);
void SetTexCoords(int channel, float* data);
void SetTriangles(int* indices);
void SetIndices(int* indices);
void SetVertices(float* data, int start, int length);
void SetNormals(float* data, int start, int length);
void SetTangents(float* data, int start, int length);
void SetColors(float* data, int start, int length);
void SetTexCoords(int channel, float* data, int start, int length);
void SetVertex(float x, float y, float z, int index);
void SetNormal(float x, float y, float z, int index);
void SetTangent(float x, float y, float z, int index);
void SetColor(float r, float g, float b, float a, int index);
void SetTexCoord(float u, float v, int index);
void GetAABB(float bias = 0.f);
inline bool HasVertexAttr(VertexAttrMask attr);
void Draw();
void CalculateNormal();
void CalculateTangent();
private:
uint m_VertexAttrBits;
bool m_IsReadable;
VertexBuffer* m_VBO;
};
inline bool Mesh::HasVertexAttr(VertexAttrMask attr)
{
return m_VertexAttrBits & attr;
}
#endif
|