mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-01 07:09:41 +00:00
Add specific shadow source files to MWRender
This commit is contained in:
parent
ba1e2cab2f
commit
0568c93b39
4 changed files with 41 additions and 6 deletions
|
@ -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);
|
||||
|
|
11
apps/openmw/mwrender/shadow.cpp
Normal file
11
apps/openmw/mwrender/shadow.cpp
Normal 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);
|
||||
}
|
||||
}
|
27
apps/openmw/mwrender/shadow.hpp
Normal file
27
apps/openmw/mwrender/shadow.hpp
Normal 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
|
Loading…
Reference in a new issue