}
// TODO:check alt vs layer
-void SGEnviro::drawRain(double pitch, double roll, double speed, double rain_norm) {
+void SGEnviro::drawRain(double pitch, double roll, double heading, double speed, double rain_norm) {
glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_DEPTH_TEST);
glShadeModel(GL_SMOOTH);
glEnable(GL_BLEND);
- glBlendFunc( GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+ glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA );
glDisable( GL_FOG );
glDisable(GL_LIGHTING);
angle = -pitch - angle;
glRotatef(angle, 1.0, 0.0, 0.0);
glRotatef(roll, 0.0, 1.0, 0.0);
+ glRotatef(heading, 0.0, 0.0, 1.0);
// up cone
DrawCone2(15.0, 30.0, slice_count, true, rain_norm, speed);
// down cone (usually not visible)
- if(angle > 0.0)
+ if(angle > 0.0 || heading != 0.0)
DrawCone2(15.0, -30.0, slice_count, false, rain_norm, speed);
glPopMatrix();
soundMgr = mgr;
}
-void SGEnviro::drawPrecipitation(double rain_norm, double snow_norm, double hail_norm, double pitch, double roll, double speed) {
+void SGEnviro::drawPrecipitation(double rain_norm, double snow_norm, double hail_norm, double pitch, double roll, double heading, double speed) {
// TODO:check alt with right layer (wich layer ?)
if( precipitation_enable_state && rain_norm > 0.0)
- drawRain(pitch, roll, speed, rain_norm);
+ drawRain(pitch, roll, heading, speed, rain_norm);
}
*/
void callback_cloud(float heading, float alt, float radius, int familly, float dist);
- void drawRain(double pitch, double roll, double speed, double rain_norm);
+ void drawRain(double pitch, double roll, double heading, double speed, double rain_norm);
/**
* Draw rain or snow precipitation around the viewer.
* @param rain_norm rain normalized intensity given by metar class
* @param speed moving speed of viewer in kt
*/
void drawPrecipitation(double rain_norm, double snow_norm, double hail_norm,
- double pitch, double roll, double speed);
+ double pitch, double roll, double heading, double speed);
/**
* Draw the lightnings spawned by cumulo nimbus.
#endif
#include <simgear/compiler.h>
+#include <simgear/debug/logstream.hxx>
#include <plib/sg.h>
#include <plib/ssg.h>
rt->Reset("rgba tex2D ctt");
// rt->Reset("rgba tex2D");
if( rt->Initialize(256, 256, true) ) {
+ SG_LOG(SG_ALL, SG_INFO, "bbcache:Initialize sucessfull");
if (rt->BeginCapture())
{
+ SG_LOG(SG_ALL, SG_INFO, "bbcache:BeginCapture sucessfull, RTT available");
rtAvailable = true;
glViewport(0, 0, 256, 256);
glMatrixMode(GL_PROJECTION);
glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA );
rt->EndCapture();
- }
- }
+ } else
+ SG_LOG(SG_ALL, SG_WARN, "bbcache:BeginCapture failed, RTT not available for 3D clouds");
+ } else
+ SG_LOG(SG_ALL, SG_WARN, "bbcache:Initialize failed, RTT not available for 3D clouds");
if( cacheCount )
allocTextureMemory( cacheCount, 64 );
SG_USING_STD(vector);
#include <simgear/environment/visual_enviro.hxx>
+#include "sky.hxx"
#include "newcloud.hxx"
#include "cloudfield.hxx"
+extern SGSky *thesky;
+
static list_of_culledCloud inViewClouds;
// visibility distance for clouds in meters
double SGCloudField::fieldSize = 50000.0;
float SGCloudField::density = 100.0;
double SGCloudField::timer_dt = 0.0;
-sgVec3 SGCloudField::view_vec;
+sgVec3 SGCloudField::view_vec, SGCloudField::view_X, SGCloudField::view_Y;
static int last_cache_size = 1*1024;
static int cacheResolution = 64;
sgVec4 diffuse, ambient;
ssgGetLight( 0 )->getColour( GL_DIFFUSE, diffuse );
ssgGetLight( 0 )->getColour( GL_AMBIENT, ambient );
- sgScaleVec3 ( SGNewCloud::sunlight, diffuse , 1.0f);
- sgScaleVec3 ( SGNewCloud::ambLight, ambient , 1.0f);
+// sgScaleVec3 ( SGNewCloud::sunlight, diffuse , 1.0f);
+ sgScaleVec3 ( SGNewCloud::ambLight, ambient , 1.1f);
+ // trying something else : clouds are more yellow/red at dawn/dusk
+ // and added a bit of blue ambient
+ float *sun_color = thesky->get_sun_color();
+ sgScaleVec3 ( SGNewCloud::sunlight, sun_color , 0.4f);
+ SGNewCloud::ambLight[2] += 0.1f;
sgVec3 delta_light;
sgSubVec3(delta_light, last_sunlight, SGNewCloud::sunlight);
rely = fmod( rely + fieldSize, fieldSize );
sgSetVec3( eyePos, relx, alt, rely);
sgCopyVec3( view_vec, tmp[1] );
+ sgCopyVec3( view_X, tmp[0] );
+ sgCopyVec3( view_Y, tmp[2] );
tmp[3][2] = 0;
tmp[3][0] = 0;
glAlphaFunc(GL_GREATER, 0.0f);
glDisable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
+ glDepthMask( GL_FALSE );
glEnable(GL_SMOOTH);
glEnable(GL_BLEND);
- glBlendFunc( GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+ glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA );
glEnable( GL_TEXTURE_2D );
glDisable( GL_FOG );
glDisable(GL_LIGHTING);
// visibility distance for clouds in meters
static float CloudVis;
- static sgVec3 view_vec;
+ static sgVec3 view_vec, view_X, view_Y;
static float density;
static double timer_dt;