Пример #1
0
/*
=================
idRenderModelManagerLocal::FreeModel
=================
*/
void idRenderModelManagerLocal::FreeModel( idRenderModel *model ) {
	if ( !model ) {
		return;
	}
	if ( !dynamic_cast<idRenderModelStatic *>( model ) ) {
		common->Error( "idRenderModelManager::FreeModel: model '%s' is not a static model", model->Name() );
		return;
	}
	if ( model == defaultModel ) {
		common->Error( "idRenderModelManager::FreeModel: can't free the default model" );
		return;
	}
	if ( model == beamModel ) {
		common->Error( "idRenderModelManager::FreeModel: can't free the beam model" );
		return;
	}
	if ( model == spriteModel ) { 
		common->Error( "idRenderModelManager::FreeModel: can't free the sprite model" );
		return;
	}

	R_CheckForEntityDefsUsingModel( model );

	delete model;
}
Пример #2
0
/*
=================
idRenderModelManagerLocal::EndLevelLoad
=================
*/
void idRenderModelManagerLocal::EndLevelLoad() {
	common->Printf( "----- idRenderModelManagerLocal::EndLevelLoad -----\n" );

	int start = Sys_Milliseconds();

	insideLevelLoad = false;
	int	purgeCount = 0;
	int	keepCount = 0;
	int	loadCount = 0;

	// purge any models not touched
	for ( int i = 0 ; i < models.Num() ; i++ ) {
		idRenderModel *model = models[i];

		if ( !model->IsLevelLoadReferenced() && model->IsLoaded() && model->IsReloadable() ) {

//			common->Printf( "purging %s\n", model->Name() );

			purgeCount++;

			R_CheckForEntityDefsUsingModel( model );

			model->PurgeModel();

		} else {

//			common->Printf( "keeping %s\n", model->Name() );

			keepCount++;
		}
	}

	// purge unused triangle surface memory
	R_PurgeTriSurfData( frameData );

	// load any new ones
	for ( int i = 0 ; i < models.Num() ; i++ ) {
		idRenderModel *model = models[i];

		if ( model->IsLevelLoadReferenced() && !model->IsLoaded() && model->IsReloadable() ) {

			loadCount++;
			model->LoadModel();

			if ( ( loadCount & 15 ) == 0 ) {
				session->PacifierUpdate();
			}
		}
	}

	// _D3XP added this
	int	end = Sys_Milliseconds();
	common->Printf( "%5i models purged from previous level, ", purgeCount );
	common->Printf( "%5i models kept.\n", keepCount );
	if ( loadCount ) {
		common->Printf( "%5i new models loaded in %5.1f seconds\n", loadCount, (end-start) * 0.001 );
	}
	common->Printf( "---------------------------------------------------\n" );
}
Пример #3
0
/*
=================
idRenderModelManagerLocal::BeginLevelLoad
=================
*/
void idRenderModelManagerLocal::BeginLevelLoad() {
	insideLevelLoad = true;
	for( int i = 0 ; i < models.Num() ; i++ ) {
		idRenderModel *model = models[i];
		if( com_purgeAll.GetBool() && model->IsReloadable() ) {
			R_CheckForEntityDefsUsingModel( model );
			model->PurgeModel();
		}
		model->SetLevelLoadReferenced( false );
	}
	// purge unused triangle surface memory
	R_PurgeTriSurfData( frameData );
}
Пример #4
0
/*
=================
idRenderModelManagerLocal::BeginLevelLoad
=================
*/
void idRenderModelManagerLocal::BeginLevelLoad()
{
	insideLevelLoad = true;
	
	for( int i = 0; i < models.Num(); i++ )
	{
		idRenderModel* model = models[i];
		
		// always reload all models
		if( model->IsReloadable() )
		{
			R_CheckForEntityDefsUsingModel( model );
			model->PurgeModel();
		}
		
		model->SetLevelLoadReferenced( false );
	}
	
	vertexCache.FreeStaticData();
}
Пример #5
0
/*
=================
idRenderModelManagerLocal::EndLevelLoad
=================
*/
void idRenderModelManagerLocal::EndLevelLoad()
{
	common->Printf( "----- idRenderModelManagerLocal::EndLevelLoad -----\n" );
	
	int start = Sys_Milliseconds();
	
	insideLevelLoad = false;
	int	purgeCount = 0;
	int	keepCount = 0;
	int	loadCount = 0;
	
	// purge any models not touched
	for( int i = 0; i < models.Num(); i++ )
	{
		idRenderModel* model = models[i];
		
		if( !model->IsLevelLoadReferenced() && model->IsLoaded() && model->IsReloadable() )
		{
		
//			common->Printf( "purging %s\n", model->Name() );

			purgeCount++;
			
			R_CheckForEntityDefsUsingModel( model );
			
			model->PurgeModel();
			
		}
		else
		{
		
//			common->Printf( "keeping %s\n", model->Name() );

			keepCount++;
		}
		
		common->UpdateLevelLoadPacifier();
	}
	
	// load any new ones
	for( int i = 0; i < models.Num(); i++ )
	{
		common->UpdateLevelLoadPacifier();
		
		
		idRenderModel* model = models[i];
		
		if( model->IsLevelLoadReferenced() && !model->IsLoaded() && model->IsReloadable() )
		{
			loadCount++;
			model->LoadModel();
		}
	}
	
	// create static vertex/index buffers for all models
	for( int i = 0; i < models.Num(); i++ )
	{
		common->UpdateLevelLoadPacifier();
		
		
		idRenderModel* model = models[i];
		if( model->IsLoaded() )
		{
			for( int j = 0; j < model->NumSurfaces(); j++ )
			{
				R_CreateStaticBuffersForTri( *( model->Surface( j )->geometry ) );
			}
		}
	}
	
	
	// _D3XP added this
	int	end = Sys_Milliseconds();
	common->Printf( "%5i models purged from previous level, ", purgeCount );
	common->Printf( "%5i models kept.\n", keepCount );
	if( loadCount )
	{
		common->Printf( "%5i new models loaded in %5.1f seconds\n", loadCount, ( end - start ) * 0.001 );
	}
	common->Printf( "---------------------------------------------------\n" );
}