Added: #1469 base functions to send the camera animation instructions

--HG--
branch : gsoc2012-fabien
hg/feature/gsoc2012-fabien
Fabien_HENON 13 years ago
parent 2b954a23db
commit 2629c3cf5f

@ -129,7 +129,31 @@ bool CCameraAnimationManager::parseCameraAnimations(const IPrimitive* prim, cons
}
}
void CCameraAnimationManager::sendAnimation(const NLMISC::CEntityId& eid, const std::string& _AnimationName)
void CCameraAnimationManager::sendAnimation(const NLMISC::CEntityId& eid, const std::string& animationName)
{
// We search for the correct camera animation
TCameraAnimationContainer::iterator it;
for (it = Animations.begin(); it != Animations.end(); ++it)
{
if (it->first == animationName)
{
it->second.sendAnimationSteps(eid);
break;
}
}
}
void CCameraAnimationManager::TCameraAnimInfo::sendAnimationSteps(const NLMISC::CEntityId& eid)
{
// We first send the first step
sendAnimationStep(eid, 0);
// Now we send the other steps after the duration
}
void CCameraAnimationManager::TCameraAnimInfo::sendAnimationStep(const NLMISC::CEntityId& eid, int currentStep)
{
// We can send the current step
}

@ -43,7 +43,7 @@ public:
static void release();
/// Function that sends all the instructions of a camera animation to the specified entity
void sendAnimation(const NLMISC::CEntityId& eid, const std::string& _AnimationName);
void sendAnimation(const NLMISC::CEntityId& eid, const std::string& animationName);
private:
/// Constructor
@ -65,7 +65,7 @@ private:
{
Name = "";
}
/// Function called to release the animations
void release()
{
// We delete the camera animation steps
@ -78,9 +78,35 @@ private:
Name = "";
}
/// Function called to send the camera animation instruction specified by the current step to the client
void sendAnimationStep(const NLMISC::CEntityId& eid, int currentStep);
/// Function called to send all the camera animation instructions to the client
void sendAnimationSteps(const NLMISC::CEntityId& eid);
std::string Name;
std::vector<ICameraAnimationStep*> Steps;
private:
class TCameraAnimTimerEvent: public CTimerEvent
{
public:
TCameraAnimTimerEvent(TCameraAnimInfo* info, int nextStep, const NLMISC::CEntityId& eid): _Eid(eid)
{
_Infos = info;
_Next = nextStep;
}
// Callback called when the timer finished
void timerCallback(CTimer* owner)
{
// We tell the camera anim info to send the current step
_Infos->sendAnimationStep(_Eid, _Next);
}
private:
TCameraAnimInfo* _Infos;
int _Next;
const NLMISC::CEntityId& _Eid;
};
};
typedef std::map<std::string, TCameraAnimInfo> TCameraAnimationContainer;

Loading…
Cancel
Save