Added naming of root of presentation and used this in the setup of the position of the camera.

This commit is contained in:
Robert Osfield 2012-12-07 13:59:57 +00:00
parent ccdca3d9bf
commit 8df5440a26
2 changed files with 16 additions and 8 deletions

View File

@ -6,6 +6,13 @@ void CameraProperty::setToModel(const osg::Node* node)
{
osg::BoundingSphere bs = node->getBound();
double dist = osg::DisplaySettings::instance()->getScreenDistance();
OSG_NOTICE<<"Node name "<<node->getName()<<std::endl;
#if 1
if (node->getName().find("Presentation")==std::string::npos)
{
double screenWidth = osg::DisplaySettings::instance()->getScreenWidth();
double screenHeight = osg::DisplaySettings::instance()->getScreenHeight();
double screenDistance = osg::DisplaySettings::instance()->getScreenDistance();
@ -14,9 +21,9 @@ void CameraProperty::setToModel(const osg::Node* node)
double hfov = atan2(screenWidth/2.0,screenDistance)*2.0;
double viewAngle = vfov<hfov ? vfov : hfov;
double dist = bs.radius() / sin(viewAngle*0.5);
// dist = osg::DisplaySettings::instance()->getScreenDistance();
dist = bs.radius() / sin(viewAngle*0.5);
}
#endif
_center = bs.center();
_eye = _center - osg::Vec3d(0.0, dist, 0.0);

View File

@ -248,6 +248,7 @@ void SlideShowConstructor::createPresentation()
_presentationSwitch->setName(std::string("Presentation_")+_presentationName);
_root->addChild(_presentationSwitch.get());
_root->setName(std::string("Presentation_")+_presentationName);
osg::Vec3 slideCenter = _slideOrigin + osg::Vec3(_slideWidth*0.5f,0.0f,_slideHeight*0.5f);