]> git.mxchange.org Git - flightgear.git/blobdiff - Astro/sky.cxx
Renamed FlightGear/Simulator/Flight to FlightGear/Simulator/FDM since
[flightgear.git] / Astro / sky.cxx
index 83001c8586a7836c9935cc780146940ab8a3fe65..0e9c32e408c1dbfdb6c3a9fb14ddff0ec5491636 100644 (file)
@@ -36,8 +36,8 @@
 #include <XGL/xgl.h>
 
 #include <Aircraft/aircraft.hxx>
-#include <Debug/fg_debug.h>
-#include <Flight/flight.hxx>
+#include <Debug/logstream.hxx>
+#include <FDM/flight.hxx>
 #include <Include/fg_constants.h>
 #include <Main/views.hxx>
 #include <Math/fg_random.h>
@@ -78,7 +78,7 @@ void fgSkyVerticesInit( void ) {
     float theta;
     int i;
 
-    fgPrintf(FG_ASTRO, FG_INFO, "  Generating the sky dome vertices.\n");
+    FG_LOG(FG_ASTRO, FG_INFO, "  Generating the sky dome vertices.");
 
     for ( i = 0; i < 12; i++ ) {
        theta = (i * 30.0) * DEG_TO_RAD;
@@ -115,8 +115,8 @@ void fgSkyColorsInit( void ) {
 
     l = &cur_light_params;
 
-    fgPrintf( FG_ASTRO, FG_INFO, 
-             "  Generating the sky colors for each vertex.\n" );
+    FG_LOG( FG_ASTRO, FG_INFO, 
+           "  Generating the sky colors for each vertex." );
 
     // setup for the possibility of sunset effects
     sun_angle = l->sun_angle * RAD_TO_DEG;
@@ -243,7 +243,7 @@ void fgSkyColorsInit( void ) {
 
 // Initialize the sky structure and colors
 void fgSkyInit( void ) {
-    fgPrintf(FG_ASTRO, FG_INFO, "Initializing the sky\n");
+    FG_LOG( FG_ASTRO, FG_INFO, "Initializing the sky" );
 
     fgSkyVerticesInit();
 
@@ -255,18 +255,16 @@ void fgSkyInit( void ) {
 
 // Draw the Sky
 void fgSkyRender( void ) {
-    fgFLIGHT *f;
+    FGState *f;
     fgLIGHT *l;
-    fgVIEW *v;
     float inner_color[4];
     float middle_color[4];
     float outer_color[4];
     double diff;
     int i;
 
-    f = current_aircraft.flight;
+    f = current_aircraft.fdm_state;
     l = &cur_light_params;
-    v = &current_view;
 
     // printf("Rendering the sky.\n");
 
@@ -286,29 +284,28 @@ void fgSkyRender( void ) {
     xglPushMatrix();
 
     // Translate to view position
-    xglTranslatef( v->cur_zero_elev.x(), 
-                  v->cur_zero_elev.y(),
-                  v->cur_zero_elev.z() );
+    Point3D zero_elev = current_view.get_cur_zero_elev();
+    xglTranslatef( zero_elev.x(), zero_elev.y(), zero_elev.z() );
     // printf("  Translated to %.2f %.2f %.2f\n", 
-    //        v->cur_zero_elev.x, v->cur_zero_elev.y, v->cur_zero_elev.z );
+    //        zero_elev.x, zero_elev.y, zero_elev.z );
 
     // Rotate to proper orientation
     // printf("  lon = %.2f  lat = %.2f\n", FG_Longitude * RAD_TO_DEG,
     //        FG_Latitude * RAD_TO_DEG);
-    xglRotatef( FG_Longitude * RAD_TO_DEG, 0.0, 0.0, 1.0 );
-    xglRotatef( 90.0 - FG_Latitude * RAD_TO_DEG, 0.0, 1.0, 0.0 );
+    xglRotatef( f->get_Longitude() * RAD_TO_DEG, 0.0, 0.0, 1.0 );
+    xglRotatef( 90.0 - f->get_Latitude() * RAD_TO_DEG, 0.0, 1.0, 0.0 );
     xglRotatef( l->sun_rotation * RAD_TO_DEG, 0.0, 0.0, 1.0 );
 
     // Draw inner/center section of sky*/
     xglBegin( GL_TRIANGLE_FAN );
     xglColor4fv(l->sky_color);
     xglVertex3f(0.0, 0.0, CENTER_ELEV);
-    for ( i = 0; i < 12; i++ ) {
+    for ( i = 11; i >= 0; i++ ) {
        xglColor4fv( inner_color );
        xglVertex3fv( inner_vertex[i] );
     }
     xglColor4fv( inner_color );
-    xglVertex3fv( inner_vertex[0] );
+    xglVertex3fv( inner_vertex[11] );
     xglEnd();
 
     // Draw the middle ring
@@ -365,6 +362,29 @@ void fgSkyRender( void ) {
 
 
 // $Log$
+// Revision 1.19  1999/02/01 21:33:26  curt
+// Renamed FlightGear/Simulator/Flight to FlightGear/Simulator/FDM since
+// Jon accepted my offer to do this and thought it was a good idea.
+//
+// Revision 1.18  1999/02/01 21:09:00  curt
+// Bug fix in vertex order of inner disk (fan) of the sky dome.
+//
+// Revision 1.17  1998/12/09 18:50:12  curt
+// Converted "class fgVIEW" to "class FGView" and updated to make data
+// members private and make required accessor functions.
+//
+// Revision 1.16  1998/12/05 15:54:03  curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
+// Revision 1.15  1998/12/03 01:15:36  curt
+// Converted fgFLIGHT to a class.
+// Tweaks for Sun portability.
+//
+// Revision 1.14  1998/11/06 21:17:39  curt
+// Converted to new logstream debugging facility.  This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
 // Revision 1.13  1998/10/20 18:28:30  curt
 // Tweaked sunset/sunrise colors.
 //