-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSubDSphere.h
57 lines (43 loc) · 1009 Bytes
/
SubDSphere.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
/*
* Sphere.h: Code for sphere generation
*
* (c) 2001 Stephen Chenney, University of Wisconsin at Madison
*/
#ifndef _SUBDSPHERE_H_
#define _SUBDSPHERE_H_
#include <FL/glu.H>
#include <GL/glut.h>
#include <FL/math.H>
#include "libtarga.h"
#include <stdio.h>
#include <math.h>
typedef struct _Vertex {
float x[3];
} Vertex, *VertexPtr;
typedef struct _Edge {
unsigned int vs;
unsigned int ve;
unsigned int v_new;
unsigned int s_child;
unsigned int e_child;
} Edge, *EdgePtr;
typedef struct _Triangle {
unsigned int edges[3];
bool forward[3];
} Triangle, *TrianglePtr;
class SubDSphere {
private:
unsigned int num_vertices;
Vertex *vertices;
unsigned int num_edges;
Edge *edges;
unsigned int num_faces;
Triangle *faces;
GLuint texture_obj;
public:
~SubDSphere(void);
bool Initialize(void);
void Subdivide(unsigned int);
void Draw(const bool smooth = true);
};
#endif