Added: #1469 Base camera animation step and static animation step

--HG--
branch : gsoc2012-fabien
hg/feature/gsoc2012-fabien
Fabien_HENON 13 years ago
parent 94c3b7b47c
commit 10fdd4d28c

@ -54,7 +54,7 @@ protected:
};
// Define used to register the different types of camera animation steps
#define MISSION_REGISTER_ACTION(_class_,_name_) \
#define CAMERA_ANIMATION_REGISTR_STEP(_class_,_name_) \
class _class_##CameraAnimationStepFactory : public ICameraAnimationStepFactory \
{\
public:\
@ -73,6 +73,6 @@ public:\
return new _class_;\
} \
};\
static _class_##ActionFactory* _class_##ActionFactoryInstance = new _class_##ActionFactory;
static _class_##CameraAnimationStepFactory* _class_##CameraAnimationStepFactoryInstance = new _class_##CameraAnimationStepFactory;
#endif /* RY_CAMERAANIMATIONSTEPFACTORY_H */

@ -0,0 +1,90 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// 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 <http://www.gnu.org/licenses/>.
//
#include "camera_animation_manager/camera_animation_step_factory.h"
/// Basic camera animation step that has generic values
/// - name
/// - look_at_position
/// - text
/// - duration
class CCameraAnimationStepBasic : public ICameraAnimationStep
{
protected:
std::string LookAtPos;
std::string Text;
float Duration;
public:
CCameraAnimationStepBasic()
{
LookAtPos = "";
Text = "";
Duration = 0.f;
}
virtual bool parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename)
{
std::string value;
// We get the look at position
if (!prim->getPropertyByName("look_at_position", value))
{
nlwarning("<CCameraAnimationStepBasic parseStep> impossible to get the look_at_position property of the basic step in primitive : %s", filename.c_str());
return false;
}
LookAtPos = value;
// We get the text
if (!prim->getPropertyByName("text", value))
{
nlwarning("<CCameraAnimationStepBasic parseStep> impossible to get the text property of the basic step in primitive : %s", filename.c_str());
return false;
}
Text = value;
// We get the duration
if (!prim->getPropertyByName("duration", value))
{
nlwarning("<CCameraAnimationStepBasic parseStep> impossible to get the duration property of the basic step in primitive : %s", filename.c_str());
return false;
}
if (!NLMISC::fromString(value, Duration))
{
nlwarning("<CCameraAnimationStepBasic parseStep> impossible to convert the string : %s, in float in the basic step in primitive : %s", value.c_str(), filename.c_str());
return false;
}
return true;
}
}; // This class must not be registered because it a base class
/// Static camera animation step (that does not have specific variables)
class CCameraAnimationStepStatic : public CCameraAnimationStepBasic
{
public:
bool parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename)
{
if (!CCameraAnimationStepBasic::parseStep(prim, filename))
{
nlwarning("<CCameraAnimationStepStatic parseStep> impossible to parse the basic part of the step in primitive : %s", filename.c_str());
return false;
}
return true;
}
};
CAMERA_ANIMATION_REGISTR_STEP(CCameraAnimationStepStatic, "camera_animation_static");
Loading…
Cancel
Save