本文整理汇总了C++中CStudioHdr类的典型用法代码示例。如果您正苦于以下问题:C++ CStudioHdr类的具体用法?C++ CStudioHdr怎么用?C++ CStudioHdr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CStudioHdr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
ControlPanel::initBodypartChoices()
{
CStudioHdr *hdr = models->GetActiveStudioModel()->GetStudioHdr();
if (hdr)
{
int i;
mstudiobodyparts_t *pbodyparts = hdr->pBodypart(0);
cBodypart->removeAll();
if (hdr->numbodyparts() > 0)
{
for (i = 0; i < hdr->numbodyparts(); i++)
cBodypart->add (pbodyparts[i].pszName());
cBodypart->select (0);
cSubmodel->removeAll();
for (i = 0; i < pbodyparts[0].nummodels; i++)
{
char str[64];
sprintf (str, "Submodel %d", i + 1);
cSubmodel->add (str);
}
cSubmodel->select (0);
}
}
}
示例2: 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 );
}
}
示例3: Count
void IFaceposerModels::CheckResetFlexes( void )
{
int current_render_frame = g_MDLViewer->GetCurrentFrame();
if ( current_render_frame == m_nLastRenderFrame )
return;
m_nLastRenderFrame = current_render_frame;
// the phoneme editor just adds to the face, so reset the controllers
int c = Count();
for ( int i = 0; i < c; i++ )
{
CFacePoserModel *m = GetEntry( i );
if ( !m )
continue;
StudioModel *model = m->GetModel();
if ( !model )
continue;
CStudioHdr *hdr = model->GetStudioHdr();
if ( !hdr )
continue;
for ( LocalFlexController_t i = LocalFlexController_t(0); i < hdr->numflexcontrollers(); i++ )
{
model->SetFlexController( i, 0.0f );
}
}
}
示例4: GetModelPtr
void CAnimating::GetBoneTransform( int iBone, matrix3x4_t &pBoneToWorld )
{
CStudioHdr *pStudioHdr = GetModelPtr( );
if (!pStudioHdr)
{
Assert(!"CBaseAnimating::GetBoneTransform: model missing");
return;
}
if (iBone < 0 || iBone >= pStudioHdr->numbones())
{
Assert(!"CBaseAnimating::GetBoneTransform: invalid bone index");
return;
}
CBoneCache *pcache = GetBoneCache( );
matrix3x4_t *pmatrix = pcache->GetCachedBone( iBone );
if ( !pmatrix )
{
MatrixCopy( EntityToWorldTransform(), pBoneToWorld );
return;
}
Assert( pmatrix );
// FIXME
MatrixCopy( *pmatrix, pBoneToWorld );
}
示例5: SetSequence
void CAnimating::ResetSequenceInfo()
{
if (GetSequence() == -1)
{
// This shouldn't happen. Setting m_nSequence blindly is a horrible coding practice.
SetSequence( 0 );
}
CStudioHdr *pStudioHdr = GetModelPtr();
m_flGroundSpeed = GetSequenceGroundSpeed( pStudioHdr, GetSequence() );
m_bSequenceLoops = ((GetSequenceFlags( pStudioHdr, GetSequence() ) & STUDIO_LOOPING) != 0);
// m_flAnimTime = gpGlobals->time;
m_flPlaybackRate = 1.0;
m_bSequenceFinished = false;
m_flLastEventCheck = 0;
m_nNewSequenceParity = ( *(m_nNewSequenceParity)+1 ) & EF_PARITY_MASK;
m_nResetEventsParity = ( *(m_nResetEventsParity)+1 ) & EF_PARITY_MASK;
// FIXME: why is this called here? Nothing should have changed to make this nessesary
if ( pStudioHdr )
{
SetEventIndexForSequence( pStudioHdr->pSeqdesc( GetSequence() ) );
}
}
示例6: 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 );
}
}
}
示例7: HasContentsGrate
bool HasContentsGrate( CBaseEntity *pEntity )
{
// FIXME: Move this into the GetModelContents() function in base entity
// Find the contents based on the model type
int nModelType = modelinfo->GetModelType( pEntity->GetModel() );
if ( nModelType == mod_studio )
{
CBaseAnimating *pAnim = dynamic_cast<CBaseAnimating *>(pEntity);
if ( pAnim != NULL )
{
CStudioHdr *pStudioHdr = pAnim->GetModelPtr();
if ( pStudioHdr != NULL && (pStudioHdr->contents() & CONTENTS_GRATE) )
return true;
}
}
else if ( nModelType == mod_brush )
{
// Brushes poll their contents differently
int contents = modelinfo->GetModelContents( pEntity->GetModelIndex() );
if ( contents & CONTENTS_GRATE )
return true;
}
return false;
}
示例8: 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 );
}
}
}
}
示例9: FindNamedActor
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_SceneEntity::ResetActorFlexesForScene()
{
int nActorCount = m_pScene->GetNumActors();
for( int iActor = 0; iActor < nActorCount; ++iActor )
{
CChoreoActor *pChoreoActor = m_pScene->GetActor( iActor );
if ( !pChoreoActor )
continue;
C_BaseFlex *pFlexActor = FindNamedActor( pChoreoActor );
if ( !pFlexActor )
continue;
CStudioHdr *pStudioHdr = pFlexActor->GetModelPtr();
if ( !pStudioHdr )
continue;
if ( pStudioHdr->numflexdesc() == 0 )
continue;
// Reset the flex weights to their starting position.
LocalFlexController_t iController;
for ( iController = LocalFlexController_t(0); iController < pStudioHdr->numflexcontrollers(); ++iController )
{
pFlexActor->SetFlexWeight( iController, 0.0f );
}
// Reset the prediction interpolation values.
pFlexActor->m_iv_flexWeight.Reset();
}
}
示例10: MDLCACHE_CRITICAL_SECTION_
bool StudioModel::PostLoadModel( const char *modelname )
{
MDLCACHE_CRITICAL_SECTION_( g_pMDLCache );
CStudioHdr *pStudioHdr = GetStudioHdr();
if (pStudioHdr == NULL)
return false;
SetSequence (0);
SetController (0, 0.0f);
SetController (1, 0.0f);
SetController (2, 0.0f);
SetController (3, 0.0f);
SetBlendTime( DEFAULT_BLEND_TIME );
// SetHeadTurn( 1.0f ); // FIXME:!!!
int n;
for (n = 0; n < pStudioHdr->numbodyparts(); n++)
{
SetBodygroup (n, 0);
}
SetSkin (0);
/*
Vector mins, maxs;
ExtractBbox (mins, maxs);
if (mins[2] < 5.0f)
m_origin[2] = -mins[2];
*/
return true;
}
示例11: CFmtStr
void IFaceposerModels::CFacePoserModel::RecreateAllAnimationBitmaps()
{
StudioModel *model = m_pModel;
if ( !model )
return;
CStudioHdr *hdr = model->GetStudioHdr();
if ( !hdr )
return;
g_pProgressDialog->Start( CFmtStr( "%s - Animation Thumbnails", GetShortModelName() ), "", true );
for ( int i = 0; i < hdr->GetNumSeq(); ++i )
{
const mstudioseqdesc_t &seq = hdr->pSeqdesc( i );
g_pProgressDialog->UpdateText( "%s", seq.pszLabel() );
g_pProgressDialog->Update( (float)i / (float)hdr->GetNumSeq() );
RecreateAnimationBitmap( i, false );
if ( g_pProgressDialog->IsCancelled() )
{
Msg( "Cancelling\n" );
break;
}
}
g_pProgressDialog->Finish();
ReconcileAnimationBitmaps();
}
示例12: 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 );
}
}
}
}
}
}
示例13: GetMoveParent
//-----------------------------------------------------------------------------
// Zap!
//-----------------------------------------------------------------------------
void CRagdollBoogie::ZapThink()
{
if (!GetMoveParent())
return;
CBaseAnimating *pRagdoll = GetMoveParent()->GetBaseAnimating();
if (!pRagdoll)
return;
// Make electricity on the client
CStudioHdr *pStudioHdr = pRagdoll->GetModelPtr();
if (!pStudioHdr)
return;
mstudiohitboxset_t *set = pStudioHdr->pHitboxSet(pRagdoll->GetHitboxSet());
if (set->numhitboxes == 0)
return;
if (m_nSuppressionCount == 0)
{
CEffectData data;
data.m_nEntIndex = GetMoveParent()->entindex();
data.m_flMagnitude = 4;
data.m_flScale = HasSpawnFlags(SF_RAGDOLL_BOOGIE_ELECTRICAL_NARROW_BEAM) ? 1.0f : 2.0f;
DispatchEffect("TeslaHitboxes", data);
}
SetContextThink(&CRagdollBoogie::ZapThink, gpGlobals->curtime + random->RandomFloat(0.1f, 0.3f), s_pZapContext);
}
示例14: 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 );
}
}
}
}
示例15: GetStudioHdr
//-----------------------------------------------------------------------------
// Purpose: Returns the the sequence should be hidden or not
//-----------------------------------------------------------------------------
bool StudioModel::IsHidden( int iSequence )
{
CStudioHdr *pStudioHdr = GetStudioHdr();
if (pStudioHdr->pSeqdesc( iSequence ).flags & STUDIO_HIDDEN)
return true;
return false;
}