1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-29 04:06:40 +00:00

Add specific shadow source files to MWRender

This commit is contained in:
AnyOldName3 2017-10-03 03:40:23 +01:00
parent ba1e2cab2f
commit 0568c93b39
4 changed files with 41 additions and 6 deletions

View file

@ -24,6 +24,7 @@ add_openmw_dir (mwrender
creatureanimation effectmanager util renderinginterface pathgrid rendermode weaponanimation creatureanimation effectmanager util renderinginterface pathgrid rendermode weaponanimation
bulletdebugdraw globalmap characterpreview camera localmap water terrainstorage ripplesimulation bulletdebugdraw globalmap characterpreview camera localmap water terrainstorage ripplesimulation
renderbin actoranimation landmanager renderbin actoranimation landmanager
shadow
) )
add_openmw_dir (mwinput add_openmw_dir (mwinput

View file

@ -14,11 +14,6 @@
#include <osg/ComputeBoundsVisitor> #include <osg/ComputeBoundsVisitor>
#include <osgShadow/ShadowedScene> #include <osgShadow/ShadowedScene>
#include <osgShadow/ViewDependentShadowMap>
#include <osgShadow/ShadowMap>
#include <osgShadow/ParallelSplitShadowMap>
#include <osgShadow/ShadowMap>
#include <osgShadow/LightSpacePerspectiveShadowMap>
#include <osgUtil/LineSegmentIntersector> #include <osgUtil/LineSegmentIntersector>
#include <osgUtil/IncrementalCompileOperation> #include <osgUtil/IncrementalCompileOperation>
@ -57,6 +52,7 @@
#include "water.hpp" #include "water.hpp"
#include "terrainstorage.hpp" #include "terrainstorage.hpp"
#include "util.hpp" #include "util.hpp"
#include "shadow.hpp"
namespace MWRender namespace MWRender
{ {
@ -228,7 +224,7 @@ namespace MWRender
int mapres = 2048; int mapres = 2048;
settings->setTextureSize(osg::Vec2s(mapres,mapres)); settings->setTextureSize(osg::Vec2s(mapres,mapres));
osgShadow::MinimalShadowMap* tech = new osgShadow::LightSpacePerspectiveShadowMapDB(); MWShadow* tech = new MWShadow();
shadowedScene->setShadowTechnique(tech); shadowedScene->setShadowTechnique(tech);
tech->setMaxFarPlane(0); tech->setMaxFarPlane(0);

View file

@ -0,0 +1,11 @@
#include "shadow.hpp"
namespace MWRender
{
void MWShadow::ViewData::init(MWShadow * st, osgUtil::CullVisitor * cv)
{
LightSpacePerspectiveShadowMapDB::ViewData::init(st, cv);
osg::StateSet * stateset = _camera->getOrCreateStateSet();
stateset->removeAttribute(osg::StateAttribute::CULLFACE);
}
}

View file

@ -0,0 +1,27 @@
#ifndef OPENMW_MWRENDER_SHADOW_H
#define OPENMW_MWRENDER_SHADOW_H
#include <osgShadow/LightSpacePerspectiveShadowMap>
namespace MWRender
{
class MWShadow : public osgShadow::LightSpacePerspectiveShadowMapDB
{
protected:
struct ViewData : public LightSpacePerspectiveShadowMapDB::ViewData
{
virtual void init(MWShadow * st, osgUtil::CullVisitor * cv);
};
virtual ViewDependentShadowTechnique::ViewData * initViewDependentData(osgUtil::CullVisitor *cv, ViewDependentShadowTechnique::ViewData * vd)
{
MWShadow::ViewData* td = dynamic_cast<MWShadow::ViewData*>(vd);
if (!td)
td = new MWShadow::ViewData;
td->init(this, cv);
return td;
}
};
}
#endif //OPENMW_MWRENDER_SHADOW_H