forked from teamnwah/openmw-tes3coop
Add an incomplete implementation of SayAnimationValue (lip animation)
This commit is contained in:
parent
c5e543b91b
commit
bb70deabb1
2 changed files with 30 additions and 2 deletions
|
@ -59,6 +59,15 @@ std::string getVampireHead(const std::string& race, bool female)
|
|||
namespace MWRender
|
||||
{
|
||||
|
||||
float SayAnimationValue::getValue() const
|
||||
{
|
||||
if (MWBase::Environment::get().getSoundManager()->sayDone(mReference))
|
||||
return 0;
|
||||
else
|
||||
// TODO: Use the loudness of the currently playing sound
|
||||
return 1;
|
||||
}
|
||||
|
||||
static NpcAnimation::PartBoneMap createPartListMap()
|
||||
{
|
||||
NpcAnimation::PartBoneMap result;
|
||||
|
@ -115,6 +124,8 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, int v
|
|||
{
|
||||
mNpc = mPtr.get<ESM::NPC>()->mBase;
|
||||
|
||||
mSayAnimationValue = Ogre::SharedPtr<SayAnimationValue>(new SayAnimationValue(mPtr));
|
||||
|
||||
for(size_t i = 0;i < ESM::PRT_Count;i++)
|
||||
{
|
||||
mPartslots[i] = -1; //each slot is empty
|
||||
|
@ -558,15 +569,18 @@ bool NpcAnimation::addOrReplaceIndividualPart(ESM::PartReferenceType type, int g
|
|||
}
|
||||
|
||||
// TODO:
|
||||
// type == ESM::PRT_Head should get an animation source based on the current output of
|
||||
// the actor's 'say' sound (0 = silent, 1 = loud?).
|
||||
// type == ESM::PRT_Weapon should get an animation source based on the current offset
|
||||
// of the weapon attack animation (from its beginning, or start marker?)
|
||||
std::vector<Ogre::Controller<Ogre::Real> >::iterator ctrl(mObjectParts[type].mControllers.begin());
|
||||
for(;ctrl != mObjectParts[type].mControllers.end();ctrl++)
|
||||
{
|
||||
if(ctrl->getSource().isNull())
|
||||
{
|
||||
ctrl->setSource(mNullAnimationValuePtr);
|
||||
|
||||
if (type == ESM::PRT_Head)
|
||||
ctrl->setSource(mSayAnimationValue);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -13,6 +13,18 @@ namespace ESM
|
|||
namespace MWRender
|
||||
{
|
||||
|
||||
class SayAnimationValue : public Ogre::ControllerValue<Ogre::Real>
|
||||
{
|
||||
private:
|
||||
MWWorld::Ptr mReference;
|
||||
public:
|
||||
SayAnimationValue(MWWorld::Ptr reference) : mReference(reference) {}
|
||||
|
||||
virtual Ogre::Real getValue() const;
|
||||
virtual void setValue(Ogre::Real value)
|
||||
{ }
|
||||
};
|
||||
|
||||
class NpcAnimation : public Animation, public MWWorld::InventoryStoreListener
|
||||
{
|
||||
public:
|
||||
|
@ -50,6 +62,8 @@ private:
|
|||
|
||||
Ogre::Vector3 mFirstPersonOffset;
|
||||
|
||||
Ogre::SharedPtr<SayAnimationValue> mSayAnimationValue;
|
||||
|
||||
void updateNpcBase();
|
||||
|
||||
NifOgre::ObjectList insertBoundedPart(const std::string &model, int group, const std::string &bonename,
|
||||
|
|
Loading…
Reference in a new issue