Gazebo Rendering

API Reference

3.7.2
gz/rendering/ogre2/Ogre2MaterialSwitcher.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_OGRE2_OGRE2MATERIALSWITCHER_HH_
19 #define GZ_RENDERING_OGRE2_OGRE2MATERIALSWITCHER_HH_
20 
21 #include <map>
22 #include <string>
23 
24 #include <gz/math/Color.hh>
25 #include "gz/rendering/config.hh"
26 #include "gz/rendering/ogre2/Export.hh"
29 
30 namespace ignition
31 {
32  namespace rendering
33  {
34  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
35  //
36  // forward declarations
37  class Ogre2SelectionBuffer;
38 
40  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2MaterialSwitcher :
41  public Ogre::RenderTargetListener
42  {
44  public: explicit Ogre2MaterialSwitcher(Ogre2ScenePtr _scene);
45 
47  public: ~Ogre2MaterialSwitcher();
48 
51  public: std::string EntityName(
52  const gz::math::Color &_color) const;
53 
55  public: void Reset();
56 
60  public: virtual void preRenderTargetUpdate(
61  const Ogre::RenderTargetEvent &_evt);
62 
66  public: virtual void postRenderTargetUpdate(
67  const Ogre::RenderTargetEvent &_evt);
68 
70  private: gz::math::Color currentColor;
71 
74  private: std::map<unsigned int, std::string> colorDict;
75 
78 
81  private: Ogre::MaterialPtr plainMaterial;
82 
86  private: Ogre::MaterialPtr plainOverlayMaterial;
87 
90  private: void NextColor();
91 
94  public: friend class Ogre2SelectionBuffer;
95 
97  private: Ogre2ScenePtr scene;
98  };
99  }
100  }
101 }
102 #endif
STL class.
STL class.
Helper class to assign unique colors to renderables.
Definition: gz/rendering/ogre2/Ogre2MaterialSwitcher.hh:40
Generates a selection buffer object for a given camera. The selection buffer is used of entity select...
Definition: gz/rendering/ogre2/Ogre2SelectionBuffer.hh:47