本文整理汇总了C++中CStudioHdr::GetNumPoseParameters方法的典型用法代码示例。如果您正苦于以下问题:C++ CStudioHdr::GetNumPoseParameters方法的具体用法?C++ CStudioHdr::GetNumPoseParameters怎么用?C++ CStudioHdr::GetNumPoseParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStudioHdr
的用法示例。
在下文中一共展示了CStudioHdr::GetNumPoseParameters方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
ControlPanel::initPoseParameters()
{
CStudioHdr *hdr = models->GetActiveStudioModel()->GetStudioHdr();
if (hdr)
{
for (int i = 0; i < hdr->GetNumPoseParameters(); i++)
{
setBlend( i, 0.0 );
}
}
}
示例2: LookupPoseParameter
//-----------------------------------------------------------------------------
// Purpose: Clear all pose parameters
//-----------------------------------------------------------------------------
void C_HL2MP_Player::InitializePoseParams( void )
{
m_headYawPoseParam = LookupPoseParameter( "head_yaw" );
GetPoseParameterRange( m_headYawPoseParam, m_headYawMin, m_headYawMax );
m_headPitchPoseParam = LookupPoseParameter( "head_pitch" );
GetPoseParameterRange( m_headPitchPoseParam, m_headPitchMin, m_headPitchMax );
CStudioHdr *hdr = GetModelPtr();
for ( int i = 0; i < hdr->GetNumPoseParameters() ; i++ )
{
SetPoseParameter( hdr, i, 0.0 );
}
}
示例3: GetStudioHdr
int StudioModel::LookupPoseParameter( char const *szName )
{
CStudioHdr *pStudioHdr = GetStudioHdr();
if (!pStudioHdr)
return false;
for (int iParameter = 0; iParameter < pStudioHdr->GetNumPoseParameters(); iParameter++)
{
if (stricmp( szName, pStudioHdr->pPoseParameter( iParameter ).pszName() ) == 0)
{
return iParameter;
}
}
return -1;
}
示例4: SetNormalizedPoseParameter
void CASW_Dummy_Vehicle::SetNormalizedPoseParameter(int iParam, float fValue)
{
CStudioHdr *pStudioHdr = GetModelPtr();
if (!pStudioHdr)
return;
if (iParam < 0 || iParam >= pStudioHdr->GetNumPoseParameters())
return;
const mstudioposeparamdesc_t &Pose = pStudioHdr->pPoseParameter( iParam );
float diff = Pose.end - Pose.start;
SetPoseParameter(iParam, Pose.start + diff * fValue);
}
示例5: GetPoseParameterRange
bool StudioModel::GetPoseParameterRange( int iParameter, float *pflMin, float *pflMax )
{
*pflMin = 0;
*pflMax = 0;
CStudioHdr *pStudioHdr = GetStudioHdr();
if (!pStudioHdr)
return false;
if (iParameter < 0 || iParameter >= pStudioHdr->GetNumPoseParameters())
return false;
const mstudioposeparamdesc_t &Pose = pStudioHdr->pPoseParameter( iParameter );
*pflMin = Pose.start;
*pflMax = Pose.end;
return true;
}
示例6: LoadModel
bool SEditModelRender::LoadModel( const char *localPath )
{
DestroyModel();
const model_t *mdl = modelinfo->FindOrLoadModel( localPath );
if ( !mdl )
return false;
Q_strcpy( m_szModelPath, localPath );
C_BaseFlex *pEnt = new C_BaseFlex();
pEnt->InitializeAsClientEntity( NULL,
#ifdef SWARM_DLL
false
#else
RENDER_GROUP_OPAQUE_ENTITY
#endif
);
MDLCACHE_CRITICAL_SECTION();
pEnt->SetModelPointer( mdl );
pEnt->Spawn();
pEnt->SetAbsAngles( vec3_angle );
pEnt->SetAbsOrigin( vec3_origin );
pEnt->AddEffects( EF_NODRAW | EF_NOINTERP );
pEnt->m_EntClientFlags |= ENTCLIENTFLAG_DONTUSEIK;
// leave it alone.
pEnt->RemoveFromLeafSystem();
cl_entitylist->RemoveEntity( pEnt->GetRefEHandle() );
pEnt->CollisionProp()->DestroyPartitionHandle();
CStudioHdr *pHdr = pEnt->GetModelPtr();
m_iNumPoseParams = pHdr ? pHdr->GetNumPoseParameters() : 0;
pModelInstance = pEnt;
return true;
}
示例7: EdgeLimitPoseParameter
float CAnimating::EdgeLimitPoseParameter( int iParameter, float flValue, float flBase )
{
CStudioHdr *pstudiohdr = GetModelPtr( );
if ( !pstudiohdr )
{
return flValue;
}
if (iParameter < 0 || iParameter >= pstudiohdr->GetNumPoseParameters())
{
return flValue;
}
const mstudioposeparamdesc_t &Pose = pstudiohdr->pPoseParameter( iParameter );
if (Pose.loop || Pose.start == Pose.end)
{
return flValue;
}
return RangeCompressor( flValue, Pose.start, Pose.end, flBase );
}
示例8: DrawModel
//-----------------------------------------------------------------------------
// Purpose: Render the weapon. Draw the Viewmodel if the weapon's being carried
// by this player, otherwise draw the worldmodel.
//-----------------------------------------------------------------------------
int C_BaseViewModel::DrawModel( int flags, const RenderableInstance_t &instance )
{
if ( !m_bReadyToDraw )
return 0;
if ( flags & STUDIO_RENDER )
{
// Determine blending amount and tell engine
float blend = (float)( instance.m_nAlpha / 255.0f );
// Totally gone
if ( blend <= 0.0f )
return 0;
// Tell engine
render->SetBlend( blend );
float color[3];
GetColorModulation( color );
render->SetColorModulation( color );
}
CMatRenderContextPtr pRenderContext( materials );
if ( ShouldFlipViewModel() )
pRenderContext->CullMode( MATERIAL_CULLMODE_CW );
int ret = 0;
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
C_BaseCombatWeapon *pWeapon = GetOwningWeapon();
// If the local player's overriding the viewmodel rendering, let him do it
if ( pPlayer && pPlayer->IsOverridingViewmodel() )
{
ret = pPlayer->DrawOverriddenViewmodel( this, flags, instance );
}
else if ( pWeapon && pWeapon->IsOverridingViewmodel() )
{
ret = pWeapon->DrawOverriddenViewmodel( this, flags, instance );
}
else
{
ret = BaseClass::DrawModel( flags, instance );
}
pRenderContext->CullMode( MATERIAL_CULLMODE_CCW );
// Now that we've rendered, reset the animation restart flag
if ( flags & STUDIO_RENDER )
{
if ( m_nOldAnimationParity != m_nAnimationParity )
{
m_nOldAnimationParity = m_nAnimationParity;
}
// Tell the weapon itself that we've rendered, in case it wants to do something
if ( pWeapon )
{
pWeapon->ViewModelDrawn( this );
}
if ( vm_debug.GetBool() )
{
MDLCACHE_CRITICAL_SECTION();
int line = 16;
CStudioHdr *hdr = GetModelPtr();
engine->Con_NPrintf( line++, "%s: %s(%d), cycle: %.2f cyclerate: %.2f playbackrate: %.2f\n",
(hdr)?hdr->pszName():"(null)",
GetSequenceName( GetSequence() ),
GetSequence(),
GetCycle(),
GetSequenceCycleRate( hdr, GetSequence() ),
GetPlaybackRate()
);
if ( hdr )
{
for( int i=0; i < hdr->GetNumPoseParameters(); ++i )
{
const mstudioposeparamdesc_t &Pose = hdr->pPoseParameter( i );
engine->Con_NPrintf( line++, "pose_param %s: %f",
Pose.pszName(), GetPoseParameter( i ) );
}
}
// Determine blending amount and tell engine
float blend = (float)( instance.m_nAlpha / 255.0f );
float color[3];
GetColorModulation( color );
engine->Con_NPrintf( line++, "blend=%f, color=%f,%f,%f", blend, color[0], color[1], color[2] );
engine->Con_NPrintf( line++, "GetRenderMode()=%d", GetRenderMode() );
engine->Con_NPrintf( line++, "m_nRenderFX=0x%8.8X", GetRenderFX() );
color24 c = GetRenderColor();
unsigned char a = GetRenderAlpha();
engine->Con_NPrintf( line++, "rendercolor=%d,%d,%d,%d", c.r, c.g, c.b, a );
//.........这里部分代码省略.........
示例9: FindPoseCycle
void IFaceposerModels::CFacePoserModel::CreateNewBitmap( char const *pchBitmapFilename, int sequence, int nSnapShotSize, bool bZoomInOnFace, CExpression *pExpression, mxbitmapdata_t *bitmap )
{
MatSysWindow *pWnd = g_pMatSysWindow;
if ( !pWnd )
return;
StudioModel *model = m_pModel;
if ( !model )
return;
CStudioHdr *hdr = model->GetStudioHdr();
if ( !hdr )
return;
if ( sequence < 0 || sequence >= hdr->GetNumSeq() )
return;
mstudioseqdesc_t &seqdesc = hdr->pSeqdesc( sequence );
Con_ColorPrintf( FILE_COLOR, "Creating bitmap %s for sequence '%s'\n", pchBitmapFilename, seqdesc.pszLabel() );
model->ClearOverlaysSequences();
int iLayer = model->GetNewAnimationLayer();
model->SetOverlaySequence( iLayer, sequence, 1.0 );
model->SetOverlayRate( iLayer, FindPoseCycle( model, sequence ), 0.0 );
for (int i = 0; i < hdr->GetNumPoseParameters(); i++)
{
model->SetPoseParameter( i, 0.0 );
}
float flexValues[ GLOBAL_STUDIO_FLEX_CONTROL_COUNT ] = { 0 };
if ( pExpression )
{
float *settings = pExpression->GetSettings();
float *weights = pExpression->GetWeights();
// Save existing settings from model
for ( LocalFlexController_t i = LocalFlexController_t(0); i < hdr->numflexcontrollers(); ++i )
{
int j = hdr->pFlexcontroller( i )->localToGlobal;
if ( j == -1 )
continue;
flexValues[ i ] = model->GetFlexController( i );
// Set Value from passed in settings
model->SetFlexController( i, settings[ j ] * weights[ j ] );
}
}
model->ClearLookTargets( );
QAngle oldrot, oldLight;
Vector oldtrans;
VectorCopy( model->m_angles, oldrot );
VectorCopy( model->m_origin, oldtrans );
VectorCopy( g_viewerSettings.lightrot, oldLight );
model->m_angles.Init();
model->m_origin.Init();
g_viewerSettings.lightrot.Init();
g_viewerSettings.lightrot.y = -180;
bool bSaveGround = g_viewerSettings.showGround;
g_viewerSettings.showGround = false;
if ( bZoomInOnFace )
{
Vector size;
VectorSubtract( hdr->hull_max(), hdr->hull_min(), size );
float eyeheight = hdr->hull_min().z + 0.9 * size.z;
// float width = ( size.x + size.y ) / 2.0f;
model->m_origin.x = size.z * .6f;
if ( hdr->GetNumAttachments() > 0 )
{
for (int i = 0; i < hdr->GetNumAttachments(); i++)
{
const mstudioattachment_t &attachment = hdr->pAttachment( i );
int iBone = hdr->GetAttachmentBone( i );
if ( Q_stricmp( attachment.pszName(), "eyes" ) )
continue;
mstudiobone_t *bone = hdr->pBone( iBone );
if ( !bone )
continue;
matrix3x4_t boneToPose;
MatrixInvert( bone->poseToBone, boneToPose );
matrix3x4_t attachmentPoseToLocal;
ConcatTransforms( boneToPose, attachment.local, attachmentPoseToLocal );
Vector localSpaceEyePosition;
VectorITransform( vec3_origin, attachmentPoseToLocal, localSpaceEyePosition );
//.........这里部分代码省略.........