Added naming of root of presentation and used this in the setup of the position of the camera.
This commit is contained in:
parent
ccdca3d9bf
commit
8df5440a26
@ -6,6 +6,13 @@ void CameraProperty::setToModel(const osg::Node* node)
|
|||||||
{
|
{
|
||||||
osg::BoundingSphere bs = node->getBound();
|
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 screenWidth = osg::DisplaySettings::instance()->getScreenWidth();
|
||||||
double screenHeight = osg::DisplaySettings::instance()->getScreenHeight();
|
double screenHeight = osg::DisplaySettings::instance()->getScreenHeight();
|
||||||
double screenDistance = osg::DisplaySettings::instance()->getScreenDistance();
|
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 hfov = atan2(screenWidth/2.0,screenDistance)*2.0;
|
||||||
double viewAngle = vfov<hfov ? vfov : hfov;
|
double viewAngle = vfov<hfov ? vfov : hfov;
|
||||||
|
|
||||||
double dist = bs.radius() / sin(viewAngle*0.5);
|
dist = bs.radius() / sin(viewAngle*0.5);
|
||||||
|
}
|
||||||
// dist = osg::DisplaySettings::instance()->getScreenDistance();
|
#endif
|
||||||
|
|
||||||
_center = bs.center();
|
_center = bs.center();
|
||||||
_eye = _center - osg::Vec3d(0.0, dist, 0.0);
|
_eye = _center - osg::Vec3d(0.0, dist, 0.0);
|
||||||
|
@ -248,6 +248,7 @@ void SlideShowConstructor::createPresentation()
|
|||||||
_presentationSwitch->setName(std::string("Presentation_")+_presentationName);
|
_presentationSwitch->setName(std::string("Presentation_")+_presentationName);
|
||||||
|
|
||||||
_root->addChild(_presentationSwitch.get());
|
_root->addChild(_presentationSwitch.get());
|
||||||
|
_root->setName(std::string("Presentation_")+_presentationName);
|
||||||
|
|
||||||
osg::Vec3 slideCenter = _slideOrigin + osg::Vec3(_slideWidth*0.5f,0.0f,_slideHeight*0.5f);
|
osg::Vec3 slideCenter = _slideOrigin + osg::Vec3(_slideWidth*0.5f,0.0f,_slideHeight*0.5f);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user