29 #include "../idlib/precompiled.h"
100 if ( args.
Argc() != 2 ) {
126 for (
int i = 0 ;
i < localModelManager.
models.
Num() ;
i++ ) {
133 totalMem += model->
Memory();
141 common->
Printf(
"total memory: %4.1fM\n", (
float)totalMem / (1024*1024) );
165 const char *model = args.
Argv( 1 );
257 if ( !modelName || !modelName[0] ) {
261 canonical = modelName;
269 if ( canonical.
Icmp( model->
Name() ) == 0 ) {
292 if ( ( extension.
Icmp(
"ase" ) == 0 ) || ( extension.
Icmp(
"lwo" ) == 0 ) || ( extension.
Icmp(
"flt" ) == 0 ) ) {
295 }
else if ( extension.
Icmp(
"ma" ) == 0 ) {
301 }
else if ( extension.
Icmp(
"md3" ) == 0 ) {
304 }
else if ( extension.
Icmp(
"prt" ) == 0 ) {
307 }
else if ( extension.
Icmp(
"liquid" ) == 0 ) {
312 if ( extension.
Length() ) {
316 if ( !createIfNotFound ) {
359 if ( !dynamic_cast<idRenderModelStatic *>( model ) ) {
360 common->
Error(
"idRenderModelManager::FreeModel: model '%s' is not a static model", model->
Name() );
364 common->
Error(
"idRenderModelManager::FreeModel: can't free the default model" );
368 common->
Error(
"idRenderModelManager::FreeModel: can't free the beam model" );
372 common->
Error(
"idRenderModelManager::FreeModel: can't free the sprite model" );
396 return GetModel( modelName,
false );
437 common->
Printf(
"Checking for changed model files...\n" );
456 if ( current <= model->Timestamp() ) {
512 common->
Printf(
"----- idRenderModelManagerLocal::EndLevelLoad -----\n" );
555 if ( ( loadCount & 15 ) == 0 ) {
563 common->
Printf(
"%5i models purged from previous level, ", purgeCount );
566 common->
Printf(
"%5i new models loaded in %5.1f seconds\n", loadCount, (end-start) * 0.001 );
568 common->
Printf(
"---------------------------------------------------\n" );
577 int i,
j, totalMem = 0;
587 sortIndex =
new int[ localModelManager.
models.
Num()];
589 for ( i = 0; i < localModelManager.
models.
Num(); i++ ) {
593 for ( i = 0; i < localModelManager.
models.
Num() - 1; i++ ) {
594 for ( j = i + 1; j < localModelManager.
models.
Num(); j++ ) {
595 if ( localModelManager.
models[sortIndex[i]]->Memory() < localModelManager.
models[sortIndex[
j]]->Memory() ) {
596 int temp = sortIndex[
i];
597 sortIndex[
i] = sortIndex[
j];
604 for (
int i = 0 ; i < localModelManager.
models.
Num() ; i++ ) {
virtual idRenderModel * DefaultModel()
virtual void SetLevelLoadReferenced(bool referenced)=0
virtual int Memory() const =0
virtual void ReloadModels(bool forceAll=false)
int Next(const int index) const
virtual void Print() const =0
virtual int ReadFile(const char *relativePath, void **buffer, ID_TIME_T *timestamp=NULL)=0
idCVar com_purgeAll("com_purgeAll","0", CVAR_BOOL|CVAR_ARCHIVE|CVAR_SYSTEM,"purge everything between level loads")
idRenderModelManagerLocal()
virtual void TouchData()=0
virtual bool IsLevelLoadReferenced()=0
int Sys_Milliseconds(void)
static void ArgCompletion_ModelName(const idCmdArgs &args, void(*callback)(const char *s))
idFileSystem * fileSystem
virtual void SetLevelLoadReferenced(bool referenced)
virtual void BeginLevelLoad()
virtual void AddModel(idRenderModel *model)
virtual void FreeModel(idRenderModel *model)
virtual const char * Name() const =0
idRenderModel * spriteModel
virtual bool IsReloadable() const =0
void RemoveIndex(const int key, const int index)
virtual void FreeVertexCache()=0
virtual void PurgeModel()=0
int Icmp(const char *text) const
void R_CheckForEntityDefsUsingModel(idRenderModel *model)
int First(const int key) const
virtual idRenderModel * FindModel(const char *modelName)
void R_ReCreateWorldReferences(void)
virtual void WritePrecacheCommands(idFile *file)
virtual void InitEmpty(const char *name)
static idStr FormatNumber(int number)
static void TouchModel_f(const idCmdArgs &args)
virtual void List() const =0
virtual idRenderModel * AllocModel()
idList< idRenderModel * > models
virtual idFile * OpenFileWrite(const char *relativePath, const char *basePath="fs_savepath")=0
static void ReloadModels_f(const idCmdArgs &args)
idRenderModel * defaultModel
virtual idRenderModel * CheckModel(const char *modelName)
void DeleteContents(bool clear)
virtual void RemoveModel(idRenderModel *model)
virtual void UpdateScreen(bool outOfSequence=true)=0
virtual void Printf(const char *fmt,...) id_attribute((format(printf
virtual void LoadModel()=0
static void ListModels_f(const idCmdArgs &args)
int GenerateKey(const char *string, bool caseSensitive=true) const
virtual void InitFromFile(const char *fileName)=0
int Append(const type &obj)
idRenderModel * beamModel
void R_FreeDerivedData(void)
idRenderModelManager * renderModelManager
virtual void EndLevelLoad()
virtual bool IsDefaultModel() const =0
virtual void PacifierUpdate()=0
virtual bool IsLoaded()=0
virtual void PrintMemInfo(MemInfo_t *mi)
bool RemoveIndex(int index)
static void PrintModel_f(const idCmdArgs &args)
const char * c_str(void) const
void R_PurgeTriSurfData(frameData_t *frame)
int FindIndex(const type &obj) const
const char * Argv(int arg) const
idRenderModelManagerLocal localModelManager
void Add(const int key, const int index)
virtual idRenderModel * CheckModel(const char *modelName)=0
idRenderModel * trailModel
virtual void FreeModelVertexCaches()
void ExtractFileExtension(idStr &dest) const
virtual void CloseFile(idFile *f)=0
virtual void DPrintf(const char *fmt,...) id_attribute((format(printf
virtual void Error(const char *fmt,...) id_attribute((format(printf
virtual void virtual void Warning(const char *fmt,...) id_attribute((format(printf
int sprintf(idStr &string, const char *fmt,...)
virtual int Printf(const char *fmt,...) id_attribute((format(printf
virtual ~idRenderModelManagerLocal()
virtual void AddCommand(const char *cmdName, cmdFunction_t function, int flags, const char *description, argCompletion_t argCompletion=NULL)=0
idRenderModel * GetModel(const char *modelName, bool createIfNotFound)