mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 05:53:50 +00:00
Merge branch 'fix-sky' into 'master'
Fix building mwrender/sky with OSG 3.6.5 See merge request OpenMW/openmw!162
This commit is contained in:
commit
52fa20fb1c
1 changed files with 14 additions and 3 deletions
|
@ -16,6 +16,7 @@
|
|||
#include <osg/BlendFunc>
|
||||
#include <osg/AlphaFunc>
|
||||
#include <osg/PolygonOffset>
|
||||
#include <osg/Version>
|
||||
#include <osg/observer_ptr>
|
||||
|
||||
#include <osgParticle/BoxPlacer>
|
||||
|
@ -558,19 +559,25 @@ private:
|
|||
osg::ref_ptr<osg::OcclusionQueryNode> oqn = new osg::OcclusionQueryNode;
|
||||
oqn->setQueriesEnabled(true);
|
||||
|
||||
#if OSG_VERSION_GREATER_OR_EQUAL(3, 6, 5)
|
||||
// With OSG 3.6.5, the method of providing user defined query geometry has been completely replaced
|
||||
osg::ref_ptr<osg::QueryGeometry> queryGeom = new osg::QueryGeometry(oqn->getName());
|
||||
#else
|
||||
osg::ref_ptr<osg::QueryGeometry> queryGeom = oqn->getQueryGeometry();
|
||||
#endif
|
||||
|
||||
// Make it fast! A DYNAMIC query geometry means we can't break frame until the flare is rendered (which is rendered after all the other geometry,
|
||||
// so that would be pretty bad). STATIC should be safe, since our node's local bounds are static, thus computeBounds() which modifies the queryGeometry
|
||||
// is only called once.
|
||||
// Note the debug geometry setDebugDisplay(true) is always DYNAMIC and that can't be changed, not a big deal.
|
||||
oqn->getQueryGeometry()->setDataVariance(osg::Object::STATIC);
|
||||
queryGeom->setDataVariance(osg::Object::STATIC);
|
||||
|
||||
// Set up the query geometry to match the actual sun's rendering shape. osg::OcclusionQueryNode wasn't originally intended to allow this,
|
||||
// normally it would automatically adjust the query geometry to match the sub graph's bounding box. The below hack is needed to
|
||||
// circumvent this.
|
||||
osg::Geometry* queryGeom = oqn->getQueryGeometry();
|
||||
queryGeom->setVertexArray(mGeom->getVertexArray());
|
||||
queryGeom->setTexCoordArray(0, mGeom->getTexCoordArray(0), osg::Array::BIND_PER_VERTEX);
|
||||
queryGeom->removePrimitiveSet(0, oqn->getQueryGeometry()->getNumPrimitiveSets());
|
||||
queryGeom->removePrimitiveSet(0, queryGeom->getNumPrimitiveSets());
|
||||
queryGeom->addPrimitiveSet(mGeom->getPrimitiveSet(0));
|
||||
|
||||
// Hack to disable unwanted awful code inside OcclusionQueryNode::computeBound.
|
||||
|
@ -578,6 +585,10 @@ private:
|
|||
// Still need a proper bounding sphere.
|
||||
oqn->setInitialBound(queryGeom->getBound());
|
||||
|
||||
#if OSG_VERSION_GREATER_OR_EQUAL(3, 6, 5)
|
||||
oqn->setQueryGeometry(queryGeom.release());
|
||||
#endif
|
||||
|
||||
osg::StateSet* queryStateSet = new osg::StateSet;
|
||||
if (queryVisible)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue