]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - radiant/glinterface.cpp
transfer from internal tree r5311 branches/1.4-gpl
[xonotic/netradiant.git] / radiant / glinterface.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 //-----------------------------------------------------------------------------\r
23 //\r
24 //\r
25 // DESCRIPTION:\r
26 // Quick interface hack for selected face interface\r
27 // this one really needs more work, but I'm in a hurry with TexTool\r
28 \r
29 #include "stdafx.h"\r
30 //#include "qe3.h"\r
31 \r
32 // stores objects that want to be hooked into drawing in the XY window or Camera view\r
33 //++timo TODO: add support for Z view ... (texture view?)\r
34 CPtrArray l_GL2DWindows;\r
35 CPtrArray l_GL3DWindows;\r
36 \r
37 void WINAPI QERApp_HookGL2DWindow(IGL2DWindow* pGLW)\r
38 {\r
39         l_GL2DWindows.Add( pGLW );\r
40         pGLW->IncRef();\r
41 }\r
42 \r
43 void WINAPI QERApp_UnHookGL2DWindow(IGL2DWindow* pGLW)\r
44 {\r
45         for( int i = 0; i < l_GL2DWindows.GetSize(); i++ )\r
46         {\r
47                 if (l_GL2DWindows.GetAt(i) == pGLW)\r
48                 {\r
49                         l_GL2DWindows.RemoveAt(i);\r
50                         pGLW->DecRef();\r
51                         return;\r
52                 }\r
53         }\r
54 #ifdef _DEBUG\r
55         Sys_Printf("ERROR: IGL2DWindow* not found in QERApp_UnHookGL2DWindow\n");\r
56 #endif\r
57 }\r
58 \r
59 void Draw2DPluginEntities( VIEWTYPE vt )\r
60 {\r
61         for(int i = 0; i<l_GL2DWindows.GetSize(); i++ )\r
62                 static_cast<IGL2DWindow*>(l_GL2DWindows.GetAt(i))->Draw2D( vt );\r
63 }\r
64 \r
65 void WINAPI QERApp_HookGL3DWindow(IGL3DWindow* pGLW)\r
66 {\r
67   l_GL3DWindows.Add( pGLW );\r
68   pGLW->IncRef();\r
69 }\r
70 \r
71 void WINAPI QERApp_UnHookGL3DWindow(IGL3DWindow* pGLW)\r
72 {\r
73         for( int i = 0; i < l_GL3DWindows.GetSize(); i++ )\r
74         {\r
75                 if (l_GL3DWindows.GetAt(i) == pGLW)\r
76                 {\r
77                         l_GL3DWindows.RemoveAt(i);\r
78                         pGLW->DecRef();\r
79                         return;\r
80                 }\r
81         }\r
82 #ifdef _DEBUG\r
83         Sys_Printf("ERROR: IGL3DWindow* not found in QERApp_UnHookGL3DWindow\n");\r
84 #endif\r
85 }\r
86 \r
87 void Draw3DPluginEntities()\r
88 {\r
89         for(int i = 0; i<l_GL3DWindows.GetSize(); i++ )\r
90                 static_cast<IGL3DWindow*>(l_GL3DWindows.GetAt(i))->Draw3D();\r
91 }\r