set defaut implementation at creation

This commit is contained in:
Julien Valentin
2017-08-29 14:11:44 +02:00
parent 0c9a624026
commit 059fc70337
6 changed files with 18 additions and 20 deletions

View File

@@ -61,25 +61,25 @@ namespace osgAnimation
virtual const char* className() const { return "MorphGeometry"; }
// set implementation of rig method
void setMorphTransformImplementation(MorphTransform*);
MorphTransform* getMorphTransformImplementation();
const MorphTransform* getMorphTransformImplementation() const { return _rigTransformImplementation.get(); }
inline void setMorphTransformImplementation(MorphTransform*mt) { _morphTransformImplementation=mt; }
inline MorphTransform* getMorphTransformImplementation() { return _morphTransformImplementation.get(); }
inline const MorphTransform* getMorphTransformImplementation() const { return _morphTransformImplementation.get(); }
/** Set the morphing method. */
void setMethod(Method method) { _method = method; }
inline void setMethod(Method method) { _method = method; }
/** Get the morphing method. */
inline Method getMethod() const { return _method; }
/** Set flag for morphing normals. */
void setMorphNormals(bool morphNormals) { _morphNormals = morphNormals; }
inline void setMorphNormals(bool morphNormals) { _morphNormals = morphNormals; }
/** Get the flag for morphing normals. */
inline bool getMorphNormals() const { return _morphNormals; }
/** Get the list of MorphTargets.*/
const MorphTargetList& getMorphTargetList() const { return _morphTargets; }
inline const MorphTargetList& getMorphTargetList() const { return _morphTargets; }
/** Get the list of MorphTargets. Warning if you modify this array you will have to call dirty() */
MorphTargetList& getMorphTargetList() { return _morphTargets; }
inline MorphTargetList& getMorphTargetList() { return _morphTargets; }
/** Return the \c MorphTarget at position \c i.*/
inline const MorphTarget& getMorphTarget( unsigned int i ) const { return _morphTargets[i]; }
@@ -130,7 +130,7 @@ namespace osgAnimation
}
/** update a morph target at index setting its current weight to morphWeight */
void setWeight(unsigned int index, float morphWeight)
inline void setWeight(unsigned int index, float morphWeight)
{
if (index < _morphTargets.size())
{
@@ -144,10 +144,10 @@ namespace osgAnimation
inline bool isDirty()const { return _dirty; }
/** for retrocompatibility */
virtual void transformSoftwareMethod(){ if (!_rigTransformImplementation.valid())_rigTransformImplementation = new MorphTransformSoftware();(*_rigTransformImplementation.get())(*this);}
virtual void transformSoftwareMethod(){(*_morphTransformImplementation.get())(*this);}
protected:
osg::ref_ptr<MorphTransform> _rigTransformImplementation;
osg::ref_ptr<MorphTransform> _morphTransformImplementation;
/// Do we need to recalculate the morphed geometry?
bool _dirty;

View File

@@ -1,5 +1,5 @@
/* -*-c++-*-
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
* Copyright (C) 2017 Julien Valentin <mp3butcher@hotmail.com>
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or

View File

@@ -145,10 +145,6 @@ namespace osgAnimation
}
geom->setSkeleton(finder._root.get());
if(!geom->getRigTransformImplementation())
{
geom->setRigTransformImplementation(new RigTransformSoftware);
}
geom->getRigTransformImplementation()->prepareData(*geom);
}