From 4383fd3c45fc5b6d5bfa9c4aad7d789b39050704 Mon Sep 17 00:00:00 2001 From: timoore Date: Fri, 4 Jan 2008 07:33:42 +0000 Subject: [PATCH] Give the sky a BACKGROUND_BIT nodemask Add a MODEL_BIT and tag clouds with that. Remove vestigial post_root from sky code. --- simgear/scene/sky/sky.cxx | 9 +++------ simgear/scene/sky/sky.hxx | 10 +++------- simgear/scene/util/RenderConstants.hxx | 6 +++++- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/simgear/scene/sky/sky.cxx b/simgear/scene/sky/sky.cxx index b1970e07..ae8cd88b 100644 --- a/simgear/scene/sky/sky.cxx +++ b/simgear/scene/sky/sky.cxx @@ -26,6 +26,7 @@ #endif #include +#include #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() ); } diff --git a/simgear/scene/sky/sky.hxx b/simgear/scene/sky/sky.hxx index 4c4c47c1..d842b9b7 100644 --- a/simgear/scene/sky/sky.hxx +++ b/simgear/scene/sky/sky.hxx @@ -217,9 +217,9 @@ private: SGSharedPtr stars; layer_list_type cloud_layers; - osg::ref_ptr pre_root, post_root, cloud_root; - osg::ref_ptr pre_selector, post_selector; - osg::ref_ptr pre_transform, post_transform; + osg::ref_ptr pre_root, cloud_root; + osg::ref_ptr pre_selector; + osg::ref_ptr 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); } /** diff --git a/simgear/scene/util/RenderConstants.hxx b/simgear/scene/util/RenderConstants.hxx index 3574a737..66ce522e 100644 --- a/simgear/scene/util/RenderConstants.hxx +++ b/simgear/scene/util/RenderConstants.hxx @@ -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: -- 2.39.5