Пример #1
0
	//Static
	CAnimation* CSkeleton::AnimationParser(const std::string& p_crszKey, std::ifstream& p_rFile)
	{
		DEBUG(3, __FUNCTION__, "Parsing skeletal animation");
		std::string szData;
		CSkeleton* pSkele = new CSkeleton("data/skeletons/" + p_crszKey + ".skel");
		CAnimation* pAnim = new CAnimation();
		while(!p_rFile.eof())
		{
			p_rFile >> szData;
			DEBUG(3, __FUNCTION__, szData);
			if(szData == "end")
				break;
			
			if(szData == "nxt") //Next frame
			{
				DEBUG(3, __FUNCTION__, "Frame added");
				pAnim->AddFrame(pSkele);
				pSkele = new CSkeleton("data/skeletons/" + p_crszKey + ".skel");
			}
			else //Transformations
			{
				pSkele->ApplyTransformation(szData);
			}
		}

		pAnim->AddFrame(pSkele);
		return pAnim;
	}