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