GLInterface.cpp 2.8 KB

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