Frederic Bouvier wrote:
> Stuart Buchanan a écrit :
> > Hi All,
> >
> > Attached is a small patch for 3D clouds.
> >
> > It provide the following:
> > 1) Proper spherical distribution of sprites (previously they were 
> > distributed 
> cylindrically - whoops)
> > 2) Better shading, so the bottom of the cloud is darker than the top.
> > 3) Fixed a couple of texture sizing bugs.
> >
> > I don't think any of these are controversial, so if someone would commit 
> > it, 
> I'd be grateful.
> >  
> 
> I applied your patch. I noticed this message being repeated endlessly
> when clouds are activated :
> 
> Warning: detected OpenGL error 'valeur non valide' after RenderBin::draw(,)

Fixed in the patch below. For some reason the shader didn't like index 16 being 
used...

The patch also fixes the chequer-board effect that was causing very sparse 
cloud cover.

I've still to work out why the Fair Weather scenario isn't displaying clouds 
consistently. 

-Stuart

Index: CloudShaderGeometry.hxx
===================================================================
RCS file: 
/var/cvs/SimGear-0.3/source/simgear/scene/sky/CloudShaderGeometry.hxx,v
retrieving revision 1.3
diff -u -p -r1.3 CloudShaderGeometry.hxx
--- CloudShaderGeometry.hxx    23 Nov 2008 12:14:57 -0000    1.3
+++ CloudShaderGeometry.hxx    24 Nov 2008 01:19:56 -0000
@@ -42,12 +42,12 @@ class CloudShaderGeometry : public osg::
 {
     public:
         
+        const static unsigned int CLOUD_HEIGHT = 10;
         const static unsigned int TEXTURE_INDEX_X = 11;
         const static unsigned int TEXTURE_INDEX_Y = 12;
         const static unsigned int WIDTH = 13;
         const static unsigned int HEIGHT = 14;
         const static unsigned int SHADE = 15;
-        const static unsigned int CLOUD_HEIGHT = 16;
         
         CloudShaderGeometry()
         { 
Index: cloudfield.cxx
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/scene/sky/cloudfield.cxx,v
retrieving revision 1.22
diff -u -p -r1.22 cloudfield.cxx
--- cloudfield.cxx    23 Nov 2008 12:14:56 -0000    1.22
+++ cloudfield.cxx    24 Nov 2008 01:19:56 -0000
@@ -157,14 +157,16 @@ SGCloudField::SGCloudField() :
         }
     }
     
+    int leafs = QUADTREE_SIZE / BRANCH_SIZE;
+    
     for (int x = 0; x < QUADTREE_SIZE; x++) {
         for (int y = 0; y < QUADTREE_SIZE; y++) {
             field_group[x][y]= new osg::Switch;
             field_group[x][y]->setName("3D cloud group");
             
             // Work out where to put this node in the quad tree
-            int i = (int) (BRANCH_SIZE * ((float) x) / ((float) 
QUADTREE_SIZE));
-            int j = (int) (BRANCH_SIZE * ((float) y) / ((float) 
QUADTREE_SIZE));
+            int i = x / leafs;
+            int j = y / leafs;
             quad[i][j]->addChild(field_group[x][y].get(), 0.0f, 20000.0f);
         }
     }


      

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to