#include <simgear/math/polar3d.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/misc/sg_path.hxx>
+#include <simgear/sky/SkySceneLoader.hpp>
+#include <simgear/sky/SkyUtil.hpp>
#include <simgear/timing/sg_time.hxx>
#include <simgear/timing/lowleveltime.h>
extern const char *default_root;
+SkySceneLoader *sgCloud3d;
// Read in configuration (file and command line) and just set fg_root
bool fgInitFGRoot ( int argc, char **argv ) {
globals->get_environment_mgr()->bind();
#endif
+ ////////////////////////////////////////////////////////////////////
+ // Initialize the 3D cloud subsystem.
+ ////////////////////////////////////////////////////////////////////
+
+ if ( fgGetBool("/sim/rendering/clouds3d") ) {
+ SGPath cloud_path(globals->get_fg_root());
+ cloud_path.append("large.sky");
+ if ( !sgCloud3d->Load( cloud_path.str() ) ) {
+ fgSetBool("/sim/rendering/clouds3d", false);
+ }
+ }
+
+
////////////////////////////////////////////////////////////////////
// Initialize vor/ndb/ils/fix list management and query systems
////////////////////////////////////////////////////////////////////
#include <simgear/math/polar3d.hxx>
#include <simgear/math/sg_random.h>
#include <simgear/misc/sg_path.hxx>
+#include <simgear/sky/SkySceneLoader.hpp>
+#include <simgear/sky/SkyUtil.hpp>
#include <simgear/sky/sky.hxx>
#include <simgear/timing/sg_time.hxx>
// Sky structures
SGSky *thesky;
+SkySceneLoader *sgClouds3d;
+bool _bcloud_orig = true;
+Point3D posit;
+Point3D *_posit = &posit;
// hack
sgMat4 copy_of_ssgOpenGLAxisSwapMatrix =
// a completely dark scene. So, we set GL_LIGHT_MODEL_AMBIENT
// explicitely to black.
glLightModelfv( GL_LIGHT_MODEL_AMBIENT, black );
- // glLightModeli( GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE );
+ glLightModeli( GL_LIGHT_MODEL_LOCAL_VIEWER, GL_FALSE );
ssgGetLight( 0 ) -> setColour( GL_AMBIENT, l->scene_ambient );
// calculate our current position in cartesian space
globals->get_scenery()->set_center( globals->get_scenery()->get_next_center() );
+ if ( fgGetBool("/sim/rendering/clouds3d") ) {
+ posit = globals->get_scenery()->get_center();
+ if ( _bcloud_orig ) {
+ sgClouds3d->Set_Cloud_Orig( _posit );
+ _bcloud_orig = false;
+ }
+ /* sgClouds3d->Update( (sgVec4 *)current__view->get_cloud_VIEW(),
+ _posit );
+ */
+ }
+
// update view port
fgReshape( fgGetInt("/sim/startup/xsize"),
fgGetInt("/sim/startup/ysize") );
if ( fgGetBool("/sim/rendering/skyblend") ) {
// draw the sky cloud layers
- if (fgGetBool("/environment/clouds/status"))
- thesky->postDraw( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER );
+ if (fgGetBool("/environment/clouds/status")) {
+ thesky->postDraw( cur_fdm_state->get_Altitude()
+ * SG_FEET_TO_METER );
+ }
}
globals->get_model_mgr()->draw();
globals->get_aircraft_model()->draw();
+ // draw the 3D clouds
+ if ( fgGetBool("/sim/rendering/clouds3d") ) sgClouds3d->Draw();
+
// display HUD && Panel
glDisable( GL_FOG );
glDisable( GL_DEPTH_TEST );
viewmgr->get_current_view()->get_v_fov() );
fgHUDReshape();
+ sgClouds3d->Resize( viewmgr->get_current_view()->get_h_fov(),
+ viewmgr->get_current_view()->get_v_fov() );
}
// Initialize GLUT and define a main window
#endif
// Define Display Parameters
- glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
+ glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE | GLUT_ALPHA);
SG_LOG( SG_GENERAL, SG_INFO, "Opening a window: " <<
fgGetInt("/sim/startup/xsize") << "x"