Beispiel #1
0
void BootChapter::on_start() {
    L_DEBUG("Starting boot chapter");

    fade_to_black(0, /*show_loading=true*/true);
    manager().switch_to_chapter("title");
}
Beispiel #2
0
bool cGrSkyDome::repaint( sgVec4 sky_color, sgVec4 fog_color, double sol_angle, double vis )
{
  double diff, prev_sun_angle = 999.0;
  sgVec3 outer_param, outer_amt, outer_diff;
  sgVec3 middle_param, middle_amt, middle_diff;
  int i, j;

  if (prev_sun_angle == sol_angle)
        return true;

  prev_sun_angle = sol_angle;

  //sol_angle *= SGD_RADIANS_TO_DEGREES;

  // Check for sunrise/sunset condition
  if ((sol_angle > 80.0)) 
  { 
    sgSetVec3( outer_param,
      (float)((10.0 - fabs(90.0 - sol_angle)) / 20.0),
      (float)((10.0 - fabs(90.0 - sol_angle)) / 40.0),
      (float)(-(10.0 - fabs(90.0 - sol_angle)) / 30.0));

    sgSetVec3( middle_param,
      (float)((10.0 - fabs(90.0 - sol_angle)) / 40.0),
      (float)((10.0 - fabs(90.0 - sol_angle)) / 80.0),
      0.0 );

    sgScaleVec3( outer_diff, outer_param, 1.0f / 6.0f );

    sgScaleVec3( middle_diff, middle_param, 1.0f / 6.0f );
  }
  else 
  {
    sgSetVec3( outer_param, 0.0, 0.0, 0.0 );
    sgSetVec3( middle_param, 0.0, 0.0, 0.0 );

    sgSetVec3( outer_diff, 0.0, 0.0, 0.0 );
    sgSetVec3( middle_diff, 0.0, 0.0, 0.0 );
  }

  // calculate transition colors between sky and fog
  sgCopyVec3( outer_amt, outer_param );
  sgCopyVec3( middle_amt, middle_param );

  //
  // First, recalulate the basic colors
  //

  sgVec4 center_color;
  sgVec4 upper_color[12];
  sgVec4 middle_color[12];
  sgVec4 lower_color[12];
  sgVec4 bottom_color[12];

  double vis_factor, cvf = vis;

  if (cvf > 45000)
        cvf = 45000;

  vis_factor = (vis - 1000.0) / 2000.0;
  if ( vis_factor < 0.0 ) 
  {
        vis_factor = 0.0;
  } else if ( vis_factor > 1.0) 
  {
        vis_factor = 1.0;
  }

  for ( j = 0; j < 3; j++ ) 
  {
    diff = sky_color[j] - fog_color[j];
    center_color[j] = sky_color[j]; // - (float)(diff * ( 1.0 - vis_factor ));
  }

  for ( i = 0; i < 6; i++ ) 
  {
    for ( j = 0; j < 3; j++ ) 
    {
      double saif = sol_angle/SG_PI;
      diff = sky_color[j] - fog_color[j] * (0.8 + j * 0.2) * (0.8 + saif - ((6-i)/10));

      upper_color[i][j] = sky_color[j] - (float)(diff * ( 1.0 - vis_factor * (0.7 + 0.3 * cvf/45000)));
      middle_color[i][j] = sky_color[j] - (float)(diff * ( 1.0 - vis_factor * (0.1 + 0.85 * cvf/45000)))
			 + middle_amt[j];
      lower_color[i][j] = fog_color[j] + outer_amt[j];

      if ( upper_color[i][j] > 1.0 ) { upper_color[i][j] = 1.0; }
      if ( upper_color[i][j] < 0.0 ) { upper_color[i][j] = 0.0; }
      if ( middle_color[i][j] > 1.0 ) { middle_color[i][j] = 1.0; }
      if ( middle_color[i][j] < 0.0 ) { middle_color[i][j] = 0.0; }
      if ( lower_color[i][j] > 1.0 ) { lower_color[i][j] = 1.0; }
      if ( lower_color[i][j] < 0.0 ) { lower_color[i][j] = 0.0; }
    }
    upper_color[i][3] = middle_color[i][3] = lower_color[i][3] = 1.0;

    for ( j = 0; j < 3; j++ ) 
    {
      outer_amt[j] -= outer_diff[j];
      middle_amt[j] -= middle_diff[j];
    }
  }

  sgSetVec3( outer_amt, 0.0, 0.0, 0.0 );
  sgSetVec3( middle_amt, 0.0, 0.0, 0.0 );

  for ( i = 6; i < 12; i++ ) 
  {
    for ( j = 0; j < 3; j++ ) 
    {
	  double saif = sol_angle/SG_PI;
      diff = (sky_color[j] - fog_color[j]) * (0.8 + j * 0.2) * (0.8 + saif - ((-i+12)/10));

      upper_color[i][j] = sky_color[j] - (float)(diff *
                                 ( 1.0 - vis_factor * (0.7 + 0.3 * cvf/45000)));
      middle_color[i][j] = sky_color[j] - (float)(diff *
                                 ( 1.0 - vis_factor * (0.1 + 0.85 * cvf/45000)))
								  + middle_amt[j];
      lower_color[i][j] = fog_color[j] + outer_amt[j];

      if ( upper_color[i][j] > 1.0 ) { upper_color[i][j] = 1.0; }
      if ( upper_color[i][j] < 0.0 ) { upper_color[i][j] = 0.0; }
      if ( middle_color[i][j] > 1.0 ) { middle_color[i][j] = 1.0; }
      if ( middle_color[i][j] < 0.0 ) { middle_color[i][j] = 0.0; }
      if ( lower_color[i][j] > 1.0 ) { lower_color[i][j] = 1.0; }
      if ( lower_color[i][j] < 0.0 ) { lower_color[i][j] = 0.0; }
    }
    upper_color[i][3] = middle_color[i][3] = lower_color[i][3] = 1.0;

    for ( j = 0; j < 3; j++ ) 
    {
      outer_amt[j] += outer_diff[j];
      middle_amt[j] += middle_diff[j];
    }
  }

  fade_to_black( (sgVec4 *) center_color, asl * center_elev, 1);
  fade_to_black( upper_color, (asl+0.05f) * upper_elev, 12);
  fade_to_black( middle_color, (asl+0.05f) * middle_elev, 12);
  fade_to_black( lower_color, (asl+0.05f) * lower_elev, 12);

  for ( i = 0; i < 12; i++ ) 
  {
    sgCopyVec4( bottom_color[i], fog_color );
  }

  //
  // Second, assign the basic colors to the object color arrays
  //

  float *slot;
  int counter;

  // update the center disk color arrays
  counter = 0;
  slot = center_disk_cl->get( counter++ );
  // sgVec4 red;
  // sgSetVec4( red, 1.0, 0.0, 0.0, 1.0 );
  sgCopyVec4( slot, center_color );
  for ( i = 11; i >= 0; i-- ) 
  {
    slot = center_disk_cl->get( counter++ );
    sgCopyVec4( slot, upper_color[i] );
  }
  slot = center_disk_cl->get( counter++ );
  sgCopyVec4( slot, upper_color[11] );

  // generate the upper ring
  counter = 0;
  for ( i = 0; i < 12; i++ ) 
  {
    slot = upper_ring_cl->get( counter++ );
    sgCopyVec4( slot, middle_color[i] );

    slot = upper_ring_cl->get( counter++ );
    sgCopyVec4( slot, upper_color[i] );
  }
  slot = upper_ring_cl->get( counter++ );
  sgCopyVec4( slot, middle_color[0] );

  slot = upper_ring_cl->get( counter++ );
  sgCopyVec4( slot, upper_color[0] );

  // generate middle ring
  counter = 0;
  for ( i = 0; i < 12; i++ ) 
  {
    slot = middle_ring_cl->get( counter++ );
    sgCopyVec4( slot, lower_color[i] );

    slot = middle_ring_cl->get( counter++ );
    sgCopyVec4( slot, middle_color[i] );
  }
  slot = middle_ring_cl->get( counter++ );
  sgCopyVec4( slot, lower_color[0] );

  slot = middle_ring_cl->get( counter++ );
  sgCopyVec4( slot, middle_color[0] );

  // generate lower ring
  counter = 0;
  for ( i = 0; i < 12; i++ ) 
  {
    slot = lower_ring_cl->get( counter++ );
    sgCopyVec4( slot, bottom_color[i] );

    slot = lower_ring_cl->get( counter++ );
    sgCopyVec4( slot, lower_color[i] );
  }
  slot = lower_ring_cl->get( counter++ );
  sgCopyVec4( slot, bottom_color[0] );

  slot = lower_ring_cl->get( counter++ );
  sgCopyVec4( slot, lower_color[0] );

  return true;
}