Added support for spherical texture mapping and better file search support

for meterial files.
This commit is contained in:
Robert Osfield
2004-08-31 14:48:05 +00:00
parent 1da72da167
commit de686f409b
2 changed files with 25 additions and 3 deletions

View File

@@ -108,6 +108,13 @@ void ReaderWriterOBJ::buildMaterialToStateSetMap(obj::Model& model, MaterialToSt
{
osg::Texture2D* texture = new osg::Texture2D(image);
stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON);
if (material.textureReflection)
{
osg::TexGen* texgen = new osg::TexGen;
texgen->setMode(osg::TexGen::SPHERE_MAP);
stateset->setTextureAttributeAndModes(0,texgen,osg::StateAttribute::ON);
}
}
}
@@ -439,6 +446,9 @@ osgDB::ReaderWriter::ReadResult ReaderWriterOBJ::readNode(const std::string& fil
std::ifstream fin(fileName.c_str());
if (fin)
{
osgDB::PushAndPopDataPath papdp( osgDB::getFilePath(fileName.c_str()) );
obj::Model model;
model.readOBJ(fin);