diff --git a/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_modifiers.cpp b/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_modifiers.cpp new file mode 100644 index 000000000..479dbd2e8 --- /dev/null +++ b/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_modifiers.cpp @@ -0,0 +1,53 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . +// + +#include "camera_animation_manager/camera_animation_modifier_factory.h" + +///////////////////////////////////////////////////////////////////////////// +/// This animation modifier shakes the camera. The parameter is +/// - strength +class CCameraAnimationModifierShake : public ICameraAnimationModifier +{ +protected: + float Strength; + +public: + CCameraAnimationModifierShake() + { + Strength = 0.f; + } + + virtual bool parseModifier(const NLLIGO::IPrimitive* prim, const std::string& filename) + { + std::string value; + + // We get the strength + if (!prim->getPropertyByName("duration", value)) + { + nlwarning(" impossible to get the strength property of the basic modifier in primitive : %s", filename.c_str()); + return false; + } + if (!NLMISC::fromString(value, Strength)) + { + nlwarning(" impossible to convert the string : %s, in float in the basic modifier in primitive : %s", value.c_str(), filename.c_str()); + return false; + } + + return true; + } +}; +CAMERA_ANIMATION_REGISTR_MODIFIER(CCameraAnimationModifierShake, "camera_modifier_shake"); \ No newline at end of file