Give the sky a BACKGROUND_BIT nodemask
Add a MODEL_BIT and tag clouds with that. Remove vestigial post_root from sky code.
This commit is contained in:
@@ -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() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user