Quake-III-Arena

Quake III Arena GPL Source Release
Log | Files | Refs

GLInterface.cpp (2881B)


      1 /*
      2 ===========================================================================
      3 Copyright (C) 1999-2005 Id Software, Inc.
      4 
      5 This file is part of Quake III Arena source code.
      6 
      7 Quake III Arena source code is free software; you can redistribute it
      8 and/or modify it under the terms of the GNU General Public License as
      9 published by the Free Software Foundation; either version 2 of the License,
     10 or (at your option) any later version.
     11 
     12 Quake III Arena source code is distributed in the hope that it will be
     13 useful, 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 Foobar; 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 // $LogFile$
     25 // $Revision: 1.1.1.4.2.1 $
     26 // $Author: ttimo $
     27 // $Date: 2000/02/04 22:59:34 $
     28 // $log$
     29 // Revision 1.1.1.3  1999/12/29 18:31:26  TBesset
     30 // Q3Radiant public version
     31 //
     32 // Revision 1.2  1999/11/22 17:46:45  Timo & Christine
     33 // merged EARadiant into the main tree
     34 // bug fixes for Q3Plugin / EAPlugin
     35 // export for Robert
     36 //
     37 // Revision 1.1.4.1  1999/11/03 20:37:59  Timo & Christine
     38 // MEAN plugin for Q3Radiant, alpha version
     39 //
     40 // Revision 1.1.2.1  1999/10/27 08:34:26  Timo & Christine
     41 // preview version of the texture tools plugin is ready
     42 // ( TexTool.dll plugin is in Q3Plugin module )
     43 // plugins can draw in their own window using Radiant's qgl bindings
     44 //
     45 //
     46 // DESCRIPTION:
     47 // Quick interface hack for selected face interface
     48 // this one really needs more work, but I'm in a hurry with TexTool
     49 
     50 #include "stdafx.h"
     51 
     52 // stores objects that want to be hooked into drawing in the XY window
     53 //++timo TODO: add support for camera view, Z view ... (texture view?)
     54 CPtrArray l_GLWindows;
     55 
     56 int WINAPI QERApp_ISelectedFace_GetTextureNumber()
     57 {
     58 	if (g_ptrSelectedFaces.GetSize() > 0)
     59 	{
     60 		face_t *selFace = reinterpret_cast<face_t*>(g_ptrSelectedFaces.GetAt(0));
     61 		return selFace->d_texture->texture_number;
     62 	}
     63 	//++timo hu ? find the appropriate gl bind number
     64 	return 0;
     65 }
     66 
     67 void WINAPI QERApp_HookXYGLWindow(IGLWindow* pGLW)
     68 {
     69 	l_GLWindows.Add( pGLW );
     70 	pGLW->IncRef();
     71 }
     72 
     73 void WINAPI QERApp_UnHookGLWindow(IGLWindow* pGLW)
     74 {
     75 	for( int i = 0; i < l_GLWindows.GetSize(); i++ )
     76 	{
     77 		if (l_GLWindows.GetAt(i) == pGLW)
     78 		{
     79 			l_GLWindows.RemoveAt(i);
     80 			pGLW->DecRef();
     81 			return;
     82 		}
     83 	}
     84 #ifdef _DEBUG
     85 	Sys_Printf("ERROR: IGLWindow* not found in QERApp_UnHookGLWindow\n");
     86 #endif
     87 }
     88 
     89 void DrawPluginEntities( VIEWTYPE vt )
     90 {
     91 	for(int i = 0; i<l_GLWindows.GetSize(); i++ )
     92 		static_cast<IGLWindow*>(l_GLWindows.GetAt(i))->Draw( vt );
     93 }