mltinyx.cpp

来自「这是一个混合动画的实例代码」· C++ 代码 · 共 150 行

CPP
150
字号
///////////////////////////////////////////////////////////////////////////////
// 
// File: mlTinyx.cpp
// 
// Author: Frank Luna (C) All Rights Reserved
//
// System: Athlon 1800+ XP, 512 DDR, Radeon 9500 Pro, Windows XP, MSVC++ 7.0 
//
// Desc: Contains the implementation of Tiny_X. 
//
///////////////////////////////////////////////////////////////////////////////

#include "mlTinyx.h"

void Tiny_X::playLoiter()
{
	ID3DXAnimationSet* loiter = 0;
	_animCtrl->GetAnimationSet(LOITER_INDEX, &loiter);
	_animCtrl->SetTrackAnimationSet(0, loiter);
	_animCtrl->ResetTime();
}

void Tiny_X::playWalk()
{
	ID3DXAnimationSet* walk = 0;
	_animCtrl->GetAnimationSet(WALK_INDEX, &walk);
	_animCtrl->SetTrackAnimationSet(0, walk);
	_animCtrl->ResetTime();
}

void Tiny_X::playJog()
{
	ID3DXAnimationSet* jog = 0;
	_animCtrl->GetAnimationSet(JOG_INDEX, &jog);
	_animCtrl->SetTrackAnimationSet(0, jog);
	_animCtrl->ResetTime();
}

void Tiny_X::playWave()
{
	ID3DXAnimationSet* wave = 0;
	_animCtrl->GetAnimationSet(WAVE_INDEX, &wave);
	_animCtrl->SetTrackAnimationSet(0, wave);
	_animCtrl->ResetTime();
}

void Tiny_X::playLoiterWaveBlend()
{
	ID3DXAnimationSet* loiter = 0;
	ID3DXAnimationSet* wave   = 0;

	_animCtrl->GetAnimationSet(LOITER_INDEX, &loiter);
	_animCtrl->GetAnimationSet(WAVE_INDEX, &wave);

	_animCtrl->SetTrackAnimationSet(0, loiter);
	_animCtrl->SetTrackAnimationSet(1, wave);

	_animCtrl->SetTrackWeight(0, 0.2f);
	_animCtrl->SetTrackWeight(1, 0.8f);

	_animCtrl->SetTrackEnable(0, true);
	_animCtrl->SetTrackEnable(1, true);

	_animCtrl->SetTrackSpeed(0, 1.0f);
	_animCtrl->SetTrackSpeed(1, 1.0f);

	_animCtrl->SetTrackPriority(0, D3DXPRIORITY_HIGH);
	_animCtrl->SetTrackPriority(1, D3DXPRIORITY_HIGH);

	_animCtrl->ResetTime();
}

void Tiny_X::playLoiterJogBlend()
{
	ID3DXAnimationSet* loiter = 0;
	ID3DXAnimationSet* jog    = 0;

	_animCtrl->GetAnimationSet(LOITER_INDEX, &loiter);
	_animCtrl->GetAnimationSet(JOG_INDEX, &jog);

	_animCtrl->SetTrackAnimationSet(0, loiter);
	_animCtrl->SetTrackAnimationSet(1, jog);

	_animCtrl->SetTrackWeight(0, 0.7f);
	_animCtrl->SetTrackWeight(1, 0.3f);

	_animCtrl->SetTrackEnable(0, true);
	_animCtrl->SetTrackEnable(1, true);

	_animCtrl->SetTrackSpeed(0, 1.0f);
	_animCtrl->SetTrackSpeed(1, 1.0f);

	_animCtrl->SetTrackPriority(0, D3DXPRIORITY_HIGH);
	_animCtrl->SetTrackPriority(1, D3DXPRIORITY_HIGH);

	_animCtrl->ResetTime();
}

void Tiny_X::playJogWaveBlend()
{
	ID3DXAnimationSet* jog  = 0;
	ID3DXAnimationSet* wave = 0;

	_animCtrl->GetAnimationSet(JOG_INDEX, &jog);
	_animCtrl->GetAnimationSet(WAVE_INDEX, &wave);

	_animCtrl->SetTrackAnimationSet(0, jog);
	_animCtrl->SetTrackAnimationSet(1, wave);

	_animCtrl->SetTrackWeight(0, 0.4f);
	_animCtrl->SetTrackWeight(1, 0.6f);

	_animCtrl->SetTrackEnable(0, true);
	_animCtrl->SetTrackEnable(1, true);

	_animCtrl->SetTrackSpeed(0, 1.0f);
	_animCtrl->SetTrackSpeed(1, 1.0f);

	_animCtrl->SetTrackPriority(0, D3DXPRIORITY_HIGH);
	_animCtrl->SetTrackPriority(1, D3DXPRIORITY_HIGH);

	_animCtrl->ResetTime();
}

void Tiny_X::playWalkWaveBlend()
{
	ID3DXAnimationSet* walk = 0;
	ID3DXAnimationSet* wave = 0;

	_animCtrl->GetAnimationSet(WALK_INDEX, &walk);
	_animCtrl->GetAnimationSet(WAVE_INDEX, &wave);

	_animCtrl->SetTrackAnimationSet(0, walk);
	_animCtrl->SetTrackAnimationSet(1, wave);

	_animCtrl->SetTrackWeight(0, 0.5f);
	_animCtrl->SetTrackWeight(1, 0.5f);

	_animCtrl->SetTrackEnable(0, true);
	_animCtrl->SetTrackEnable(1, true);

	_animCtrl->SetTrackSpeed(0, 1.0f);
	_animCtrl->SetTrackSpeed(1, 1.0f);

	_animCtrl->SetTrackPriority(0, D3DXPRIORITY_HIGH);
	_animCtrl->SetTrackPriority(1, D3DXPRIORITY_HIGH);

	_animCtrl->ResetTime();
}
 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?