本文整理汇总了C++中CBaseAnimating::GetModelScale方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseAnimating::GetModelScale方法的具体用法?C++ CBaseAnimating::GetModelScale怎么用?C++ CBaseAnimating::GetModelScale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseAnimating
的用法示例。
在下文中一共展示了CBaseAnimating::GetModelScale方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetCollisionBounds
//-----------------------------------------------------------------------------
// Sets the collision bounds + the size
//-----------------------------------------------------------------------------
void CCollisionProperty::SetCollisionBounds( const Vector &mins, const Vector &maxs )
{
if ( ( m_vecMinsPreScaled != mins ) || ( m_vecMaxsPreScaled != maxs ) )
{
m_vecMinsPreScaled = mins;
m_vecMaxsPreScaled = maxs;
}
bool bDirty = false;
// Check if it's a scaled model
CBaseAnimating *pAnim = GetOuter()->GetBaseAnimating();
if ( pAnim && pAnim->GetModelScale() != 1.0f )
{
// Do the scaling
Vector vecNewMins = mins * pAnim->GetModelScale();
Vector vecNewMaxs = maxs * pAnim->GetModelScale();
if ( ( m_vecMins != vecNewMins ) || ( m_vecMaxs != vecNewMaxs ) )
{
m_vecMins = vecNewMins;
m_vecMaxs = vecNewMaxs;
bDirty = true;
}
}
else
{
// No scaling needed!
if ( ( m_vecMins != mins ) || ( m_vecMaxs != maxs ) )
{
m_vecMins = mins;
m_vecMaxs = maxs;
bDirty = true;
}
}
if ( bDirty )
{
//ASSERT_COORD( m_vecMins.Get() );
//ASSERT_COORD( m_vecMaxs.Get() );
Vector vecSize;
VectorSubtract( m_vecMaxs, m_vecMins, vecSize );
m_flRadius = vecSize.Length() * 0.5f;
MarkSurroundingBoundsDirty();
}
}
示例2: SetSurroundingBoundsType
//-----------------------------------------------------------------------------
// Sets the method by which the surrounding collision bounds is set
//-----------------------------------------------------------------------------
void CCollisionProperty::SetSurroundingBoundsType( SurroundingBoundsType_t type, const Vector *pMins, const Vector *pMaxs )
{
m_nSurroundType = type;
if (type != USE_SPECIFIED_BOUNDS)
{
Assert( !pMins && !pMaxs );
MarkSurroundingBoundsDirty();
}
else
{
Assert( pMins && pMaxs );
m_vecSpecifiedSurroundingMinsPreScaled = *pMins;
m_vecSpecifiedSurroundingMaxsPreScaled = *pMaxs;
// Check if it's a scaled model
CBaseAnimating *pAnim = GetOuter()->GetBaseAnimating();
if ( pAnim && pAnim->GetModelScale() != 1.0f )
{
// Do the scaling
Vector vecNewMins = *pMins * pAnim->GetModelScale();
Vector vecNewMaxs = *pMaxs * pAnim->GetModelScale();
m_vecSpecifiedSurroundingMins = vecNewMins;
m_vecSpecifiedSurroundingMaxs = vecNewMaxs;
m_vecSurroundingMins = vecNewMins;
m_vecSurroundingMaxs = vecNewMaxs;
}
else
{
// No scaling needed!
m_vecSpecifiedSurroundingMins = *pMins;
m_vecSpecifiedSurroundingMaxs = *pMaxs;
m_vecSurroundingMins = *pMins;
m_vecSurroundingMaxs = *pMaxs;
}
ASSERT_COORD( m_vecSurroundingMins );
ASSERT_COORD( m_vecSurroundingMaxs );
}
}
示例3: PropBreakableCreateAll
//.........这里部分代码省略.........
#endif
{
#ifdef GAME_DLL
if ( list[i].mpBreakMode == MULTIPLAYER_BREAK_CLIENTSIDE )
continue;
#else
if ( list[i].mpBreakMode == MULTIPLAYER_BREAK_SERVERSIDE )
continue;
#endif
if ( !defaultLocation && list[i].mpBreakMode == MULTIPLAYER_BREAK_DEFAULT )
continue;
}
if ( ( nPropCount != -1 ) && ( nPropBreakablesPerFrameCount > nPropCount ) )
break;
if ( ( iPrecomputedBreakableCount != -1 ) && ( i >= iPrecomputedBreakableCount ) )
break;
matrix3x4_t matrix;
AngleMatrix( params.angles, params.origin, matrix );
CStudioHdr studioHdr;
const model_t *model = modelinfo->GetModel( modelIndex );
if ( model )
{
studioHdr.Init( modelinfo->GetStudiomodel( model ) );
}
// Increment the number of breakable props this frame.
++nPropBreakablesPerFrameCount;
const float flModelScale = pOwnerAnim->GetModelScale();
Vector position = vec3_origin;
QAngle angles = params.angles;
if ( pOwnerAnim && list[i].placementName[0] )
{
if ( list[i].placementIsBone )
{
int boneIndex = pOwnerAnim->LookupBone( list[i].placementName );
if ( boneIndex >= 0 )
{
pOwnerAnim->GetBonePosition( boneIndex, position, angles );
AngleMatrix( angles, position, matrix );
}
}
else
{
int attachmentIndex = Studio_FindAttachment( &studioHdr, list[i].placementName ) + 1;
if ( attachmentIndex > 0 )
{
pOwnerAnim->GetAttachment( attachmentIndex, matrix );
MatrixAngles( matrix, angles );
}
}
}
else
{
int placementIndex = Studio_FindAttachment( &studioHdr, "placementOrigin" ) + 1;
Vector placementOrigin = parentOrigin;
if ( placementIndex > 0 )
{
GetAttachmentLocalSpace( &studioHdr, placementIndex-1, localToWorld );
MatrixGetColumn( localToWorld, 3, placementOrigin );
placementOrigin -= parentOrigin;