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,17 +6,24 @@ void CameraProperty::setToModel(const osg::Node* node)
|
|||||||
{
|
{
|
||||||
osg::BoundingSphere bs = node->getBound();
|
osg::BoundingSphere bs = node->getBound();
|
||||||
|
|
||||||
double screenWidth = osg::DisplaySettings::instance()->getScreenWidth();
|
double dist = osg::DisplaySettings::instance()->getScreenDistance();
|
||||||
double screenHeight = osg::DisplaySettings::instance()->getScreenHeight();
|
|
||||||
double screenDistance = osg::DisplaySettings::instance()->getScreenDistance();
|
OSG_NOTICE<<"Node name "<<node->getName()<<std::endl;
|
||||||
|
|
||||||
double vfov = atan2(screenHeight/2.0,screenDistance)*2.0;
|
#if 1
|
||||||
double hfov = atan2(screenWidth/2.0,screenDistance)*2.0;
|
if (node->getName().find("Presentation")==std::string::npos)
|
||||||
double viewAngle = vfov<hfov ? vfov : hfov;
|
{
|
||||||
|
double screenWidth = osg::DisplaySettings::instance()->getScreenWidth();
|
||||||
|
double screenHeight = osg::DisplaySettings::instance()->getScreenHeight();
|
||||||
|
double screenDistance = osg::DisplaySettings::instance()->getScreenDistance();
|
||||||
|
|
||||||
double dist = bs.radius() / sin(viewAngle*0.5);
|
double vfov = atan2(screenHeight/2.0,screenDistance)*2.0;
|
||||||
|
double hfov = atan2(screenWidth/2.0,screenDistance)*2.0;
|
||||||
|
double viewAngle = vfov<hfov ? vfov : hfov;
|
||||||
|
|
||||||
// dist = osg::DisplaySettings::instance()->getScreenDistance();
|
dist = bs.radius() / sin(viewAngle*0.5);
|
||||||
|
}
|
||||||
|
#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