Make use of SGReaderWriterOptions::copyOrCreate in SGMaterial.
This commit is contained in:
@@ -100,12 +100,11 @@ SGMaterial::SGMaterial( const osgDB::Options* options,
|
|||||||
const SGPropertyNode *props,
|
const SGPropertyNode *props,
|
||||||
SGPropertyNode *prop_root)
|
SGPropertyNode *prop_root)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<const SGReaderWriterOptions> sgOptions;
|
osg::ref_ptr<SGReaderWriterOptions> opt;
|
||||||
if (options)
|
opt = SGReaderWriterOptions::copyOrCreate(options);
|
||||||
sgOptions = new SGReaderWriterOptions(*options);
|
|
||||||
init();
|
init();
|
||||||
read_properties( sgOptions.get(), props, prop_root);
|
read_properties(opt.get(), props, prop_root);
|
||||||
buildEffectProperties(sgOptions.get());
|
buildEffectProperties(opt.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
SGMaterial::~SGMaterial (void)
|
SGMaterial::~SGMaterial (void)
|
||||||
@@ -409,9 +408,6 @@ osg::Texture2D* SGMaterial::get_object_mask(SGTexturedTriangleBin triangleBin)
|
|||||||
void SGMaterial::buildEffectProperties(const SGReaderWriterOptions* options)
|
void SGMaterial::buildEffectProperties(const SGReaderWriterOptions* options)
|
||||||
{
|
{
|
||||||
using namespace osg;
|
using namespace osg;
|
||||||
ref_ptr<SGReaderWriterOptions> xmlOptions;
|
|
||||||
if (options)
|
|
||||||
xmlOptions = new SGReaderWriterOptions(*options);
|
|
||||||
ref_ptr<SGMaterialUserData> user = new SGMaterialUserData(this);
|
ref_ptr<SGMaterialUserData> user = new SGMaterialUserData(this);
|
||||||
SGPropertyNode_ptr propRoot = new SGPropertyNode();
|
SGPropertyNode_ptr propRoot = new SGPropertyNode();
|
||||||
makeChild(propRoot, "inherits-from")->setStringValue(effect);
|
makeChild(propRoot, "inherits-from")->setStringValue(effect);
|
||||||
@@ -449,7 +445,7 @@ void SGMaterial::buildEffectProperties(const SGReaderWriterOptions* options)
|
|||||||
makeChild(effectParamProp, "scale")->setValue(SGVec3d(xsize,ysize,0.0));
|
makeChild(effectParamProp, "scale")->setValue(SGVec3d(xsize,ysize,0.0));
|
||||||
makeChild(effectParamProp, "light-coverage")->setDoubleValue(light_coverage);
|
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());
|
matState.effect->setUserData(user.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user