Pass ReaderWriter options to SGMaterialAnimation

It needs to grab the path list from options in order to support the texture
change animation.
This commit is contained in:
timoore
2007-12-23 23:33:04 +00:00
parent 6646aa5644
commit 94be52886e
3 changed files with 10 additions and 7 deletions

View File

@@ -354,8 +354,11 @@ private:
SGMaterialAnimation::SGMaterialAnimation(const SGPropertyNode* configNode,
SGPropertyNode* modelRoot) :
SGAnimation(configNode, modelRoot)
SGPropertyNode* modelRoot,
const osgDB::ReaderWriter::Options*
options) :
SGAnimation(configNode, modelRoot),
texturePathList(options->getDatabasePathList())
{
if (configNode->hasChild("global"))
SG_LOG(SG_IO, SG_ALERT, "Use of <global> in material animation is "
@@ -373,9 +376,6 @@ SGMaterialAnimation::createAnimationGroup(osg::Group& parent)
if (node)
inputRoot = getModelRoot()->getRootNode()->getNode(node->getStringValue(),
true);
osgDB::FilePathList texturePathList = osgDB::getDataFilePathList();
if (getConfig()->hasChild("texture-prop"))
osg::StateSet* stateSet = group->getOrCreateStateSet();
if (getConfig()->hasChild("texture")) {

View File

@@ -12,6 +12,7 @@
#endif
#include <osg/Material>
#include <osgDB/ReaderWriter>
#include "animation.hxx"
//////////////////////////////////////////////////////////////////////
@@ -21,12 +22,14 @@
class SGMaterialAnimation : public SGAnimation {
public:
SGMaterialAnimation(const SGPropertyNode* configNode,
SGPropertyNode* modelRoot);
SGPropertyNode* modelRoot,
const osgDB::ReaderWriter::Options* options);
virtual osg::Group* createAnimationGroup(osg::Group& parent);
virtual void install(osg::Node& node);
private:
osg::ref_ptr<osg::Material> defaultMaterial;
osg::Vec4 defaultAmbientDiffuse;
osgDB::FilePathList texturePathList;
};
#endif // _SG_MATERIALANIMATION_HXX

View File

@@ -521,7 +521,7 @@ SGAnimation::animate(osg::Node* node, const SGPropertyNode* configNode,
SGFlashAnimation animInst(configNode, modelRoot);
animInst.apply(node);
} else if (type == "material") {
SGMaterialAnimation animInst(configNode, modelRoot);
SGMaterialAnimation animInst(configNode, modelRoot, options);
animInst.apply(node);
} else if (type == "noshadow") {
SGShadowAnimation animInst(configNode, modelRoot);