-
Notifications
You must be signed in to change notification settings - Fork 47
/
RenderableWireFrame.h
52 lines (41 loc) · 1.1 KB
/
RenderableWireFrame.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
#ifndef RENDERABLEWIREFRAME_H_
#define RENDERABLEWIREFRAME_H_
#include "render.h"
struct EdgeRenderIndices
{
RenderIndex first;
RenderIndex second;
EdgeRenderIndices()
: first(0), second(0)
{}
EdgeRenderIndices(const RenderIndex _first, const RenderIndex _second)
: first(_first), second(_second)
{}
};
class RenderableWireframe :
public OpenGLRenderable
{
public:
void render(const RenderInfo& info) const
{
if (m_size == 0) return;
if (info.checkFlag(RENDER_VERTEX_COLOUR))
{
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(
4, GL_UNSIGNED_BYTE, sizeof(VertexCb), &m_vertices->colour
);
}
glVertexPointer(3, GL_DOUBLE, sizeof(VertexCb), &m_vertices->vertex);
glDrawElements(GL_LINES, GLsizei(m_size<<1), RenderIndexTypeID, &m_faceVertex.front());
if (info.checkFlag(RENDER_VERTEX_COLOUR))
{
glDisableClientState(GL_COLOR_ARRAY);
}
}
std::vector<EdgeRenderIndices> m_faceVertex;
std::size_t m_size;
const VertexCb* m_vertices;
virtual ~RenderableWireframe() {}
};
#endif /*RENDERABLEWIREFRAME_H_*/