-
-#if 0
- static int debug_period = 0;
- if (debug_period++ == 50) {
- debug_period = 0;
- cout << "drawRain("
- << pitch << ", "
- << roll << ", "
- << heading << ", "
- << hspeed << ", "
- << rain_norm << ");"
- //" angle = " << angle
- //<< " raindrop(KTS) = " << raindrop_speed_kts
- << endl;
- }
-#endif
-
-
- glBindTexture(GL_TEXTURE_2D, 0);
-
- glDisable(GL_DEPTH_TEST);
- glShadeModel(GL_SMOOTH);
- glEnable(GL_BLEND);
- glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA );
- glDisable( GL_FOG );
- glDisable(GL_LIGHTING);
-
- int slice_count = static_cast<int>(
- (streak_count_min + rain_norm*(streak_count_max-streak_count_min))
- * precipitation_density / 100.0);
-
- // www.wonderquest.com/falling-raindrops.htm says that
- // Raindrop terminal velocity is 5 to 20mph
- // Rather than model it accurately (temp, pressure, diameter), and make it
- // smaller than terminal when closer to the precipitation cloud base,
- // we interpolate in the 5-20mph range according to rain_norm.
- double raindrop_speed_kts
- = (5.0 + rain_norm*15.0) * SG_MPH_TO_MPS * SG_MPS_TO_KT;
-
- float angle = atanf(hspeed / raindrop_speed_kts) * SG_RADIANS_TO_DEGREES;
- glPushMatrix();
- // the cone rotate with hspeed
- angle = -pitch - angle;
- glRotatef(roll, 0.0, 0.0, 1.0);
- glRotatef(heading, 0.0, 1.0, 0.0);
- glRotatef(angle, 1.0, 0.0, 0.0);
-
- // up cone
- DrawCone2(cone_base_radius, cone_height,
- slice_count, true, rain_norm, hspeed);
- // down cone (usually not visible)
- if(angle > 0.0 || heading != 0.0)
- DrawCone2(cone_base_radius, -cone_height,
- slice_count, false, rain_norm, hspeed);
-
- glPopMatrix();
-
- glEnable(GL_LIGHTING);
- glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ;
- glEnable( GL_FOG );
- glEnable(GL_DEPTH_TEST);
-