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


C++ GetModelPtr函数代码示例

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


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

示例1: GetModelPtr

//-----------------------------------------------------------------------------
// Purpose: clear out any face/eye values stored in the material system
//-----------------------------------------------------------------------------
void C_HL2MPRagdoll::SetupWeights( const matrix3x4_t *pBoneToWorld, int nFlexWeightCount, float *pFlexWeights, float *pFlexDelayedWeights )
{
	BaseClass::SetupWeights( pBoneToWorld, nFlexWeightCount, pFlexWeights, pFlexDelayedWeights );

	static float destweight[128];
	static bool bIsInited = false;

	CStudioHdr *hdr = GetModelPtr();
	if ( !hdr )
		return;

	int nFlexDescCount = hdr->numflexdesc();
	if ( nFlexDescCount )
	{
		Assert( !pFlexDelayedWeights );
		memset( pFlexWeights, 0, nFlexWeightCount * sizeof(float) );
	}

	if ( m_iEyeAttachment > 0 )
	{
		matrix3x4_t attToWorld;
		if (GetAttachment( m_iEyeAttachment, attToWorld ))
		{
			Vector local, tmp;
			local.Init( 1000.0f, 0.0f, 0.0f );
			VectorTransform( local, attToWorld, tmp );
			modelrender->SetViewTarget( GetModelPtr(), GetBody(), tmp );
		}
	}
}
开发者ID:uunx,项目名称:quakelife2,代码行数:33,代码来源:c_hl2mp_player.cpp

示例2: MDLCACHE_CRITICAL_SECTION

//-----------------------------------------------------------------------------
// Purpose: find the anim events that may have started sounds, and stop them.
//-----------------------------------------------------------------------------
void C_BaseObject::StopAnimGeneratedSounds( void )
{
	MDLCACHE_CRITICAL_SECTION();

	CStudioHdr *pStudioHdr = GetModelPtr();
	if ( !pStudioHdr )
		return;

	mstudioseqdesc_t &seqdesc = pStudioHdr->pSeqdesc( GetSequence() );

	float flCurrentCycle = GetCycle();

	mstudioevent_t *pevent = GetEventIndexForSequence( seqdesc );

	for (int i = 0; i < (int)seqdesc.numevents; i++)
	{
		if ( pevent[i].cycle < flCurrentCycle )
		{
			if ( pevent[i].event == CL_EVENT_SOUND || pevent[i].event == AE_CL_PLAYSOUND )
			{
				StopSound( entindex(), pevent[i].options );
			}
		}
	}
}
开发者ID:Deathreus,项目名称:TF2Classic,代码行数:28,代码来源:c_baseobject.cpp

示例3: GetModelPtr

// asw - test always advancing the frames
void C_ASW_Alien::ASWUpdateClientSideAnimation()
{
	if ( GetSequence() != -1 )
	{
		// latch old values
		//OnLatchInterpolatedVariables( LATCH_ANIMATION_VAR );
		// move frame forward
		//FrameAdvance( 0.0f ); // 0 means to use the time we last advanced instead of a constant

		CStudioHdr *hdr = GetModelPtr();
		float cyclerate = hdr ? GetSequenceCycleRate( hdr, GetSequence() ) : 1.0f;
		float addcycle = gpGlobals->frametime * cyclerate * m_flPlaybackRate;
		float flNewCycle = GetCycle() + addcycle;
		m_flAnimTime = gpGlobals->curtime;

		if ( (flNewCycle < 0.0f) || (flNewCycle >= 1.0f) ) 
		{	
			if (flNewCycle >= 1.0f)	// asw
				ReachedEndOfSequence(); // asw
			if ( IsSequenceLooping( hdr, GetSequence() ) )
			{
				flNewCycle -= (int)(flNewCycle);
			}
			else
			{
				flNewCycle = (flNewCycle < 0.0f) ? 0.0f : 1.0f;
			}
		}

		SetCycle( flNewCycle );
	}
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:33,代码来源:c_asw_alien.cpp

示例4: GetModelPtr

void C_BaseAnimatingOverlay::GetRenderBounds( Vector& theMins, Vector& theMaxs )
{
	BaseClass::GetRenderBounds( theMins, theMaxs );

	if ( !IsRagdoll() )
	{
		CStudioHdr *pStudioHdr = GetModelPtr();
		if ( !pStudioHdr || !pStudioHdr->SequencesAvailable() )
			return;

		int nSequences = pStudioHdr->GetNumSeq();

		int i;
		for (i = 0; i < m_AnimOverlay.Count(); i++)
		{
			if (m_AnimOverlay[i].m_flWeight > 0.0)
			{
				if ( m_AnimOverlay[i].m_nSequence >= nSequences )
				{
					continue;
				}

				mstudioseqdesc_t &seqdesc = pStudioHdr->pSeqdesc( m_AnimOverlay[i].m_nSequence );
				VectorMin( seqdesc.bbmin, theMins, theMins );
				VectorMax( seqdesc.bbmax, theMaxs, theMaxs );
			}
		}
	}
}
开发者ID:TotallyMehis,项目名称:ZM-Updated,代码行数:29,代码来源:c_baseanimatingoverlay.cpp

示例5: GetAbsAngles

//-----------------------------------------------------------------------------
void C_CHostage::UpdateClientSideAnimation()
{
	if (IsDormant())
	{
		return;
	}

	m_PlayerAnimState->Update( GetAbsAngles()[YAW], GetAbsAngles()[PITCH] );

	// initialize pose parameters
	char *setToZero[] =
	{
		"spine_yaw",
		"head_roll"
	};
	CStudioHdr *pStudioHdr = GetModelPtr();
	for ( int i=0; i < ARRAYSIZE( setToZero ); i++ )
	{
		int index = LookupPoseParameter( pStudioHdr, setToZero[i] );
		if ( index >= 0 )
			SetPoseParameter( pStudioHdr, index, 0 );
	}

	// orient head and eyes
	LookAround();
	UpdateLookAt( pStudioHdr );


	BaseClass::UpdateClientSideAnimation();
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:31,代码来源:c_cs_hostage.cpp

示例6: GetOwner

// If the local player is visible (thirdperson mode, tf2 taunts, etc., then make sure that we are using the 
//  w_ (world) model not the v_ (view) model or else the model can flicker, etc.
// Otherwise, if we're not the local player, always use the world model
void C_BaseCombatWeapon::EnsureCorrectRenderingModel()
{
	C_BasePlayer *localplayer = C_BasePlayer::GetLocalPlayer();
	if ( localplayer && 
		localplayer == GetOwner() &&
		!localplayer->ShouldDrawLocalPlayer() )
	{
		return;
	}

	MDLCACHE_CRITICAL_SECTION();

	// BRJ 10/14/02
	// FIXME: Remove when Yahn's client-side prediction is done
	// It's a hacky workaround for the model indices fighting
	// (GetRenderBounds uses the model index, which is for the view model)
	SetModelIndex( GetWorldModelIndex() );

	// Validate our current sequence just in case ( in theory the view and weapon models should have the same sequences for sequences that overlap at least )
	CStudioHdr *pStudioHdr = GetModelPtr();
	if ( pStudioHdr && 
		GetSequence() >= pStudioHdr->GetNumSeq() )
	{
		SetSequence( 0 );
	}
}
开发者ID:AniCator,项目名称:Project-Potato,代码行数:29,代码来源:c_basecombatweapon.cpp

示例7: GetModelPtr

//-----------------------------------------------------------------------------
// Purpose: zero's out all non-restore safe fields
// Output :
//-----------------------------------------------------------------------------
void CBaseAnimatingOverlay::OnRestore( )
{
	int i;

	// force order of unused layers to current MAX_OVERLAYS
	// and Tracker 48843 (Alyx skating after restore) restore the owner entity ptr (otherwise the network layer won't get NetworkStateChanged signals until the layer is re-Init()'ed
	for (i = 0; i < m_AnimOverlay.Count(); i++)
	{
		m_AnimOverlay[i].m_pOwnerEntity = this;

		if ( !m_AnimOverlay[i].IsActive())
		{
			m_AnimOverlay[i].m_nOrder.Set( MAX_OVERLAYS );
		}
	}

	// get rid of all layers that shouldn't be restored
	for (i = 0; i < m_AnimOverlay.Count(); i++)
	{
		if ( ( m_AnimOverlay[i].IsActive() && (m_AnimOverlay[i].m_fFlags & ANIM_LAYER_DONTRESTORE) ) ||
			 ( GetModelPtr() && !IsValidSequence(m_AnimOverlay[i].m_nSequence) ) )
		{
			FastRemoveLayer( i );
		}
	}

	BaseClass::OnRestore();
}
开发者ID:Muini,项目名称:Nag-asw,代码行数:32,代码来源:BaseAnimatingOverlay.cpp

示例8: SetNextThink

void CASW_Parasite::InfestThink( void )
{	
	SetNextThink( gpGlobals->curtime + 0.1f );

	if ( !GetModelPtr() )
		return;
	
	StudioFrameAdvance();

	DispatchAnimEvents( this );

	CASW_Marine *pMarine = dynamic_cast<CASW_Marine*>(GetParent());
	CASW_Colonist *pColonist = dynamic_cast<CASW_Colonist*>(GetParent());

	if (!pColonist) {
	if ( !pMarine || !pMarine->IsInfested() || pMarine->IsEffectActive( EF_NODRAW ) )
	{
		FinishedInfesting();
	}
	}

	if (!pMarine) {
		if ( !pColonist || !pColonist->IsInfested() || pColonist->IsEffectActive( EF_NODRAW ) )
		{
			FinishedInfesting();
		}
	}
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:28,代码来源:asw_parasite.cpp

示例9: AllocateLayer

//-----------------------------------------------------------------------------
// Purpose: 
// Output : int
//-----------------------------------------------------------------------------
int	CBaseAnimatingOverlay::AddLayeredSequence( int sequence, int iPriority )
{
	int i = AllocateLayer( iPriority );
	// No room?
	if ( IsValidLayer( i ) )
	{
		m_AnimOverlay[i].m_flCycle = 0;
		m_AnimOverlay[i].m_flPrevCycle = 0;
		m_AnimOverlay[i].m_flPlaybackRate = 1.0;
		m_AnimOverlay[i].m_nActivity = ACT_INVALID;
		m_AnimOverlay[i].m_nSequence = sequence;
		m_AnimOverlay[i].m_flWeight = 1.0f;
		m_AnimOverlay[i].m_flBlendIn = 0.0f;
		m_AnimOverlay[i].m_flBlendOut = 0.0f;
		m_AnimOverlay[i].m_bSequenceFinished = false;
		m_AnimOverlay[i].m_flLastEventCheck = 0;
		m_AnimOverlay[i].m_bLooping = ((GetSequenceFlags( GetModelPtr(), sequence ) & STUDIO_LOOPING) != 0);
		if (ai_sequence_debug.GetBool() == true && m_debugOverlays & OVERLAY_NPC_SELECTED_BIT)
		{
			Msg("%5.3f : adding %d (%d): %s : %5.3f (%.3f)\n", gpGlobals->curtime, i, m_AnimOverlay[ i ].m_nOrder.Get(), GetSequenceName( m_AnimOverlay[ i ].m_nSequence ), m_AnimOverlay[ i ].m_flCycle.Get(), m_AnimOverlay[ i ].m_flWeight.Get() );
		}
	}

	return i;
}
开发者ID:Muini,项目名称:Nag-asw,代码行数:29,代码来源:BaseAnimatingOverlay.cpp

示例10: GetModelPtr

void CEnvParticleScript::PrecacheAnimationEventMaterials()
{
	CStudioHdr *hdr = GetModelPtr();
	if ( hdr )
	{
		int numseq = hdr->GetNumSeq();
		for ( int i = 0; i < numseq; ++i )
		{
			mstudioseqdesc_t& seqdesc = hdr->pSeqdesc( i );
			int ecount = seqdesc.numevents;
			for ( int j = 0 ; j < ecount; ++j )
			{
				const mstudioevent_t* event = (const mstudioevent_for_client_server_t*)seqdesc.pEvent( j );
				if ( event->Event() == CL_EVENT_SPRITEGROUP_CREATE )
				{
					char pAttachmentName[256];
					char pSpriteName[256];
					int nArgs = sscanf( event->pszOptions(), "%255s %255s", pAttachmentName, pSpriteName );
					if ( nArgs == 2 )
					{
						PrecacheMaterial( pSpriteName );
					}
				}
			}
		}
	}
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:27,代码来源:env_particlescript.cpp

示例11: GetModelPtr

void CRagdollProp::SetupBones( matrix3x4_t *pBoneToWorld, int boneMask )
{
	studiohdr_t *pStudioHdr = GetModelPtr( );
	bool sim[MAXSTUDIOBONES];
	memset( sim, 0, pStudioHdr->numbones );

	int i;

	for ( i = 0; i < m_ragdoll.listCount; i++ )
	{
		if ( RagdollGetBoneMatrix( m_ragdoll, pBoneToWorld, i ) )
		{
			sim[m_ragdoll.boneIndex[i]] = true;
		}
	}

	mstudiobone_t *pbones = pStudioHdr->pBone( 0 );
	for ( i = 0; i < pStudioHdr->numbones; i++ )
	{
		if ( sim[i] )
			continue;

		MatrixCopy( pBoneToWorld[pbones[i].parent], pBoneToWorld[ i ] );
	}
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:25,代码来源:physics_prop_ragdoll.cpp

示例12:

void CHL2MP_Player::PickDefaultSpawnTeam( void )
{
	if (GetModelPtr() == NULL)
	{
		ChangeTeam(TEAM_UNASSIGNED);
	}
}
开发者ID:RaraFolf,项目名称:FIREFIGHT-RELOADED-src-sdk-2013,代码行数:7,代码来源:hl2mp_player.cpp

示例13: GetModelPtr

//-----------------------------------------------------------------------------
// Should this object cast render-to-texture shadows?
//-----------------------------------------------------------------------------
ShadowType_t C_PropVehicleDriveable::ShadowCastType()
{
	CStudioHdr *pStudioHdr = GetModelPtr();
	if ( !pStudioHdr )
		return SHADOWS_NONE;

	if ( IsEffectActive(EF_NODRAW | EF_NOSHADOW) )
		return SHADOWS_NONE;

	// Always use render-to-texture. We'll always the dirty bits in our think function
	return SHADOWS_RENDER_TO_TEXTURE;
}
开发者ID:WorldGamers,项目名称:Mobile-Forces-Source,代码行数:15,代码来源:c_prop_vehicle.cpp

示例14: SetActivity

//-----------------------------------------------------------------------------
// Purpose: 
// Input  : act - 
//-----------------------------------------------------------------------------
void CBaseObject::SetActivity( Activity act ) 
{ 
	// Hrm, it's not actually a studio model...
	if ( !GetModelPtr() )
		return;

	int sequence = SelectWeightedSequence( act ); 
	if ( sequence != ACTIVITY_NOT_AVAILABLE )
	{
		m_Activity = act; 
		SetObjectSequence( sequence );
	}
}
开发者ID:staticfox,项目名称:TF2Classic,代码行数:17,代码来源:baseobject_shared.cpp

示例15: StudioFrameAdvance

void CBaseCombatWeapon::Operator_FrameUpdate( CBaseCombatCharacter *pOperator )
{
	StudioFrameAdvance( ); // animate

	if ( IsSequenceFinished() )
	{
		if ( SequenceLoops() )
		{
			// animation does loop, which means we're playing subtle idle. Might need to fidget.
			int iSequence = SelectWeightedSequence( GetActivity() );
			if ( iSequence != ACTIVITY_NOT_AVAILABLE )
			{
				ResetSequence( iSequence );	// Set to new anim (if it's there)
			}
		}
#if 0
		else
		{
			// animation that just ended doesn't loop! That means we just finished a fidget
			// and should return to our heaviest weighted idle (the subtle one)
			SelectHeaviestSequence( GetActivity() );
		}
#endif
	}

	CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
	if ( pOwner == NULL )
		return;

	CBaseViewModel *vm = pOwner->GetViewModel( m_nViewModelIndex );
	if ( vm == NULL )
		return;

	// HACK: Player weapon and view model often use the same mdl, which results
	// in duplicate anim events.  For now, let the view model handle the events
	// if they're the same, which is the preferred behavior in general.
	CStudioHdr *w_hdr = GetModelPtr();
	CStudioHdr *v_hdr = vm->GetModelPtr();
	if ( w_hdr->GetRenderHdr() != v_hdr->GetRenderHdr() )
	{
		// Animation events are passed back to the weapon's owner/operator
		DispatchAnimEvents( pOperator );
	}

	// Update and dispatch the viewmodel events
	if ( vm != NULL )
	{
		vm->StudioFrameAdvance();
		vm->DispatchAnimEvents( this );
	}
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:51,代码来源:basecombatweapon.cpp


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