PlugInManager.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. // PlugInManager.h: interface for the CPlugInManager class.
  19. //
  20. //////////////////////////////////////////////////////////////////////
  21. #if !defined(AFX_PLUGINMANAGER_H__CFB18412_55FE_11D2_B082_00AA00A410FC__INCLUDED_)
  22. #define AFX_PLUGINMANAGER_H__CFB18412_55FE_11D2_B082_00AA00A410FC__INCLUDED_
  23. #if _MSC_VER >= 1000
  24. #pragma once
  25. #endif // _MSC_VER >= 1000
  26. #include "plugin.h"
  27. class CPlugInManager
  28. {
  29. private:
  30. CObArray m_PlugIns;
  31. CPtrArray m_BrushHandles;
  32. CPtrArray m_SelectedBrushHandles;
  33. CPtrArray m_ActiveBrushHandles;
  34. CPlugIn *m_pTexturePlug;
  35. CPlugIn *m_pSurfaceListPlug;
  36. // v1.70
  37. // brushes of the current entity ( see m_SelectedBrushHandles and m_ActiveBrushHandles )
  38. CPtrArray m_EntityBrushHandles;
  39. // allocated entities, not commited yet ( see m_BrushHandles )
  40. CPtrArray m_EntityHandles;
  41. // tells in which array to look when given a patch index
  42. enum EPatchesMode { EActivePatches, ESelectedPatches, EAllocatedPatches } PatchesMode;
  43. // patches handles (brush_t*)
  44. CPtrArray m_PatchesHandles;
  45. // plugin-allocated patches, not commited yet (patchMesh_t*)
  46. CPtrArray m_PluginPatches;
  47. public:
  48. CPlugIn * PluginForModule( HMODULE hPlug );
  49. CPtrArray& GetActiveHandles() {return m_ActiveBrushHandles; };
  50. CPtrArray& GetSelectedHandles() {return m_SelectedBrushHandles; };
  51. CPtrArray& GetPluginPatches() {return m_PluginPatches; };
  52. brush_t* FindBrushHandle(void *vp);
  53. patchMesh_t* FindPatchHandle(int index);
  54. int CreatePatchHandle();
  55. int AllocateActivePatchHandles();
  56. int AllocateSelectedPatchHandles();
  57. void CommitPatchHandleToMap(int index, patchMesh_t *pMesh, char *texName);
  58. void ReleasePatchesHandles() { m_PatchesHandles.RemoveAll(); m_PluginPatches.RemoveAll(); }
  59. void AddFaceToBrushHandle(void *vp, vec3_t v1, vec3_t v2, vec3_t v3);
  60. void CommitBrushHandleToMap(void *vp);
  61. void DeleteBrushHandle(LPVOID vp);
  62. LPVOID CreateBrushHandle();
  63. void Dispatch(int n, const char *p);
  64. void Cleanup();
  65. void Init(const char* pPath);
  66. CPlugInManager();
  67. virtual ~CPlugInManager();
  68. // the texture manager front ends the single load
  69. // addins (texture, model, map formats.. etc.)
  70. _QERTextureInfo* GetTextureInfo();
  71. void LoadTexture(const char *pFilename);
  72. LPVOID GetSurfaceFlags();
  73. // v1.70
  74. CPtrArray& GetEntityBrushHandles() {return m_EntityBrushHandles; };
  75. CPtrArray& GetEntityHandles() {return m_EntityHandles; };
  76. // the vpBrush needs to be in m_BrushHandles
  77. void CommitBrushHandleToEntity( LPVOID vpBrush, LPVOID vpEntity );
  78. // the vpEntity needs to be in m_EntityHandles
  79. void CommitEntityHandleToMap( LPVOID vpEntity );
  80. protected:
  81. int FillFuncTable(CPlugIn *pPlug); // PGM
  82. };
  83. #endif // !defined(AFX_PLUGINMANAGER_H__CFB18412_55FE_11D2_B082_00AA00A410FC__INCLUDED_)