diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index c2ed62ef87..dd62d6678b 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -81,15 +81,15 @@ namespace return mat; } - osg::ref_ptr createTexturedQuad(int numUvSets=1) + osg::ref_ptr createTexturedQuad(int numUvSets=1, float scale=1.f) { osg::ref_ptr geom = new osg::Geometry; osg::ref_ptr verts = new osg::Vec3Array; - verts->push_back(osg::Vec3f(-0.5, -0.5, 0)); - verts->push_back(osg::Vec3f(-0.5, 0.5, 0)); - verts->push_back(osg::Vec3f(0.5, 0.5, 0)); - verts->push_back(osg::Vec3f(0.5, -0.5, 0)); + verts->push_back(osg::Vec3f(-0.5*scale, -0.5*scale, 0)); + verts->push_back(osg::Vec3f(-0.5*scale, 0.5*scale, 0)); + verts->push_back(osg::Vec3f(0.5*scale, 0.5*scale, 0)); + verts->push_back(osg::Vec3f(0.5*scale, -0.5*scale, 0)); geom->setVertexArray(verts); @@ -621,14 +621,13 @@ private: tex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); tex->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); - osg::ref_ptr transform (new osg::PositionAttitudeTransform); - const float scale = 2.6f; - transform->setScale(osg::Vec3f(scale,scale,scale)); + osg::ref_ptr group (new osg::Group); - mTransform->addChild(transform); + mTransform->addChild(group); - osg::ref_ptr geom = createTexturedQuad(); - transform->addChild(geom); + const float scale = 2.6f; + osg::ref_ptr geom = createTexturedQuad(1, scale); + group->addChild(geom); osg::StateSet* stateset = geom->getOrCreateStateSet(); @@ -637,7 +636,7 @@ private: stateset->setRenderBinDetails(RenderBin_SunGlare, "RenderBin"); stateset->setNestRenderBins(false); - mSunFlashNode = transform; + mSunFlashNode = group; mSunFlashCallback = new SunFlashCallback(mOcclusionQueryVisiblePixels, mOcclusionQueryTotalPixels); mSunFlashNode->addCullCallback(mSunFlashCallback); @@ -785,9 +784,11 @@ private: stateset = new osg::StateSet; stateset->setAttributeAndModes(mat, osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE); } - - const float threshold = 0.6; - visibleRatio = visibleRatio * (1.f - threshold) + threshold; + else if (visibleRatio < 1.f) + { + const float threshold = 0.6; + visibleRatio = visibleRatio * (1.f - threshold) + threshold; + } } float scale = visibleRatio; @@ -797,11 +798,13 @@ private: // no traverse return; } + else if (scale == 1.f) + traverse(node, cv); else { osg::Matrix modelView = *cv->getModelViewMatrix(); - modelView.preMultScale(osg::Vec3f(visibleRatio, visibleRatio, visibleRatio)); + modelView.preMultScale(osg::Vec3f(scale, scale, scale)); if (stateset) cv->pushStateSet(stateset);