ModelManager.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. ===========================================================================
  3. Doom 3 BFG Edition GPL Source Code
  4. Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
  6. Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #ifndef __MODELMANAGER_H__
  21. #define __MODELMANAGER_H__
  22. /*
  23. ===============================================================================
  24. Model Manager
  25. Temporarily created models do not need to be added to the model manager.
  26. ===============================================================================
  27. */
  28. class idRenderModelManager {
  29. public:
  30. virtual ~idRenderModelManager() {}
  31. // registers console commands and clears the list
  32. virtual void Init() = 0;
  33. // frees all the models
  34. virtual void Shutdown() = 0;
  35. // called only by renderer::BeginLevelLoad
  36. virtual void BeginLevelLoad() = 0;
  37. // called only by renderer::EndLevelLoad
  38. virtual void EndLevelLoad() = 0;
  39. // called only by renderer::Preload
  40. virtual void Preload( const idPreloadManifest &manifest ) = 0;
  41. // allocates a new empty render model.
  42. virtual idRenderModel * AllocModel() = 0;
  43. // frees a render model
  44. virtual void FreeModel( idRenderModel *model ) = 0;
  45. // returns NULL if modelName is NULL or an empty string, otherwise
  46. // it will create a default model if not loadable
  47. virtual idRenderModel * FindModel( const char *modelName ) = 0;
  48. // returns NULL if not loadable
  49. virtual idRenderModel * CheckModel( const char *modelName ) = 0;
  50. // returns the default cube model
  51. virtual idRenderModel * DefaultModel() = 0;
  52. // world map parsing will add all the inline models with this call
  53. virtual void AddModel( idRenderModel *model ) = 0;
  54. // when a world map unloads, it removes its internal models from the list
  55. // before freeing them.
  56. // There may be an issue with multiple renderWorlds that share data...
  57. virtual void RemoveModel( idRenderModel *model ) = 0;
  58. // the reloadModels console command calls this, but it can
  59. // also be explicitly invoked
  60. virtual void ReloadModels( bool forceAll = false ) = 0;
  61. // write "touchModel <model>" commands for each non-world-map model
  62. virtual void WritePrecacheCommands( idFile *f ) = 0;
  63. // called during vid_restart
  64. virtual void FreeModelVertexCaches() = 0;
  65. // print memory info
  66. virtual void PrintMemInfo( MemInfo_t *mi ) = 0;
  67. };
  68. // this will be statically pointed at a private implementation
  69. extern idRenderModelManager *renderModelManager;
  70. #endif /* !__MODELMANAGER_H__ */