当前位置: 首页>>代码示例>>C++>>正文


C++ ParticleMgr函数代码示例

本文整理汇总了C++中ParticleMgr函数的典型用法代码示例。如果您正苦于以下问题:C++ ParticleMgr函数的具体用法?C++ ParticleMgr怎么用?C++ ParticleMgr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ParticleMgr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetMaterialNameFromIndex

//-----------------------------------------------------------------------------
// Purpose:
// Input  : *pParticleMgr -
//			*pArgs -
//-----------------------------------------------------------------------------
void C_EntityParticleTrail::Start( )
{
    if( ParticleMgr()->AddEffect( &m_ParticleEffect, this ) == false )
        return;

    const char *pMaterialName = GetMaterialNameFromIndex( m_iMaterialName );
    if ( !pMaterialName )
        return;

    m_hMaterial	= ParticleMgr()->GetPMaterial( pMaterialName );
    m_teParticleSpawn.Init( 150 );
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:17,代码来源:c_entityparticletrail.cpp

示例2: GetPMaterial

//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *materialName - 
//-----------------------------------------------------------------------------
void CLitSmokeEmitter::Init( const char *materialName, Vector sortOrigin )
{
	m_hSmokeMaterial = GetPMaterial( materialName );
	
	IMaterial *pMaterial = ParticleMgr()->PMaterialToIMaterial( m_hSmokeMaterial );
	if ( pMaterial )
	{
		m_Renderer.Init( ParticleMgr(), pMaterial );
	}

	SetSortOrigin( sortOrigin );
	m_bInitted = true;
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:17,代码来源:particle_litsmokeemitter.cpp

示例3: ParticleMgr

//-----------------------------------------------------------------------------
// ParticleSystem iteration, query, modification
//-----------------------------------------------------------------------------
ParticleSystemSearchResult CClientTools::NextParticleSystem( ParticleSystemSearchResult sr )
{
	CNewParticleEffect *pParticleEffect = NULL;
	if ( sr == NULL )
	{
		pParticleEffect = ParticleMgr()->FirstNewEffect();
	}
	else
	{
		pParticleEffect = ParticleMgr()->NextNewEffect( reinterpret_cast< CNewParticleEffect* >( sr ) );
	}
	return reinterpret_cast< ParticleSystemSearchResult >( pParticleEffect );
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:16,代码来源:entity_client_tools.cpp

示例4: while

void CTrailParticles::RenderParticles(CParticleRenderIterator *pIterator)
{
    const TrailParticle *pParticle = (const TrailParticle*) pIterator->GetFirst();
    while (pParticle)
    {
        //Get our remaining time
        float lifePerc = 1.0f - (pParticle->m_flLifetime / pParticle->m_flDieTime);
        float scale = (pParticle->m_flLength*lifePerc);

        if (scale < 0.01f)
            scale = 0.01f;

        Vector	start, delta;

        //NOTE: We need to do everything in screen space
        TransformParticle(ParticleMgr()->GetModelView(), pParticle->m_Pos, start);
        float sortKey = start.z;

        Vector3DMultiply(ParticleMgr()->GetModelView(), pParticle->m_vecVelocity, delta);

        float	color[4];
        float	ramp = 1.0;

        // Fade in for the first few frames
        if (pParticle->m_flLifetime <= 0.3 && m_fFlags & bitsPARTICLE_TRAIL_FADE_IN)
        {
            ramp = pParticle->m_flLifetime;
        }
        else if (m_fFlags & bitsPARTICLE_TRAIL_FADE)
        {
            ramp = (1.0f - (pParticle->m_flLifetime / pParticle->m_flDieTime));
        }

        color[0] = pParticle->m_color.r * ramp * (1.0f / 255.0f);
        color[1] = pParticle->m_color.g * ramp * (1.0f / 255.0f);
        color[2] = pParticle->m_color.b * ramp * (1.0f / 255.0f);
        color[3] = pParticle->m_color.a * ramp * (1.0f / 255.0f);

        float	flLength = (pParticle->m_vecVelocity * scale).Length();//( delta - pos ).Length();
        float	flWidth = (flLength < pParticle->m_flWidth) ? flLength : pParticle->m_flWidth;

        //See if we should fade
        Vector vecScaledDelta = (delta*scale);
        Tracer_Draw(pIterator->GetParticleDraw(), start, vecScaledDelta, flWidth, color);

        pParticle = (const TrailParticle*) pIterator->GetNext(sortKey);
    }
}
开发者ID:Yosam02,项目名称:game,代码行数:48,代码来源:fx_sparks.cpp

示例5: while

void CLitSmokeEmitter::RenderParticles( CParticleRenderIterator *pIterator )
{
	const LitSmokeParticle *pParticle = (const LitSmokeParticle*)pIterator->GetFirst();
	while ( pParticle )
	{
		float	tLifetime = pParticle->m_flLifetime / pParticle->m_flDieTime;

		// Transform.						   
		Vector tPos;

		TransformParticle( ParticleMgr()->GetModelView(), pParticle->m_Pos, tPos );
		float sortKey = tPos.z;
		
		float alpha255 = ( ( (float) pParticle->m_uchColor[3]/255.0f ) * sin( M_PI_F * tLifetime ) ) * 255.0f;

		Vector	color01 = Vector( pParticle->m_uchColor[0], pParticle->m_uchColor[1], pParticle->m_uchColor[2] ) * (tLifetime / 255.0f);

		m_Renderer.RenderParticle_AddColor (
			pIterator->GetParticleDraw(),
			pParticle->m_Pos,
			tPos,
			alpha255,
			FLerp( pParticle->m_uchStartSize, pParticle->m_uchEndSize, tLifetime ),
			color01
		);
		
		pParticle = (const LitSmokeParticle*)pIterator->GetNext( sortKey );
	}
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:29,代码来源:particle_litsmokeemitter.cpp

示例6: ParticleMgr

void CNewParticleEffect::Construct()
{
	m_vSortOrigin.Init();

	m_bDontRemove = false;
	m_bRemove = false;
	m_bDrawn = false;
	m_bNeedsBBoxUpdate = false;
	m_bIsFirstFrame = true;
	m_bAutoUpdateBBox = false;
	m_bAllocated = true;
	m_bSimulate = true;
	m_bRecord = false;
	m_bShouldPerformCullCheck = false;
	m_bDisableAggregation = true;							// will be reset when someone creates it via CreateOrAggregate


	m_nToolParticleEffectId = TOOLPARTICLESYSTEMID_INVALID;
	m_RefCount = 0;
	ParticleMgr()->AddEffect( this );
	m_LastMax = Vector( -1.0e6, -1.0e6, -1.0e6 );
	m_LastMin = Vector( 1.0e6, 1.0e6, 1.0e6 );
	m_MinBounds = Vector( 1.0e6, 1.0e6, 1.0e6 );
	m_MaxBounds = Vector( -1.0e6, -1.0e6, -1.0e6 );
	m_pDebugName = NULL;
	m_nSplitScreenUser = -1;

	SetRenderable( this );

	RecordCreation();
}
开发者ID:AeroHand,项目名称:dota2-lua-engine,代码行数:31,代码来源:particles_new.cpp

示例7: FindEffect

CNewParticleEffect *CParticleProperty::Create( CParticleSystemDefinition *pDef, ParticleAttachment_t iAttachType, int iAttachmentPoint, Vector vecOriginOffset, matrix3x4_t *matOffset )
{
	int nBatchMode = cl_particle_batch_mode.GetInt();
	bool bRequestedBatch = ( nBatchMode == 2 ) || ( ( nBatchMode == 1 ) && pDef && pDef->ShouldBatch() ); 
	if ( ( iAttachType == PATTACH_CUSTOMORIGIN ) && bRequestedBatch )
	{
		int iIndex = FindEffect( pDef->GetName() );
		if ( iIndex >= 0 )
		{
			CNewParticleEffect *pEffect = m_ParticleEffects[iIndex].pParticleEffect.GetObject();
			pEffect->Restart();
			return pEffect;
		}
	}

	int iIndex = m_ParticleEffects.AddToTail();
	ParticleEffectList_t *newEffect = &m_ParticleEffects[iIndex];
	newEffect->pParticleEffect = CNewParticleEffect::Create( m_pOuter, pDef, pDef->GetName() );

	if ( !newEffect->pParticleEffect->IsValid() )
	{
		// Caused by trying to spawn an unregistered particle effect. Remove it.
		ParticleMgr()->RemoveEffect( newEffect->pParticleEffect.GetObject() );
		return NULL;
	}

	AddControlPoint( iIndex, 0, GetOuter(), iAttachType, iAttachmentPoint, vecOriginOffset, matOffset );

	if ( m_pOuter )
	{
		m_pOuter->OnNewParticleEffect( pDef->GetName(), newEffect->pParticleEffect.GetObject() );
	}

	return newEffect->pParticleEffect.GetObject();
}
开发者ID:Cre3per,项目名称:hl2sdk-csgo,代码行数:35,代码来源:particle_property.cpp

示例8: WorldAlignMaxs

void C_FuncSmokeVolume::OnDataChanged( DataUpdateType_t updateType )
{		
	m_MinColor[0] = ( 1.0f / 255.0f ) * m_Color1.r;
	m_MinColor[1] = ( 1.0f / 255.0f ) * m_Color1.g;
	m_MinColor[2] = ( 1.0f / 255.0f ) * m_Color1.b;

	m_MaxColor[0] = ( 1.0f / 255.0f ) * m_Color2.r;
	m_MaxColor[1] = ( 1.0f / 255.0f ) * m_Color2.g;
	m_MaxColor[2] = ( 1.0f / 255.0f ) * m_Color2.b;

	m_ParticleRadius = m_ParticleDrawWidth * 0.5f;
	m_SpacingRadius = m_ParticleSpacingDistance * 0.5f;

	m_ParticleEffect.SetParticleCullRadius( m_ParticleRadius );

//	Warning( "m_Density: %f\n", m_Density );
//	Warning( "m_MovementSpeed: %f\n", m_MovementSpeed );
	
	if(updateType == DATA_UPDATE_CREATED)
	{
		Vector size = WorldAlignMaxs() - WorldAlignMins();
		m_xCount = 0.5f + ( size.x / ( m_SpacingRadius * 2.0f ) );
		m_yCount = 0.5f + ( size.y / ( m_SpacingRadius * 2.0f ) );
		m_zCount = 0.5f + ( size.z / ( m_SpacingRadius * 2.0f ) );
		m_CurrentDensity = m_Density;

		delete [] m_pSmokeParticleInfos;
		m_pSmokeParticleInfos = new SmokeParticleInfo[m_xCount * m_yCount * m_zCount];
		Start( ParticleMgr(), NULL );
	}
	BaseClass::OnDataChanged( updateType );
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:32,代码来源:c_func_smokevolume.cpp

示例9: GetTransformMatrix

void CLocalSpaceEmitter::RenderParticles( CParticleRenderIterator *pIterator )
{
	const matrix3x4_t &mLocalToWorld = GetTransformMatrix();
	const VMatrix &mModelView = ParticleMgr()->GetModelView();

	const SimpleParticle *pParticle = (const SimpleParticle *)pIterator->GetFirst();
	while ( pParticle )
	{
		// Transform it
		Vector screenPos, worldPos;
		VectorTransform( pParticle->m_Pos, mLocalToWorld, worldPos );
		
		// Correct viewmodel squashing
		if ( m_fFlags & FLE_VIEWMODEL )
		{
			FormatViewModelAttachment( NULL, worldPos, false );
		}

		TransformParticle( mModelView, worldPos, screenPos );
		
		float sortKey = (int) screenPos.z;

		// Render it
		RenderParticle_ColorSizeAngle(
			pIterator->GetParticleDraw(),
			screenPos,
			UpdateColor( pParticle ),
			UpdateAlpha( pParticle ) * GetAlphaDistanceFade( screenPos, m_flNearClipMin, m_flNearClipMax ),
			UpdateScale( pParticle ),
			pParticle->m_flRoll 
			);

		pParticle = (const SimpleParticle *)pIterator->GetNext( sortKey );
	}
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:35,代码来源:particles_localspace.cpp

示例10: ParticleMgr

//-----------------------------------------------------------------------------
// Reload particle definitions
//-----------------------------------------------------------------------------
void CClientTools::ReloadParticleDefintions( const char *pFileName, const void *pBufData, int nLen )
{
	// Remove all new effects, because we are going to free internal structures they point to
	ParticleMgr()->RemoveAllNewEffects();

	// FIXME: Use file name to determine if we care about this data
	CUtlBuffer buf( pBufData, nLen, CUtlBuffer::READ_ONLY );
	g_pParticleSystemMgr->ReadParticleConfigFile( buf, true );
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:12,代码来源:entity_client_tools.cpp

示例11: Start

//-----------------------------------------------------------------------------
// Purpose: First sent down from the server
//-----------------------------------------------------------------------------
void C_ParticleTrail::OnDataChanged(DataUpdateType_t updateType)
{
	C_BaseEntity::OnDataChanged(updateType);

	if ( updateType == DATA_UPDATE_CREATED )
	{
		Start( ParticleMgr(), NULL );
	}
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:12,代码来源:fx_trail.cpp

示例12: defined

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CBasePlasmaProjectile::Activate( void )
{
	BaseClass::Activate();

#if defined( CLIENT_DLL )
	if ( IsClientCreated() && !m_pParticleMgr )
	{
		Start(ParticleMgr(), NULL);
		SetNextClientThink( CLIENT_THINK_ALWAYS );
	}
#endif
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:15,代码来源:plasmaprojectile.cpp

示例13: Start

//-----------------------------------------------------------------------------
// Purpose: Called after a data update has occured
// Input  : bnewentity - 
//-----------------------------------------------------------------------------
void C_SmokeStack::OnDataChanged(DataUpdateType_t updateType)
{
	C_BaseEntity::OnDataChanged(updateType);

	if(updateType == DATA_UPDATE_CREATED)
	{
		Start(ParticleMgr(), NULL);
	}

	// Recalulate lifetime in case length or speed changed.
	m_InvLifetime = m_Speed / m_JetLength;
}
开发者ID:TalonBraveInfo,项目名称:InvasionSource,代码行数:16,代码来源:c_smokestack.cpp

示例14: LookupAttachment

//-----------------------------------------------------------------------------
// Creates, destroys particles attached to an attachment
//-----------------------------------------------------------------------------
void C_EnvParticleScript::CreateParticle( const char *pAttachmentName, const char *pSpriteName )
{
	// Find the attachment
	int nAttachment = LookupAttachment( pAttachmentName );
	if ( nAttachment <= 0 )
		return;

	// Get the sprite materials
	PMaterialHandle hMat = m_ParticleEffect.FindOrAddMaterial( pSpriteName );
	ParticleScriptParticle_t *pParticle = 
		(ParticleScriptParticle_t*)m_ParticleEffect.AddParticle(sizeof(ParticleScriptParticle_t), hMat);

	if ( pParticle == NULL )
		return;
	
	// Get the sprite size from the material's materialvars
	bool bFound = false;
	IMaterialVar *pMaterialVar = NULL;
	IMaterial *pMaterial = ParticleMgr()->PMaterialToIMaterial( hMat );
	if ( pMaterial )
	{
		pMaterialVar = pMaterial->FindVar( "$spritesize", &bFound, false );
	}

	if ( bFound )
	{
		pParticle->m_flSize = pMaterialVar->GetFloatValue();
	}
	else
	{
		pParticle->m_flSize = 100.0f;
	}

	// Make sure the particle cull size reflects our particles
	if ( pParticle->m_flSize > m_flMaxParticleSize )
	{
		m_flMaxParticleSize = pParticle->m_flSize;
		m_ParticleEffect.SetParticleCullRadius( m_flMaxParticleSize );
	}

	// Place the particle on the attachment specified
	pParticle->m_nAttachment = nAttachment;
	QAngle vecAngles;
	GetAttachment( nAttachment, pParticle->m_Pos, vecAngles );

	if ( m_flSequenceScale != 1.0f )
	{
		pParticle->m_Pos -= GetAbsOrigin();
		pParticle->m_Pos *= m_flSequenceScale;
		pParticle->m_Pos += GetAbsOrigin();
	}
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:55,代码来源:c_env_particlescript.cpp

示例15: Start

//-----------------------------------------------------------------------------
// Purpose: Called after a data update has occured
// Input  : bnewentity - 
//-----------------------------------------------------------------------------
void C_SteamJet::OnDataChanged(DataUpdateType_t updateType)
{
	C_BaseEntity::OnDataChanged(updateType);

	if(updateType == DATA_UPDATE_CREATED)
	{
		Start(ParticleMgr(), NULL);
	}

	// Recalulate lifetime in case length or speed changed.
	m_Lifetime = m_JetLength / m_Speed;
	m_ParticleEffect.SetParticleCullRadius( max(m_StartSize, m_EndSize) );
}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:17,代码来源:c_steamjet.cpp


注:本文中的ParticleMgr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。