ModelManager.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. ===========================================================================
  3. Doom 3 GPL Source Code
  4. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
  6. Doom 3 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 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 Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 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 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. // allocates a new empty render model.
  40. virtual idRenderModel * AllocModel() = 0;
  41. // frees a render model
  42. virtual void FreeModel( idRenderModel *model ) = 0;
  43. // returns NULL if modelName is NULL or an empty string, otherwise
  44. // it will create a default model if not loadable
  45. virtual idRenderModel * FindModel( const char *modelName ) = 0;
  46. // returns NULL if not loadable
  47. virtual idRenderModel * CheckModel( const char *modelName ) = 0;
  48. // returns the default cube model
  49. virtual idRenderModel * DefaultModel() = 0;
  50. // world map parsing will add all the inline models with this call
  51. virtual void AddModel( idRenderModel *model ) = 0;
  52. // when a world map unloads, it removes its internal models from the list
  53. // before freeing them.
  54. // There may be an issue with multiple renderWorlds that share data...
  55. virtual void RemoveModel( idRenderModel *model ) = 0;
  56. // the reloadModels console command calls this, but it can
  57. // also be explicitly invoked
  58. virtual void ReloadModels( bool forceAll = false ) = 0;
  59. // write "touchModel <model>" commands for each non-world-map model
  60. virtual void WritePrecacheCommands( idFile *f ) = 0;
  61. // called during vid_restart
  62. virtual void FreeModelVertexCaches() = 0;
  63. // print memory info
  64. virtual void PrintMemInfo( MemInfo_t *mi ) = 0;
  65. };
  66. // this will be statically pointed at a private implementation
  67. extern idRenderModelManager *renderModelManager;
  68. #endif /* !__MODELMANAGER_H__ */