Gazebo Rendering

API Reference

8.2.0
OgreRTShaderSystem.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 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 #ifndef GZ_RENDERING_OGRE_OGRERTSHADERSYSTEM_HH_
18 #define GZ_RENDERING_OGRE_OGRERTSHADERSYSTEM_HH_
19 
20 #include <memory>
21 #include <string>
22 
23 #include <gz/common/SingletonT.hh>
26 #include "gz/rendering/ogre/Export.hh"
27 
28 namespace gz
29 {
30  namespace rendering
31  {
32  inline namespace GZ_RENDERING_VERSION_NAMESPACE {
33  //
34  // forward declaration
35  class OgreRTShaderSystemPrivate;
36 
39 
45  class GZ_RENDERING_OGRE_VISIBLE OgreRTShaderSystem
46  {
49  public: enum LightingModel
50  {
60  SSLM_NormalMapLightingObjectSpace
61  };
62 
64  private: OgreRTShaderSystem();
65 
67  private: virtual ~OgreRTShaderSystem();
68 
72  public: bool Init();
73 
75  public: void Fini();
76 
78  public: void Clear();
79 
82  public: void AddScene(OgreScenePtr _scene);
83 
86  public: void RemoveScene(OgreScenePtr _scene);
87 
90  public: void RemoveScene(const std::string &_scene);
91 
93  public: void UpdateShaders();
94 
97  public: void AttachEntity(OgreSubMesh *_vis);
98 
101  public: void DetachEntity(OgreSubMesh *_vis);
102 
106  public: static void AttachViewport(Ogre::Viewport *_viewport,
107  OgreScenePtr _scene);
108 
112  public: static void DetachViewport(Ogre::Viewport *_viewport,
113  OgreScenePtr _scene);
114 
117  public: void SetPerPixelLighting(bool _set);
118 
121  public: void RemoveShaders(OgreSubMesh *_subMesh);
122 
125  public: void GenerateShaders(OgreSubMesh *_subMesh);
126 
129  public: void ApplyShadows(OgreScenePtr _scene);
130 
133  public: void RemoveShadows(OgreScenePtr _scene);
134 
137  public: Ogre::PSSMShadowCameraSetup *PSSMShadowCameraSetup() const;
138 
143  private: bool Paths(std::string &_coreLibsPath,
144  std::string &_cachePath);
145 
150  public: bool SetShadowTextureSize(const unsigned int _size);
151 
154  public: unsigned int ShadowTextureSize() const;
155 
158  public: bool IsInitialized() const;
159 
168  public: void Update();
169 
172  public: static OgreRTShaderSystem *Instance();
173 
175  private: friend class common::SingletonT<OgreRTShaderSystem>;
176 
179  };
181  }
182  }
183 }
184 #endif