-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQuadMesh.h
65 lines (45 loc) · 1.06 KB
/
QuadMesh.h
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
63
64
65
struct MeshVertex
{
VECTOR3D position;
VECTOR3D normal;
};
struct MeshQuad
{
// pointers to vertices of each quad
MeshVertex *vertices[4];
};
class QuadMesh
{
private:
int maxMeshSize;
int minMeshSize;
float meshDim;
int numVertices;
MeshVertex *vertices;
int numQuads;
MeshQuad *quads;
int numFacesDrawn;
GLfloat mat_ambient[4];
GLfloat mat_specular[4];
GLfloat mat_diffuse[4];
GLfloat mat_shininess[1];
private:
bool CreateMemory();
void FreeMemory();
public:
typedef std::pair<int, int> MaxMeshDim;
QuadMesh(int maxMeshSize = 40, float meshDim = 1.0f);
~QuadMesh()
{
FreeMemory();
}
MaxMeshDim GetMaxMeshDimentions()
{
return MaxMeshDim(minMeshSize, maxMeshSize);
}
bool InitMesh(int meshSize, VECTOR3D origin, double meshLength, double meshWidth,VECTOR3D dir1, VECTOR3D dir2);
void DrawMesh(int meshSize);
void UpdateMesh();
void SetMaterial(VECTOR3D ambient, VECTOR3D diffuse, VECTOR3D specular, double shininess);
void ComputeNormals();
};