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