]> git.mxchange.org Git - simgear.git/commitdiff
Give the sky a BACKGROUND_BIT nodemask
authortimoore <timoore>
Fri, 4 Jan 2008 07:33:42 +0000 (07:33 +0000)
committertimoore <timoore>
Fri, 4 Jan 2008 07:33:42 +0000 (07:33 +0000)
Add a MODEL_BIT and tag clouds with that.

Remove vestigial post_root from sky code.

simgear/scene/sky/sky.cxx
simgear/scene/sky/sky.hxx
simgear/scene/util/RenderConstants.hxx

index b1970e07ea7b44a9ca04c1a589b584aada399577..ae8cd88b54966bfd8be8f3a423d5cf70446b0aba 100644 (file)
@@ -26,6 +26,7 @@
 #endif
 
 #include <simgear/math/sg_random.h>
+#include <simgear/scene/util/RenderConstants.hxx>
 
 #include "sky.hxx"
 #include "cloudfield.hxx"
@@ -44,14 +45,13 @@ SGSky::SGSky( void ) {
     in_cloud  = -1;
 
     pre_root = new osg::Group;
-    post_root = new osg::Group;
+    pre_root->setNodeMask(simgear::BACKGROUND_BIT);
     cloud_root = new osg::Group;
+    cloud_root->setNodeMask(simgear::BACKGROUND_BIT | simgear::MODEL_BIT);
 
     pre_selector = new osg::Switch;
-    post_selector = new osg::Switch;
 
     pre_transform = new osg::MatrixTransform;
-    post_transform = new osg::MatrixTransform;
 }
 
 
@@ -85,10 +85,7 @@ void SGSky::build( double h_radius_m, double v_radius_m,
 
     pre_selector->addChild( pre_transform.get() );
 
-    post_selector->addChild( post_transform.get() );
-
     pre_root->addChild( pre_selector.get() );
-    post_root->addChild( post_selector.get() );
 }
 
 
index 4c4c47c1081e89b005a43cd04a8f07fd0c6b93a7..d842b9b7b7a3f3301832c2aeb3262290241272b9 100644 (file)
@@ -217,9 +217,9 @@ private:
     SGSharedPtr<SGStars> stars;
     layer_list_type cloud_layers;
 
-    osg::ref_ptr<osg::Group> pre_root, post_root, cloud_root;
-    osg::ref_ptr<osg::Switch> pre_selector, post_selector;
-    osg::ref_ptr<osg::MatrixTransform> pre_transform, post_transform;
+    osg::ref_ptr<osg::Group> pre_root, cloud_root;
+    osg::ref_ptr<osg::Switch> pre_selector;
+    osg::ref_ptr<osg::MatrixTransform> pre_transform;
 
     SGPath tex_path;
 
@@ -332,7 +332,6 @@ public:
     void modify_vis( float alt, float time_factor );
 
     osg::Node* getPreRoot() { return pre_root.get(); }
-    osg::Node* getPostRoot() { return post_root.get(); }
     osg::Node* getCloudRoot() { return cloud_root.get(); }
 
     /** 
@@ -342,11 +341,9 @@ public:
     inline void texture_path( const string& path ) {
        tex_path = SGPath( path );
     }
-
     /** Enable drawing of the sky. */
     inline void enable() {
         pre_selector->setValue(0, 1);
-       post_selector->setValue(0, 1);
     }
 
     /**
@@ -355,7 +352,6 @@ public:
      */
     inline void disable() {
         pre_selector->setValue(0, 0);
-       post_selector->setValue(0, 0);
     }
 
     /**
index 3574a737d2bca703aca8bf941f50612867102130..66ce522eb88d418cfb261885d2fbafa3354682f2 100644 (file)
@@ -39,7 +39,11 @@ enum NodeMask {
     RUNWAYLIGHTS_BIT = (1 << 10),
     LIGHTS_BITS = (GROUNDLIGHTS0_BIT | GROUNDLIGHTS1_BIT | GROUNDLIGHTS2_BIT
                    | RUNWAYLIGHTS_BIT),
-    BACKGROUND_BIT = (1 << 11)
+    // Sky parts
+    BACKGROUND_BIT = (1 << 11),
+    // Everything else that isn't terrain. Initially for clouds;
+    // eventually for other models?
+    MODEL_BIT = (1 << 12)
 };
 
 // Theory of bin numbering: