CustomPSSMShadowCameraSetup.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16*/
17
18#ifndef GAZEBO_RENDERING_CUSTOMPSSMSHADOWCAMERASETUP_HH_
19#define GAZEBO_RENDERING_CUSTOMPSSMSHADOWCAMERASETUP_HH_
20
22
23#include "gazebo/util/system.hh"
24
25namespace gazebo
26{
27 namespace rendering
28 {
31 class GAZEBO_VISIBLE CustomPSSM3 : public Ogre::RTShader::IntegratedPSSM3
32 {
34 public: CustomPSSM3() {}
35
36 // Documentation inherited
37 public: virtual const Ogre::String &getType() const override;
38
44 protected: virtual bool resolveParameters(
45 Ogre::RTShader::ProgramSet *_programSet) override;
46
48 public: static Ogre::String Type;
49 };
50
54 public Ogre::RTShader::SubRenderStateFactory
55 {
56 // Documentation inherited.
57 public: virtual const Ogre::String &getType() const override;
58
59 // Documentation inherited.
60 public: virtual Ogre::RTShader::SubRenderState *createInstance(
61 Ogre::ScriptCompiler *_compiler,
62 Ogre::PropertyAbstractNode *_prop,
63 Ogre::Pass *_pass,
64 Ogre::RTShader::SGScriptTranslator *_translator) override;
65
66 // Documentation inherited
67 protected: virtual Ogre::RTShader::SubRenderState *createInstanceImpl()
68 override;
69 };
70
90 : public Ogre::PSSMShadowCameraSetup
91 {
94
97
100 void calculateShadowMappingMatrix(const Ogre::SceneManager &_sm,
101 const Ogre::Camera &_cam, const Ogre::Light &_light,
102 Ogre::Matrix4 *_out_view, Ogre::Matrix4 *_outProj,
103 Ogre::Camera *_outCam) const;
104
108 public: Ogre::Matrix4 buildViewMatrix(const Ogre::Vector3 &_pos,
109 const Ogre::Vector3 &_dir, const Ogre::Vector3 & _up) const;
110
114 public: virtual void getZUpFocusedShadowCamera(
115 const Ogre::SceneManager *_sm, const Ogre::Camera *_cam,
116 const Ogre::Viewport *_vp, const Ogre::Light *_light,
117 Ogre::Camera *_texCam, size_t _iteration) const;
118
121 public: virtual void getShadowCamera(const Ogre::SceneManager *_sm,
122 const Ogre::Camera *_cam, const Ogre::Viewport *_vp,
123 const Ogre::Light *_light, Ogre::Camera *_texCam, size_t _iteration)
124 const override;
125 };
126
131 public Ogre::RTShader::GLSLProgramWriter
132 {
135
137 public: ~CustomGLSLProgramWriter() = default;
138 };
139
142 public Ogre::RTShader::ProgramWriterFactory
143 {
146
149
152 public: const Ogre::String &getTargetLanguage() const override;
153
156 public: virtual Ogre::RTShader::ProgramWriter* create() override;
157 };
158 }
159}
160
161#endif
rendering
Definition RenderEngine.hh:31
A factory to create our own CustomGLSLProgramWriter.
Definition CustomPSSMShadowCameraSetup.hh:143
virtual Ogre::RTShader::ProgramWriter * create() override
Creates the GLSLProgramWriter.
const Ogre::String & getTargetLanguage() const override
Get shader language supported by this factory.
This overrides ogre's default GLSLProgramWriter to fix a bug in ogre versions <= 1....
Definition CustomPSSMShadowCameraSetup.hh:132
A factory that enables creation of CustomPSSM3 instances.
Definition CustomPSSMShadowCameraSetup.hh:55
virtual Ogre::RTShader::SubRenderState * createInstanceImpl() override
virtual const Ogre::String & getType() const override
virtual Ogre::RTShader::SubRenderState * createInstance(Ogre::ScriptCompiler *_compiler, Ogre::PropertyAbstractNode *_prop, Ogre::Pass *_pass, Ogre::RTShader::SGScriptTranslator *_translator) override
Custom PSSM shadow receiver that overrides one deficient method in IntegratedPSSM3.
Definition CustomPSSMShadowCameraSetup.hh:32
static Ogre::String Type
Type of sub render state.
Definition CustomPSSMShadowCameraSetup.hh:48
virtual const Ogre::String & getType() const override
virtual bool resolveParameters(Ogre::RTShader::ProgramSet *_programSet) override
This is a duplicate of the method from the parent class with one line changed to use sampler2DShadow,...
CustomPSSM3()
Constructor.
Definition CustomPSSMShadowCameraSetup.hh:34
Parallel Split Shadow Map (PSSM) shadow camera setup.
Definition CustomPSSMShadowCameraSetup.hh:91
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
The same as FocusedShadowCameraSetup::ShadowCameraSetup() except resulting light frusta are z-up inst...
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
Returns a shadow camera with PSSM splits based on iteration.
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
lightly modified FocusedShadowCameraSetup::calculateShadowMappingMatrix().
Ogre::Matrix4 buildViewMatrix(const Ogre::Vector3 &_pos, const Ogre::Vector3 &_dir, const Ogre::Vector3 &_up) const
The same as FocusedShadowCameraSetup::buildViewMatrix() except resulting matrices are z-up instead of...
CustomPSSMShadowCameraSetup()
Constructor, defaults to 3 splits.
Forward declarations for the common classes.
Definition Animation.hh:27
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition system.hh:59