Add specific shadow source files to MWRender

pull/1547/head
AnyOldName3 7 years ago
parent ba1e2cab2f
commit 0568c93b39

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

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

@ -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);
}
}

@ -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
Loading…
Cancel
Save