2017-11-08 01:44:49 +00:00
|
|
|
#ifndef COMPONENTS_SCENEUTIL_SHADOW_H
|
|
|
|
#define COMPONENTS_SCENEUTIL_SHADOW_H
|
2017-10-03 02:40:23 +00:00
|
|
|
|
2017-12-27 02:32:17 +00:00
|
|
|
#include <osgShadow/ShadowSettings>
|
2017-10-11 19:47:19 +00:00
|
|
|
#include <osgShadow/ViewDependentShadowMap>
|
2017-10-03 02:40:23 +00:00
|
|
|
|
2017-11-22 20:07:07 +00:00
|
|
|
#include <components/shader/shadermanager.hpp>
|
|
|
|
|
2017-11-08 01:44:49 +00:00
|
|
|
namespace SceneUtil
|
2017-10-03 02:40:23 +00:00
|
|
|
{
|
2017-10-11 19:47:19 +00:00
|
|
|
class MWShadow : public osgShadow::ViewDependentShadowMap
|
2017-10-03 02:40:23 +00:00
|
|
|
{
|
2017-10-11 19:47:19 +00:00
|
|
|
public:
|
2017-12-27 02:32:17 +00:00
|
|
|
static void setupShadowSettings(osg::ref_ptr<osgShadow::ShadowSettings> settings, int castsShadowMask);
|
2017-11-07 00:32:04 +00:00
|
|
|
|
2017-12-27 02:32:17 +00:00
|
|
|
static void disableShadowsForStateSet(osg::ref_ptr<osg::StateSet> stateSet);
|
2017-10-11 19:47:19 +00:00
|
|
|
|
2017-12-27 02:32:17 +00:00
|
|
|
MWShadow();
|
2017-11-05 14:46:03 +00:00
|
|
|
|
2017-10-11 19:47:19 +00:00
|
|
|
virtual void cull(osgUtil::CullVisitor& cv);
|
2017-11-22 20:07:07 +00:00
|
|
|
|
|
|
|
virtual Shader::ShaderManager::DefineMap getShadowDefines();
|
|
|
|
|
|
|
|
virtual Shader::ShaderManager::DefineMap getShadowsDisabledDefines();
|
2017-10-03 02:40:23 +00:00
|
|
|
protected:
|
2017-11-03 14:33:06 +00:00
|
|
|
const int debugTextureUnit;
|
|
|
|
|
2017-11-07 00:32:04 +00:00
|
|
|
std::vector<osg::ref_ptr<osg::Camera>> debugCameras;
|
2017-10-11 19:47:19 +00:00
|
|
|
|
|
|
|
osg::ref_ptr<osg::Program> debugProgram;
|
|
|
|
|
2017-11-07 00:32:04 +00:00
|
|
|
std::vector<osg::ref_ptr<osg::Node>> debugGeometry;
|
2017-12-27 02:32:17 +00:00
|
|
|
|
|
|
|
const int numberOfShadowMapsPerLight;
|
|
|
|
const bool enableShadows;
|
|
|
|
const bool debugHud;
|
|
|
|
|
|
|
|
const int baseShadowTextureUnit;
|
2017-10-03 02:40:23 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-11-08 01:44:49 +00:00
|
|
|
#endif //COMPONENTS_SCENEUTIL_SHADOW_H
|