Harald JOHSNEN:

Changes
=======

- correct the transparency probleme when old 3d clouds were enabled
 (rendering context with an alpha channel)
- changed rain cone orientation, it can now be viewed from helicopter or chase
  view (still not tower view)
- clouds are a bit more yellow/red at dawn/dusk
- weather data is now correctly propagated to the interpolator, this correct
  visibility, wind, etc
- the 'metar' weather scenario now immedialty reuse the real metar data
- real metar no more overwrite custom weather scenario
This commit is contained in:
ehofman 2005-05-22 08:09:08 +00:00
parent 430ba60b33
commit 7b5d49ef60
5 changed files with 31 additions and 14 deletions

View File

@ -388,14 +388,14 @@ void SGEnviro::DrawCone2(float baseRadius, float height, int slices, bool down,
}
// 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);
@ -411,11 +411,12 @@ void SGEnviro::drawRain(double pitch, double roll, double speed, double rain_nor
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();
@ -431,10 +432,10 @@ void SGEnviro::set_soundMgr(SGSoundMgr *mgr) {
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);
}

View File

@ -77,7 +77,7 @@ public:
*/
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
@ -88,7 +88,7 @@ public:
* @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.

View File

@ -25,6 +25,7 @@
#endif
#include <simgear/compiler.h>
#include <simgear/debug/logstream.hxx>
#include <plib/sg.h>
#include <plib/ssg.h>
@ -115,8 +116,10 @@ void SGBbCache::init(int cacheCount) {
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);
@ -138,8 +141,10 @@ void SGBbCache::init(int cacheCount) {
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 );

View File

@ -38,9 +38,12 @@
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
@ -51,7 +54,7 @@ bool SGCloudField::enable3D = false;
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;
@ -364,8 +367,13 @@ void SGCloudField::Render(void) {
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);
@ -389,6 +397,8 @@ void SGCloudField::Render(void) {
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;
@ -424,9 +434,10 @@ void SGCloudField::Render(void) {
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);

View File

@ -104,7 +104,7 @@ public:
// 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;