From a4b28e573780cbe2036eec38db5ac9d0fed9d311 Mon Sep 17 00:00:00 2001 From: frohlich Date: Mon, 27 Nov 2006 17:11:35 +0000 Subject: [PATCH] Modified Files: simgear/scene/sky/oursun.cxx: Fix the 'sun has wrong size' bug. Thanks to Mark Akermann. --- simgear/scene/sky/oursun.cxx | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/simgear/scene/sky/oursun.cxx b/simgear/scene/sky/oursun.cxx index f40f7fd9..e2b5a59d 100644 --- a/simgear/scene/sky/oursun.cxx +++ b/simgear/scene/sky/oursun.cxx @@ -83,12 +83,11 @@ SGSun::build( SGPath path, double sun_size, SGPropertyNode *property_tree_Node ) stateSet->setAttribute(material); osg::ShadeModel* shadeModel = new osg::ShadeModel; - shadeModel->setMode(osg::ShadeModel::FLAT); + shadeModel->setMode(osg::ShadeModel::SMOOTH); stateSet->setAttributeAndModes(shadeModel); osg::AlphaFunc* alphaFunc = new osg::AlphaFunc; - alphaFunc->setFunction(osg::AlphaFunc::GREATER); - alphaFunc->setReferenceValue(0.01); + alphaFunc->setFunction(osg::AlphaFunc::ALWAYS); stateSet->setAttributeAndModes(alphaFunc); osg::BlendFunc* blendFunc = new osg::BlendFunc; @@ -105,7 +104,7 @@ SGSun::build( SGPath path, double sun_size, SGPropertyNode *property_tree_Node ) osg::Geode* geode = new osg::Geode; stateSet = geode->getOrCreateStateSet(); - stateSet->setRenderBinDetails(-8, "RenderBin"); + stateSet->setRenderBinDetails(-6, "RenderBin"); // set up the sun-state path.append( "sun.rgba" ); @@ -147,7 +146,7 @@ SGSun::build( SGPath path, double sun_size, SGPropertyNode *property_tree_Node ) stateSet->setRenderBinDetails(-7, "RenderBin"); ihalopath.append( "inner_halo.rgba" ); - texture = SGLoadTexture2D(path); + texture = SGLoadTexture2D(ihalopath); stateSet->setTextureAttributeAndModes(0, texture); // Build ssg structure @@ -184,17 +183,17 @@ SGSun::build( SGPath path, double sun_size, SGPropertyNode *property_tree_Node ) geode = new osg::Geode; stateSet = geode->getOrCreateStateSet(); - stateSet->setRenderBinDetails(-6, "RenderBin"); + stateSet->setRenderBinDetails(-8, "RenderBin"); ohalopath.append( "outer_halo.rgba" ); - texture = SGLoadTexture2D(path); + texture = SGLoadTexture2D(ohalopath); stateSet->setTextureAttributeAndModes(0, texture); // Build ssg structure ohalo_cl = new osg::Vec4Array; ohalo_cl->push_back(osg::Vec4(1, 1, 1, 1)); - double ohalo_size = sun_size * 7.0; + double ohalo_size = sun_size * 8.0; osg::Vec3Array* ohalo_vl = new osg::Vec3Array; ohalo_vl->push_back(osg::Vec3(-ohalo_size, 0, -ohalo_size)); ohalo_vl->push_back(osg::Vec3(ohalo_size, 0, -ohalo_size)); @@ -209,11 +208,11 @@ SGSun::build( SGPath path, double sun_size, SGPropertyNode *property_tree_Node ) geometry = new osg::Geometry; geometry->setUseDisplayList(false); - geometry->setVertexArray(ihalo_vl); - geometry->setColorArray(ihalo_cl.get()); + geometry->setVertexArray(ohalo_vl); + geometry->setColorArray(ohalo_cl.get()); geometry->setColorBinding(osg::Geometry::BIND_OVERALL); geometry->setNormalBinding(osg::Geometry::BIND_OFF); - geometry->setTexCoordArray(0, ihalo_tl); + geometry->setTexCoordArray(0, ohalo_tl); geometry->addPrimitiveSet(new osg::DrawArrays(GL_TRIANGLE_STRIP, 0, 4)); geode->addDrawable(geometry); -- 2.39.5