-
Notifications
You must be signed in to change notification settings - Fork 2
/
widgets.cpp
executable file
·91 lines (74 loc) · 3.13 KB
/
widgets.cpp
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
82
83
84
85
86
87
88
89
90
91
/*
Copyright (C) 2010 Matthew Baranowski, Sander van Rossen & Raven software.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "system.h"
#include "ndictionary.h"
#include "md3gl.h"
#include "md3view.h"
void setVertex( Vec3 v, float f1, float f2, float f3 )
{
v[0] = f1;
v[1] = f2;
v[2] = f3;
}
void widget_AxisFaces( Vec3 *v )
{
glBegin( GL_TRIANGLES );
glVertex3fv( v[0] ); glVertex3fv( v[2] ); glVertex3fv( v[3] );
glVertex3fv( v[3] ); glVertex3fv( v[1] ); glVertex3fv( v[0] );
glVertex3fv( v[4] ); glVertex3fv( v[5] ); glVertex3fv( v[7] );
glVertex3fv( v[7] ); glVertex3fv( v[6] ); glVertex3fv( v[4] );
glVertex3fv( v[0] ); glVertex3fv( v[1] ); glVertex3fv( v[5] );
glVertex3fv( v[5] ); glVertex3fv( v[4] ); glVertex3fv( v[0] );
glVertex3fv( v[1] ); glVertex3fv( v[3] ); glVertex3fv( v[7] );
glVertex3fv( v[7] ); glVertex3fv( v[5] ); glVertex3fv( v[1] );
glVertex3fv( v[3] ); glVertex3fv( v[2] ); glVertex3fv( v[6] );
glVertex3fv( v[6] ); glVertex3fv( v[7] ); glVertex3fv( v[3] );
glVertex3fv( v[2] ); glVertex3fv( v[0] ); glVertex3fv( v[4] );
glVertex3fv( v[4] ); glVertex3fv( v[6] ); glVertex3fv( v[2] );
glEnd();
}
void widget_Axis()
{
Vec3 v[8];
setVertex( v[0], -1.0000, 1.0000, 0.0000 );
setVertex( v[1], 1.0000, 1.0000, 0.0000 );
setVertex( v[2], -1.0000, 1.0000, 10.0000 );
setVertex( v[3], 1.0000, 1.0000, 10.0000 );
setVertex( v[4], -1.0000, -1.0000, 0.0000 );
setVertex( v[5], 1.0000, -1.0000, 0.0000 );
setVertex( v[6], -1.0000, -1.0000, 10.0000 );
setVertex( v[7], 1.0000, -1.0000, 10.0000 );
glColor3f( 0, 0, 1 );
widget_AxisFaces( v );
setVertex( v[0], -1.0000, 0.0000, 1.0000 );
setVertex( v[1], 1.0000, 0.0000, 1.0000 );
setVertex( v[2], -1.0000, 10.0000, 1.0000 );
setVertex( v[3], 1.0000, 10.0000, 1.0000 );
setVertex( v[4], -1.0000, 0.0000, -1.0000 );
setVertex( v[5], 1.0000, 0.0000, -1.0000 );
setVertex( v[6], -1.0000, 10.0000, -1.0000 );
setVertex( v[7], 1.0000, 10.0000, -1.0000 );
glColor3f( 0, 1, 0 );
widget_AxisFaces( v );
setVertex( v[0], 0.0000, -1.0000, 1.0000 );
setVertex( v[1], 0.0000, 1.0000, 1.0000 );
setVertex( v[2], 10.0000, -1.0000, 1.0000 );
setVertex( v[3], 10.0000, 1.0000, 1.0000 );
setVertex( v[4], 0.0000, -1.0000, -1.0000 );
setVertex( v[5], 0.0000, 1.0000, -1.0000 );
setVertex( v[6], 10.0000, -1.0000, -1.0000 );
setVertex( v[7], 10.0000, 1.0000, -1.0000 );
glColor3f( 1, 0, 0 );
widget_AxisFaces( v );
}