Пример #1
0
CVoid CScene::SetPrevAnimation() 
{
	if (g_selectedName != -1)
	{
		m_currentClipIndex--;
		if (m_currentClipIndex == 0)
			ex_pBtnPrevAnim->EnableWindow(FALSE);
		if (m_numClips > 1)
			ex_pBtnNextAnim->EnableWindow(TRUE);

		if (m_currentClipIndex < 0)
			m_currentClipIndex = 0;

		for (CInt index = 0; index < m_numClips; index++)
		{
			if (m_currentClipIndex != index)
			{
				ClearCycle(index, 1.0f); //0.5 second
			}
			else
			{
				BlendCycle(index, 1.0f, 1.0f);
			}
		}

		PrintInfo("\nAnimation '" + (CString)m_animationClips[m_currentClipIndex]->GetName() + "' activated");
	}
}
///<summary>
/// CAnimatedInstanceModel:: Initialize
///</summary>
///<param name="AnimatedCoreModel"></param>
void CAnimatedInstanceModel::Initialize(CAnimatedCoreModel *AnimatedCoreModel)
{
  m_AnimatedCoreModel = AnimatedCoreModel;
  m_iNumAnimations = m_AnimatedCoreModel->GetNumAnimations();

  m_CalModel = new CalModel(m_AnimatedCoreModel->GetCoreModel());
  int meshId;
  for(meshId = 0; meshId < AnimatedCoreModel->GetCoreModel()->getCoreMeshCount(); meshId++)
  {
    m_CalModel->attachMesh(meshId);
  }
  
  LoadTextures();
  
  BlendCycle(1, 0.0f);
	
	CEffectManager *l_EffectManager=CORE->GetEffectManager();
	std::string &l_EffectTechniqueName=l_EffectManager->GetTechniqueEffectNameByVertexDefault(CAL3D_HW_VERTEX::GetVertexType());
	const std::string &l_ModelName= m_AnimatedCoreModel->GetAnimatedCoreModelName();

	if(l_ModelName=="bot")
	{
		m_EffectTechnique=l_EffectManager->GetEffectTechnique(m_AnimatedCoreModel->GetTechniqueName());
	}
	else
	{
		m_EffectTechnique=l_EffectManager->GetEffectTechnique(l_EffectTechniqueName);
	}
}
Пример #3
0
//It's not equal with MFC function.
CVoid CScene::SetClipIndex( CInt index, CBool loopAnimation )
{
	m_currentClipIndex = index;
	if( m_currentClipIndex == m_numClips)
		m_currentClipIndex = m_numClips - 1;
	if( m_currentClipIndex < 0 )
		m_currentClipIndex = 0;
	if( loopAnimation )
	{
		for( CInt index = 0; index < m_numClips; index++ )
		{
			if( m_currentClipIndex != index ) 
			{
				ClearCycle( index, 1.0f ); //1.0 second
			}
			else
			{
				BlendCycle( index, 1.0f, 1.0f );
			}
		}
	}
	else
	{
		ExecuteAction( m_currentClipIndex, m_animationClips[m_currentClipIndex]->GetDuration() * 0.1f, m_animationClips[m_currentClipIndex]->GetDuration() * 0.1f);
	}
}
Пример #4
0
CVoid CScene::SetPrevAnimation() 
{
	m_currentClipIndex--;
	if( m_currentClipIndex < 0 )
		m_currentClipIndex = 0;

	for( CInt index = 0; index < m_numClips; index++ )
	{
		if( m_currentClipIndex != index ) 
		{
			ClearCycle( index, 1.0f ); //0.5 second
		}
		else
		{
			BlendCycle( index, 1.0f, 1.0f );
		}
	}
}
void CAnimatedInstanceModel::Initialize(CAnimatedCoreModel *AnimatedCoreModel)
{
	m_AnimatedCoreModel = AnimatedCoreModel;
	m_CalModel = new CalModel(m_AnimatedCoreModel->GetCalCoreModel());
	m_CalHardwareModel = new CalHardwareModel(m_AnimatedCoreModel->GetCalCoreModel());
	
	// attach all meshes to the model
	//int meshId;
	//for (meshId = 0; meshId < AnimatedCoreModel->GetCalCoreModel()->getCoreMeshCount(); meshId++)
	//{
	//	m_CalModel->attachMesh(meshId);
	//}

	LoadVertexBuffer();
	LoadMaterials();

	BlendCycle(1, 1.0f, 0.0f);
	Update(0.0f);
}
Пример #6
0
CVoid CScene::SetClipIndex( CInt index, CBool loopAnimation )
{
	if (g_selectedName != -1)
	{
		if (m_numClips == 0)
			return;
		m_currentClipIndex = index;
		if (m_currentClipIndex == m_numClips - 1)
			ex_pBtnNextAnim->EnableWindow(FALSE);
		else if (m_numClips > 1)
			ex_pBtnNextAnim->EnableWindow(TRUE);

		if (m_currentClipIndex == 0)
			ex_pBtnPrevAnim->EnableWindow(FALSE);
		else if (m_numClips > 1)
			ex_pBtnPrevAnim->EnableWindow(TRUE);

		if (loopAnimation)
		{
			for (CInt index = 0; index < m_numClips; index++)
			{
				if (m_currentClipIndex != index)
				{
					ClearCycle(index, 1.0f); //1.0 second
				}
				else
				{
					BlendCycle(index, 1.0f, 1.0f);
				}
			}
		}
		else
		{
			ExecuteAction(m_currentClipIndex, m_animationClips[m_currentClipIndex]->GetDuration() * 0.1f, m_animationClips[m_currentClipIndex]->GetDuration() * 0.1f);
		}

		PrintInfo("\nAnimation '" + (CString)m_animationClips[m_currentClipIndex]->GetName() + "' activated");
	}
}