Gazebo Rendering

API Reference

6.6.3
gz/rendering/ogre/OgreMaterialSwitcher.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 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 GZ_RENDERING_OGRE_OGREMATERIALSWITCHER_HH_
19 #define GZ_RENDERING_OGRE_OGREMATERIALSWITCHER_HH_
20 
21 #include <map>
22 #include <string>
23 
24 #include <gz/common/SuppressWarning.hh>
25 #include <gz/math/Color.hh>
26 #include "gz/rendering/config.hh"
27 #include "gz/rendering/ogre/Export.hh"
30 
31 namespace ignition
32 {
33  namespace rendering
34  {
35  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
36  //
37  // forward declarations
38  class OgreSelectionBuffer;
39 
41  class IGNITION_RENDERING_OGRE_VISIBLE OgreMaterialSwitcher :
42 // Ogre::MaterialManager::Listener isn't a dll-interface class, this may cause
43 // issues
44 #ifdef _MSC_VER
45  #pragma warning(push)
46  #pragma warning(disable:4275)
47 #endif
48  public Ogre::MaterialManager::Listener,
49 #ifdef _MSC_VER
50  #pragma warning(pop)
51 #endif
52  Ogre::RenderTargetListener
53  {
55  public: OgreMaterialSwitcher();
56 
58  public: ~OgreMaterialSwitcher();
59 
62  public: std::string EntityName(
63  const gz::math::Color &_color) const;
64 
66  public: void Reset();
67 
78  public: virtual Ogre::Technique *handleSchemeNotFound(
79  uint16_t _schemeIndex, const Ogre::String &_schemeName,
80  Ogre::Material *_originalMaterial, uint16_t _lodIndex,
81  const Ogre::Renderable *_rend);
82 
86  public: virtual void preRenderTargetUpdate(
87  const Ogre::RenderTargetEvent &_evt);
88 
92  public: virtual void postRenderTargetUpdate(
93  const Ogre::RenderTargetEvent &_evt);
94 
96  private: gz::math::Color currentColor;
97 
99  private: std::string lastEntity;
100 
102  private: Ogre::Technique *lastTechnique = nullptr;
103 
107  private: std::map<unsigned int, std::string> colorDict;
109 
112  private: void NextColor();
113 
116  public: friend class OgreSelectionBuffer;
117 
119  private: Ogre::Technique *plainTechnique = nullptr;
120 
122  private: Ogre::Technique *overlayTechnique = nullptr;
123  };
124  }
125  }
126 }
127 #endif
STL class.
#define IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
Helper class to assign unique colors to renderables.
Definition: gz/rendering/ogre/OgreMaterialSwitcher.hh:41
Generates a selection buffer object for a given camera. The selection buffer is used of entity select...
Definition: gz/rendering/ogre/OgreSelectionBuffer.hh:47
#define IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING