Added: #1469 Base of the impulses for camera animation steps

--HG--
branch : gsoc2012-fabien
hg/feature/gsoc2012-fabien
Fabien_HENON 13 years ago
parent 2d3b82ff57
commit b99cfc1557

@ -21,6 +21,7 @@
#include "primitives_parser.h"
#include "nel/ligo/primitive.h"
#include "camera_animation_manager/camera_animation_step_factory.h"
#include "player_manager/player_manager.h"
using namespace std;
using namespace NLMISC;
@ -159,7 +160,17 @@ bool CCameraAnimationManager::TCameraAnimInfo::sendAnimationStep(const NLMISC::C
ICameraAnimationStep* step = Steps[currentStep];
// We send the animation step to the client
step->sendAnimationStep(eid);
NLNET::CMessage msgout("IMPULSION_ID");
msgout.serial(const_cast<NLMISC::CEntityId&>(eid));
NLMISC::CBitMemStream bms;
GenericMsgManager.pushNameToStream("CAMERA_ANIMATION:STEP", bms);
// We tell the step to fill the message
step->sendAnimationStep(Name, bms);
// We add the buffer to the message
msgout.serialBufferWithSize((uint8*)bms.buffer(), bms.length());
NLNET::CUnifiedNetwork::getInstance()->send(NLNET::TServiceId(eid.getDynamicId()), msgout);
return true;
}

@ -79,7 +79,18 @@ void ICameraAnimationStep::addModifier(ICameraAnimationModifier* modifier)
Modifiers.push_back(modifier);
}
void ICameraAnimationStep::sendAnimationStep(const NLMISC::CEntityId& eid)
void ICameraAnimationStep::sendAnimationStep(const std::string& name, NLMISC::CBitMemStream& bms)
{
throw std::exception("The method or operation is not implemented.");
// We first add the name of the step
bms.serial(const_cast<std::string&>(name));
// We ask the step to add its information to the message
sendAnimationStep(bms);
// We finally send the modifiers instructions
std::vector<ICameraAnimationModifier*>::iterator it;
for (it = Modifiers.begin(); it != Modifiers.end(); ++it)
{
//TODO
}
}

@ -41,7 +41,11 @@ public:
virtual float getDuration() const = 0;
/// Function that sends the animation step the to client
void sendAnimationStep(const NLMISC::CEntityId& eid);
virtual void sendAnimationStep(NLMISC::CBitMemStream& bms) = 0;
/// Function that send all information about a step to the client (this includes modifiers)
void sendAnimationStep(const std::string& name, NLMISC::CBitMemStream& bms);
protected:
// The list of modifiers
std::vector<ICameraAnimationModifier*> Modifiers;

@ -71,6 +71,11 @@ public:
return true;
}
virtual void sendAnimationStep(NLMISC::CBitMemStream& bms)
{
}
virtual float getDuration() const
{
return Duration;
@ -82,7 +87,7 @@ public:
class CCameraAnimationStepStatic : public CCameraAnimationStepBasic
{
public:
bool parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename)
virtual bool parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename)
{
if (!CCameraAnimationStepBasic::parseStep(prim, filename))
{
@ -91,6 +96,11 @@ public:
}
return true;
}
virtual void sendAnimationStep(NLMISC::CBitMemStream& bms)
{
CCameraAnimationStepBasic::sendAnimationStep(bms);
}
};
CAMERA_ANIMATION_REGISTR_STEP(CCameraAnimationStepStatic, "camera_animation_static");
@ -108,7 +118,7 @@ public:
EndPos = "";
}
bool parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename)
virtual bool parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename)
{
if (!CCameraAnimationStepBasic::parseStep(prim, filename))
{
@ -128,6 +138,11 @@ public:
return true;
}
virtual void sendAnimationStep(NLMISC::CBitMemStream& bms)
{
CCameraAnimationStepBasic::sendAnimationStep(bms);
}
};
CAMERA_ANIMATION_REGISTR_STEP(CCameraAnimationStepGoTo, "camera_animation_go_to");
@ -148,7 +163,7 @@ public:
DistanceToEntity = 0.f;
}
bool parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename)
virtual bool parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename)
{
if (!CCameraAnimationStepBasic::parseStep(prim, filename))
{
@ -180,6 +195,11 @@ public:
return true;
}
virtual void sendAnimationStep(NLMISC::CBitMemStream& bms)
{
CCameraAnimationStepBasic::sendAnimationStep(bms);
}
};
CAMERA_ANIMATION_REGISTR_STEP(CCameraAnimationStepFollowEntity, "camera_animation_follow_entity");
@ -203,7 +223,7 @@ public:
Speed = 0.f;
}
bool parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename)
virtual bool parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename)
{
if (!CCameraAnimationStepBasic::parseStep(prim, filename))
{
@ -247,6 +267,11 @@ public:
return true;
}
virtual void sendAnimationStep(NLMISC::CBitMemStream& bms)
{
CCameraAnimationStepBasic::sendAnimationStep(bms);
}
};
CAMERA_ANIMATION_REGISTR_STEP(CCameraAnimationStepTurnAround, "camera_animation_turn_around");
@ -284,6 +309,11 @@ public:
return true;
}
virtual void sendAnimationStep(NLMISC::CBitMemStream& bms)
{
}
virtual float getDuration() const
{
return Duration;

Loading…
Cancel
Save