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