Gazebo Rendering

API Reference

9.0.0~pre2
Ogre2SegmentationCamera.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 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_OGRE2SEGMENTATIONCAMERA_HH_
19#define GZ_RENDERING_OGRE2_OGRE2SEGMENTATIONCAMERA_HH_
20
21#ifdef _WIN32
22 // Ensure that Winsock2.h is included before Windows.h, which can get
23 // pulled in by anybody (e.g., Boost).
24 #include <Winsock2.h>
25#endif
26
27#include <memory>
28#include <string>
29
30#include <gz/common/Console.hh>
31#include <gz/common/Event.hh>
32
37
38namespace gz
39{
40 namespace rendering
41 {
42 inline namespace GZ_RENDERING_VERSION_NAMESPACE {
43 //
44 // Forward declaration
45 class Ogre2SegmentationCameraPrivate;
46
49 class GZ_RENDERING_OGRE2_VISIBLE Ogre2SegmentationCamera :
50 public virtual BaseSegmentationCamera<Ogre2Sensor>,
51 public virtual Ogre2ObjectInterface
52 {
55
57 public: virtual ~Ogre2SegmentationCamera();
58
59 // Documentation inherited
60 public: virtual void Init() override;
61
62 // Documentation inherited
63 public: virtual void Destroy() override;
64
65 // Documentation inherited
66 public: virtual void PreRender() override;
67
68 // Documentation inherited
69 public: virtual void PostRender() override;
70
71 // Documentation inherited.
72 public: virtual math::Matrix4d ProjectionMatrix() const override;
73
74 // Documentation inherited.
75 public: virtual void SetProjectionMatrix(
76 const math::Matrix4d &_matrix) override;
77
78 // Documentation inherited
79 public: virtual gz::common::ConnectionPtr
81 std::function<void(const uint8_t *, unsigned int, unsigned int,
82 unsigned int, const std::string &)> _subscriber) override;
83
84 // Documentation inherited
85 public: virtual void Render() override;
86
89 protected: virtual RenderTargetPtr RenderTarget() const override;
90
91 // Documentation inherited
92 public: void SetBackgroundLabel(int _label) override;
93
94 // Documentation inherited
96 uint8_t * _labelBuffer) const override;
97
98 // Documentation inherited.
99 public: virtual Ogre::Camera *OgreCamera() const override;
100
102 protected: void CreateCamera();
103
105 protected: virtual void CreateRenderTexture();
106
107 // Documentation inherited
108 protected: virtual void CreateSegmentationTexture() override;
109
111 protected: Ogre::Camera *ogreCamera = nullptr;
112
116
118 private: friend class Ogre2Scene;
119 };
120 }
121 }
122}
123#endif