options);
}
catch (BuilderException& e) {
- SG_LOG(SG_INPUT, SG_ALERT, e.getFormattedMessage() << ", "
+ SG_LOG(SG_INPUT, SG_DEBUG, e.getFormattedMessage() << ", "
<< "maybe the reader did not set the filename attribute, "
<< "using white for type '" << type << "' on '" << pass->getName() << "', in " << prop->getPath() );
texture = StateAttributeFactory::instance()->getWhiteTexture();
Texture* build(Effect* effect, Pass* pass, const SGPropertyNode*,
const SGReaderWriterOptions* options);
protected:
- typedef map<TexTuple, ref_ptr<T> > TexMap;
+ typedef map<TexTuple, observer_ptr<T> > TexMap;
TexMap texMap;
const string _type;
};
{
TexTuple attrs = makeTexTuple(effect, props, options, _type);
typename TexMap::iterator itr = texMap.find(attrs);
- if (itr != texMap.end())
- return itr->second.get();
- T* tex = new T;
+
+ ref_ptr<T> tex;
+ if ((itr != texMap.end())&&
+ (itr->second.lock(tex)))
+ {
+ return tex.release();
+ }
+
+ tex = new T;
setAttrs(attrs, tex, options);
- texMap.insert(make_pair(attrs, tex));
- return tex;
+ if (itr == texMap.end())
+ texMap.insert(make_pair(attrs, tex));
+ else
+ itr->second = tex; // update existing, but empty observer
+ return tex.release();
}
TextureBuilder::Registrar installDepthBuffer("depth-buffer", new GBufferBuilder(Effect::DEPTH_BUFFER));
TextureBuilder::Registrar installNormalBuffer("normal-buffer", new GBufferBuilder(Effect::NORMAL_BUFFER));
TextureBuilder::Registrar installDiffuseBuffer("diffuse-buffer", new GBufferBuilder(Effect::DIFFUSE_BUFFER));
- TextureBuilder::Registrar installSpecularBuffer("specular-buffer", new GBufferBuilder(Effect::SPECULAR_BUFFER));
- TextureBuilder::Registrar installEmissionBuffer("emission-buffer", new GBufferBuilder(Effect::EMISSION_BUFFER));
+ TextureBuilder::Registrar installSpecularBuffer("spec-emis-buffer", new GBufferBuilder(Effect::SPEC_EMIS_BUFFER));
TextureBuilder::Registrar installLightingBuffer("lighting-buffer", new GBufferBuilder(Effect::LIGHTING_BUFFER));
TextureBuilder::Registrar installMiddleBloomBuffer("middle-bloom-buffer", new GBufferBuilder(Effect::MIDDLE_BLOOM_BUFFER));
TextureBuilder::Registrar installBloomBuffer("bloom-buffer", new GBufferBuilder(Effect::BLOOM_BUFFER));
TextureBuilder::Registrar installAoBuffer("ao-buffer", new GBufferBuilder(Effect::AO_BUFFER));
+ TextureBuilder::Registrar installShadowBuffer("shadow-buffer", new GBufferBuilder(Effect::SHADOW_BUFFER));
}
}