From 76d98c7c42bc61506804ae1a7b2df4635ebcb591 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 22 Feb 2007 16:42:59 +0000 Subject: [PATCH] Implement basic full dome correction with projecto pointing upwards and at center of dome. --- examples/osgdistortion/osgdistortion.cpp | 68 +++++++++++++++--------- 1 file changed, 44 insertions(+), 24 deletions(-) diff --git a/examples/osgdistortion/osgdistortion.cpp b/examples/osgdistortion/osgdistortion.cpp index 5d4f68149..e260b5431 100644 --- a/examples/osgdistortion/osgdistortion.cpp +++ b/examples/osgdistortion/osgdistortion.cpp @@ -283,8 +283,20 @@ void setDomeFaces(osgViewer::Viewer& viewer, osg::ArgumentParser& /*arguments*/) viewer.assignSceneDataToCameras(); } -osg::Geometry* createDomeDistortionMesh(const osg::Vec3& origin, const osg::Vec3& widthVector, const osg::Vec3& heightVector, osg::ArgumentParser& arguments) +osg::Geometry* createDomeDistortionMesh(const osg::Vec3& origin, const osg::Vec3& widthVector, const osg::Vec3& heightVector, + osg::ArgumentParser& arguments) { + double sphere_radius = 1.0; + double collar_radius = 0.45; + osg::Vec3d center(0.0,0.0,0.0); + osg::Vec3d eye(0.0,0.0,0.0); + + double distance = sqrt(sphere_radius*sphere_radius - collar_radius*collar_radius); + osg::Vec3d projector = eye - osg::Vec3d(0.0,0.0, distance); + + osg::notify(osg::NOTICE)<<"Projector position = "< osg::PI_2) phi = osg::PI_2; + + phi *= 2.0; + + // osg::notify(osg::NOTICE)<<"theta = "<