本文整理汇总了C++中LPD3DXANIMATIONCONTROLLER::UnkeyAllTrackEvents方法的典型用法代码示例。如果您正苦于以下问题:C++ LPD3DXANIMATIONCONTROLLER::UnkeyAllTrackEvents方法的具体用法?C++ LPD3DXANIMATIONCONTROLLER::UnkeyAllTrackEvents怎么用?C++ LPD3DXANIMATIONCONTROLLER::UnkeyAllTrackEvents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPD3DXANIMATIONCONTROLLER
的用法示例。
在下文中一共展示了LPD3DXANIMATIONCONTROLLER::UnkeyAllTrackEvents方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetIdleKey
//-----------------------------------------------------------------------------
// Name: CTiny::SetIdleKey()
// Desc: Initialize a new track in the animation controller for the idle
// (loiter ) animation, and set up the smooth transition from the
// movement animation (current track) to it (new track).
//
// bResetPosition controls whether we start the Loiter animation from
// its beginning or current position.
//-----------------------------------------------------------------------------
void CTiny::SetIdleKey( bool bResetPosition )
{
DWORD dwNewTrack = ( m_dwCurrentTrack == 0 ? 1 : 0 );
LPD3DXANIMATIONCONTROLLER pAC;
LPD3DXANIMATIONSET pAS;
m_pAI->GetAnimController( &pAC );
pAC->GetAnimationSet( m_dwAnimIdxLoiter, &pAS );
pAC->SetTrackAnimationSet( dwNewTrack, pAS );
pAS->Release();
pAC->UnkeyAllTrackEvents( m_dwCurrentTrack );
pAC->UnkeyAllTrackEvents( dwNewTrack );
pAC->KeyTrackEnable( m_dwCurrentTrack, FALSE, m_dTimeCurrent + IDLE_TRANSITION_TIME );
pAC->KeyTrackSpeed( m_dwCurrentTrack, 0.0f, m_dTimeCurrent, IDLE_TRANSITION_TIME, D3DXTRANSITION_LINEAR );
pAC->KeyTrackWeight( m_dwCurrentTrack, 0.0f, m_dTimeCurrent, IDLE_TRANSITION_TIME, D3DXTRANSITION_LINEAR );
pAC->SetTrackEnable( dwNewTrack, TRUE );
pAC->KeyTrackSpeed( dwNewTrack, 1.0f, m_dTimeCurrent, IDLE_TRANSITION_TIME, D3DXTRANSITION_LINEAR );
pAC->KeyTrackWeight( dwNewTrack, 1.0f, m_dTimeCurrent, IDLE_TRANSITION_TIME, D3DXTRANSITION_LINEAR );
if( bResetPosition )
pAC->SetTrackPosition( dwNewTrack, 0.0 );
m_dwCurrentTrack = dwNewTrack;
pAC->Release();
}
示例2: SetMoveKey
//-----------------------------------------------------------------------------
// Name: CTiny::SetMoveKey()
// Desc: Initialize a new track in the animation controller for the movement
// animation (run or walk), and set up the smooth transition from the idle
// animation (current track) to it (new track).
//-----------------------------------------------------------------------------
void CTiny::SetMoveKey()
{
DWORD dwNewTrack = ( m_dwCurrentTrack == 0 ? 1 : 0 );
LPD3DXANIMATIONCONTROLLER pAC;
LPD3DXANIMATIONSET pAS;
m_pAI->GetAnimController( &pAC );
if( m_fSpeed == m_fSpeedWalk )
pAC->GetAnimationSet( m_dwAnimIdxWalk, &pAS );
else
pAC->GetAnimationSet( m_dwAnimIdxJog, &pAS );
pAC->SetTrackAnimationSet( dwNewTrack, pAS );
pAS->Release();
pAC->UnkeyAllTrackEvents( m_dwCurrentTrack );
pAC->UnkeyAllTrackEvents( dwNewTrack );
pAC->KeyTrackEnable( m_dwCurrentTrack, FALSE, m_dTimeCurrent + MOVE_TRANSITION_TIME );
pAC->KeyTrackSpeed( m_dwCurrentTrack, 0.0f, m_dTimeCurrent, MOVE_TRANSITION_TIME, D3DXTRANSITION_LINEAR );
pAC->KeyTrackWeight( m_dwCurrentTrack, 0.0f, m_dTimeCurrent, MOVE_TRANSITION_TIME, D3DXTRANSITION_LINEAR );
pAC->SetTrackEnable( dwNewTrack, TRUE );
pAC->KeyTrackSpeed( dwNewTrack, 1.0f, m_dTimeCurrent, MOVE_TRANSITION_TIME, D3DXTRANSITION_LINEAR );
pAC->KeyTrackWeight( dwNewTrack, 1.0f, m_dTimeCurrent, MOVE_TRANSITION_TIME, D3DXTRANSITION_LINEAR );
m_dwCurrentTrack = dwNewTrack;
pAC->Release();
}
示例3: PlayAnimation
//-----------------------------------------------------------------------------
// Name: CBipedAnimInstance::PlayAnimation()
// Desc: Initialize a new track in the animation controller for the movement
// animation (run or walk), and set up the smooth transition from the idle
// animation (current track) to it (new track).
// Params: bContinue: If it's true,load new animation track only if sAnimName is
// different from the track that is being played
// note: m_szASNameTarget can be numbers, which is translated as index into the
// model file's animation sets.
//-----------------------------------------------------------------------------
void CXFileAnimInstance::PlayAnimation(bool bContinue)
{
// -- return if no new animation is specified
if(bContinue && strcmp(m_szASNameTarget, m_szASName) == 0)
return;
strcpy(m_szASName, m_szASNameTarget);
// -- create new track
DWORD dwNewTrack = ( m_dwCurrentTrack == 0 ? 1 : 0 );
LPD3DXANIMATIONCONTROLLER pAC;
LPD3DXANIMATIONSET pAS;
m_pAI->GetAnimController( & pAC );
// TODO: use hash tablle to get the animation set
// -- Get the animation set
HRESULT hr;
double dTransitionPeriod = MOVE_TRANSITION_TIME;
if(strcmp(m_szASName, "Walk") == 0)
{
hr = pAC->GetAnimationSet( m_dwAnimIdxWalk, & pAS );
dTransitionPeriod = MOVE_TRANSITION_TIME;
}
else if(strcmp(m_szASName, "Jog") == 0)
{
hr = pAC->GetAnimationSet( m_dwAnimIdxJog, & pAS );
dTransitionPeriod = MOVE_TRANSITION_TIME;
}
else if( ('0'<= m_szASName[0]) && (m_szASName[0]<='9') )
{// if it's a number from 0~99
UINT nIndex = 0;
if(('0'<= m_szASName[1]) && (m_szASName[1]<='9'))
nIndex = (m_szASName[0] - '0')*10+m_szASName[1]-'0';
else
nIndex = (m_szASName[0] - '0');
// use the name as the index of the animation set.
hr = pAC->GetAnimationSet( nIndex, & pAS );
dTransitionPeriod = MOVE_TRANSITION_TIME;
}
else //if(strcmp(m_szASName, "Loiter"))
{
hr = pAC->GetAnimationSet( m_dwAnimIdxLoiter, & pAS );
dTransitionPeriod = IDLE_TRANSITION_TIME;
}
if( ! SUCCEEDED(hr) ) // failed to load
{
// TODO: Load default animation
hr = pAC->GetAnimationSet( m_dwAnimIdxLoiter, & pAS );
dTransitionPeriod = IDLE_TRANSITION_TIME;
if( ! SUCCEEDED(hr) )// failed to load the default
return;
}
// -- Enable new track and set transition weight
pAC->SetTrackAnimationSet( dwNewTrack, pAS );
pAS->Release();
pAC->UnkeyAllTrackEvents( m_dwCurrentTrack );
pAC->UnkeyAllTrackEvents( dwNewTrack );
pAC->KeyTrackEnable( m_dwCurrentTrack, FALSE, m_dTimeCurrent + dTransitionPeriod );
pAC->KeyTrackSpeed( m_dwCurrentTrack, 0.0f, m_dTimeCurrent, dTransitionPeriod, D3DXTRANSITION_LINEAR );
pAC->KeyTrackWeight( m_dwCurrentTrack, 0.0f, m_dTimeCurrent, dTransitionPeriod, D3DXTRANSITION_LINEAR );
pAC->SetTrackEnable( dwNewTrack, TRUE );
pAC->KeyTrackSpeed( dwNewTrack, 1.0f, m_dTimeCurrent, dTransitionPeriod, D3DXTRANSITION_LINEAR );
pAC->KeyTrackWeight( dwNewTrack, 1.0f, m_dTimeCurrent, dTransitionPeriod, D3DXTRANSITION_LINEAR );
if(!bContinue) // restart
pAC->SetTrackPosition( dwNewTrack, 0.0 );
m_dwCurrentTrack = dwNewTrack;
pAC->Release();
}