posts - 0, comments - 1, trackbacks - 0, articles - 25
  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

블랜딩 애니메이션

Posted on 2009-10-09 15:47 cngamedev 阅读(762) 评论(0)  编辑 收藏 引用 所属分类: DirectX

 예: 뛰면서 총쏘기: 뛰기 + 총쏘기

animation controller는 모든 활성화된 track들의 animation을 자동으로 blending해 준다
따라서 animation들을 각 track에 지정하고 track들을 활성화시키면 됨
track을 활성화하기 (Enable을 true로 하면 활성화됨)
 

ID3DXAnimationController::SetTrackEnable
Enables or disables a track in the animation controller.

          HRESULT SetTrackEnable(
            UINT Track,
            BOOL Enable
          );
          Parameters
Track
[in] Identifier of the track to be mixed.
Enable
[in] Enable value. Set to TRUE to enable this track in the controller, or to FALSE to prevent it from being mixed.
Return Values
If the method succeeds, the return value is S_OK. If the method fails, the return value can be one of the following values: D3DERR_INVALIDCALL, E_OUTOFMEMORY.

Remarks
To mix a track with other tracks, the Enable flag must be set to TRUE. Conversely, setting the flag to FALSE will prevent the track from being mixed with other tracks.

Requirements
Header: Declared in D3dx9anim.h.

 

각 track의 play 속도를 지정할 수 있음: 보통 1로 하나, fast forward나 slow motion등의 특수효과를 얻으려면 1전후로 조절하면 됨

ID3DXAnimationController::SetTrackSpeed
Sets the track speed. The track speed is similar to a multiplier that is used to speed up or slow down the playback of the track.

          HRESULT SetTrackSpeed(
            UINT Track,
            FLOAT Speed
          );
          Parameters
Track
[in] Identifier of the track to set the speed on.
Speed
[in] New speed.
Return Values
If the method succeeds, the return value is S_OK. If the method fails, the return value can be one of the following values: D3DERR_INVALIDCALL, E_OUTOFMEMORY.

Requirements
Header: Declared in D3dx9anim.h.

 

// blen함수
void Tiny_X::PlayJogWaveBlend()
{
ID3DXAnimationSet* jog = 0;
ID3DXAnimationSet* wave = 0;
g_animCtrl->GetAnimationSet(JOG_INDEX, &jog);
g_animCtrl->GetAnimationSet(WAVE_INDEX, &wave);
g_animCtrl->SetTrackAnimationSet(0, jog);
g_animCtrl->SetTrackAnimationSet(1, jog);
g_animCtrl->SetTrackWeight(0, 0.4f);
g_animCtrl->SetTrackWeight(1, 0.6f);
g_animCtrl->SetTrackEnable(0, true);
g_animCtrl->SetTrackEnable(1, true);
g_animCtrl->SetTrackSpeed(0, 1.0f);
g_animCtrl->SetTrackSpeed(1, 1.0f);
g_animCtrl->SetTrackPriority(0, D3DXPRIORITY_HIGH);
g_animCtrl->SetTrackPriority(1, D3DXPRIORITY_HIGH);
g_animCtrl->ResetTime();
}
 

 


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理