From cc87fb93ba4ab76caea59a081c0527471ca1c02a Mon Sep 17 00:00:00 2001 From: curt Date: Mon, 16 Sep 2002 14:56:16 +0000 Subject: [PATCH] Updates for 3d cloud rendering. --- src/Main/main.cxx | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/Main/main.cxx b/src/Main/main.cxx index bdfbffc2a..fc833ceec 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -454,15 +454,16 @@ void fgRenderFrame() { // calculate our current position in cartesian space globals->get_scenery()->set_center( globals->get_scenery()->get_next_center() ); + // do it here. at init time the clouds are loaded BEFORE our position is known if ( fgGetBool("/sim/rendering/clouds3d") ) { - posit = globals->get_scenery()->get_center(); if ( _bcloud_orig ) { + // cloud center can be anywhere in fgfs coordinates, but the tile + // cener is a good place as we'll have some visible when starting + posit = globals->get_scenery()->get_center(); sgClouds3d->Set_Cloud_Orig( _posit ); _bcloud_orig = false; } - /* sgClouds3d->Update( (sgVec4 *)current__view->get_cloud_VIEW(), - _posit ); - */ + sgClouds3d->Update( current__view->get_absolute_view_pos() ); } // update view port @@ -764,8 +765,14 @@ void fgRenderFrame() { globals->get_model_mgr()->draw(); globals->get_aircraft_model()->draw(); - // draw the 3D clouds - if ( fgGetBool("/sim/rendering/clouds3d") ) sgClouds3d->Draw(); + // draw the 3D clouds + if ( fgGetBool("/sim/rendering/clouds3d") ) { + //glPushAttrib(GL_ALL_ATTRIB_BITS); + // transform the current view matrix with camera offset position + sgClouds3d->Draw( (sgVec4 *)current__view->get_VIEW() ); + //sgClouds3d->Draw(); + //glPopAttrib(); + } // display HUD && Panel glDisable( GL_FOG ); @@ -1331,8 +1338,12 @@ int fgGlutInit( int *argc, char **argv ) { glutInit(argc, argv); #endif - // Define Display Parameters - glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE | GLUT_ALPHA); + // Define Display Parameters. Clouds3d works best with --bpp32 option + if ( fgGetBool("/sim/rendering/clouds3d") ) { + glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE | GLUT_ALPHA ); + } else { + glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE ); + } SG_LOG( SG_GENERAL, SG_INFO, "Opening a window: " << fgGetInt("/sim/startup/xsize") << "x" -- 2.39.5