obj plugin: Fix not writing material shininess
This commit is contained in:
parent
2f71260c5a
commit
cae16c5fd7
@ -424,6 +424,7 @@ OBJWriterNodeVisitor::OBJMaterial::OBJMaterial(osg::Material* mat, osg::Texture*
|
||||
diffuse(1,1,1,1),
|
||||
ambient(0.2,0.2,0.2,1),
|
||||
specular(0,0,0,1),
|
||||
shininess(-1),
|
||||
image("")
|
||||
{
|
||||
static unsigned int s_objmaterial_id = 0;
|
||||
@ -436,6 +437,7 @@ OBJWriterNodeVisitor::OBJMaterial::OBJMaterial(osg::Material* mat, osg::Texture*
|
||||
diffuse = mat->getDiffuse(osg::Material::FRONT);
|
||||
ambient = mat->getAmbient(osg::Material::FRONT);
|
||||
specular = mat->getSpecular(osg::Material::FRONT);
|
||||
shininess = mat->getShininess(osg::Material::FRONT)*1000.0f/128.0f;
|
||||
}
|
||||
|
||||
if (tex) {
|
||||
@ -456,6 +458,8 @@ std::ostream& operator<<(std::ostream& fout, const OBJWriterNodeVisitor::OBJMate
|
||||
fout << " " << "Ka " << mat.ambient << std::endl;
|
||||
fout << " " << "Kd " << mat.diffuse << std::endl;
|
||||
fout << " " << "Ks " << mat.specular << std::endl;
|
||||
if (mat.shininess != -1)
|
||||
fout << " " << "Ns " << mat.shininess<< std::endl;
|
||||
|
||||
if(!mat.image.empty())
|
||||
fout << " " << "map_Kd " << mat.image << std::endl;
|
||||
|
@ -118,6 +118,7 @@ class OBJWriterNodeVisitor: public osg::NodeVisitor {
|
||||
OBJMaterial(osg::Material* mat, osg::Texture* tex, bool outputTextureFiles = false, const osgDB::Options* options = NULL);
|
||||
|
||||
osg::Vec4 diffuse, ambient, specular;
|
||||
float shininess;
|
||||
std::string image;
|
||||
std::string name;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user