-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGLRender.hpp
66 lines (55 loc) · 1.81 KB
/
GLRender.hpp
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
#ifndef _GL_RENDER_
#define _GL_RENDER_
#include "GeometryTypes.hpp"
#include "PolygonSorter.hpp"
#include "Intersection.hpp"
#include <QColor>
///////////////////////////////////////////////////////////////////////////////////////////////////
// The functions for efficiently rendering objects to the screen. They work by buffering all
// necessary data to the graphics card memory when constructed and when actually rendering do the
// bare minimum to update the view. This results in very fast rendering even for very large
// objects. Note that the current system disables lighting and depth testing in all cases and only
// properly sorts the polyhedron faces relative to themselves, so rendering artifacts are expected.
///////////////////////////////////////////////////////////////////////////////////////////////////
struct GlPolyhedron
{
size_t nverts, nedges, nfaces;
unsigned int bufs[2];
unsigned int* edges;
unsigned int* faces;
PolygonSorter* ps;
GlPolyhedron(const Polyhedron3* P);
~GlPolyhedron();
void render_edges(const QColor& color);
void render_faces(const Ray3& view, const QColor& color);
};
struct GlSkeleton
{
size_t nverts, nedges;
unsigned int bufs[1];
unsigned int* edges;
GlSkeleton(const Skeleton3* S);
~GlSkeleton();
void render(const double weight, const QColor& color);
};
struct GlIntersection
{
Point3 plane_corners[4];
size_t nintersections, *npoints;
unsigned int bufs[1];
unsigned int** polys;
GlIntersection(const Intersection& I);
~GlIntersection();
void render_plane(const QColor& color);
void render_polygons(const QColor& color);
};
struct GlPoint
{
Point3 pt;
double radius;
GlPoint(const Point3& pt, double radius);
~GlPoint();
void render(const QColor& color);
};
void gl_setup();
#endif