Added GL_NORMALIZE usage to handle the case of the FlattenStaticTransform visitor not being applied to the scaled subgraphs causing lighting problems
This commit is contained in:
parent
02cb58d3d9
commit
2550c95c32
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include <osgDB/Registry>
|
#include <osgDB/Registry>
|
||||||
#include <osgDB/ReadFile>
|
#include <osgDB/ReadFile>
|
||||||
|
#include <osgDB/WriteFile>
|
||||||
|
|
||||||
#include <osgGA/TrackballManipulator>
|
#include <osgGA/TrackballManipulator>
|
||||||
#include <osgGA/FlightManipulator>
|
#include <osgGA/FlightManipulator>
|
||||||
@ -146,7 +147,7 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius)
|
|||||||
float size = radius/bs.radius()*0.3f;
|
float size = radius/bs.radius()*0.3f;
|
||||||
osg::MatrixTransform* positioned = new osg::MatrixTransform;
|
osg::MatrixTransform* positioned = new osg::MatrixTransform;
|
||||||
positioned->setDataVariance(osg::Object::STATIC);
|
positioned->setDataVariance(osg::Object::STATIC);
|
||||||
positioned->setMatrix(osg::Matrix::translate(-bs.center())*
|
positioned ->setMatrix(osg::Matrix::translate(-bs.center())*
|
||||||
osg::Matrix::scale(size,size,size)*
|
osg::Matrix::scale(size,size,size)*
|
||||||
osg::Matrix::rotate(osg::inDegrees(-90.0f),0.0f,0.0f,1.0f));
|
osg::Matrix::rotate(osg::inDegrees(-90.0f),0.0f,0.0f,1.0f));
|
||||||
|
|
||||||
@ -180,6 +181,10 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius)
|
|||||||
model->addChild(xform);
|
model->addChild(xform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef OSG_GLES2_AVAILABLE
|
||||||
|
model->getOrCreateStateSet()->setMode(GL_NORMALIZE, osg::StateAttribute::ON);
|
||||||
|
#endif
|
||||||
|
|
||||||
return model.release();
|
return model.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,6 +252,13 @@ int main( int argc, char **argv )
|
|||||||
osgUtil::Optimizer optimzer;
|
osgUtil::Optimizer optimzer;
|
||||||
optimzer.optimize(rootnode);
|
optimzer.optimize(rootnode);
|
||||||
|
|
||||||
|
std::string filename;
|
||||||
|
if (arguments.read("-o",filename))
|
||||||
|
{
|
||||||
|
osgDB::writeNodeFile(*rootnode, filename);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// set the scene to render
|
// set the scene to render
|
||||||
viewer.setSceneData(rootnode);
|
viewer.setSceneData(rootnode);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user