From Jeremy Moles, Added check for image transluceny to image loaded code, placing

the image quad into the transparent bin for images with alpha values.
This commit is contained in:
Robert Osfield
2007-04-24 19:08:52 +00:00
parent 00a44eb636
commit 20f8fedfcc

View File

@@ -119,10 +119,23 @@ Node* osgDB::readNodeFiles(osg::ArgumentParser& arguments,const ReaderWriter::Op
NodeList nodeList;
std::string filename;
while (arguments.read("--image",filename))
{
osg::ref_ptr<osg::Image> image = readImageFile(filename.c_str(), options);
if (image.valid()) nodeList.push_back(osg::createGeodeForImage(image.get()));
if (image.valid())
{
osg::Geode* geode = osg::createGeodeForImage(image.get());
if (image->isImageTranslucent())
{
osg::notify()<<"Image "<<image->getFileName()<<" is translucent; setting up blending."<<std::endl;
geode->getOrCreateStateSet()->setMode(GL_BLEND, osg::StateAttribute::ON);
geode->getOrCreateStateSet()->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
}
nodeList.push_back(geode);
}
}
while (arguments.read("--movie",filename))