OpenMW
|
#include <animation.hpp>
Classes | |
class | AnimationValue |
struct | AnimSource |
struct | AnimState |
class | EffectAnimationValue |
struct | EffectParams |
class | NullAnimationValue |
Public Types | |
enum | Group { Group_LowerBody = 1<<0, Group_Torso = 1<<1, Group_LeftArm = 1<<2, Group_RightArm = 1<<3, Group_UpperBody = Group_Torso | Group_LeftArm | Group_RightArm, Group_All = Group_LowerBody | Group_UpperBody } |
Public Member Functions | |
Animation (const MWWorld::Ptr &ptr, Ogre::SceneNode *node) | |
virtual | ~Animation () |
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. | |
void | removeEffect (int effectId) |
void | getLoopingEffects (std::vector< int > &out) |
virtual void | preRender (Ogre::Camera *camera) |
Prepare this animation for being rendered with camera (rotates billboard nodes) | |
virtual void | setAlpha (float alpha) |
void | updatePtr (const MWWorld::Ptr &ptr) |
bool | hasAnimation (const std::string &anim) |
void | setAccumulation (const Ogre::Vector3 &accum) |
void | play (const std::string &groupname, int priority, int groups, bool autodisable, float speedmult, const std::string &start, const std::string &stop, float startpoint, size_t loops) |
bool | isPlaying (const std::string &groupname) const |
bool | isPlaying (Group group) const |
bool | getInfo (const std::string &groupname, float *complete=NULL, float *speedmult=NULL) const |
void | disable (const std::string &groupname) |
float | getVelocity (const std::string &groupname) const |
virtual Ogre::Vector3 | runAnimation (float duration) |
virtual void | showWeapons (bool showWeapon) |
virtual void | showCarriedLeft (bool show) |
void | enableLights (bool enable) |
Ogre::AxisAlignedBox | getWorldBounds () |
void | setCamera (Camera *cam) |
Ogre::Node * | getNode (const std::string &name) |
Ogre::TagPoint * | attachObjectToBone (const Ogre::String &bonename, Ogre::MovableObject *obj) |
void | detachObjectFromBone (Ogre::MovableObject *obj) |
Protected Types | |
typedef std::vector < Ogre::SharedPtr< AnimSource > > | AnimSourceList |
typedef std::map< std::string, AnimState > | AnimStateMap |
typedef std::map < Ogre::MovableObject *, std::string > | ObjectAttachMap |
Protected Member Functions | |
void | resetActiveGroups () |
void | updateSkeletonInstance (const Ogre::SkeletonInstance *skelsrc, Ogre::SkeletonInstance *skel) |
void | updatePosition (float oldtime, float newtime, Ogre::Vector3 &position) |
bool | reset (AnimState &state, const NifOgre::TextKeyMap &keys, const std::string &groupname, const std::string &start, const std::string &stop, float startpoint) |
void | handleTextKey (AnimState &state, const std::string &groupname, const NifOgre::TextKeyMap::const_iterator &key) |
void | setObjectRoot (const std::string &model, bool baseonly) |
void | addAnimSource (const std::string &model) |
void | addExtraLight (Ogre::SceneManager *sceneMgr, NifOgre::ObjectScenePtr objlist, const ESM::Light *light) |
void | clearAnimSources () |
Ogre::Vector3 | getEnchantmentColor (MWWorld::Ptr item) |
Static Protected Member Functions | |
static size_t | detectAnimGroup (const Ogre::Node *node) |
static float | calcAnimVelocity (const NifOgre::TextKeyMap &keys, NifOgre::NodeTargetValue< Ogre::Real > *nonaccumctrl, const Ogre::Vector3 &accum, const std::string &groupname) |
static NifOgre::TextKeyMap::const_iterator | findGroupStart (const NifOgre::TextKeyMap &keys, const std::string &groupname) |
static void | setRenderProperties (NifOgre::ObjectScenePtr objlist, Ogre::uint32 visflags, Ogre::uint8 solidqueue, Ogre::uint8 transqueue, Ogre::Real dist=0.0f, bool enchantedGlow=false, Ogre::Vector3 *glowColor=NULL) |
Protected Attributes | |
std::vector< EffectParams > | mEffects |
MWWorld::Ptr | mPtr |
Camera * | mCamera |
Ogre::SceneNode * | mInsert |
Ogre::Entity * | mSkelBase |
NifOgre::ObjectScenePtr | mObjectRoot |
AnimSourceList | mAnimSources |
Ogre::Node * | mAccumRoot |
Ogre::Node * | mNonAccumRoot |
NifOgre::NodeTargetValue < Ogre::Real > * | mNonAccumCtrl |
Ogre::Vector3 | mAccumulate |
AnimStateMap | mStates |
Ogre::SharedPtr< AnimationValue > | mAnimationValuePtr [sNumGroups] |
Ogre::SharedPtr < NullAnimationValue > | mNullAnimationValuePtr |
ObjectAttachMap | mAttachedObjects |
Static Protected Attributes | |
static const size_t | sNumGroups = 4 |
Private Member Functions | |
void | updateEffects (float duration) |
typedef std::vector< Ogre::SharedPtr<AnimSource> > MWRender::Animation::AnimSourceList [protected] |
typedef std::map<std::string,AnimState> MWRender::Animation::AnimStateMap [protected] |
typedef std::map<Ogre::MovableObject*,std::string> MWRender::Animation::ObjectAttachMap [protected] |
MWRender::Animation::Animation | ( | const MWWorld::Ptr & | ptr, |
Ogre::SceneNode * | node | ||
) |
MWRender::Animation::~Animation | ( | ) | [virtual] |
void MWRender::Animation::addAnimSource | ( | const std::string & | model | ) | [protected] |
void MWRender::Animation::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.
model | |
effectId | An ID for this effect. Note that adding the same ID again won't add another effect. |
loop | Loop the effect. If false, it is removed automatically after it finishes playing. If true, you need to remove it manually using removeEffect when the effect should end. |
bonename | Bone to attach to, or empty string to use the scene node instead |
texture | override the texture specified in the model's materials |
void MWRender::Animation::addExtraLight | ( | Ogre::SceneManager * | sceneMgr, |
NifOgre::ObjectScenePtr | objlist, | ||
const ESM::Light * | light | ||
) | [protected] |
Adds an additional light to the given object list using the specified ESM record.
Ogre::TagPoint * MWRender::Animation::attachObjectToBone | ( | const Ogre::String & | bonename, |
Ogre::MovableObject * | obj | ||
) |
float MWRender::Animation::calcAnimVelocity | ( | const NifOgre::TextKeyMap & | keys, |
NifOgre::NodeTargetValue< Ogre::Real > * | nonaccumctrl, | ||
const Ogre::Vector3 & | accum, | ||
const std::string & | groupname | ||
) | [static, protected] |
void MWRender::Animation::clearAnimSources | ( | ) | [protected] |
void MWRender::Animation::detachObjectFromBone | ( | Ogre::MovableObject * | obj | ) |
size_t MWRender::Animation::detectAnimGroup | ( | const Ogre::Node * | node | ) | [static, protected] |
void MWRender::Animation::disable | ( | const std::string & | groupname | ) |
Disables the specified animation group;
groupname | Animation group to disable. |
void MWRender::Animation::enableLights | ( | bool | enable | ) |
NifOgre::TextKeyMap::const_iterator MWRender::Animation::findGroupStart | ( | const NifOgre::TextKeyMap & | keys, |
const std::string & | groupname | ||
) | [static, protected] |
Ogre::Vector3 MWRender::Animation::getEnchantmentColor | ( | MWWorld::Ptr | item | ) | [protected] |
bool MWRender::Animation::getInfo | ( | const std::string & | groupname, |
float * | complete = NULL , |
||
float * | speedmult = NULL |
||
) | const |
Gets info about the given animation group.
groupname | Animation group to check. |
complete | Stores completion amount (0 = at start key, 0.5 = half way between start and stop keys), etc. |
speedmult | Stores the animation speed multiplier |
void MWRender::Animation::getLoopingEffects | ( | std::vector< int > & | out | ) |
Ogre::Node * MWRender::Animation::getNode | ( | const std::string & | name | ) |
float MWRender::Animation::getVelocity | ( | const std::string & | groupname | ) | const |
Retrieves the velocity (in units per second) that the animation will move.
Ogre::AxisAlignedBox MWRender::Animation::getWorldBounds | ( | ) |
void MWRender::Animation::handleTextKey | ( | AnimState & | state, |
const std::string & | groupname, | ||
const NifOgre::TextKeyMap::const_iterator & | key | ||
) | [protected] |
bool MWRender::Animation::hasAnimation | ( | const std::string & | anim | ) |
bool MWRender::Animation::isPlaying | ( | const std::string & | groupname | ) | const |
Returns true if the named animation group is playing.
bool MWRender::Animation::isPlaying | ( | Group | group | ) | const |
void MWRender::Animation::play | ( | const std::string & | groupname, |
int | priority, | ||
int | groups, | ||
bool | autodisable, | ||
float | speedmult, | ||
const std::string & | start, | ||
const std::string & | stop, | ||
float | startpoint, | ||
size_t | loops | ||
) |
Plays an animation.
groupname | Name of the animation group to play. |
priority | Priority of the animation. The animation will play on bone groups that don't have another animation set of a higher priority. |
groups | Bone groups to play the animation on. |
autodisable | Automatically disable the animation when it stops playing. |
speedmult | Speed multiplier for the animation. |
start | Key marker from which to start. |
stop | Key marker to stop at. |
startpoint | How far in between the two markers to start. 0 starts at the start marker, 1 starts at the stop marker. |
loops | How many times to loop the animation. This will use the "loop start" and "loop stop" markers if they exist, otherwise it will use "start" and "stop". |
void MWRender::Animation::preRender | ( | Ogre::Camera * | camera | ) | [virtual] |
Prepare this animation for being rendered with camera (rotates billboard nodes)
Reimplemented in MWRender::NpcAnimation.
void MWRender::Animation::removeEffect | ( | int | effectId | ) |
bool MWRender::Animation::reset | ( | AnimState & | state, |
const NifOgre::TextKeyMap & | keys, | ||
const std::string & | groupname, | ||
const std::string & | start, | ||
const std::string & | stop, | ||
float | startpoint | ||
) | [protected] |
void MWRender::Animation::resetActiveGroups | ( | ) | [protected] |
Ogre::Vector3 MWRender::Animation::runAnimation | ( | float | duration | ) | [virtual] |
Reimplemented in MWRender::NpcAnimation.
void MWRender::Animation::setAccumulation | ( | const Ogre::Vector3 & | accum | ) |
virtual void MWRender::Animation::setAlpha | ( | float | alpha | ) | [inline, virtual] |
Reimplemented in MWRender::NpcAnimation.
void MWRender::Animation::setCamera | ( | Camera * | cam | ) | [inline] |
void MWRender::Animation::setObjectRoot | ( | const std::string & | model, |
bool | baseonly | ||
) | [protected] |
void MWRender::Animation::setRenderProperties | ( | NifOgre::ObjectScenePtr | objlist, |
Ogre::uint32 | visflags, | ||
Ogre::uint8 | solidqueue, | ||
Ogre::uint8 | transqueue, | ||
Ogre::Real | dist = 0.0f , |
||
bool | enchantedGlow = false , |
||
Ogre::Vector3 * | glowColor = NULL |
||
) | [static, protected] |
virtual void MWRender::Animation::showCarriedLeft | ( | bool | show | ) | [inline, virtual] |
Reimplemented in MWRender::NpcAnimation.
void MWRender::Animation::showWeapons | ( | bool | showWeapon | ) | [virtual] |
Reimplemented in MWRender::NpcAnimation.
void MWRender::Animation::updateEffects | ( | float | duration | ) | [private] |
void MWRender::Animation::updatePosition | ( | float | oldtime, |
float | newtime, | ||
Ogre::Vector3 & | position | ||
) | [protected] |
void MWRender::Animation::updatePtr | ( | const MWWorld::Ptr & | ptr | ) |
void MWRender::Animation::updateSkeletonInstance | ( | const Ogre::SkeletonInstance * | skelsrc, |
Ogre::SkeletonInstance * | skel | ||
) | [protected] |
Ogre::Node* MWRender::Animation::mAccumRoot [protected] |
Ogre::Vector3 MWRender::Animation::mAccumulate [protected] |
Ogre::SharedPtr<AnimationValue> MWRender::Animation::mAnimationValuePtr[sNumGroups] [protected] |
AnimSourceList MWRender::Animation::mAnimSources [protected] |
ObjectAttachMap MWRender::Animation::mAttachedObjects [protected] |
Camera* MWRender::Animation::mCamera [protected] |
std::vector<EffectParams> MWRender::Animation::mEffects [protected] |
Ogre::SceneNode* MWRender::Animation::mInsert [protected] |
NifOgre::NodeTargetValue<Ogre::Real>* MWRender::Animation::mNonAccumCtrl [protected] |
Ogre::Node* MWRender::Animation::mNonAccumRoot [protected] |
Ogre::SharedPtr<NullAnimationValue> MWRender::Animation::mNullAnimationValuePtr [protected] |
MWWorld::Ptr MWRender::Animation::mPtr [protected] |
Ogre::Entity* MWRender::Animation::mSkelBase [protected] |
AnimStateMap MWRender::Animation::mStates [protected] |
const size_t MWRender::Animation::sNumGroups = 4 [static, protected] |