-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRenderer.h
68 lines (56 loc) · 1.45 KB
/
Renderer.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
58
59
60
61
62
63
64
65
66
67
68
#ifndef RENDERER_H
#define RENDERER_H
#include "lib/qu3e/src/q3.h"
class Renderer : public q3Render
{
public:
void SetPenColor( f32 r, f32 g, f32 b, f32 a = 1.0f ) override
{
Q3_UNUSED( a );
glColor3f( (float)r, (float)g, (float)b );
}
void SetPenPosition( f32 x, f32 y, f32 z ) override
{
x_ = x, y_ = y, z_ = z;
}
void SetScale( f32 sx, f32 sy, f32 sz ) override
{
glPointSize( (float)sx );
sx_ = sx, sy_ = sy, sz_ = sz;
}
void Line( f32 x, f32 y, f32 z ) override
{
glBegin( GL_LINES );
glVertex3f( (float)x_, (float)y_, (float)z_ );
glVertex3f( (float)x, (float)y, (float)z );
SetPenPosition( x, y, z );
glEnd( );
}
void Triangle(
f32 x1, f32 y1, f32 z1,
f32 x2, f32 y2, f32 z2,
f32 x3, f32 y3, f32 z3
) override
{
glBegin( GL_TRIANGLES );
glColor4f( 0.2f, 0.4f, 0.7f, 0.5f );
glVertex3f( (float)x1, (float)y1, (float)z1 );
glVertex3f( (float)x2, (float)y2, (float)z2 );
glVertex3f( (float)x3, (float)y3, (float)z3 );
glEnd( );
}
void SetTriNormal( f32 x, f32 y, f32 z ) override
{
glNormal3f( (float)x, (float)y, (float)z );
}
void Point( ) override
{
glBegin( GL_POINTS );
glVertex3f( (float)x_, (float)y_, (float)z_ );
glEnd( );
};
private:
f32 x_, y_, z_;
f32 sx_, sy_, sz_;
};
#endif