[Simgear-cvslogs] CVS: source/simgear/scene/sky cloud.cxx, 1.51, 1.52
Status: Beta
Brought to you by:
curt
|
From: Tim M. <ti...@fl...> - 2007-10-02 21:48:14
|
Update of /var/cvs/SimGear-0.3/source/simgear/scene/sky
In directory baron:/tmp/cvs-serv16604/simgear/scene/sky
Modified Files:
cloud.cxx
Log Message:
Order the cloud layers properly using OSG RenderBin
Index: cloud.cxx
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/scene/sky/cloud.cxx,v
retrieving revision 1.51
retrieving revision 1.52
diff -C 2 -r1.51 -r1.52
*** cloud.cxx 10 Nov 2006 05:30:37 -0000 1.51
--- cloud.cxx 2 Oct 2007 21:43:52 -0000 1.52
***************
*** 76,80 ****
// make an StateSet for a cloud layer given the named texture
static osg::StateSet*
! SGMakeState(const SGPath &path, const char* colorTexture, const char* normalTexture)
{
osg::StateSet *stateSet = new osg::StateSet;
--- 76,81 ----
// make an StateSet for a cloud layer given the named texture
static osg::StateSet*
! SGMakeState(const SGPath &path, const char* colorTexture,
! const char* normalTexture)
{
osg::StateSet *stateSet = new osg::StateSet;
***************
*** 158,161 ****
--- 159,165 ----
layer_root->addChild(group_bottom.get());
layer_root->addChild(group_top.get());
+ // Force the cloud layers into recursive bins of bin 4.
+ osg::StateSet *rootSet = layer_root->getOrCreateStateSet();
+ rootSet->setRenderBinDetails(4, "RenderBin");
group_top->addChild(layer_transform.get());
***************
*** 514,524 ****
osg::CopyOp copyOp(osg::CopyOp::DEEP_COPY_ALL
& ~osg::CopyOp::DEEP_COPY_TEXTURES);
!
osg::StateSet* stateSet = static_cast<osg::StateSet*>(layer_states2[layer_coverage]->clone(copyOp));
! // OSGFIXME
! stateSet->setRenderBinDetails(4, "RenderBin");
group_top->setStateSet(stateSet);
stateSet = static_cast<osg::StateSet*>(layer_states2[layer_coverage]->clone(copyOp));
! stateSet->setRenderBinDetails(4, "RenderBin");
group_bottom->setStateSet(stateSet);
}
--- 518,527 ----
osg::CopyOp copyOp(osg::CopyOp::DEEP_COPY_ALL
& ~osg::CopyOp::DEEP_COPY_TEXTURES);
! // render bin will be set in reposition
osg::StateSet* stateSet = static_cast<osg::StateSet*>(layer_states2[layer_coverage]->clone(copyOp));
! stateSet->setDataVariance(osg::Object::DYNAMIC);
group_top->setStateSet(stateSet);
stateSet = static_cast<osg::StateSet*>(layer_states2[layer_coverage]->clone(copyOp));
! stateSet->setDataVariance(osg::Object::DYNAMIC);
group_bottom->setStateSet(stateSet);
}
***************
*** 848,857 ****
layer_transform->setMatrix( LAT*LON*T );
!
if ( alt <= layer_asl ) {
layer_root->setSingleChildOn(0);
! } else {
layer_root->setSingleChildOn(1);
}
// now calculate update texture coordinates
--- 851,872 ----
layer_transform->setMatrix( LAT*LON*T );
! // The layers need to be drawn in order because they are
! // translucent, but OSG transparency sorting doesn't work because
! // the cloud polys are huge. However, the ordering is simple: the
! // bottom polys should be drawn from high altitude to low, and the
! // top polygons from low to high. The altitude can be used
! // directly to order the polygons!
! layer_root->getChild(0)->getStateSet()->setRenderBinDetails(-(int)layer_asl,
! "RenderBin");
! layer_root->getChild(1)->getStateSet()->setRenderBinDetails((int)layer_asl,
! "RenderBin");
if ( alt <= layer_asl ) {
layer_root->setSingleChildOn(0);
! } else if ( alt >= layer_asl + layer_thickness ) {
layer_root->setSingleChildOn(1);
+ } else {
+ layer_root->setAllChildrenOff();
}
+
// now calculate update texture coordinates
|