1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 21:42:13 +00:00

Add basic support for distant terrain CLSB

(cherry picked from commit 0f9dc3e65b72e6fff762f7a0933bae6f861e5fd4)
This commit is contained in:
AnyOldName3 2018-02-05 23:03:18 +00:00
parent cb6767b4fc
commit 9ec59783ba
3 changed files with 18 additions and 0 deletions

View File

@ -282,6 +282,14 @@ namespace SceneUtil
popCurrentMask();
}
void MWShadow::ComputeLightSpaceBounds::apply(Terrain::QuadTreeWorld & quadTreeWorld)
{
// For now, just expand the bounds fully as terrain will fill them up and possible ways to detect which terrain definitely won't cast shadows aren't implemented.
update(osg::Vec3(-1.0, -1.0, 0.0));
update(osg::Vec3(1.0, 1.0, 0.0));
}
void MWShadow::ComputeLightSpaceBounds::apply(osg::Billboard&)
{
OSG_INFO << "Warning Billboards not yet supported" << std::endl;

View File

@ -4,6 +4,7 @@
#include <osgShadow/ShadowSettings>
#include <osgShadow/ViewDependentShadowMap>
#include <components/terrain/quadtreeworld.hpp>
#include <components/shader/shadermanager.hpp>
namespace SceneUtil
@ -34,6 +35,8 @@ namespace SceneUtil
void apply(osg::Drawable& drawable);
void apply(Terrain::QuadTreeWorld& quadTreeWorld);
void apply(osg::Billboard&);
void apply(osg::Projection&);

View File

@ -4,6 +4,8 @@
#include <sstream>
#include <components/sceneutil/shadow.hpp>
#include "quadtreenode.hpp"
#include "storage.hpp"
#include "viewdata.hpp"
@ -344,7 +346,12 @@ void loadRenderingNode(ViewData::Entry& entry, ViewData* vd, ChunkManager* chunk
void QuadTreeWorld::accept(osg::NodeVisitor &nv)
{
if (nv.getVisitorType() != osg::NodeVisitor::CULL_VISITOR && nv.getVisitorType() != osg::NodeVisitor::INTERSECTION_VISITOR)
{
SceneUtil::MWShadow::ComputeLightSpaceBounds* shadowBoundsVisitor = dynamic_cast<SceneUtil::MWShadow::ComputeLightSpaceBounds *>(&nv);
if (shadowBoundsVisitor)
shadowBoundsVisitor->apply(*this);
return;
}
ViewData* vd = mRootNode->getView(nv);