1 #ifndef GAME_RENDER_ANIMATION_H
2 #define GAME_RENDER_ANIMATION_H
4 #include "../mwworld/ptr.hpp"
28 class LightListCallback;
35 class ResetAccumRootCallback;
36 class RotateController;
44 virtual float getValue(osg::NodeVisitor* nv);
142 virtual void handleTextKey(
const std::string &groupname,
const std::multimap<float, std::string>::const_iterator &key,
143 const std::multimap<float, std::string>& map) = 0;
161 virtual float getValue(osg::NodeVisitor* nv);
237 typedef std::multimap<osg::ref_ptr<osg::Node>, osg::ref_ptr<osg::NodeCallback> >
ControllerMap;
243 typedef std::map<std::string, osg::ref_ptr<osg::MatrixTransform> >
NodeMap;
289 void updatePosition(
float oldtime,
float newtime, osg::Vec3f& position);
296 bool reset(
AnimState &state,
const std::multimap<float, std::string> &keys,
297 const std::string &groupname,
const std::string &start,
const std::string &stop,
298 float startpoint,
bool loopfallback);
300 void handleTextKey(
AnimState &state,
const std::string &groupname,
const std::multimap<float, std::string>::const_iterator &key,
301 const std::multimap<float, std::string>& map);
311 void setObjectRoot(
const std::string &model,
bool forceskeleton,
bool baseonly,
bool isCreature);
332 void addGlow(osg::ref_ptr<osg::Node> node, osg::Vec4f glowColor,
float glowDuration = -1);
362 void addEffect (
const std::string& model,
int effectId,
bool loop =
false,
const std::string& bonename =
"", std::string texture =
"");
399 void play(
const std::string &groupname,
const AnimPriority& priority,
int blendMask,
bool autodisable,
400 float speedmult,
const std::string &start,
const std::string &stop,
401 float startpoint,
size_t loops,
bool loopfallback=
false);
408 bool isPlaying(
const std::string &groupname)
const;
419 bool getInfo(
const std::string &groupname,
float *complete=NULL,
float *speedmult=NULL)
const;
435 void disable(
const std::string &groupname);
438 float getVelocity(
const std::string &groupname)
const;
449 const osg::Node*
getNode(
const std::string&
name)
const;
int mPriority[sNumBlendMasks]
Definition: animation.hpp:136
void addAnimSource(const std::string &model)
Definition: animation.cpp:499
void adjustSpeedMult(const std::string &groupname, float speedmult)
Definition: animation.cpp:878
AnimSourceList mAnimSources
Definition: animation.hpp:219
Animation(const MWWorld::Ptr &ptr, osg::ref_ptr< osg::Group > parentNode, Resource::ResourceSystem *resourceSystem)
Definition: animation.cpp:418
float mStartTime
Definition: animation.hpp:177
osg::ref_ptr< osg::Group > mObjectRoot
Definition: animation.hpp:223
AnimState()
Definition: animation.hpp:194
boost::shared_ptr< EffectAnimationTime > mAnimTime
Definition: animation.hpp:257
osg::Group * getObjectRoot()
Definition: animation.cpp:1162
Wrapper class that constructs and provides access to the most commonly used resource subsystems...
Definition: resourcesystem.hpp:24
boost::shared_ptr< float > getTimePtr() const
Definition: animation.hpp:158
bool getInfo(const std::string &groupname, float *complete=NULL, float *speedmult=NULL) const
Definition: animation.cpp:893
void setTimePtr(boost::shared_ptr< float > time)
Definition: animation.hpp:156
virtual void showWeapons(bool showWeapon)
Definition: animation.hpp:451
int mEffectId
Definition: animation.hpp:259
Handles the bone matrices for any number of child RigGeometries.
Definition: skeleton.hpp:36
void setAlpha(float alpha)
A value < 1 makes the animation translucent, 1.f = fully opaque.
Definition: animation.cpp:1427
Definition: animation.hpp:77
Detaches the node from its parent when the object goes out of scope.
Definition: animation.hpp:54
osg::ref_ptr< osg::Node > mNode
Definition: animation.hpp:70
static const size_t sNumBlendMasks
Definition: animation.hpp:98
bool isPlaying(const std::string &groupname) const
Definition: animation.cpp:885
Definition: animation.hpp:95
virtual float getHeadYaw() const
Definition: animation.cpp:1561
void addExtraLight(osg::ref_ptr< osg::Group > parent, const ESM::Light *light)
Definition: animation.cpp:1286
virtual float getValue(osg::NodeVisitor *nv)
Definition: animation.cpp:1575
boost::shared_ptr< AnimationTime > mAnimationTimePtr[sNumBlendMasks]
Definition: animation.hpp:240
PartHolderPtr mObjects
Definition: animation.hpp:256
virtual void setWeaponGroup(const std::string &group)
Definition: animation.hpp:453
int & operator[](BoneGroup n)
Definition: animation.hpp:118
float getTextKeyTime(const std::string &textKey) const
Get the absolute position in the animation track of the text key.
Definition: animation.cpp:597
virtual void setHeadPitch(float pitchRadians)
Definition: animation.cpp:1546
float mTime
Definition: animation.hpp:42
bool contains(int priority) const
Definition: animation.hpp:128
void addTime(float duration)
Definition: animation.cpp:1580
virtual void setHeadYaw(float yawRadians)
Definition: animation.cpp:1551
void disable(const std::string &groupname)
Definition: animation.cpp:933
Definition: animation.hpp:175
void setTextKeyListener(TextKeyListener *listener)
Definition: animation.cpp:799
void addGlow(osg::ref_ptr< osg::Node > node, osg::Vec4f glowColor, float glowDuration=-1)
Definition: animation.cpp:1218
Definition: animation.hpp:164
void clearAnimSources()
Definition: animation.cpp:559
osg::ref_ptr< SceneUtil::LightListCallback > mLightListCallback
Definition: animation.hpp:277
Definition: animation.hpp:84
Definition: animation.hpp:82
osg::ref_ptr< NifOsg::KeyframeController > mAccumCtrl
Definition: animation.hpp:230
bool mLoop
Definition: animation.hpp:260
virtual float getValue(osg::NodeVisitor *nv)
Definition: animation.hpp:167
int mBlendMask
Definition: animation.hpp:191
void setActive(bool active)
Definition: animation.cpp:449
void addSpellCastGlow(const ESM::MagicEffect *effect, float glowDuration=1.5)
Definition: animation.cpp:1196
void resetActiveGroups()
Definition: animation.cpp:815
Definition: animation.hpp:90
Definition: nifloader.hpp:40
float mLoopStartTime
Definition: animation.hpp:178
NodeMap mNodeMap
Definition: animation.hpp:244
void setTime(float time)
Definition: animation.hpp:205
virtual void handleTextKey(const std::string &groupname, const std::multimap< float, std::string >::const_iterator &key, const std::multimap< float, std::string > &map)=0
float mMaxControllerLength
Definition: animation.hpp:258
bool mNodeMapCreated
Definition: animation.hpp:245
std::multimap< osg::ref_ptr< osg::Node >, osg::ref_ptr< osg::NodeCallback > > ControllerMap
Definition: animation.hpp:237
void handleTextKey(AnimState &state, const std::string &groupname, const std::multimap< float, std::string >::const_iterator &key, const std::multimap< float, std::string > &map)
Definition: animation.cpp:613
osg::ref_ptr< osg::Node > mAccumRoot
Definition: animation.hpp:227
osg::Vec3f mAccumulate
Definition: animation.hpp:251
MWWorld::Ptr mPtr
Definition: animation.hpp:247
float mSpeedMult
Definition: animation.hpp:184
EffectAnimationTime()
Definition: animation.hpp:50
virtual void updatePtr(const MWWorld::Ptr &ptr)
Definition: animation.cpp:455
float mAlpha
Definition: animation.hpp:275
virtual void attachArrow()
Definition: animation.hpp:458
void removeEffect(int effectId)
Definition: animation.cpp:1358
AnimStateMap mStates
Definition: animation.hpp:216
void updateEffects(float duration)
This is typically called as part of runAnimation, but may be called manually if needed.
Definition: animation.cpp:1379
PartHolder(osg::ref_ptr< osg::Node > node)
Definition: animation.cpp:1627
const NodeMap & getNodeMap() const
Definition: animation.cpp:804
osg::ref_ptr< RotateController > mHeadController
Definition: animation.hpp:268
float mHeadPitchRadians
Definition: animation.hpp:270
virtual void setAccurateAiming(bool enabled)
Definition: animation.hpp:470
float mLoopStopTime
Definition: animation.hpp:179
TextKeyListener * mTextKeyListener
Definition: animation.hpp:266
void setObjectRoot(const std::string &model, bool forceskeleton, bool baseonly, bool isCreature)
Definition: animation.cpp:1095
bool reset(AnimState &state, const std::multimap< float, std::string > &keys, const std::string &groupname, const std::string &start, const std::string &stop, float startpoint, bool loopfallback)
Definition: animation.cpp:724
Definition: controller.hpp:195
osg::ref_ptr< osg::Group > mInsert
Definition: animation.hpp:221
bool mAutoDisable
Definition: animation.hpp:192
virtual float getHeadPitch() const
Definition: animation.cpp:1556
osg::Vec4f getEnchantmentColor(const MWWorld::ConstPtr &item) const
Definition: animation.cpp:1262
size_t detectBlendMask(const osg::Node *node) const
Definition: animation.cpp:468
bool operator==(const AnimPriority &other) const
Definition: animation.hpp:110
Definition: animation.hpp:477
osg::ref_ptr< GlowUpdater > mGlowUpdater
Definition: animation.hpp:273
~AnimState()
Definition: animation.cpp:1620
virtual void enableHeadAnimation(bool enable)
Definition: animation.hpp:460
BlendMask
Definition: animation.hpp:87
virtual void setRenderBin()
Set the render bin for this animation's object root. May be customized by subclasses.
Definition: animation.cpp:1461
bool upperBodyReady() const
Returns true if no important animations are currently playing on the upper body.
Definition: animation.cpp:1404
bool mLoopingEnabled
Definition: animation.hpp:187
virtual void showCarriedLeft(bool show)
Definition: animation.hpp:452
Pointer to a const LiveCellRef.
Definition: ptr.hpp:90
Definition: loadmgef.hpp:13
Definition: animation.hpp:88
void operator=(Animation &)
size_t mLoopCount
Definition: animation.hpp:188
void addEffect(const std::string &model, int effectId, bool loop=false, const std::string &bonename="", std::string texture="")
Add an effect mesh attached to a bone or the insert scene node.
Definition: animation.cpp:1302
~PartHolder()
Definition: animation.cpp:1632
float getTime() const
Definition: animation.hpp:201
boost::shared_ptr< AnimSource > mSource
Definition: animation.hpp:176
Definition: animation.hpp:89
AnimPriority mPriority
Definition: animation.hpp:190
float mHeadYawRadians
Definition: animation.hpp:269
virtual void setVampire(bool vampire)
Definition: animation.hpp:454
size_t getCurrentLoopCount(const std::string &groupname) const
Definition: animation.cpp:924
std::string mBoneName
Definition: animation.hpp:261
virtual osg::Vec3f runAnimation(float duration)
Definition: animation.cpp:1003
osg::ref_ptr< osg::Node > getNode()
Definition: animation.hpp:64
BoneGroup
Definition: animation.hpp:80
void setLoopingEnabled(const std::string &groupname, bool enabled)
Definition: animation.cpp:1088
bool hasAnimation(const std::string &anim) const
Definition: animation.cpp:571
float mStopTime
Definition: animation.hpp:180
osg::ref_ptr< SceneUtil::LightSource > mGlowLight
Definition: animation.hpp:272
std::vector< EffectParams > mEffects
Definition: animation.hpp:264
osg::ref_ptr< ResetAccumRootCallback > mResetAccumRootCallback
Definition: animation.hpp:233
void play(const std::string &groupname, const AnimPriority &priority, int blendMask, bool autodisable, float speedmult, const std::string &start, const std::string &stop, float startpoint, size_t loops, bool loopfallback=false)
Definition: animation.cpp:643
virtual void addControllers()
Definition: animation.cpp:1513
Definition: animation.hpp:91
ObjectAnimation(const MWWorld::Ptr &ptr, const std::string &model, Resource::ResourceSystem *resourceSystem, bool animated, bool allowLight)
Definition: animation.cpp:1597
Definition: animation.hpp:93
boost::shared_ptr< float > TimePtr
Definition: animation.hpp:182
void unlink()
Unreferences mNode without detaching it from the graph. Only use if you know what you are doing...
Definition: animation.cpp:1645
SceneUtil::Skeleton * mSkeleton
Definition: animation.hpp:224
std::string mModelName
Definition: animation.hpp:255
std::vector< boost::shared_ptr< AnimSource > > AnimSourceList
Definition: animation.hpp:218
virtual float getValue(osg::NodeVisitor *nv)
Definition: animation.cpp:1568
Definition: animation.hpp:139
virtual void releaseArrow(float attackStrength)
Definition: animation.hpp:459
Definition: animation.hpp:253
bool shouldLoop() const
Definition: animation.hpp:210
osg::Group * getOrCreateObjectRoot()
Definition: animation.cpp:1167
void operator=(const PartHolder &)
Definition: animation.hpp:39
Definition: animation.hpp:81
Pointer to a LiveCellRef.
Definition: ptr.hpp:19
float getCurrentTime(const std::string &groupname) const
Get the current absolute position in the animation track for the animation that is currently playing ...
Definition: animation.cpp:915
Holds an animation priority value for each BoneGroup.
Definition: animation.hpp:101
void resetTime(float time)
Definition: animation.cpp:1585
Definition: controller.hpp:11
std::map< std::string, AnimState > AnimStateMap
Definition: animation.hpp:215
const osg::Node * getNode(const std::string &name) const
Definition: animation.cpp:1417
void enable(CodeContainer &code, Literals &literals, const std::string &id)
Definition: generator.cpp:870
std::map< std::string, osg::ref_ptr< osg::MatrixTransform > > NodeMap
Definition: animation.hpp:243
boost::shared_ptr< float > mTimePtr
Definition: animation.hpp:152
float getTime() const
Definition: animation.cpp:1590
Definition: loadligh.hpp:17
float getVelocity(const std::string &groupname) const
Definition: animation.cpp:941
boost::shared_ptr< PartHolder > PartHolderPtr
Definition: animation.hpp:75
bool mPlaying
Definition: animation.hpp:186
virtual void setLightEffect(float effect)
Definition: animation.cpp:1473
Resource::ResourceSystem * mResourceSystem
Definition: animation.hpp:249
MWWorld::ConstPtr getPtr() const
Definition: animation.cpp:444
Definition: animation.hpp:83
Definition: animation.hpp:149
ControllerMap mActiveControllers
Definition: animation.hpp:238
float getStartTime(const std::string &groupname) const
Get the absolute position in the animation track of the first text key with the given group...
Definition: animation.cpp:584
TimePtr mTime
Definition: animation.hpp:183
void getLoopingEffects(std::vector< int > &out) const
Definition: animation.cpp:1370
AnimPriority(int priority)
Convenience constructor, initialises all priorities to the same value.
Definition: animation.hpp:104
virtual ~Animation()
Definition: animation.cpp:436
const char * name
Definition: crashcatcher.cpp:59
void setAccumulation(const osg::Vec3f &accum)
Definition: animation.cpp:460
virtual void setPitchFactor(float factor)
Definition: animation.hpp:457
void updatePosition(float oldtime, float newtime, osg::Vec3f &position)
Definition: animation.cpp:996