Ejemplo n.º 1
0
/*
================
idExplodingBarrel::AddParticles
================
*/
void idExplodingBarrel::AddParticles( const char* name, bool burn )
{
	if( name && *name )
	{
		int explicitTimeGroup = timeGroup;
		SetTimeState explicitTS( explicitTimeGroup );
		if( particleModelDefHandle >= 0 )
		{
			gameRenderWorld->FreeEntityDef( particleModelDefHandle );
		}
		memset( &particleRenderEntity, 0, sizeof( particleRenderEntity ) );
		idRenderModel* modelDef = renderModelManager->FindModel( name );
		if( modelDef )
		{
			particleRenderEntity.origin = physicsObj.GetAbsBounds().GetCenter();
			particleRenderEntity.axis = mat3_identity;
			particleRenderEntity.hModel = modelDef;
			float rgb = ( burn ) ? 0.0f : 1.0f;
			particleRenderEntity.shaderParms[ SHADERPARM_RED ] = rgb;
			particleRenderEntity.shaderParms[ SHADERPARM_GREEN ] = rgb;
			particleRenderEntity.shaderParms[ SHADERPARM_BLUE ] = rgb;
			particleRenderEntity.shaderParms[ SHADERPARM_ALPHA ] = rgb;
			particleRenderEntity.shaderParms[ SHADERPARM_TIMEOFFSET ] = -MS2SEC( gameLocal.realClientTime );
			particleRenderEntity.shaderParms[ SHADERPARM_DIVERSITY ] = ( burn ) ? 1.0f : gameLocal.random.RandomInt( 90 );
			particleRenderEntity.timeGroup = explicitTimeGroup;
			particleModelDefHandle = gameRenderWorld->AddEntityDef( &particleRenderEntity );
			if( burn )
			{
				BecomeActive( TH_THINK );
			}
			particleTime = gameLocal.realClientTime;
		}
	}
}
Ejemplo n.º 2
0
/*
================
idExplodingBarrel::AddParticles
================
*/
void idExplodingBarrel::AddParticles(const char *name, bool burn) {
	if (name && *name) {
#ifdef _D3XP
		int explicitTimeGroup = timeGroup;
		SetTimeState explicitTS(explicitTimeGroup);
#endif
		if (particleModelDefHandle >= 0) {
			gameRenderWorld->FreeEntityDef(particleModelDefHandle);
		}
		memset(&particleRenderEntity, 0, sizeof(particleRenderEntity));
		const idDeclModelDef *modelDef = static_cast<const idDeclModelDef *>(declManager->FindType(DECL_MODELDEF, name));
		if (modelDef) {
			particleRenderEntity.origin = physicsObj.GetAbsBounds().GetCenter();
			particleRenderEntity.axis = mat3_identity;
			particleRenderEntity.hModel = modelDef->ModelHandle();
			float rgb = (burn) ? 0.0f : 1.0f;
			particleRenderEntity.shaderParms[SHADERPARM_RED] = rgb;
			particleRenderEntity.shaderParms[SHADERPARM_GREEN] = rgb;
			particleRenderEntity.shaderParms[SHADERPARM_BLUE] = rgb;
			particleRenderEntity.shaderParms[SHADERPARM_ALPHA] = rgb;
			particleRenderEntity.shaderParms[SHADERPARM_TIMEOFFSET] = -MS2SEC(gameLocal.realClientTime);
			particleRenderEntity.shaderParms[SHADERPARM_DIVERSITY] = (burn) ? 1.0f : gameLocal.random.RandomInt(90);
			particleRenderEntity.suppressSurfaceInViewID = -8;	// sikk - Depth Render
#ifdef _D3XP
			particleRenderEntity.timeGroup = explicitTimeGroup;
#endif
			if (!particleRenderEntity.hModel) {
				particleRenderEntity.hModel = renderModelManager->FindModel(name);
			}
			particleModelDefHandle = gameRenderWorld->AddEntityDef(&particleRenderEntity);
			if (burn) {
				BecomeActive(TH_THINK);
			}
			particleTime = gameLocal.realClientTime;
		}
	}
}