本文整理汇总了C++中ISkeletonAnim::SetAnimationNormalizedTime方法的典型用法代码示例。如果您正苦于以下问题:C++ ISkeletonAnim::SetAnimationNormalizedTime方法的具体用法?C++ ISkeletonAnim::SetAnimationNormalizedTime怎么用?C++ ISkeletonAnim::SetAnimationNormalizedTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISkeletonAnim
的用法示例。
在下文中一共展示了ISkeletonAnim::SetAnimationNormalizedTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReplayUpdateThirdPersonAnimations
void CMountedGunController::ReplayUpdateThirdPersonAnimations( ICharacterInstance* pCharacter, float aimRad, float aimUp, float aimDown, bool firstPerson /*= false*/)
{
if (pCharacter)
{
ISkeletonAnim *pSkeletonAnim = pCharacter->GetISkeletonAnim();
assert(pSkeletonAnim);
//Update manually animation time, to match current weapon orientation
uint32 numAnimsLayer = pSkeletonAnim->GetNumAnimsInFIFO(REPLAY_PLAYER_ANIMATION_LAYER_BASE);
for(uint32 i=0; i<numAnimsLayer; i++)
{
CAnimation &animation = pSkeletonAnim->GetAnimFromFIFO(REPLAY_PLAYER_ANIMATION_LAYER_BASE, i);
if (animation.HasStaticFlag(CA_MANUAL_UPDATE))
{
float time = CalculateAnimationTime(aimRad);
pSkeletonAnim->SetAnimationNormalizedTime(&animation, time);
animation.ClearStaticFlag( CA_DISABLE_MULTILAYER );
}
}
if (firstPerson)
return;
//Update additive weights for aiming up/down
pSkeletonAnim->SetLayerBlendWeight(REPLAY_PLAYER_ANIMATION_LAYER_AIM_UP, aimUp);
pSkeletonAnim->SetLayerBlendWeight(REPLAY_PLAYER_ANIMATION_LAYER_AIM_DOWN, aimDown);
}
}
示例2: Resume
void CActionScope::Resume(float forcedBlendTime, uint32 resumeFlags)
{
if (!m_scopeContext.charInst)
{
return;
}
IAnimationSet *pAnimSet = m_scopeContext.charInst->GetIAnimationSet();
if (!pAnimSet)
{
return;
}
ISkeletonAnim *pSkeletonAnim = m_scopeContext.charInst->GetISkeletonAnim();
if (!pSkeletonAnim)
{
return;
}
const bool useDefaultBlendTime = (forcedBlendTime < 0);
for (int i = 0; i < m_numLayers; ++i)
{
SSequencer &sequencer = m_layerSequencers[i];
const int animationLayer = m_layer + i;
const float blendTime = useDefaultBlendTime ? sequencer.blend.duration : forcedBlendTime;
if (sequencer.savedAnimNormalisedTime < 0)
{
pSkeletonAnim->StopAnimationInLayer(animationLayer, blendTime);
}
else
{
const uint32 pos = sequencer.pos - 1;
if (pos < sequencer.sequence.size())
{
SAnimClip& clip = sequencer.sequence[pos];
const int animID = pAnimSet->GetAnimIDByCRC(clip.animation.animRef.crc);
if (0 <= animID)
{
CryCharAnimationParams params;
InitAnimationParams(clip.animation, i, clip.blend, params);
const bool installAnimationSuccess = InstallAnimation(animID, params);
if (installAnimationSuccess)
{
const int animationsInLayer = pSkeletonAnim->GetNumAnimsInFIFO(animationLayer);
CRY_ASSERT(1 <= animationsInLayer);
const bool loopingAnimation = ((clip.animation.flags & CA_LOOP_ANIMATION) != 0);
const uint32 restoreAnimationTimeFlagToCheck = loopingAnimation ? IActionController::ERF_RestoreLoopingAnimationTime : IActionController::ERF_RestoreNonLoopingAnimationTime;
const bool restoreAnimationTime = ((restoreAnimationTimeFlagToCheck & resumeFlags) != 0);
if (restoreAnimationTime)
{
const int lastAnimationIndex = animationsInLayer - 1;
CAnimation &animation = pSkeletonAnim->GetAnimFromFIFO(animationLayer, lastAnimationIndex);
pSkeletonAnim->SetAnimationNormalizedTime(&animation, sequencer.savedAnimNormalisedTime);
}
}
}
}
}
}
}
示例3: if
void CVehicleWeaponControlled::Update3PAnim(CPlayer *player, float goalTime, float frameTime, const Matrix34 &mat)
{
if (player)
{
if (IEntity *entity = player->GetEntity())
{
const float ANIM_ANGLE_RANGE = gf_PI*0.25f;
static float dir = 0.05f;
static float pos = 0.5f;
pos += dir;
if (pos > 1.0f)
{
pos = 1.0f;
dir = -dir;
}
else if (pos < 0.0f)
{
pos = 0.0f;
dir = -dir;
}
m_CurrentTime = LERP(m_CurrentTime, goalTime, frameTime);
if (ICharacterInstance *character = entity->GetCharacter(0))
{
ISkeletonAnim *pSkeletonAnim = character->GetISkeletonAnim();
assert(pSkeletonAnim);
//Update manually animation time, to match current weapon orientation
uint32 numAnimsLayer = pSkeletonAnim->GetNumAnimsInFIFO(0);
for(uint32 i=0; i<numAnimsLayer; i++)
{
CAnimation &animation = pSkeletonAnim->GetAnimFromFIFO(0, i);
if (animation.HasStaticFlag( CA_MANUAL_UPDATE ))
{
float time = m_CurrentTime; //pos; //fmod_tpl(aimRad / ANIM_ANGLE_RANGE, 1.0f);
time = (float)__fsel(time, time, 1.0f + time);
pSkeletonAnim->SetAnimationNormalizedTime(&animation, time);
animation.ClearStaticFlag( CA_DISABLE_MULTILAYER );
}
}
}
const SMountParams* pMountParams = GetMountedParams();
SEntitySlotInfo info;
if (GetEntity()->GetSlotInfo(eIGS_ThirdPerson, info))
{
if (info.pStatObj)
{
IStatObj *pStatsObj = info.pStatObj;
const Vec3 &leftHandPos = pStatsObj->GetHelperPos(pMountParams->left_hand_helper.c_str());
const Vec3 &rightHandPos = pStatsObj->GetHelperPos(pMountParams->right_hand_helper.c_str());
const Vec3 leftIKPos = mat.TransformPoint(leftHandPos);
const Vec3 rightIKPos = mat.TransformPoint(rightHandPos);
player->SetIKPos("leftArm", leftIKPos, 1);
player->SetIKPos("rightArm", rightIKPos, 1);
}
}
}
}
}