merge branch work back into trunk
[xonotic/netradiant.git] / plugins / model / model.cpp
1 /*
2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
4
5 This file is part of GtkRadiant.
6
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20 */
21
22 #include "plugin.h"
23 #include "picomodel.h"
24
25 void pivot_draw(const vec3_t pivot)
26 {
27   vec3_t vCenter, vMin, vMax;
28   VectorCopy(pivot, vCenter);
29
30   g_QglTable.m_pfn_qglPointSize(4);
31
32   g_QglTable.m_pfn_qglBegin(GL_POINTS);
33   g_QglTable.m_pfn_qglVertex3fv(vCenter);
34   g_QglTable.m_pfn_qglEnd();
35
36   g_QglTable.m_pfn_qglBegin(GL_LINES);
37   vCenter[0] -= 8;
38   g_QglTable.m_pfn_qglVertex3fv(vCenter);
39   vCenter[0] += 16;
40   g_QglTable.m_pfn_qglVertex3fv(vCenter);
41   vCenter[0] -= 8;
42   vCenter[1] -= 8;
43   g_QglTable.m_pfn_qglVertex3fv(vCenter);
44   vCenter[1] += 16;
45   g_QglTable.m_pfn_qglVertex3fv(vCenter);
46   vCenter[1] -= 8;
47   vCenter[2] -= 8;
48   g_QglTable.m_pfn_qglVertex3fv(vCenter);
49   vCenter[2] += 16;
50   g_QglTable.m_pfn_qglVertex3fv(vCenter);
51   vCenter[2] -= 8;
52   g_QglTable.m_pfn_qglEnd();
53
54   VectorCopy(vCenter, vMin);
55   VectorCopy(vCenter, vMax);
56   vMin[0] -= 4;
57   vMin[1] -= 4;
58   vMin[2] -= 4;
59   vMax[0] += 4;
60   vMax[1] += 4;
61   vMax[2] += 4;
62
63         g_QglTable.m_pfn_qglBegin(GL_LINE_LOOP);
64     g_QglTable.m_pfn_qglVertex3f(vMin[0],vMin[1],vMin[2]);
65     g_QglTable.m_pfn_qglVertex3f(vMax[0],vMin[1],vMin[2]);
66     g_QglTable.m_pfn_qglVertex3f(vMax[0],vMax[1],vMin[2]);
67     g_QglTable.m_pfn_qglVertex3f(vMin[0],vMax[1],vMin[2]);
68         g_QglTable.m_pfn_qglEnd();
69         
70         g_QglTable.m_pfn_qglBegin(GL_LINE_LOOP);
71           g_QglTable.m_pfn_qglVertex3f(vMin[0],vMin[1],vMax[2]);
72                 g_QglTable.m_pfn_qglVertex3f(vMax[0],vMin[1],vMax[2]);
73                 g_QglTable.m_pfn_qglVertex3f(vMax[0],vMax[1],vMax[2]);
74                 g_QglTable.m_pfn_qglVertex3f(vMin[0],vMax[1],vMax[2]);
75         g_QglTable.m_pfn_qglEnd();
76
77         g_QglTable.m_pfn_qglBegin(GL_LINES);
78         g_QglTable.m_pfn_qglVertex3f(vMin[0],vMin[1],vMin[2]);
79                 g_QglTable.m_pfn_qglVertex3f(vMin[0],vMin[1],vMax[2]);
80                 g_QglTable.m_pfn_qglVertex3f(vMin[0],vMax[1],vMax[2]);
81                 g_QglTable.m_pfn_qglVertex3f(vMin[0],vMax[1],vMin[2]);
82                 g_QglTable.m_pfn_qglVertex3f(vMax[0],vMin[1],vMin[2]);
83                 g_QglTable.m_pfn_qglVertex3f(vMax[0],vMin[1],vMax[2]);
84                 g_QglTable.m_pfn_qglVertex3f(vMax[0],vMax[1],vMax[2]);
85                 g_QglTable.m_pfn_qglVertex3f(vMax[0],vMax[1],vMin[2]);
86         g_QglTable.m_pfn_qglEnd();
87 }
88