const SGPropertyNode *props,
SGPropertyNode *prop_root)
{
- osg::ref_ptr<const SGReaderWriterOptions> sgOptions;
- if (options)
- sgOptions = new SGReaderWriterOptions(*options);
+ osg::ref_ptr<SGReaderWriterOptions> opt;
+ opt = SGReaderWriterOptions::copyOrCreate(options);
init();
- read_properties( sgOptions.get(), props, prop_root);
- buildEffectProperties(sgOptions.get());
+ read_properties(opt.get(), props, prop_root);
+ buildEffectProperties(opt.get());
}
SGMaterial::~SGMaterial (void)
void SGMaterial::buildEffectProperties(const SGReaderWriterOptions* options)
{
using namespace osg;
- ref_ptr<SGReaderWriterOptions> xmlOptions;
- if (options)
- xmlOptions = new SGReaderWriterOptions(*options);
ref_ptr<SGMaterialUserData> user = new SGMaterialUserData(this);
SGPropertyNode_ptr propRoot = new SGPropertyNode();
makeChild(propRoot, "inherits-from")->setStringValue(effect);
makeChild(effectParamProp, "scale")->setValue(SGVec3d(xsize,ysize,0.0));
makeChild(effectParamProp, "light-coverage")->setDoubleValue(light_coverage);
- matState.effect = makeEffect(effectProp, false, xmlOptions.get());
+ matState.effect = makeEffect(effectProp, false, options);
matState.effect->setUserData(user.get());
}
}