| 167 | | if(ss.first) |
| 168 | | pGeometry->getOrCreateStateSet()->setAttributeAndModes(ss.first); |
| 169 | | if(ss.second) |
| 170 | | pGeometry->getOrCreateStateSet()->setTextureAttributeAndModes(0, ss.second); |
| | 169 | if (osg::Material* pMaterial = ss.first) |
| | 170 | { |
| | 171 | pGeometry->getOrCreateStateSet()->setAttributeAndModes(pMaterial); |
| | 172 | transparent = pMaterial->getDiffuse(osg::Material::FRONT).w() < 1.0f; |
| | 173 | } |
| | 174 | if (osg::Texture2D* pTexture = ss.second) |
| | 175 | { |
| | 176 | pGeometry->getOrCreateStateSet()->setTextureAttributeAndModes(0, pTexture); |
| | 177 | if (!transparent && pTexture->getImage()) |
| | 178 | { |
| | 179 | transparent = pTexture->getImage()->isImageTranslucent(); |
| | 180 | } |
| | 181 | } |
| | 182 | |
| | 183 | if (transparent) |
| | 184 | { |
| | 185 | pGeometry->getOrCreateStateSet()->setAttributeAndModes(new osg::BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); |
| | 186 | } |