|
OpenMW
|
#include <npcanimation.hpp>
Public Types | |
| enum | ViewMode { VM_Normal, VM_FirstPerson, VM_HeadOnly } |
| typedef std::map < ESM::PartReferenceType, std::string > | PartBoneMap |
Public Types inherited from MWRender::Animation | |
| enum | BoneGroup { BoneGroup_LowerBody = 0, BoneGroup_Torso, BoneGroup_LeftArm, BoneGroup_RightArm } |
| enum | BlendMask { BlendMask_LowerBody = 1<<0, BlendMask_Torso = 1<<1, BlendMask_LeftArm = 1<<2, BlendMask_RightArm = 1<<3, BlendMask_UpperBody = BlendMask_Torso | BlendMask_LeftArm | BlendMask_RightArm, BlendMask_All = BlendMask_LowerBody | BlendMask_UpperBody } |
Public Member Functions | |
| virtual void | equipmentChanged () |
| virtual void | permanentEffectAdded (const ESM::MagicEffect *magicEffect, bool isNew) |
| NpcAnimation (const MWWorld::Ptr &ptr, osg::ref_ptr< osg::Group > parentNode, Resource::ResourceSystem *resourceSystem, bool disableSounds=false, ViewMode viewMode=VM_Normal, float firstPersonFieldOfView=55.f) | |
| virtual | ~NpcAnimation () |
| virtual void | enableHeadAnimation (bool enable) |
| virtual void | setAccurateAiming (bool enabled) |
| virtual void | setWeaponGroup (const std::string &group) |
| virtual osg::Vec3f | runAnimation (float timepassed) |
| virtual void | setPitchFactor (float factor) |
| virtual void | showWeapons (bool showWeapon) |
| virtual void | showCarriedLeft (bool show) |
| virtual void | attachArrow () |
| virtual void | releaseArrow (float attackStrength) |
| virtual osg::Group * | getArrowBone () |
| virtual osg::Node * | getWeaponNode () |
| virtual Resource::ResourceSystem * | getResourceSystem () |
| virtual void | showWeapon (bool show) |
| void | setViewMode (ViewMode viewMode) |
| void | updateParts () |
| void | rebuild () |
| Rebuilds the NPC, updating their root model, animation sources, and equipment. More... | |
| int | getSlot (const osg::NodePath &path) const |
| Get the inventory slot that the given node path leads into, or -1 if not found. More... | |
| virtual void | setVampire (bool vampire) |
| void | setFirstPersonOffset (const osg::Vec3f &offset) |
| Set a translation offset (in object root space) to apply to meshes when in first person mode. More... | |
| virtual void | updatePtr (const MWWorld::Ptr &updated) |
Public Member Functions inherited from MWRender::ActorAnimation | |
| ActorAnimation (const MWWorld::Ptr &ptr, osg::ref_ptr< osg::Group > parentNode, Resource::ResourceSystem *resourceSystem) | |
| virtual | ~ActorAnimation () |
| virtual void | itemAdded (const MWWorld::ConstPtr &item, int count) |
| virtual void | itemRemoved (const MWWorld::ConstPtr &item, int count) |
Public Member Functions inherited from MWRender::Animation | |
| void | setTextKeyListener (TextKeyListener *listener) |
| Animation (const MWWorld::Ptr &ptr, osg::ref_ptr< osg::Group > parentNode, Resource::ResourceSystem *resourceSystem) | |
| virtual | ~Animation () |
| Must be thread safe. More... | |
| MWWorld::ConstPtr | getPtr () const |
| MWWorld::Ptr | getPtr () |
| void | setActive (int active) |
| osg::Group * | getOrCreateObjectRoot () |
| osg::Group * | getObjectRoot () |
| void | addEffect (const std::string &model, int effectId, bool loop=false, const std::string &bonename="", const std::string &texture="", float scale=1.0f) |
| Add an effect mesh attached to a bone or the insert scene node. More... | |
| void | removeEffect (int effectId) |
| void | getLoopingEffects (std::vector< int > &out) const |
| void | addSpellCastGlow (const ESM::MagicEffect *effect, float glowDuration=1.5) |
| bool | hasAnimation (const std::string &anim) const |
| void | setAccumulation (const osg::Vec3f &accum) |
| 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) |
| void | adjustSpeedMult (const std::string &groupname, float speedmult) |
| bool | isPlaying (const std::string &groupname) const |
| bool | upperBodyReady () const |
| Returns true if no important animations are currently playing on the upper body. More... | |
| bool | getInfo (const std::string &groupname, float *complete=NULL, float *speedmult=NULL) const |
| float | getStartTime (const std::string &groupname) const |
| Get the absolute position in the animation track of the first text key with the given group. More... | |
| float | getTextKeyTime (const std::string &textKey) const |
| Get the absolute position in the animation track of the text key. More... | |
| float | getCurrentTime (const std::string &groupname) const |
| Get the current absolute position in the animation track for the animation that is currently playing from the given group. More... | |
| size_t | getCurrentLoopCount (const std::string &groupname) const |
| void | disable (const std::string &groupname) |
| float | getVelocity (const std::string &groupname) const |
| void | setLoopingEnabled (const std::string &groupname, bool enabled) |
| void | updateEffects () |
| This is typically called as part of runAnimation, but may be called manually if needed. More... | |
| const osg::Node * | getNode (const std::string &name) const |
| void | setAlpha (float alpha) |
| A value < 1 makes the animation translucent, 1.f = fully opaque. More... | |
| virtual void | setLightEffect (float effect) |
| virtual void | setHeadPitch (float pitchRadians) |
| virtual void | setHeadYaw (float yawRadians) |
| virtual float | getHeadPitch () const |
| virtual float | getHeadYaw () const |
Public Member Functions inherited from MWRender::WeaponAnimation | |
| WeaponAnimation () | |
| virtual | ~WeaponAnimation () |
| void | attachArrow (MWWorld::Ptr actor) |
| void | releaseArrow (MWWorld::Ptr actor, float attackStrength) |
| void | addControllers (const std::map< std::string, osg::ref_ptr< osg::MatrixTransform > > &nodes, std::multimap< osg::ref_ptr< osg::Node >, osg::ref_ptr< osg::NodeCallback > > &map, osg::Node *objectRoot) |
| Add WeaponAnimation-related controllers to nodes and store the added controllers in map. More... | |
| void | deleteControllers () |
| void | configureControllers (float characterPitchRadians) |
| Configure controllers, should be called every animation frame. More... | |
Static Public Member Functions | |
| static const std::vector < const ESM::BodyPart * > & | getBodyParts (const std::string &raceId, bool female, bool firstperson, bool werewolf) |
Protected Member Functions | |
| virtual void | addControllers () |
Protected Member Functions inherited from MWRender::Animation | |
| const NodeMap & | getNodeMap () const |
| void | resetActiveGroups () |
| size_t | detectBlendMask (const osg::Node *node) const |
| void | updatePosition (float oldtime, float newtime, osg::Vec3f &position) |
| 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) |
| void | handleTextKey (AnimState &state, const std::string &groupname, const std::multimap< float, std::string >::const_iterator &key, const std::multimap< float, std::string > &map) |
| void | setObjectRoot (const std::string &model, bool forceskeleton, bool baseonly, bool isCreature) |
| void | loadAllAnimationsInFolder (const std::string &model, const std::string &baseModel) |
| void | addAnimSource (const std::string &model, const std::string &baseModel) |
| void | addSingleAnimSource (const std::string &model, const std::string &baseModel) |
| void | addExtraLight (osg::ref_ptr< osg::Group > parent, const ESM::Light *light) |
| void | clearAnimSources () |
| osg::Vec4f | getEnchantmentColor (const MWWorld::ConstPtr &item) const |
| void | addGlow (osg::ref_ptr< osg::Node > node, osg::Vec4f glowColor, float glowDuration=-1) |
Protected Member Functions inherited from MWRender::WeaponAnimation | |
| void | setControllerRotate (const osg::Quat &rotate) |
| void | setControllerEnabled (bool enabled) |
Private Types | |
| enum | NpcType { Type_Normal, Type_Werewolf, Type_Vampire } |
Private Member Functions | |
| void | updateNpcBase () |
| PartHolderPtr | insertBoundedPart (const std::string &model, const std::string &bonename, const std::string &bonefilter, bool enchantedGlow, osg::Vec4f *glowColor=NULL) |
| void | removeIndividualPart (ESM::PartReferenceType type) |
| void | reserveIndividualPart (ESM::PartReferenceType type, int group, int priority) |
| bool | addOrReplaceIndividualPart (ESM::PartReferenceType type, int group, int priority, const std::string &mesh, bool enchantedGlow=false, osg::Vec4f *glowColor=NULL) |
| void | removePartGroup (int group) |
| void | addPartGroup (int group, int priority, const std::vector< ESM::PartReference > &parts, bool enchantedGlow=false, osg::Vec4f *glowColor=NULL) |
| virtual void | setRenderBin () |
| Set the render bin for this animation's object root. May be customized by subclasses. More... | |
Static Private Member Functions | |
| static bool | isFirstPersonPart (const ESM::BodyPart *bodypart) |
| static bool | isFemalePart (const ESM::BodyPart *bodypart) |
Private Attributes | |
| PartHolderPtr | mObjectParts [ESM::PRT_Count] |
| std::string | mSoundIds [ESM::PRT_Count] |
| const ESM::NPC * | mNpc |
| std::string | mHeadModel |
| std::string | mHairModel |
| ViewMode | mViewMode |
| bool | mShowWeapons |
| bool | mShowCarriedLeft |
| NpcType | mNpcType |
| int | mPartslots [ESM::PRT_Count] |
| int | mPartPriorities [ESM::PRT_Count] |
| osg::Vec3f | mFirstPersonOffset |
| float | mFirstPersonFieldOfView |
| std::shared_ptr < HeadAnimationTime > | mHeadAnimationTime |
| std::shared_ptr < WeaponAnimationTime > | mWeaponAnimationTime |
| bool | mSoundsDisabled |
| bool | mAccurateAiming |
| float | mAimingFactor |
| osg::ref_ptr< NeckController > | mFirstPersonNeckController |
Static Private Attributes | |
| static const PartBoneMap | sPartList = createPartListMap() |
| typedef std::map<ESM::PartReferenceType,std::string> MWRender::NpcAnimation::PartBoneMap |
|
private |
| MWRender::NpcAnimation::NpcAnimation | ( | const MWWorld::Ptr & | ptr, |
| osg::ref_ptr< osg::Group > | parentNode, | ||
| Resource::ResourceSystem * | resourceSystem, | ||
| bool | disableSounds = false, |
||
| ViewMode | viewMode = VM_Normal, |
||
| float | firstPersonFieldOfView = 55.f |
||
| ) |
| ptr | |
| disableListener | Don't listen for equipment changes and magic effects. InventoryStore only supports one listener at a time, so you shouldn't do this if creating several NpcAnimations for the same Ptr, eg preview dolls for the player. Those need to be manually rendered anyway. |
| disableSounds | Same as disableListener but for playing items sounds |
| viewMode |
|
virtual |
|
protectedvirtual |
Provided to allow derived classes adding their own controllers. Note, the controllers must be added to mActiveControllers so they get cleaned up properly on the next controller rebuild. A controller rebuild may be necessary to ensure correct ordering.
Reimplemented from MWRender::Animation.
|
private |
|
private |
|
virtual |
Reimplemented from MWRender::Animation.
|
virtual |
Reimplemented from MWRender::Animation.
|
virtual |
Fired when items are equipped or unequipped
Reimplemented from MWWorld::InventoryStoreListener.
|
virtual |
Implements MWRender::WeaponAnimation.
|
static |
Get a list of body parts that may be used by an NPC of given race and gender.
|
virtual |
Implements MWRender::WeaponAnimation.
| int MWRender::NpcAnimation::getSlot | ( | const osg::NodePath & | path | ) | const |
Get the inventory slot that the given node path leads into, or -1 if not found.
|
virtual |
Implements MWRender::WeaponAnimation.
|
private |
|
staticprivate |
|
staticprivate |
|
virtual |
| effect | |
| isNew | Is this effect new (e.g. the item for it was just now manually equipped) or was it loaded from a savegame / initial game state? If it isn't new, non-looping VFX should not be played. |
| playSound | Play effect sound? |
Reimplemented from MWWorld::InventoryStoreListener.
| void MWRender::NpcAnimation::rebuild | ( | ) |
Rebuilds the NPC, updating their root model, animation sources, and equipment.
|
virtual |
|
private |
|
private |
|
private |
|
virtual |
|
virtual |
1: the first person meshes follow the camera's rotation completely 0: the first person meshes follow the camera with a reduced factor, so you can look down at your own hands
Reimplemented from MWRender::Animation.
| void MWRender::NpcAnimation::setFirstPersonOffset | ( | const osg::Vec3f & | offset | ) |
Set a translation offset (in object root space) to apply to meshes when in first person mode.
|
inlinevirtual |
A relative factor (0-1) that decides if and how much the skeleton should be pitched to indicate the facing orientation of the character.
Reimplemented from MWRender::Animation.
|
privatevirtual |
Set the render bin for this animation's object root. May be customized by subclasses.
Reimplemented from MWRender::Animation.
|
virtual |
| void MWRender::NpcAnimation::setViewMode | ( | NpcAnimation::ViewMode | viewMode | ) |
|
virtual |
Reimplemented from MWRender::Animation.
|
virtual |
Reimplemented from MWRender::Animation.
|
inlinevirtual |
Implements MWRender::WeaponAnimation.
|
virtual |
Reimplemented from MWRender::Animation.
|
private |
| void MWRender::NpcAnimation::updateParts | ( | ) |
|
virtual |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
1.8.6