Renamed the osg::EarthSky to osg::ClearNode to make it more obvious what

role it has play and make it more relevant to non vis-sim applications.
This commit is contained in:
Robert Osfield
2002-08-19 11:42:37 +00:00
parent c72953d94b
commit b23a48a763
15 changed files with 71 additions and 96 deletions

View File

@@ -2,7 +2,7 @@
#include <osg/Notify>
#include <osg/Depth>
#include <osg/StateSet>
#include <osg/EarthSky>
#include <osg/ClearNode>
#include <osg/Transform>
#include <osgUtil/CullVisitor>
@@ -86,8 +86,8 @@ int main( int argc, char **argv )
// osg::Depth, and setting their bin numbers to less than 0,
// to force them to draw before the rest of the scene.
osg::EarthSky* earthSky = osgNew osg::EarthSky;
earthSky->setRequiresClear(false); // we've got base and sky to do it.
osg::ClearNode* clearNode = osgNew osg::ClearNode;
clearNode->setRequiresClear(false); // we've got base and sky to do it.
// use a transform to make the sky and base around with the eye point.
osg::Transform* transform = osgNew osg::Transform;
@@ -108,10 +108,10 @@ int main( int argc, char **argv )
transform->addChild(makeBase()); // bin number -1 so draw second.
// add the transform to the earth sky.
earthSky->addChild(transform);
clearNode->addChild(transform);
// add to earth sky to the scene.
group->addChild(earthSky);
group->addChild(clearNode);
// the rest of the scene drawn after the base and sky above.
group->addChild(makeTrees()); // will drop into a transparent, depth sorted bin (1)

View File

@@ -1,13 +1,13 @@
#include <osg/EarthSky>
#include <osg/ClearNode>
#include <algorithm>
using namespace osg;
/**
* EarthSky constructor.
* ClearNode constructor.
*/
EarthSky::EarthSky()
ClearNode::ClearNode()
{
StateSet* stateset = osgNew StateSet;
stateset->setRenderBinDetails(-1,"RenderBin");

View File

@@ -26,7 +26,7 @@ CXXFILES =\
DOFTransform.cpp\
Drawable.cpp\
DrawPixels.cpp\
EarthSky.cpp\
ClearNode.cpp\
Fog.cpp\
FrameStamp.cpp\
FrontFace.cpp\

View File

@@ -36,7 +36,7 @@
// UNSUPPORTED:
//
// - OSG Scene Graph Node Types:
// LightSource, Transform, Imposter, EarthSky,
// LightSource, Transform, Imposter, ClearNode,
// Switch - only active child written
// LOD - only most detailed child written
// Billboard - only static translation transform parenting child written,
@@ -2404,7 +2404,7 @@ class StateSetActionVisitor : public osg::NodeVisitor
void apply(osg::Switch& node) { NodeVisitor::apply(node); }
void apply(osg::LOD& node) { NodeVisitor::apply(node); }
void apply(osg::Impostor& node) { NodeVisitor::apply(node); }
void apply(osg::EarthSky& node) { NodeVisitor::apply(node); }
void apply(osg::ClearNode& node) { NodeVisitor::apply(node); }
const osg::StateSet &GetActiveStateSet()
@@ -2488,7 +2488,7 @@ class DXWriteVisitor : public StateSetActionVisitor
MessageBin &msg_bin;
enum NodeTypes { LOD, BILLBOARD, LIGHTSOURCE, TRANSFORM, SWITCH,
IMPOSTER, EARTHSKY };
IMPOSTER, CLEARNODE };
typedef std::map< NodeTypes, int > StringMap;
StringMap problem_nodes;
@@ -2612,8 +2612,8 @@ class DXWriteVisitor : public StateSetActionVisitor
{ problem_nodes[ TRANSFORM ]++; apply((osg::Group&)node); }
void apply(osg::Impostor& node)
{ problem_nodes[ IMPOSTER ]++; apply((osg::LOD&)node); }
void apply(osg::EarthSky& node)
{ problem_nodes[ EARTHSKY ]++; apply((osg::Group&)node); }
void apply(osg::ClearNode& node)
{ problem_nodes[ CLEARNODE ]++; apply((osg::Group&)node); }
void ReportProblems();
};
@@ -2652,8 +2652,8 @@ void DXWriteVisitor::ReportProblems()
msg_bin.Add( "WARNING: %d Imposter(s) found ... Skipped.\n",
smitr->second );
break;
case EARTHSKY :
msg_bin.Add( "WARNING: %d EarthSky(s) found ... Skipped.\n",
case CLEARNODE :
msg_bin.Add( "WARNING: %d ClearNode(s) found ... Skipped.\n",
smitr->second );
break;
}

View File

@@ -15,14 +15,6 @@ bool BlendFunc_matchModeStr(const char* str,int& mode);
const char* BlendFunc_getModeStr(int value);
// register the read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_BlendFuncProxy
(
osgNew osg::BlendFunc,
"BlendFunc",
"Object StateAttribute BlendFunc",
&BlendFunc_readLocalData,
&BlendFunc_writeLocalData
);
RegisterDotOsgWrapperProxy g_TransparencyProxy
(
@@ -33,6 +25,15 @@ RegisterDotOsgWrapperProxy g_TransparencyProxy
&BlendFunc_writeLocalData
);
RegisterDotOsgWrapperProxy g_BlendFuncProxy
(
osgNew osg::BlendFunc,
"BlendFunc",
"Object StateAttribute BlendFunc",
&BlendFunc_readLocalData,
&BlendFunc_writeLocalData
);
bool BlendFunc_readLocalData(Object& obj, Input& fr)
{
bool iteratorAdvanced = false;

View File

@@ -1,4 +1,4 @@
#include "osg/EarthSky"
#include "osg/ClearNode"
#include "osgDB/Registry"
#include "osgDB/Input"
@@ -8,24 +8,34 @@ using namespace osg;
using namespace osgDB;
// forward declare functions to use later.
bool EarthSky_readLocalData(Object& obj, Input& fr);
bool EarthSky_writeLocalData(const Object& obj, Output& fw);
bool ClearNode_readLocalData(Object& obj, Input& fr);
bool ClearNode_writeLocalData(const Object& obj, Output& fw);
// register the read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_EarthSkyProxy
(
osgNew osg::EarthSky,
osgNew osg::ClearNode,
"EarthSky",
"Object Node EarthSky Group",
&EarthSky_readLocalData,
&EarthSky_writeLocalData
&ClearNode_readLocalData,
&ClearNode_writeLocalData
);
bool EarthSky_readLocalData(Object& obj, Input& fr)
RegisterDotOsgWrapperProxy g_ClearNodeProxy
(
osgNew osg::ClearNode,
"ClearNode",
"Object Node ClearNode Group",
&ClearNode_readLocalData,
&ClearNode_writeLocalData
);
bool ClearNode_readLocalData(Object& obj, Input& fr)
{
bool iteratorAdvanced = false;
EarthSky& es = static_cast<EarthSky&>(obj);
ClearNode& es = static_cast<ClearNode&>(obj);
if (fr.matchSequence("requiresClear"))
{
@@ -60,9 +70,9 @@ bool EarthSky_readLocalData(Object& obj, Input& fr)
}
bool EarthSky_writeLocalData(const Object& obj, Output& fw)
bool ClearNode_writeLocalData(const Object& obj, Output& fw)
{
const EarthSky& es = static_cast<const EarthSky&>(obj);
const ClearNode& es = static_cast<const ClearNode&>(obj);
fw.indent() << "requiresClear ";
if (es.getRequiresClear())

View File

@@ -12,7 +12,7 @@ CXXFILES =\
Depth.cpp\
DOFTransform.cpp\
Drawable.cpp\
EarthSky.cpp\
ClearNode.cpp\
Fog.cpp\
FrontFace.cpp\
Geode.cpp\

View File

@@ -521,10 +521,10 @@ void CullVisitor::apply(LOD& node)
popCurrentMask();
}
void CullVisitor::apply(osg::EarthSky& node)
void CullVisitor::apply(osg::ClearNode& node)
{
// simply override the current earth sky.
setEarthSky(&node);
setClearNode(&node);
// push the node's state.
StateSet* node_state = node.getStateSet();

View File

@@ -371,7 +371,7 @@ void SceneView::cullStage(osg::Matrix* projection,osg::Matrix* modelview,osgUtil
cullVisitor->setLODBias(_LODBias);
cullVisitor->setSmallFeatureCullingPixelSize(_smallFeatureCullingPixelSize);
cullVisitor->setEarthSky(NULL); // reset earth sky on each frame.
cullVisitor->setClearNode(NULL); // reset earth sky on each frame.
cullVisitor->setRenderGraph(rendergraph);
cullVisitor->setRenderStage(renderStage);
@@ -424,12 +424,12 @@ void SceneView::cullStage(osg::Matrix* projection,osg::Matrix* modelview,osgUtil
if (_globalState.valid()) cullVisitor->popStateSet();
const osg::EarthSky* earthSky = cullVisitor->getEarthSky();
if (earthSky)
const osg::ClearNode* clearNode = cullVisitor->getClearNode();
if (clearNode)
{
if (earthSky->getRequiresClear())
if (clearNode->getRequiresClear())
{
renderStage->setClearColor(earthSky->getClearColor());
renderStage->setClearColor(clearNode->getClearColor());
renderStage->setClearMask(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
// really should set clear mask here, but what to? Need
// to consider the stencil and accumulation buffers..