From e54d75149491c1c147a277e07e2e6e60e4b89de0 Mon Sep 17 00:00:00 2001 From: torcs-ng Date: Mon, 18 Mar 2013 12:58:58 +0000 Subject: [PATCH] update OsgDome git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5333 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 0daa26290bc8260a3e2451c4091b6e46c1ffb317 Former-commit-id: 0ce3e4595e96b74ba0eb6fa1fdfc1ea9746e1eb3 --- src/modules/graphic/osggraph/OsgDome.cpp | 5 +---- src/modules/graphic/osggraph/OsgStars.cpp | 16 +-------------- src/modules/graphic/osggraph/OsgSun.cpp | 24 ++++------------------- 3 files changed, 6 insertions(+), 39 deletions(-) diff --git a/src/modules/graphic/osggraph/OsgDome.cpp b/src/modules/graphic/osggraph/OsgDome.cpp index 997e052d9..df5f4db70 100644 --- a/src/modules/graphic/osggraph/OsgDome.cpp +++ b/src/modules/graphic/osggraph/OsgDome.cpp @@ -204,8 +204,7 @@ bool SDSkyDome::repaint( const Vec3f& sky_color, osg::Vec3f middle_param, middle_diff; // Check for sunrise/sunset condition - GfOut("Sun Angle in Dome = %f\n", sun_angle); - + sun_angle = osg::RadiansToDegrees(sun_angle); if (sun_angle > 80) { // 0.0 - 0.4 @@ -223,8 +222,6 @@ bool SDSkyDome::repaint( const Vec3f& sky_color, outer_diff = osg::Vec3f(0, 0, 0); middle_diff = osg::Vec3f(0, 0, 0); } - /*GfOut(" outer_red_param = %.2f outer_red_diff = %.2f\n", - outer_red_param, outer_red_diff);*/ osg::Vec3f outer_amt = outer_param; osg::Vec3f middle_amt = middle_param; diff --git a/src/modules/graphic/osggraph/OsgStars.cpp b/src/modules/graphic/osggraph/OsgStars.cpp index 83d4422c2..b2a78b514 100644 --- a/src/modules/graphic/osggraph/OsgStars.cpp +++ b/src/modules/graphic/osggraph/OsgStars.cpp @@ -106,60 +106,48 @@ bool SDStars::repaint( double sun_angle, int num, const osg::Vec3d star_data[] ) double mag, nmag, alpha, factor, cutoff; int phase; - GfOut("Sun Angle in Stars = %f\n", sun_angle); - if ( sun_angle > (SD_PI_2 + 10.0 * SD_DEGREES_TO_RADIANS ) ) { factor = 1.0; cutoff = 4.5; phase = 0; - //GfOut("Stars = %f\n", 10.0f); } else if ( sun_angle > (SD_PI_2 + 8.8 * SD_DEGREES_TO_RADIANS ) ) { factor = 1.0; cutoff = 3.8; phase = 1; - //GfOut("Stars = %f\n", 8.0f); } else if ( sun_angle > (SD_PI_2 + 7.5 * SD_DEGREES_TO_RADIANS ) ) { factor = 0.95; cutoff = 3.1; phase = 2; - //GfOut("Stars = %f\n", 7.5f); } else if ( sun_angle > (SD_PI_2 + 7.0 * SD_DEGREES_TO_RADIANS ) ) { factor = 0.9; cutoff = 2.4; phase = 3; - //GfOut("Stars = %f\n", 7.0f); } else if ( sun_angle > (SD_PI_2 + 6.5 * SD_DEGREES_TO_RADIANS ) ) { factor = 0.85; cutoff = 1.8; phase = 4; - //GfOut("Stars = %f\n", 6.5f); } else if ( sun_angle > (SD_PI_2 + 6.0 * SD_DEGREES_TO_RADIANS ) ) { factor = 0.8; cutoff = 1.2; phase = 5; - //GfOut("Stars = %f\n", 6.0f); - } else if ( sun_angle > (SD_PI_2 + 5.5 * SD_DEGREES_TO_RADIANS ) ) + } else if ( sun_angle > (SD_PI_2 + 5.5 * SD_DEGREES_TO_RADIANS ) ) { factor = 0.75; cutoff = 0.6; phase = 6; - //GfOut("Stars = %f\n", 5.5f); } else { factor = 0.7; cutoff = 0.0; phase = 7; - //GfOut("Stars default\n"); } - GfOut("Phase = %d - old_phase = %d\n", phase, old_phase); - if ( phase != old_phase ) { old_phase = phase; @@ -171,12 +159,10 @@ bool SDStars::repaint( double sun_angle, int num, const osg::Vec3d star_data[] ) nmag = ( 4.5 - mag ) / 5.5; alpha = nmag * 0.85 + 0.15; alpha *= factor; - //GfOut("Alpha = %f\n", alpha); } else { alpha = 0.0; - //GfOut("Stars desactivée\n"); } if (alpha > 1.0) { alpha = 1.0; } diff --git a/src/modules/graphic/osggraph/OsgSun.cpp b/src/modules/graphic/osggraph/OsgSun.cpp index 65e249bf4..769ef0889 100644 --- a/src/modules/graphic/osggraph/OsgSun.cpp +++ b/src/modules/graphic/osggraph/OsgSun.cpp @@ -240,8 +240,8 @@ bool SDSun::repaint( double sun_angle, double new_visibility ) // Blue - 435.8 nm blue_scat_f = (aerosol_factor * path_distance * density_avg) / 3.607E+06; sun_color[2] = 1 - blue_scat_f /* red_scat_corr_f*/; - i_halo_color[1] = 1 - (1.1 * (blue_scat_f /* red_scat_corr_f*/)); - o_halo_color[1] = 1 - (1.4 * (blue_scat_f /* red_scat_corr_f*/)); + i_halo_color[2] = 1 - (1.1 * (blue_scat_f /* red_scat_corr_f*/)); + o_halo_color[2] = 1 - (1.4 * (blue_scat_f /* red_scat_corr_f*/)); //scene_color[2] = 1 - blue_scat_f; // Alpha @@ -295,8 +295,6 @@ bool SDSun::repaint( double sun_angle, double new_visibility ) else if ( i_halo_color[0] > 1) i_halo_color[0] = 1; if ( o_halo_color[0] < 0 ) o_halo_color[0] = 0; else if ( o_halo_color[0] > 1) o_halo_color[0] = 1; - /*if (scene_color[0] < 0) scene_color[0] = 0; - else if (scene_color[0] > 1) scene_color[0] = 1;*/ if ( sun_color[1] < 0 ) sun_color[1] = 0; else if ( sun_color[1] > 1) sun_color[1] = 1; @@ -304,8 +302,6 @@ bool SDSun::repaint( double sun_angle, double new_visibility ) else if ( i_halo_color[1] > 1) i_halo_color[1] = 1; if ( o_halo_color[1] < 0 ) o_halo_color[1] = 0; else if ( o_halo_color[0] > 1) o_halo_color[1] = 1; - /*if (scene_color[1] < 0) scene_color[1] = 0; - else if (scene_color[1] > 1) scene_color[1] = 1;*/ if ( sun_color[2] < 0 ) sun_color[2] = 0; else if ( sun_color[2] > 1) sun_color[2] = 1; @@ -315,20 +311,13 @@ bool SDSun::repaint( double sun_angle, double new_visibility ) else if ( o_halo_color[2] > 1) o_halo_color[2] = 1; if ( o_halo_color[3] < 0 ) o_halo_color[3] = 0; else if ( o_halo_color[3] > 1) o_halo_color[3] = 1; - /*if (scene_color[2] < 0) scene_color[2] = 0; - else if (scene_color[2] > 1) scene_color[2] = 1; - if (scene_color[3] < 0) scene_color[3] = 0; - else if (scene_color[3] > 1) scene_color[3] = 1;*/ sd_gamma_correct_rgb( i_halo_color._v ); sd_gamma_correct_rgb( o_halo_color._v ); - //sd_gamma_correct_rgb( scene_color._v ); sd_gamma_correct_rgb( sun_color._v ); (*sun_cl)[0] = sun_color; sun_cl->dirty(); - //(*scene_cl)[0] = scene_color; - //scene_cl->dirty(); (*ihalo_cl)[0] = i_halo_color; ihalo_cl->dirty(); (*ohalo_cl)[0] = o_halo_color; @@ -354,17 +343,12 @@ bool SDSun::reposition( osg::Vec3d p, double angle) osg::Vec4f pos = osg::Vec4f(0.0,0.0,0.0,1.0)*R; sun_position = osg::Vec3f(pos._v[0],pos._v[1],pos._v[2]); - GfOut("Sun Position in Sun: %f %f %f %f %f\n", pos._v[0], pos._v[1], pos._v[2],sun_dist,pos.length()); - - osg::Vec3f upos = osg::Vec3f(sun_position); + /*osg::Vec3f upos = osg::Vec3f(sun_position); osg::Vec3f uplan = osg::Vec3f(sun_position._v[0],0.0,sun_position._v[2]); upos.normalize(); uplan.normalize(); - sun_angle_to_scene = acos(upos*uplan); - //sun_angle = sun_angle_to_scene; - - GfOut("Sun Angle = %f\n", sun_angle); + sun_angle_to_scene = acos(upos*uplan);*/ // Suncolor related things: if ( prev_sun_angle != sun_angle )