Gazebo Rendering

API Reference

6.6.3
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"
28 
29 #ifdef _MSC_VER
30  #pragma warning(push, 0)
31 #endif
32 #include <OgreCamera.h>
33 #include <OgreMaterial.h>
34 #ifdef _MSC_VER
35  #pragma warning(pop)
36 #endif
37 
38 namespace ignition
39 {
40  namespace rendering
41  {
42  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
43  //
44  // forward declarations
45  class Ogre2SelectionBuffer;
46 
48  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2MaterialSwitcher :
49  public Ogre::Camera::Listener
50  {
52  public: explicit Ogre2MaterialSwitcher(Ogre2ScenePtr _scene);
53 
55  public: ~Ogre2MaterialSwitcher();
56 
59  public: std::string EntityName(
60  const ignition::math::Color &_color) const;
61 
63  public: void Reset();
64 
68  public: virtual void cameraPreRenderScene(
69  Ogre::Camera *_cam) override;
70 
74  public: virtual void cameraPostRenderScene(Ogre::Camera *_cam) override;
75 
77  private: gz::math::Color currentColor;
78 
81  private: std::map<unsigned int, std::string> colorDict;
82 
85 
88  private: Ogre::MaterialPtr plainMaterial;
89 
93  private: Ogre::MaterialPtr plainOverlayMaterial;
94 
97  private: void NextColor();
98 
101  public: friend class Ogre2SelectionBuffer;
102 
104  private: Ogre2ScenePtr scene;
105  };
106  }
107  }
108 }
109 #endif
STL class.
STL class.
Helper class to assign unique colors to renderables.
Definition: gz/rendering/ogre2/Ogre2MaterialSwitcher.hh:48
Generates a selection buffer object for a given camera. The selection buffer is used of entity select...
Definition: gz/rendering/ogre2/Ogre2SelectionBuffer.hh:47