- Timestamp:
- Oct 18, 2010, 8:43:42 AM (14 years ago)
- Location:
- osgVisual/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/src/core/visual_core.cpp
r135 r136 416 416 //addWindVolume( 0.0, 15000.0, 300.0, 90.0 ); 417 417 418 sky->addCloudLayer( 0, 20000, 20000, 600.0, 1000.0, 0.5, CUMULONIMBUS_CAPPILATUS );418 //sky->addCloudLayer( 0, 20000, 20000, 600.0, 1000.0, 0.5, CUMULONIMBUS_CAPPILATUS ); 419 419 //sky->addCloudLayer( 1, 5000000, 5000000, 600.0, 7351.0, 0.2, CIRRUS_FIBRATUS ); 420 420 //sky->addCloudLayer( 2, 50000, 50000, 600.0, 7351.0, 0.2, CIRROCUMULUS ); 421 //sky->addCloudLayer( 3, 100000, 100000, 1300.0, 100.0, 0.07, CUMULUS_CONGESTUS );422 sky->addCloudLayer( 1, 50000, 50000, 3500.0, 2000.0, 0.90, STRATOCUMULUS );421 sky->addCloudLayer( 3, 50000, 50000, 1300.0, 700.0, 0.07, CUMULUS_CONGESTUS ); 422 //sky->addCloudLayer( 1, 50000, 50000, 3500.0, 2000.0, 0.90, STRATOCUMULUS ); 423 423 424 424 //cloudLayerSlots[1].cloudLayerPointer->SetPrecipitation(SilverLining::CloudLayer::SLEET, 25.0 ); -
osgVisual/src/sky_Silverlining/visual_skySilverLining.cpp
r134 r136 251 251 void visual_skySilverLining::updateUpVector() 252 252 { 253 // Allowed deltaLat and deltaLon between Updating the upvector 254 double deltaLatToUpdate = osg::DegreesToRadians( 0.1 ); // 0.5 deg 255 double deltaLonToUpdate = osg::DegreesToRadians( 0.1 ); // 0.5 deg 256 257 if ( fabs(lat-upVectorLat) > deltaLatToUpdate || fabs(lon-upVectorLon) > deltaLonToUpdate ) 258 { 259 // Get ellipsoid model 260 osg::EllipsoidModel* ellipsoid = sceneRoot->getEllipsoidModel(); 261 if ( !ellipsoid ) 262 return; 263 264 //OSG_NOTIFY( osg::ALWAYS ) << "update Upvector.." << std::endl; 265 266 // Calculate up vector 267 double x,y,z; 268 util::getXYZofCamera(sceneCamera, x, y, z); 269 osg::Vec3d upVector = ellipsoid->computeLocalUpVector( x, y, z ); 270 upVector.normalize(); 271 272 // Calculate side vector 273 osg::Matrixd localToWorld; 274 ellipsoid->computeLocalToWorldTransformFromLatLongHeight(lat, lon, height, localToWorld); 275 276 osg::Vec3d sideVector(localToWorld(0, 0), localToWorld(0, 1), localToWorld(0, 2)); 277 sideVector.normalize(); 278 279 // Update silverlining vectors 280 //std::cout << "upVector: X: " << upVector.x() << ", Y: "<< upVector.y() << ", Z: "<< upVector.z() << std::endl; 281 //std::cout << "sideVector: X: " << sideVector.x() << ", Y: "<< sideVector.y() << ", Z: "<< sideVector.z() << std::endl; 282 atmosphere->SetUpVector( upVector.x(), upVector.y(), upVector.z() ); 283 atmosphere->SetRightVector( sideVector.x(), sideVector.y(), sideVector.z() ); 284 285 // Note new upvector lat/lon 286 upVectorLon = lon; 287 upVectorLat = lat; 288 } // If update requiered END 253 //// Allowed deltaLat and deltaLon between Updating the upvector 254 //double deltaLatToUpdate = osg::DegreesToRadians( 0.1 ); // 0.5 deg 255 //double deltaLonToUpdate = osg::DegreesToRadians( 0.1 ); // 0.5 deg 256 257 //if ( fabs(lat-upVectorLat) > deltaLatToUpdate || fabs(lon-upVectorLon) > deltaLonToUpdate ) 258 //{ 259 // // Get ellipsoid model 260 // osg::EllipsoidModel* ellipsoid = sceneRoot->getEllipsoidModel(); 261 // if ( !ellipsoid ) 262 // return; 263 264 // //OSG_NOTIFY( osg::ALWAYS ) << "update Upvector.." << std::endl; 265 266 // // Calculate up vector 267 // double x,y,z; 268 // util::getXYZofCamera(sceneCamera, x, y, z); 269 // osg::Vec3d upVector = ellipsoid->computeLocalUpVector( x, y, z ); 270 // upVector.normalize(); 271 // 272 // // Calculate side vector 273 // osg::Matrixd localToWorld; 274 // ellipsoid->computeLocalToWorldTransformFromLatLongHeight(lat, lon, height, localToWorld); 275 276 // osg::Vec3d sideVector(localToWorld(0, 0), localToWorld(0, 1), localToWorld(0, 2)); 277 // sideVector.normalize(); 278 279 // // Update silverlining vectors 280 // //std::cout << "upVector: X: " << upVector.x() << ", Y: "<< upVector.y() << ", Z: "<< upVector.z() << std::endl; 281 // //std::cout << "sideVector: X: " << sideVector.x() << ", Y: "<< sideVector.y() << ", Z: "<< sideVector.z() << std::endl; 282 // atmosphere->SetUpVector( upVector.x(), upVector.y(), upVector.z() ); 283 // atmosphere->SetRightVector( sideVector.x(), sideVector.y(), sideVector.z() ); 284 285 // // Note new upvector lat/lon 286 // upVectorLon = lon; 287 // upVectorLat = lat; 288 //} // If update requiered END 289 290 double x,y,z; 291 util::getXYZofCamera(sceneCamera, x, y, z); 292 293 osg::Vec3d up(x, y, z); 294 295 up.normalize(); 296 osg::Vec3d north(0, 0, 1); // Z is north 297 osg::Vec3d east = north ^ up; // Cross product 298 east.normalize(); 299 300 atmosphere->SetUpVector(up.x(), up.y(), up.z()); 301 atmosphere->SetRightVector(east.x(), east.y(), east.z()); 302 303 osg::Matrixd view = sceneCamera->getViewMatrix(); 304 osg::Matrixd proj = sceneCamera->getProjectionMatrix(); 305 306 double dView[16], dProj[16]; 307 308 int i = 0; 309 for (int row = 0; row < 4; row++) 310 { 311 for (int col = 0; col < 4; col++) 312 { 313 dView[i] = view(row, col); 314 dProj[i] = proj(row, col); 315 i++; 316 } 317 } 318 atmosphere->SetCameraMatrix(dView); 319 atmosphere->SetProjectionMatrix(dProj); 289 320 } 290 321
Note: See TracChangeset
for help on using the changeset viewer.