Changeset 3511 for OpenSceneGraph/trunk/examples/osgcluster/osgcluster.cpp
- Timestamp:
- 10/19/04 15:52:46 (9 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgcluster/osgcluster.cpp
r3230 r3511 127 127 while (arguments.read("-n",socketNumber)) ; 128 128 129 float camera_fov= 45.0f;129 float camera_fov=-1.0f; 130 130 while (arguments.read("-f",camera_fov)) 131 131 { 132 std::cout << "setting lens perspective : original "<<viewer.getLensHorizontalFov()<<" "<<viewer.getLensVerticalFov()<<std::endl;133 viewer.setLensPerspective(camera_fov,camera_fov*viewer.getLensVerticalFov()/viewer.getLensHorizontalFov(),1.0f,1000.0f);134 std::cout << "setting lens perspective : new "<<viewer.getLensHorizontalFov()<<" "<<viewer.getLensVerticalFov()<<std::endl;135 132 } 136 133 … … 172 169 // create the windows and run the threads. 173 170 viewer.realize(); 171 172 173 // set up the lens after realize as the Producer lens is not set up properly before this.... will need to inveestigate this at a later date. 174 if (camera_fov>0.0f) 175 { 176 float aspectRatio = tan( osg::DegreesToRadians(viewer.getLensVerticalFov()*0.5)) / tan(osg::DegreesToRadians(viewer.getLensHorizontalFov()*0.5)); 177 float new_fovy = osg::RadiansToDegrees(atan( aspectRatio * tan( osg::DegreesToRadians(camera_fov*0.5))))*2.0f; 178 std::cout << "setting lens perspective : original "<<viewer.getLensHorizontalFov()<<" "<<viewer.getLensVerticalFov()<<std::endl; 179 viewer.setLensPerspective(camera_fov,new_fovy,1.0f,1000.0f); 180 std::cout << "setting lens perspective : new "<<viewer.getLensHorizontalFov()<<" "<<viewer.getLensVerticalFov()<<std::endl; 181 } 182 174 183 175 184 // objects for managing the broadcasting and recieving of camera packets.
