当前位置: 首页>>代码示例>>C++>>正文


C++ LPD3DXANIMATIONSET类代码示例

本文整理汇总了C++中LPD3DXANIMATIONSET的典型用法代码示例。如果您正苦于以下问题:C++ LPD3DXANIMATIONSET类的具体用法?C++ LPD3DXANIMATIONSET怎么用?C++ LPD3DXANIMATIONSET使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了LPD3DXANIMATIONSET类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetAnimByName

bool MoonSkinmesh::SetAnimByName(const char *strAnimName)
{
	if(_pAnimController == NULL)
		return false;
	UINT nAnimSet;
	string strAnim = strAnimName;
	if(strAnim == _strAnimName)
		return true;
	_strAnimName = strAnim;
	string strTemp;
	nAnimSet = _pAnimController->GetMaxNumAnimationSets();
	LPD3DXANIMATIONSET pAnimSet;

	for(UINT i = 0; i < nAnimSet; i++)
	{
		_pAnimController->GetAnimationSet(i,&pAnimSet);
		strTemp = pAnimSet->GetName();
		if(strTemp == strAnim)
		{
			/*_currentTrack++;*/
			_pAnimController->SetTrackAnimationSet(0,pAnimSet);
			_pAnimController->ResetTime();
			/*_pAnimController->SetTrackEnable((_currentTrack+1)%2, FALSE);
			_pAnimController->SetTrackEnable(_currentTrack%2, TRUE);*/
			return true;
		}
	}
	return false;
}
开发者ID:wenqvip,项目名称:MoonGame,代码行数:29,代码来源:MoonSkinmesh.cpp

示例2: 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();
}
开发者ID:KNeal,项目名称:Oculus,代码行数:36,代码来源:Tiny.cpp

示例3: SetAnimation

void CXModel::SetAnimation(unsigned int index)
{
   if(index >= m_numAnimations || index == m_currentAni)
      return;

   m_currentAni = index;

   LPD3DXANIMATIONSET set;
   m_animControl->GetAnimationSet(m_currentAni, &set);

   unsigned long nextTrack = (m_currentTrack == 0 ? 1 : 0);

   // Set next track.
   m_animControl->SetTrackAnimationSet(nextTrack, set);
   set->Release();	

   // Take way all tracks.
   m_animControl->UnkeyAllTrackEvents(m_currentTrack);
   m_animControl->UnkeyAllTrackEvents(nextTrack);

   // Key current track.
   m_animControl->KeyTrackEnable(m_currentTrack, FALSE, m_currentTime + m_transition);
   m_animControl->KeyTrackSpeed(m_currentTrack, 0.0f, m_currentTime, m_transition, D3DXTRANSITION_LINEAR);
   m_animControl->KeyTrackWeight(m_currentTrack, 0.0f, m_currentTime, m_transition, D3DXTRANSITION_LINEAR);

   // Key next track.
   m_animControl->SetTrackEnable(nextTrack, TRUE);
   m_animControl->KeyTrackSpeed(nextTrack, 1.0f, m_currentTime, m_transition, D3DXTRANSITION_LINEAR);
   m_animControl->KeyTrackWeight(nextTrack, 1.0f, m_currentTime, m_transition, D3DXTRANSITION_LINEAR);

   m_currentTrack = nextTrack;
}
开发者ID:hjb912,项目名称:stranded-demo-c-directx,代码行数:32,代码来源:XMesh.cpp

示例4: InvalidateDeviceObjects

//-----------------------------------------------------------------------------
// Name: CTiny::RestoreDeviceObjects()
// Desc: Free D3D objects so that the device can be reset.
//-----------------------------------------------------------------------------
HRESULT CTiny::InvalidateDeviceObjects()
{
    // Save the current track's animation set name
    // so we can reset it again in RestoreDeviceObjects later.
    LPD3DXANIMATIONCONTROLLER pAC = NULL;
    m_pAI->GetAnimController( &pAC );
    if( pAC )
    {
        LPD3DXANIMATIONSET pAS = NULL;
        pAC->GetTrackAnimationSet( m_dwCurrentTrack, &pAS );
        if( pAS )
        {
            if( pAS->GetName() )
                strcpy_s( m_szASName, 64, pAS->GetName() );
            SAFE_RELEASE( pAS );
        }
        SAFE_RELEASE( pAC );
    }

    CMultiAnimAllocateHierarchy AH;
    AH.SetMA( m_pMA );
    m_pMA->Cleanup( &AH );

    return S_OK;
}
开发者ID:benjcleveland,项目名称:UW-Game,代码行数:29,代码来源:Tiny.cpp

示例5: 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();
}
开发者ID:KNeal,项目名称:Oculus,代码行数:35,代码来源:Tiny.cpp

示例6: SetAnimationSet

/**
 * \brief Change to a different animation set
 * Handles transitions between animations to make it smooth and not a sudden jerk to a new position
 * \param index - new animation set index
 * \author Keith Ditchburn \date 18 July 2005
*/
void CXFileEntity::SetAnimationSet(unsigned int index)
{
	if (index==m_currentAnimationSet)
		return;

	if (index>=m_numAnimationSets)
		index=0;

	// Remember current animation
	m_currentAnimationSet=index;

	// Get the animation set from the controller
	LPD3DXANIMATIONSET set;
	m_animController->GetAnimationSet(m_currentAnimationSet, &set );	

	// Note: for a smooth transition between animation sets we can use two tracks and assign the new set to the track
	// not currently playing then insert Keys into the KeyTrack to do the transition between the tracks
	// tracks can be mixed together so we can gradually change into the new animation

	// Alternate tracks
	DWORD newTrack = ( m_currentTrack == 0 ? 1 : 0 );

	// Assign to our track
	m_animController->SetTrackAnimationSet( newTrack, set );
    set->Release();	

	// Clear any track events currently assigned to our two tracks
	m_animController->UnkeyAllTrackEvents( m_currentTrack );
    m_animController->UnkeyAllTrackEvents( newTrack );

	// Add an event key to disable the currently playing track kMoveTransitionTime seconds in the future
    m_animController->KeyTrackEnable( m_currentTrack, FALSE, m_currentTime + kMoveTransitionTime );
	// Add an event key to change the speed right away so the animation completes in kMoveTransitionTime seconds
    m_animController->KeyTrackSpeed( m_currentTrack, 0.0f, m_currentTime, kMoveTransitionTime, D3DXTRANSITION_LINEAR );
	// Add an event to change the weighting of the current track (the effect it has blended with the secon track)
    m_animController->KeyTrackWeight( m_currentTrack, 0.0f, m_currentTime, kMoveTransitionTime, D3DXTRANSITION_LINEAR );

	// Enable the new track
    m_animController->SetTrackEnable( newTrack, TRUE );
	// Add an event key to set the speed of the track
    m_animController->KeyTrackSpeed( newTrack, 1.0f, m_currentTime, kMoveTransitionTime, D3DXTRANSITION_LINEAR );
	// Add an event to change the weighting of the current track (the effect it has blended with the first track)
	// As you can see this will go from 0 effect to total effect(1.0f) in kMoveTransitionTime seconds and the first track goes from 
	// total to 0.0f in the same time.
    m_animController->KeyTrackWeight( newTrack, 1.0f, m_currentTime, kMoveTransitionTime, D3DXTRANSITION_LINEAR );

	// Remember current track
    m_currentTrack = newTrack;
}
开发者ID:corpsofengineers,项目名称:ffed3d,代码行数:55,代码来源:XfileEntity.cpp

示例7: GetAnimationSetLength

double CXFileEntity::GetAnimationSetLength(unsigned int index)
{
	if (index>=m_numAnimationSets)
		return 0;

	// Get the animation set
	LPD3DXANIMATIONSET set;
	m_animController->GetAnimationSet(m_currentAnimationSet, &set );

	double pr = set->GetPeriod();

	set->Release();

	return pr;
}
开发者ID:corpsofengineers,项目名称:ffed3d,代码行数:15,代码来源:XfileEntity.cpp

示例8: GetAnimationSetName

/**
 * \brief Get the name of the animation
 * Note: altered 24/09/07 to solve a D3DX memory leak caused because I was not releasing the set after getting it
 * \param index - the animation set index
 * \return the name
 * \author Keith Ditchburn \date 18 July 2005
*/
std::string CXFileEntity::GetAnimationSetName(unsigned int index)
{
	if (index>=m_numAnimationSets)
		return "Error: No set exists";

	// Get the animation set
	LPD3DXANIMATIONSET set;
	m_animController->GetAnimationSet(m_currentAnimationSet, &set );

	std::string nameString(set->GetName());

	set->Release();

	return nameString;
}
开发者ID:corpsofengineers,项目名称:ffed3d,代码行数:22,代码来源:XfileEntity.cpp

示例9: getAnimationSetIndex

	/**
	 * @brief
	 * 引数に渡された名前と一致する
	 * アニメーションセットのインデックスを返す
	 * 
	 */
	UINT AnimationManager::getAnimationSetIndex(const std::string& animationSetName)
	{
		LPD3DXANIMATIONSET pAnimationSet = 0;

		for (UINT i = 0; i < m_pAnimationController->GetNumAnimationSets(); ++i) {
			V_THROW(m_pAnimationController->GetAnimationSet(i, &pAnimationSet));

			if (animationSetName == std::string(pAnimationSet->GetName())) {
				pAnimationSet->Release();
				return i;
			}

			pAnimationSet->Release();
		}

		return 0xffffff;
	}
开发者ID:kwmur,项目名称:my-first-game,代码行数:23,代码来源:AnimationManager.cpp

示例10: InvalidateDeviceObjects

//-----------------------------------------------------------------------------
// Name: CBipedAnimInstance::InvalidateDeviceObjects()
// Desc: Free D3D objects so that the device can be reset.
//-----------------------------------------------------------------------------
HRESULT CXFileAnimInstance::InvalidateDeviceObjects()
{
    // Save the current track's animation set name
    // so we can reset it again in RestoreDeviceObjects later.
    LPD3DXANIMATIONCONTROLLER pAC = NULL;
    m_pAI->GetAnimController( & pAC );
    if( pAC )
    {
        LPD3DXANIMATIONSET pAS = NULL;
        pAC->GetTrackAnimationSet( m_dwCurrentTrack, &pAS );
        if( pAS )
        {
            if( pAS->GetName() )
                strcpy( m_szASName, pAS->GetName() );
            SAFE_RELEASE( pAS );
        }
        SAFE_RELEASE( pAC );
    }

    return S_OK;
}
开发者ID:LiXizhi,项目名称:NPLRuntime,代码行数:25,代码来源:XFileAnimInstance.cpp

示例11: SetAnimationRun

void CAnimationInstance::SetAnimationRun(void)
{
	DWORD dwNewTrack = ( m_dwCurrentTrack == 0 ? 1 : 0);
	LPD3DXANIMATIONSET pAnimSet;

	m_pAnimationController->GetAnimationSet( m_dwAnimIndexJog, &pAnimSet);
	m_pAnimationController->SetTrackAnimationSet( dwNewTrack, pAnimSet);
	pAnimSet->Release();

	m_pAnimationController->UnkeyAllTrackEvents( m_dwCurrentTrack);
	m_pAnimationController->UnkeyAllTrackEvents( dwNewTrack);

	m_pAnimationController->KeyTrackEnable( m_dwCurrentTrack, FALSE, m_dTimeCurrent + MOVE_TRANSITION_TIME);
	m_pAnimationController->KeyTrackSpeed( m_dwCurrentTrack, 0.0f, m_dTimeCurrent, MOVE_TRANSITION_TIME, D3DXTRANSITION_LINEAR);
	m_pAnimationController->KeyTrackWeight( m_dwCurrentTrack, 0.0f, m_dTimeCurrent, MOVE_TRANSITION_TIME, D3DXTRANSITION_LINEAR);
	m_pAnimationController->SetTrackEnable( dwNewTrack, TRUE);
	m_pAnimationController->KeyTrackSpeed( dwNewTrack, 1.0f,  m_dTimeCurrent, MOVE_TRANSITION_TIME, D3DXTRANSITION_LINEAR);
	m_pAnimationController->KeyTrackWeight( dwNewTrack, 1.0f, m_dTimeCurrent, MOVE_TRANSITION_TIME, D3DXTRANSITION_LINEAR);

	m_dwCurrentTrack = dwNewTrack;
}
开发者ID:mattrudder,项目名称:AckZombies,代码行数:21,代码来源:AnimationInstance.cpp

示例12: GetAnimIndex

//-----------------------------------------------------------------------------
// Name: CBipedAnimInstance::GetAnimIndex()
// Desc: Returns the index of an animation set within this animation instance's
//       animation controller given an animation set name.
//-----------------------------------------------------------------------------
DWORD CXFileAnimInstance::GetAnimIndex( char sString[] )
{
    HRESULT hr;
    LPD3DXANIMATIONCONTROLLER pAC;
    LPD3DXANIMATIONSET pAS;
    DWORD dwRet = ANIMINDEX_FAIL;

    m_pAI->GetAnimController( & pAC );

    for( DWORD i = 0; i < pAC->GetNumAnimationSets(); ++ i )
    {
        hr = pAC->GetAnimationSet( i, & pAS );
        if( FAILED( hr ) )
            continue;

        if( pAS->GetName() &&
            !strncmp( pAS->GetName(), sString, min( strlen( pAS->GetName() ), strlen( sString ) ) ) )
        {
            dwRet = i;
            pAS->Release();
            break;
        }

        pAS->Release();
    }

    pAC->Release();

    return dwRet;
}
开发者ID:LiXizhi,项目名称:NPLRuntime,代码行数:35,代码来源:XFileAnimInstance.cpp

示例13: SetAnimation

void stSANXFRAMEELEMENT::SetAnimation(unsigned int index,float Time,float Duration)
{
	if((index>=this->NumAnimations)||(index==this->CurrentAnimation))
	{
		return;
	}
	this->CurrentAnimation=index;
	LPD3DXANIMATIONSET AnimationSet;
	this->AnimationControler->GetAnimationSet(this->CurrentAnimation,&AnimationSet);
	unsigned long NextTrack=(this->CurrentAnimation==0?1:0);
	this->AnimationControler->SetTrackAnimationSet(NextTrack,AnimationSet);
	AnimationSet->Release();
	this->AnimationControler->UnkeyAllTrackEvents(this->CurrentTrack);
	this->AnimationControler->UnkeyAllTrackEvents(NextTrack);
	this->AnimationControler->KeyTrackEnable(this->CurrentTrack,FALSE,Time+Duration);
	this->AnimationControler->KeyTrackSpeed(this->CurrentTrack,0.0,Time,Duration,D3DXTRANSITION_LINEAR);
	this->AnimationControler->KeyTrackWeight(this->CurrentTrack,0.0,Time,Duration,D3DXTRANSITION_LINEAR);
	this->AnimationControler->SetTrackEnable(NextTrack,TRUE);
	this->AnimationControler->KeyTrackSpeed(NextTrack,0.0,Time,Duration,D3DXTRANSITION_LINEAR);
	this->AnimationControler->KeyTrackWeight(NextTrack,0.0,Time,Duration,D3DXTRANSITION_LINEAR);
	this->CurrentTrack=NextTrack;
}
开发者ID:zxyinz,项目名称:ComputerVisionThesis,代码行数:22,代码来源:SanGraphics.cpp

示例14: ChangeAnim

void SkinnedComponent::ChangeAnim(int animNum)
{
	
	if( CurrentAnim == animNum )
		return;
	CurrentAnim = animNum;
	CurrentTime = 0;
	LPD3DXANIMATIONSET animSet = NULL;
			this->mAnimCtrl->SetTrackSpeed(0, 1.0f);
			this->mAnimCtrl->GetAnimationSet(animNum, &animSet);
			this->mAnimCtrl->SetTrackAnimationSet(0, animSet);
			this->mAnimCtrl->SetTrackPosition(0,CurrentTime);
			CurrentPeriod = (float)animSet->GetPeriod();
			NumFrames = ((ID3DXKeyframedAnimationSet*)animSet)->GetNumTranslationKeys(0);
			NumFrames = max(NumFrames, (int)((ID3DXKeyframedAnimationSet*)animSet)->GetNumTranslationKeys(0));
			NumFrames = max(NumFrames, (int)((ID3DXKeyframedAnimationSet*)animSet)->GetNumRotationKeys(0));
			animSet->Release();

			//RecalculateBB();
			
		
}
开发者ID:anthonySerra,项目名称:CodeSamples,代码行数:22,代码来源:GraphicsEngine.cpp

示例15: while

void XEnitity::SetAnimationSet(unsigned int index)
{
	//m_pAnimCtrl->ResetTime();

	const float MoveTransitionTime=0.25f;
	
	while (index>=m_NumAnimationSets)
		index-=m_NumAnimationSets;

	if (index==m_CurrentAnimationSet)
		return;

	m_CurrentAnimationSet=index;

	DWORD NewTrack = (m_CurrentTrack == 0 ? 1 : 0);

	LPD3DXANIMATIONSET set;

	m_pAnimCtrl->GetAnimationSet(m_CurrentAnimationSet, &set );	
	m_pAnimCtrl->SetTrackAnimationSet( NewTrack, set );
	set->Release();	

	m_pAnimCtrl->UnkeyAllTrackEvents(m_CurrentTrack);
	m_pAnimCtrl->UnkeyAllTrackEvents(NewTrack);

	m_pAnimCtrl->KeyTrackEnable(m_CurrentTrack, FALSE, m_CurrentTime + MoveTransitionTime);
	m_pAnimCtrl->KeyTrackSpeed(m_CurrentTrack, 0.0f, m_CurrentTime, MoveTransitionTime, D3DXTRANSITION_LINEAR);
	m_pAnimCtrl->KeyTrackWeight(m_CurrentTrack, 0.0f, m_CurrentTime, MoveTransitionTime, D3DXTRANSITION_LINEAR);

	m_pAnimCtrl->SetTrackEnable(NewTrack, TRUE);
	m_pAnimCtrl->KeyTrackSpeed(NewTrack, 1.f, m_CurrentTime, MoveTransitionTime, D3DXTRANSITION_LINEAR);
	m_pAnimCtrl->KeyTrackWeight(NewTrack, 1.f, m_CurrentTime, MoveTransitionTime, D3DXTRANSITION_LINEAR);

	m_CurrentTrack = NewTrack;
	MessageBeep(MB_OK);
	return;
}
开发者ID:ongamex,项目名称:old_stuff,代码行数:37,代码来源:XEnitity.cpp


注:本文中的LPD3DXANIMATIONSET类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。