mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-11 21:36:40 -04:00
Remove dynamic_cast in GeomMorpherController
This commit is contained in:
parent
94e8560bf8
commit
28b20428b9
@ -221,28 +221,25 @@ GeomMorpherController::GeomMorpherController(const Nif::NiMorphData *data)
|
|||||||
|
|
||||||
void GeomMorpherController::update(osg::NodeVisitor *nv, osg::Drawable *drawable)
|
void GeomMorpherController::update(osg::NodeVisitor *nv, osg::Drawable *drawable)
|
||||||
{
|
{
|
||||||
osgAnimation::MorphGeometry* morphGeom = dynamic_cast<osgAnimation::MorphGeometry*>(drawable);
|
osgAnimation::MorphGeometry* morphGeom = static_cast<osgAnimation::MorphGeometry*>(drawable);
|
||||||
if (morphGeom)
|
if (hasInput())
|
||||||
{
|
{
|
||||||
if (hasInput())
|
if (mKeyFrames.size() <= 1)
|
||||||
|
return;
|
||||||
|
float input = getInputValue(nv);
|
||||||
|
int i = 0;
|
||||||
|
for (std::vector<Nif::FloatKeyMapPtr>::iterator it = mKeyFrames.begin()+1; it != mKeyFrames.end(); ++it,++i)
|
||||||
{
|
{
|
||||||
if (mKeyFrames.size() <= 1)
|
float val = 0;
|
||||||
return;
|
if (!(*it)->mKeys.empty())
|
||||||
float input = getInputValue(nv);
|
val = interpKey((*it)->mKeys, input);
|
||||||
int i = 0;
|
val = std::max(0.f, std::min(1.f, val));
|
||||||
for (std::vector<Nif::FloatKeyMapPtr>::iterator it = mKeyFrames.begin()+1; it != mKeyFrames.end(); ++it,++i)
|
|
||||||
{
|
|
||||||
float val = 0;
|
|
||||||
if (!(*it)->mKeys.empty())
|
|
||||||
val = interpKey((*it)->mKeys, input);
|
|
||||||
val = std::max(0.f, std::min(1.f, val));
|
|
||||||
|
|
||||||
morphGeom->setWeight(i, val);
|
morphGeom->setWeight(i, val);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
morphGeom->transformSoftwareMethod();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
morphGeom->transformSoftwareMethod();
|
||||||
}
|
}
|
||||||
|
|
||||||
UVController::UVController()
|
UVController::UVController()
|
||||||
|
@ -97,6 +97,7 @@ namespace NifOsg
|
|||||||
virtual float getMaximum() const;
|
virtual float getMaximum() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Must be set on an osgAnimation::MorphGeometry.
|
||||||
class GeomMorpherController : public osg::Drawable::UpdateCallback, public SceneUtil::Controller, public ValueInterpolator
|
class GeomMorpherController : public osg::Drawable::UpdateCallback, public SceneUtil::Controller, public ValueInterpolator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user