##

CustomPSSMShadowCameraSetup.hh
Go to the documentation of this file.
/*
* Copyright (C) 2017 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_RENDERING_CUSTOMPSSMSHADOWCAMERASETUP_HH_
#define GAZEBO_RENDERING_CUSTOMPSSMSHADOWCAMERASETUP_HH_
#include "gazebo/rendering/ogre_gazebo.h"
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace rendering
{
class GAZEBO_VISIBLE CustomPSSM3 : public Ogre::RTShader::IntegratedPSSM3
{
public: CustomPSSM3() {}
// Documentation inherited
public: virtual const Ogre::String &getType() const override;
protected: virtual bool resolveParameters(
Ogre::RTShader::ProgramSet *_programSet) override;
public: static Ogre::String Type;
};
class GAZEBO_VISIBLE CustomPSSM3Factory :
public Ogre::RTShader::SubRenderStateFactory
{
// Documentation inherited.
public: virtual const Ogre::String &getType() const override;
// Documentation inherited.
public: virtual Ogre::RTShader::SubRenderState *createInstance(
Ogre::ScriptCompiler *_compiler,
Ogre::PropertyAbstractNode *_prop,
Ogre::Pass *_pass,
Ogre::RTShader::SGScriptTranslator *_translator) override;
// Documentation inherited
protected: virtual Ogre::RTShader::SubRenderState *createInstanceImpl()
override;
};
class GAZEBO_VISIBLE CustomPSSMShadowCameraSetup
: public Ogre::PSSMShadowCameraSetup
{
public: CustomPSSMShadowCameraSetup();
public: ~CustomPSSMShadowCameraSetup();
void calculateShadowMappingMatrix(const Ogre::SceneManager &_sm,
const Ogre::Camera &_cam, const Ogre::Light &_light,
Ogre::Matrix4 *_out_view, Ogre::Matrix4 *_outProj,
Ogre::Camera *_outCam) const;
public: Ogre::Matrix4 buildViewMatrix(const Ogre::Vector3 &_pos,
const Ogre::Vector3 &_dir, const Ogre::Vector3 & _up) const;
public: virtual void getZUpFocusedShadowCamera(
const Ogre::SceneManager *_sm, const Ogre::Camera *_cam,
const Ogre::Viewport *_vp, const Ogre::Light *_light,
Ogre::Camera *_texCam, size_t _iteration) const;
public: virtual void getShadowCamera(const Ogre::SceneManager *_sm,
const Ogre::Camera *_cam, const Ogre::Viewport *_vp,
const Ogre::Light *_light, Ogre::Camera *_texCam, size_t _iteration)
const override;
};
class GAZEBO_VISIBLE CustomGLSLProgramWriter :
public Ogre::RTShader::GLSLProgramWriter
{
public: CustomGLSLProgramWriter();
public: ~CustomGLSLProgramWriter() = default;
};
class GAZEBO_VISIBLE CustomGLSLProgramWriterFactory :
public Ogre::RTShader::ProgramWriterFactory
{
public: CustomGLSLProgramWriterFactory();
public: ~CustomGLSLProgramWriterFactory() = default;
public: const Ogre::String &getTargetLanguage() const override;
public: virtual Ogre::RTShader::ProgramWriter* create() override;
};
}
}
#endif
gazebo::rendering::CustomGLSLProgramWriterFactory
A factory to create our own CustomGLSLProgramWriter.
Definition: CustomPSSMShadowCameraSetup.hh:141
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::rendering::CustomPSSM3::Type
static Ogre::String Type
Type of sub render state.
Definition: CustomPSSMShadowCameraSetup.hh:48
gazebo::rendering::CustomPSSM3::CustomPSSM3
CustomPSSM3()
Constructor.
Definition: CustomPSSMShadowCameraSetup.hh:34
gazebo::rendering::CustomPSSM3
Custom PSSM shadow receiver that overrides one deficient method in IntegratedPSSM3.
Definition: CustomPSSMShadowCameraSetup.hh:31
system.hh
gazebo::rendering::CustomPSSMShadowCameraSetup
Parallel Split Shadow Map (PSSM) shadow camera setup.
Definition: CustomPSSMShadowCameraSetup.hh:89
rendering
rendering
Definition: RenderEngine.hh:31
gazebo::rendering::CustomGLSLProgramWriter
This overrides ogre's default GLSLProgramWriter to fix a bug in ogre versions <= 1....
Definition: CustomPSSMShadowCameraSetup.hh:130
gazebo::rendering::CustomPSSM3Factory
A factory that enables creation of CustomPSSM3 instances.
Definition: CustomPSSMShadowCameraSetup.hh:53
ogre_gazebo.h
GAZEBO_VISIBLE
#define GAZEBO_VISIBLE
Definition: system.hh:59