-
Notifications
You must be signed in to change notification settings - Fork 1
/
geometry.h
55 lines (40 loc) · 1.58 KB
/
geometry.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
#ifndef GEOMETRY_H
#define GEOMETRY_H
#include <qopengl.h>
#include <vector>
#ifndef CRIT3DCOLOR_H
#include "color.h"
#endif
#ifndef GIS_H
#include "gis.h"
#endif
class Crit3DGeometry
{
public:
Crit3DGeometry();
void clear();
const GLfloat *getVertices() const { return m_vertices.data(); }
const GLubyte *getColors() const { return m_colors.data(); }
long dataCount() const { return long(m_vertices.size()); }
long vertexCount() const { return long(m_vertices.size()) / 3; }
float defaultDistance() const { return std::max(m_dx, m_dy); }
float magnify() const { return m_magnify; }
int artifactSlope() const { return m_artifactSlope; }
void setMagnify(float magnify);
void setArtifactSlope(int artifactSlope){ m_artifactSlope = artifactSlope; }
void setCenter(float x, float y, float z);
void setDimension(float dx, float dy);
void addTriangle(const gis::Crit3DPoint &p1, const gis::Crit3DPoint &p2, const gis::Crit3DPoint &p3,
const Crit3DColor &c1, const Crit3DColor &c2, const Crit3DColor &c3);
void setVertexColor(int i, const Crit3DColor &color);
private:
void addVertex(const gis::Crit3DPoint &v);
void addVertexColor(const Crit3DColor &color);
std::vector<GLfloat> m_vertices;
std::vector<GLubyte> m_colors;
float m_dx, m_dy;
float m_xCenter, m_yCenter, m_zCenter;
float m_magnify;
int m_artifactSlope;
};
#endif // GEOMETRY_H