Hi,
How can I scale the scene so that cameras scale along too?
If I scale the scene using code similar to following, the models are scaled,
but what happens is that the scene seems to "run away" as the camera stays
still while all models get smaller. :
--
shadowedScene = new osgShadow::ShadowedScene;
_rotateNode = new osg::MatrixTransform;
shadowedScene->addChild(_rotateNode.get());
float val = 0.5f;
osg::ref_ptr<osg::MatrixTransform> tptr = _rotateNode;
if(tptr.valid())
{
osg::Matrix mat =
osg::Matrix::scale(val, val, val);
osg::Matrix oldmat =
osg::Matrix::translate(_rotateNode->getBound().center());
tptr->setMatrix( mat *
oldmat );
// Create a scene stateset
osg::ref_ptr<osg::StateSet>
sceneState = _parentNode->getOrCreateStateSet();
// Set the SceneRoot to
normalise normals when scaling is applied to objects.
sceneState->setMode(GL_NORMALIZE, osg::StateAttribute::ON);
}
--
Thanks for any help,
Seppo
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org