Added: #1469 Base functions to send camera animation modifiers to the client

--HG--
branch : gsoc2012-fabien
hg/feature/gsoc2012-fabien
Fabien_HENON 13 years ago
parent 0451f31350
commit a2acbb4988

@ -49,4 +49,14 @@ void ICameraAnimationModifierFactory::init()
{
if (!Entries)
Entries = new std::vector<std::pair<std::string, ICameraAnimationModifierFactory*> >;
}
void ICameraAnimationModifier::sendCameraFullModifier(NLMISC::CBitMemStream& bms)
{
// We first add the name of the modifier
std::string name = getModifierName();
bms.serial(const_cast<std::string&>(name));
// We ask the modifier to add its information to the message
sendCameraModifier(bms);
}

@ -33,9 +33,14 @@ public:
/// This function is called when it's time to parse the primitive to load the camera animation modifier
virtual bool parseModifier(const NLLIGO::IPrimitive* prim, const std::string& filename) = 0;
/// Function called to send the modifier to the client
virtual void sendCameraModifier(NLMISC::CBitMemStream& bms) = 0;
/// Function to get the name of the modifier
virtual std::string getModifierName() const = 0;
/// Function called to send the modifier to the client (including its name)
void sendCameraFullModifier(NLMISC::CBitMemStream& bms);
};
/************************************************************************/

@ -53,6 +53,11 @@ public:
return true;
}
virtual void sendCameraModifier(NLMISC::CBitMemStream& bms)
{
}
CAMERA_ANIMATION_MODIFIER_NAME("camera_modifier_shake");
};
CAMERA_ANIMATION_REGISTER_MODIFIER(CCameraAnimationModifierShake, "camera_modifier_shake");
@ -101,6 +106,11 @@ public:
return true;
}
virtual void sendCameraModifier(NLMISC::CBitMemStream& bms)
{
}
CAMERA_ANIMATION_MODIFIER_NAME("sound_trigger");
};
CAMERA_ANIMATION_REGISTER_MODIFIER(CCameraAnimationModifierSoundTrigger, "sound_trigger");

@ -89,9 +89,16 @@ void ICameraAnimationStep::sendAnimationFullStep(NLMISC::CBitMemStream& bms)
sendAnimationStep(bms);
// We finally send the modifiers instructions
// We add a header to tell the number of modifiers
uint8 nbModifiers = (uint8)Modifiers.size();
bms.serial(const_cast<uint8&>(nbModifiers));
// We loop through the modifiers to add them
std::vector<ICameraAnimationModifier*>::iterator it;
for (it = Modifiers.begin(); it != Modifiers.end(); ++it)
{
//TODO
ICameraAnimationModifier* modifier = *it;
modifier->sendCameraFullModifier(bms);
}
}

Loading…
Cancel
Save