Gazebo Rendering

API Reference

7.4.2
gz/rendering/ogre/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  public common::SingletonT<OgreRTShaderSystem>
47  {
50  public: enum LightingModel
51  {
61  SSLM_NormalMapLightingObjectSpace
62  };
63 
65  private: OgreRTShaderSystem();
66 
68  private: virtual ~OgreRTShaderSystem();
69 
73  public: bool Init();
74 
76  public: void Fini();
77 
79  public: void Clear();
80 
83  public: void AddScene(OgreScenePtr _scene);
84 
87  public: void RemoveScene(OgreScenePtr _scene);
88 
91  public: void RemoveScene(const std::string &_scene);
92 
94  public: void UpdateShaders();
95 
98  public: void AttachEntity(OgreSubMesh *_vis);
99 
102  public: void DetachEntity(OgreSubMesh *_vis);
103 
107  public: static void AttachViewport(Ogre::Viewport *_viewport,
108  OgreScenePtr _scene);
109 
113  public: static void DetachViewport(Ogre::Viewport *_viewport,
114  OgreScenePtr _scene);
115 
118  public: void SetPerPixelLighting(bool _set);
119 
122  public: void RemoveShaders(OgreSubMesh *_subMesh);
123 
126  public: void GenerateShaders(OgreSubMesh *_subMesh);
127 
130  public: void ApplyShadows(OgreScenePtr _scene);
131 
134  public: void RemoveShadows(OgreScenePtr _scene);
135 
138  public: Ogre::PSSMShadowCameraSetup *PSSMShadowCameraSetup() const;
139 
144  private: bool Paths(std::string &_coreLibsPath,
145  std::string &_cachePath);
146 
151  public: bool SetShadowTextureSize(const unsigned int _size);
152 
155  public: unsigned int ShadowTextureSize() const;
156 
159  public: bool IsInitialized() const;
160 
169  public: void Update();
170 
174  public: static OgreRTShaderSystem *Instance();
175 
177  private: friend class common::SingletonT<OgreRTShaderSystem>;
178 
181  };
183  }
184  }
185 }
186 #endif