-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmoebius.h
More file actions
81 lines (63 loc) · 1.55 KB
/
moebius.h
File metadata and controls
81 lines (63 loc) · 1.55 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef CSI4130_MOEBIUS_H_
#define CSI4130_MOEBIUS_H_
#include <cassert>
#include <cstdlib> // Needed in windows for rand
// gl types
#include <GL/glew.h>
//#if WIN32
//#include <gl/wglew.h>
//#else
//#include <GL/glext.h>
//#endif
// glm types
#include <glm/glm.hpp>
class MoebiusStrip {
private:
const static int g_nPoints;
const static int g_nIndices;
int g_nNormals;
public:
// indexed specification
const static GLfloat g_vertex[];
const static GLushort g_index[];
GLfloat g_normal[360];
public:
inline MoebiusStrip();
inline ~MoebiusStrip();
// indexed drawing
inline int getNPoints() const;
inline int getNNormals();
inline glm::vec3 getVertex( int _num );
inline int getNIndices() const;
inline GLushort getIndex( int _num ) const;
glm::vec3 getUnitNormal(int p1index1, int p1index2, int p2index1, int p2index2);
private:
void calculateNormals();
// no copy or assignment
MoebiusStrip(const MoebiusStrip& _oMoebiusStrips );
MoebiusStrip& operator=( const MoebiusStrip& _oMoebiusStrips );
};
MoebiusStrip::MoebiusStrip() {
g_nNormals = 120;
calculateNormals();
}
MoebiusStrip::~MoebiusStrip() {
}
int MoebiusStrip::getNPoints() const {
return g_nPoints;
}
int MoebiusStrip::getNNormals() {
return g_nNormals;
}
glm::vec3 MoebiusStrip::getVertex( int _num ) {
assert( _num < g_nPoints );
return glm::vec3(g_vertex[_num*3],g_vertex[_num*3+1],g_vertex[_num*3+2]);
}
int MoebiusStrip::getNIndices() const {
return g_nIndices;
}
GLushort MoebiusStrip::getIndex( int _num ) const {
assert( _num < g_nIndices );
return g_index[_num];
}
#endif