diff --git a/examples/osgfxbrowser/osgfxbrowser.cpp b/examples/osgfxbrowser/osgfxbrowser.cpp index f02038816..a49d9fcf0 100644 --- a/examples/osgfxbrowser/osgfxbrowser.cpp +++ b/examples/osgfxbrowser/osgfxbrowser.cpp @@ -180,7 +180,8 @@ protected: root_->removeChild(0, root_->getNumChildren()); osg::ref_ptr effect = effects_[selected_fx_].get(); effect->setEnabled(fxen_); - effect->setChild(scene_.get()); + effect->removeChild(0, effect->getNumChildren()); + effect->addChild(scene_.get()); effect->setUpDemo(); root_->addChild(effect.get()); } diff --git a/include/osgFX/BumpMapping b/include/osgFX/BumpMapping index 70106d036..628b45a22 100644 --- a/include/osgFX/BumpMapping +++ b/include/osgFX/BumpMapping @@ -25,11 +25,11 @@ namespace osgFX { /** - This effect makes surfaces appear bumpy. The child node must use two textures, + This effect makes surfaces appear bumpy. Children nodes must use two textures, one for diffuse color and one for the normal map (which can be created from a height map with tools like nVIDIA's normal map generator). Furthermore, tangent-space basis vectors must be created and assigned to each Geometry; this - can be done quickly by calling BumpMapping::prepareChild(). Note that both + can be done quickly by calling BumpMapping::prepareChildren(). Note that both diffuse and normal map textures must have corresponding UV maps defined in Geometry objects. This effect defines a preferred technique which uses ARB vertex & fragment @@ -46,11 +46,11 @@ namespace osgFX "Bump Mapping", - "This effect makes surfaces appear bumpy. The child node must use two textures, " + "This effect makes surfaces appear bumpy. Children nodes must use two textures, " "one for diffuse color and one for the normal map (which can be created " "from a height map with tools like nVIDIA's normal map generator). Furthermore, " "tangent-space basis vectors must be created and assigned to each Geometry; this " - "can be done quickly by calling BumpMapping::prepareChild(). Note that both " + "can be done quickly by calling BumpMapping::prepareChildren(). Note that both " "diffuse and normal map textures must have corresponding UV maps defined in " "Geometry objects.\n" "This effect defines a preferred technique which uses ARB vertex & fragment " @@ -79,22 +79,22 @@ namespace osgFX /** set the texture unit that contains normal map texture. Default is 0 */ inline void setNormalMapTextureUnit(int n); - /** get the diffuse color texture that overrides the child's texture */ + /** get the diffuse color texture that overrides children's texture */ inline osg::Texture2D *getOverrideDiffuseTexture(); - /** get the const diffuse color texture that overrides the child's texture */ + /** get the const diffuse color texture that overrides children's texture */ inline const osg::Texture2D *getOverrideDiffuseTexture() const; - /** set the diffuse color texture that overrides the child's texture */ + /** set the diffuse color texture that overrides children's texture */ inline void setOverrideDiffuseTexture(osg::Texture2D *texture); - /** get the normal map texture that overrides the child's texture */ + /** get the normal map texture that overrides children's texture */ inline osg::Texture2D *getOverrideNormalMapTexture(); - /** get the const normal map texture that overrides the child's texture */ + /** get the const normal map texture that overrides children's texture */ inline const osg::Texture2D *getOverrideNormalMapTexture() const; - /** set the normal map texture that overrides the child's texture */ + /** set the normal map texture that overrides children's texture */ inline void setOverrideNormalMapTexture(osg::Texture2D *texture); /** @@ -106,8 +106,8 @@ namespace osgFX /** prepare a Node for bump lighting, calling prepareGeometry() for each Geometry */ void prepareNode(osg::Node *node); - /** prepare the current child for bump lighting. Actually calls prepareNode(getChild()) */ - void prepareChild(); + /** prepare children for bump lighting. Actually calls prepareNode() for each child */ + void prepareChildren(); /** set up a demo environment with predefined diffuse and normal maps, as well as texture coordinates */ void setUpDemo(); diff --git a/include/osgFX/Effect b/include/osgFX/Effect index 5a93f5c65..0e5a0a50d 100644 --- a/include/osgFX/Effect +++ b/include/osgFX/Effect @@ -52,10 +52,9 @@ namespace osgFX selected either manually, with selectTechnique(), or automatically, in which case the first technique that is supported by all active rendering contexts is chosen. - If you are an Effect user, then simply use it as a single-child group. - Create an instance of your desired effect, add it to your scene graph (it - is a Node) and call its setChild() method to set its child node as you - would do with a Group. + If you are an Effect user, then simply use it as a node group. Create an + instance of your desired effect, add it to your scene graph and call its + addChild() method to add a child node as you would do with a Group. If you are an Effect developer, you will have to implement the method define_techniques() to define the different techniques that can be used for obtaining the desired effect. In define_techniques() you will usually @@ -64,7 +63,7 @@ namespace osgFX techniques added first will have higher priority and will be used first as soon as all rendering contexts support it. */ - class OSGFX_EXPORT Effect: public osg::Node { + class OSGFX_EXPORT Effect: public osg::Group { public: Effect(); Effect(const Effect ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY); @@ -95,15 +94,6 @@ namespace osgFX */ inline virtual void setUpDemo() {} - /** get the const child node */ - inline const osg::Node *getChild() const; - - /** get the child node */ - inline osg::Node *getChild(); - - /** set the child node */ - inline void setChild(osg::Node *child); - /** get the number of techniques defined for this effect */ inline int getNumTechniques() const; @@ -123,14 +113,16 @@ namespace osgFX /** select a technique or enable automatic detection */ inline void selectTechnique(int i = AUTO_DETECT); - virtual void traverse(osg::NodeVisitor &nv); + /** custom traversal */ + virtual void traverse(osg::NodeVisitor &nv); + + /** default traversal */ + inline void inherited_traverse(osg::NodeVisitor &nv); protected: - virtual ~Effect() {} + virtual ~Effect(); Effect &operator=(const Effect &) { return *this; } - - virtual bool computeBound() const; - + /** force rebuilding of techniques on next traversal */ inline void dirtyTechniques(); @@ -144,7 +136,7 @@ namespace osgFX this method. */ virtual bool define_techniques() = 0; - + private: friend class Validator; @@ -157,11 +149,11 @@ namespace osgFX // use int instead of bool to avoid errors mutable osg::buffered_value tech_selected_; + int global_sel_tech_; bool techs_defined_; - osg::ref_ptr child_; osg::ref_ptr dummy_for_validation_; void build_dummy_node(); @@ -179,33 +171,6 @@ namespace osgFX enabled_ = v; } - inline const osg::Node *Effect::getChild() const - { - return child_.get(); - } - - inline osg::Node *Effect::getChild() - { - return child_.get(); - } - - inline void Effect::setChild(osg::Node *child) - { - child_ = child; - setNumChildrenRequiringUpdateTraversal(0); - setNumChildrenWithCullingDisabled(0); - setNumChildrenWithOccluderNodes(0); - if (child) { - if (child->getNumChildrenRequiringUpdateTraversal() > 0 || child->getUpdateCallback()) - setNumChildrenRequiringUpdateTraversal(1); - if (child->getNumChildrenWithCullingDisabled() > 0 || !child->getCullingActive()) - setNumChildrenWithCullingDisabled(1); - if (child->getNumChildrenWithOccluderNodes() > 0 || dynamic_cast(child)) - setNumChildrenWithOccluderNodes(1); - } - dirtyBound(); - } - inline int Effect::getNumTechniques() const { return static_cast(techs_.size()); @@ -240,6 +205,12 @@ namespace osgFX { techs_defined_ = false; } + + inline void Effect::inherited_traverse(osg::NodeVisitor &nv) + { + typedef osg::Group inherited; + inherited::traverse(nv); + } } diff --git a/include/osgFX/Technique b/include/osgFX/Technique index f0f1b38cf..e15b61ac7 100644 --- a/include/osgFX/Technique +++ b/include/osgFX/Technique @@ -37,6 +37,8 @@ namespace osgFX { + class Effect; + /** This is the base class for effect techniques. A technique represents one of the possible ways to implement a special effect. This base class is @@ -79,12 +81,6 @@ namespace osgFX /** get the number of rendering passes defined in this technique */ inline int getNumPasses() const; - /** get the Group object associated to the i-th pass */ - inline osg::Group *getPassGroup(int i); - - /** get the const Group object associated to the i-th pass */ - inline const osg::Group *getPassGroup(int i) const; - /** get the StateSet object associated to the i-th pass */ inline osg::StateSet *getPassStateSet(int i); @@ -92,11 +88,13 @@ namespace osgFX inline const osg::StateSet *getPassStateSet(int i) const; /** - traverses the child nodes with multipass if necessary. + traverse children with multipass if necessary. By default this method + simply calls the protected method traverse_implementation(); you can + override it to change the default behavior. Don't call this method directly as it is called by osgFX::Effect */ - virtual void accept(osg::NodeVisitor &nv, osg::Node *child); - + inline virtual void traverse(osg::NodeVisitor &nv, Effect *fx); + protected: Technique(const Technique &): osg::Referenced() {} // copying is nonsense ;) virtual ~Technique() {} @@ -105,82 +103,54 @@ namespace osgFX /** force rebuilding of pass nodes on next traversal */ inline void dirtyPasses(); - /** optional: return a node that overrides the child node on a specified pass */ - inline virtual osg::Node *getOverrideChild(int) { return 0; } - /** create a new pass node, add it to the technique and associate a StateSet */ void addPass(osg::StateSet *ss = 0); - - /** - add a new pass to the technique specifying an user-defined pass node. - You should call this version of addPass() only when you need to gain direct - control over the pass node (i.e. for setting up a cull callback); otherwise - please use addPass(StateSet*) and let the class create the pass node for you. - */ - void addPass(osg::Group *pass); - - /** - get the control node which holds the user's subgraph. - You may want to do something on it like applying a cull callback. - */ - inline osg::Group *getControlNode(); - - /** get the const control node which holds the user's subgraph */ - inline const osg::Group *getControlNode() const; + + /** optional: return a node that overrides the child node on a specified pass */ + inline virtual osg::Node *getOverrideChild(int) { return 0; } /** define the rendering passes that make up this technique. You must implement this method in derived classes to add the required passes. */ virtual void define_passes() = 0; + + /** + traverse children with multipass if necessary. Don't call this method + directly unless you are in a customized version of traverse(). + */ + void traverse_implementation(osg::NodeVisitor &nv, Effect *fx); private: - bool passes_defined_; - - osg::ref_ptr control_node_; - osg::ref_ptr prev_child_; + typedef std::vector > Pass_list; + Pass_list passes_; }; // INLINE METHODS inline int Technique::getNumPasses() const { - return static_cast(control_node_->getNumChildren()); - } - - inline osg::Group *Technique::getPassGroup(int i) - { - return static_cast(control_node_->getChild(i)); - } - - inline const osg::Group *Technique::getPassGroup(int i) const - { - return static_cast(control_node_->getChild(i)); + return static_cast(passes_.size()); } inline osg::StateSet *Technique::getPassStateSet(int i) { - return control_node_->getChild(i)->getStateSet(); + return passes_[i].get(); } inline const osg::StateSet *Technique::getPassStateSet(int i) const { - return control_node_->getChild(i)->getStateSet(); + return passes_[i].get(); } - - inline osg::Group *Technique::getControlNode() - { - return control_node_.get(); - } - - inline const osg::Group *Technique::getControlNode() const - { - return control_node_.get(); - } - + inline void Technique::dirtyPasses() { - passes_defined_ = false; + passes_.clear(); + } + + inline void Technique::traverse(osg::NodeVisitor &nv, Effect *fx) + { + traverse_implementation(nv, fx); } } diff --git a/include/osgFX/Validator b/include/osgFX/Validator index 90170212f..a4476ed8c 100644 --- a/include/osgFX/Validator +++ b/include/osgFX/Validator @@ -34,22 +34,28 @@ namespace osgFX */ class OSGFX_EXPORT Validator: public osg::StateAttribute { public: + enum { + VALIDATOR = 0x56616C69 + }; + Validator(); Validator(Effect *effect); Validator(const Validator ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY); - META_StateAttribute(osgFX, Validator, 0x56616C69); + META_StateAttribute(osgFX, Validator, VALIDATOR); void apply(osg::State &state) const; inline int compare(const osg::StateAttribute &sa) const; + + inline void disable() { effect_ = 0; } protected: virtual ~Validator() {} Validator &operator=(const Validator &) { return *this; } private: - mutable osg::ref_ptr effect_; + mutable Effect *effect_; }; // INLINE METHODS @@ -59,8 +65,8 @@ namespace osgFX const Validator *v = dynamic_cast(&sa); if (!v) return -1; - if (effect_.get() < v->effect_.get()) return -1; - if (effect_.get() > v->effect_.get()) return 1; + if (effect_ < v->effect_) return -1; + if (effect_ > v->effect_) return 1; return 0; } diff --git a/src/osgFX/BumpMapping.cpp b/src/osgFX/BumpMapping.cpp index c06646311..007bd33cb 100644 --- a/src/osgFX/BumpMapping.cpp +++ b/src/osgFX/BumpMapping.cpp @@ -599,22 +599,23 @@ void BumpMapping::prepareNode(osg::Node *node) node->accept(tv); } -void BumpMapping::prepareChild() +void BumpMapping::prepareChildren() { - if (getChild()) - prepareNode(getChild()); + for (unsigned i=0; iaccept(tcg); + for (unsigned i=0; iaccept(tcg); // set up diffuse texture if (!diffuse_tex_.valid()) { diffuse_tex_ = new osg::Texture2D; - diffuse_tex_->setImage(osgDB::readImageFile("whitemetal_diffuse.jpg")); + diffuse_tex_->setImage(osgDB::readImageFile("Images/whitemetal_diffuse.jpg")); diffuse_tex_->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR_MIPMAP_LINEAR); diffuse_tex_->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR); diffuse_tex_->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT); @@ -625,7 +626,7 @@ void BumpMapping::setUpDemo() // set up normal map texture if (!normal_tex_.valid()) { normal_tex_ = new osg::Texture2D; - normal_tex_->setImage(osgDB::readImageFile("whitemetal_normal.jpg")); + normal_tex_->setImage(osgDB::readImageFile("Images/whitemetal_normal.jpg")); normal_tex_->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR_MIPMAP_LINEAR); normal_tex_->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR); normal_tex_->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT); @@ -634,7 +635,7 @@ void BumpMapping::setUpDemo() } // generate tangent-space basis vector - prepareChild(); + prepareChildren(); // recreate techniques on next step dirtyTechniques(); diff --git a/src/osgFX/Effect.cpp b/src/osgFX/Effect.cpp index f4b0c56dd..931da0f75 100644 --- a/src/osgFX/Effect.cpp +++ b/src/osgFX/Effect.cpp @@ -6,10 +6,12 @@ #include #include +#include + using namespace osgFX; Effect::Effect() -: osg::Node(), +: osg::Group(), enabled_(true), global_sel_tech_(AUTO_DETECT), techs_defined_(false) @@ -18,56 +20,59 @@ Effect::Effect() } Effect::Effect(const Effect ©, const osg::CopyOp ©op) -: osg::Node(copy, copyop), +: osg::Group(copy, copyop), enabled_(copy.enabled_), global_sel_tech_(copy.global_sel_tech_), - techs_defined_(false), - child_(static_cast(copyop(copy.child_.get()))) + techs_defined_(false) { build_dummy_node(); } -bool Effect::computeBound() const +Effect::~Effect() { - _bsphere.init(); - _bsphere_computed = true; - - if (child_.valid()) { - _bsphere.expandBy(child_->getBound()); - } - - return _bsphere.valid(); + // disable the validator for safety, so it won't try to access us + // even if it stays alive for some reason + if (dummy_for_validation_.valid()) { + osg::StateSet *ss = dummy_for_validation_->getStateSet(); + if (ss) { + Validator *validator = dynamic_cast(ss->getAttribute(Validator::VALIDATOR)); + if (validator) { + validator->disable(); + } + } + } } void Effect::traverse(osg::NodeVisitor &nv) { - typedef osg::Node Inherited; - - if (!child_.valid()) return; - - // we are not a Group, so children will not notify us when their - // bounding box has changed. We need to recompute it at each traversal... :( - dirtyBound(); - + // if this effect is not enabled, then go for default traversal if (!enabled_) { - child_->accept(nv); - Inherited::traverse(nv); + inherited_traverse(nv); return; } + // ensure that at least one technique is defined if (!techs_defined_) { - // clear existing techniques if necessary + // clear existing techniques techs_.clear(); + + // clear technique selection indices sel_tech_.clear(); + + // clear technique selection flags tech_selected_.clear(); // define new techniques techs_defined_ = define_techniques(); + + // check for errors, return on failure if (!techs_defined_) { osg::notify(osg::WARN) << "Warning: osgFX::Effect: could not define techniques for effect " << className() << std::endl; return; } + + // ensure that at least one technique has been defined if (techs_.empty()) { osg::notify(osg::WARN) << "Warning: osgFX::Effect: no techniques defined for effect " << className() << std::endl; return; @@ -76,7 +81,11 @@ void Effect::traverse(osg::NodeVisitor &nv) Technique *tech = 0; - if (global_sel_tech_ == AUTO_DETECT) { + // if the selection mode is set to AUTO_DETECT then we have to + // choose the active technique! + if (global_sel_tech_ == AUTO_DETECT) { + + // test whether at least one technique has been selected bool none_selected = true; for (unsigned i=0; iaccept(nv); } - int max_index = -1; + // find the highest priority technique that could be validated + // in all active rendering contexts + int max_index = -1; for (unsigned j=0; j max_index) { @@ -98,26 +111,28 @@ void Effect::traverse(osg::NodeVisitor &nv) } } - if (max_index >= 0) { + // found a valid technique? + if (max_index >= 0) { tech = techs_[max_index].get(); } } else { + + // the active technique was selected manually tech = techs_[global_sel_tech_].get(); } - if (tech) { - tech->accept(nv, child_.get()); - } else { - child_->accept(nv); - } + // if we could find an active technique, then continue with traversal + if (tech) { + tech->traverse(nv, this); + } - Inherited::traverse(nv); + // wow, we're finished! :) } void Effect::build_dummy_node() { - dummy_for_validation_ = new osg::Geode; + dummy_for_validation_ = new osg::Geode; osg::ref_ptr geo = new osg::Geometry; dummy_for_validation_->addDrawable(geo.get()); dummy_for_validation_->getOrCreateStateSet()->setAttribute(new Validator(this)); diff --git a/src/osgFX/Technique.cpp b/src/osgFX/Technique.cpp index 52317cb95..68a5e2309 100644 --- a/src/osgFX/Technique.cpp +++ b/src/osgFX/Technique.cpp @@ -1,30 +1,23 @@ #include +#include #include +#include + using namespace osgFX; Technique::Technique() -: osg::Referenced(), - passes_defined_(false), - control_node_(new osg::Group) +: osg::Referenced() { } void Technique::addPass(osg::StateSet *ss) { - osg::ref_ptr pass = new osg::Group; - control_node_->addChild(pass.get()); - - if (ss) { - ss->setRenderBinDetails(static_cast(control_node_->getNumChildren()), "RenderBin"); - pass->setStateSet(ss); - } -} - -void Technique::addPass(osg::Group *pass) -{ - control_node_->addChild(pass); + if (ss) { + passes_.push_back(ss); + ss->setRenderBinDetails(static_cast(passes_.size()), "RenderBin"); + } } bool Technique::validate(osg::State &) const @@ -41,39 +34,36 @@ bool Technique::validate(osg::State &) const return true; } -void Technique::accept(osg::NodeVisitor &nv, osg::Node *child) +void Technique::traverse_implementation(osg::NodeVisitor &nv, Effect *fx) { // define passes if necessary - if (!passes_defined_) { - - // clear existing pass nodes - if (control_node_->getNumChildren() > 0) { - control_node_->removeChild(0, control_node_->getNumChildren()); - } - + if (passes_.empty()) { define_passes(); - passes_defined_ = true; } - // update pass children if necessary - if (child != prev_child_.get()) { - for (unsigned i=0; igetNumChildren(); ++i) { - osg::Group *pass = dynamic_cast(control_node_->getChild(i)); - if (pass) { - if (pass->getNumChildren() > 0) { - pass->removeChild(0, pass->getNumChildren()); - } - osg::Node *oc = getOverrideChild(i); - if (oc) { - pass->addChild(oc); - } else { - pass->addChild(child); - } - } - } - prev_child_ = child; - } + // special actions must be taken if the node visitor is actually a CullVisitor + osgUtil::CullVisitor *cv = dynamic_cast(&nv); - // traverse the control node - control_node_->accept(nv); + // traverse all passes + for (int i=0; ipushStateSet(passes_[i].get()); + } + + // traverse the override node if defined, otherwise + // traverse children as a Group would do + osg::Node *override = getOverrideChild(i); + if (override) { + override->accept(nv); + } else { + fx->inherited_traverse(nv); + } + + // pop the StateSet if necessary + if (cv) { + cv->popStateSet(); + } + } } diff --git a/src/osgFX/Validator.cpp b/src/osgFX/Validator.cpp index 82576eb58..b44c40aa9 100644 --- a/src/osgFX/Validator.cpp +++ b/src/osgFX/Validator.cpp @@ -6,7 +6,8 @@ using namespace osgFX; Validator::Validator() -: osg::StateAttribute() +: osg::StateAttribute(), + effect_(0) { } @@ -18,13 +19,13 @@ Validator::Validator(Effect *effect) Validator::Validator(const Validator ©, const osg::CopyOp ©op) : osg::StateAttribute(copy, copyop), - effect_(static_cast(copyop(copy.effect_.get()))) + effect_(static_cast(copyop(copy.effect_))) { } void Validator::apply(osg::State &state) const { - if (!effect_.valid()) return; + if (!effect_) return; if (effect_->tech_selected_[state.getContextID()] == 0) { Effect::Technique_list::iterator i; diff --git a/src/osgPlugins/osgFX/IO_AnisotropicLighting.cpp b/src/osgPlugins/osgFX/IO_AnisotropicLighting.cpp index 8a50b2b3a..884e3703b 100644 --- a/src/osgPlugins/osgFX/IO_AnisotropicLighting.cpp +++ b/src/osgPlugins/osgFX/IO_AnisotropicLighting.cpp @@ -11,7 +11,7 @@ osgDB::RegisterDotOsgWrapperProxy AnisotropicLighting_Proxy ( new osgFX::AnisotropicLighting, "osgFX::AnisotropicLighting", - "Object Node osgFX::Effect osgFX::AnisotropicLighting", + "Object Node Group osgFX::Effect osgFX::AnisotropicLighting", AnisotropicLighting_readLocalData, AnisotropicLighting_writeLocalData ); diff --git a/src/osgPlugins/osgFX/IO_BumpMapping.cpp b/src/osgPlugins/osgFX/IO_BumpMapping.cpp index fb0d7aa7d..9de0c5ae0 100644 --- a/src/osgPlugins/osgFX/IO_BumpMapping.cpp +++ b/src/osgPlugins/osgFX/IO_BumpMapping.cpp @@ -11,7 +11,7 @@ osgDB::RegisterDotOsgWrapperProxy BumpMapping_Proxy ( new osgFX::BumpMapping, "osgFX::BumpMapping", - "Object Node osgFX::Effect osgFX::BumpMapping", + "Object Node Group osgFX::Effect osgFX::BumpMapping", BumpMapping_readLocalData, BumpMapping_writeLocalData ); diff --git a/src/osgPlugins/osgFX/IO_Cartoon.cpp b/src/osgPlugins/osgFX/IO_Cartoon.cpp index 76eb8448d..83ec5b4c9 100644 --- a/src/osgPlugins/osgFX/IO_Cartoon.cpp +++ b/src/osgPlugins/osgFX/IO_Cartoon.cpp @@ -11,7 +11,7 @@ osgDB::RegisterDotOsgWrapperProxy Cartoon_Proxy ( new osgFX::Cartoon, "osgFX::Cartoon", - "Object Node osgFX::Effect osgFX::Cartoon", + "Object Node Group osgFX::Effect osgFX::Cartoon", Cartoon_readLocalData, Cartoon_writeLocalData ); diff --git a/src/osgPlugins/osgFX/IO_Effect.cpp b/src/osgPlugins/osgFX/IO_Effect.cpp index 82503c2df..37edb5e3b 100644 --- a/src/osgPlugins/osgFX/IO_Effect.cpp +++ b/src/osgPlugins/osgFX/IO_Effect.cpp @@ -11,7 +11,7 @@ osgDB::RegisterDotOsgWrapperProxy Effect_Proxy ( 0, "osgFX::Effect", - "Object Node osgFX::Effect", + "Object Node Group osgFX::Effect", Effect_readLocalData, Effect_writeLocalData ); @@ -46,11 +46,6 @@ bool Effect_readLocalData(osg::Object &obj, osgDB::Input &fr) } } - osg::ref_ptr node = static_cast(fr.readObjectOfType(osgDB::type_wrapper())); - if (node.valid()) { - myobj.setChild(node.get()); - } - return itAdvanced; } @@ -65,7 +60,6 @@ bool Effect_writeLocalData(const osg::Object &obj, osgDB::Output &fw) } else { fw << myobj.getSelectedTechnique() << "\n"; } - fw.writeObject(*myobj.getChild()); return true; } diff --git a/src/osgPlugins/osgFX/IO_Scribe.cpp b/src/osgPlugins/osgFX/IO_Scribe.cpp index d17541d0f..cbb0f058b 100644 --- a/src/osgPlugins/osgFX/IO_Scribe.cpp +++ b/src/osgPlugins/osgFX/IO_Scribe.cpp @@ -11,7 +11,7 @@ osgDB::RegisterDotOsgWrapperProxy Scribe_Proxy ( new osgFX::Scribe, "osgFX::Scribe", - "Object Node osgFX::Effect osgFX::Scribe", + "Object Node Group osgFX::Effect osgFX::Scribe", Scribe_readLocalData, Scribe_writeLocalData ); diff --git a/src/osgPlugins/osgFX/IO_SpecularHighlights.cpp b/src/osgPlugins/osgFX/IO_SpecularHighlights.cpp index d51b4b1f5..9bf573588 100644 --- a/src/osgPlugins/osgFX/IO_SpecularHighlights.cpp +++ b/src/osgPlugins/osgFX/IO_SpecularHighlights.cpp @@ -11,7 +11,7 @@ osgDB::RegisterDotOsgWrapperProxy SpecularHighlights_Proxy ( new osgFX::SpecularHighlights, "osgFX::SpecularHighlights", - "Object Node osgFX::Effect osgFX::SpecularHighlights", + "Object Node Group osgFX::Effect osgFX::SpecularHighlights", SpecularHighlights_readLocalData, SpecularHighlights_writeLocalData );