Gazebo Rendering

API Reference

3.7.2
gz/rendering/RenderTarget.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") = 0;
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_RENDERTARGET_HH_
18 #define GZ_RENDERING_RENDERTARGET_HH_
19 
20 #include <string>
21 
22 #include <gz/math/Color.hh>
23 
24 #include "gz/rendering/config.hh"
26 #include "gz/rendering/Image.hh"
27 #include "gz/rendering/Object.hh"
28 
29 namespace ignition
30 {
31  namespace rendering
32  {
33  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
34  //
37  class IGNITION_RENDERING_VISIBLE RenderTarget :
38  public virtual Object
39  {
41  public: virtual ~RenderTarget() { }
42 
45  public: virtual unsigned int Width() const = 0;
46 
49  public: virtual unsigned int Height() const = 0;
50 
53  public: virtual void SetWidth(const unsigned int _width) = 0;
54 
57  public: virtual void SetHeight(const unsigned int _height) = 0;
58 
61  public: virtual PixelFormat Format() const = 0;
62 
65  public: virtual void SetFormat(PixelFormat _format) = 0;
66 
73  public: virtual void Copy(Image &_image) const = 0;
74 
78  public: virtual math::Color BackgroundColor() const = 0;
79 
82  public: virtual void AddRenderPass(const RenderPassPtr &_pass) = 0;
83 
86  public: virtual void RemoveRenderPass(const RenderPassPtr &_pass) = 0;
87 
90  public: virtual unsigned int RenderPassCount() const = 0;
91 
94  public: virtual RenderPassPtr RenderPassByIndex(unsigned int _index)
95  const = 0;
96  };
97 
98  /* \class RenderTexture RenderTexture.hh \
99  * ignition/rendering/RenderTexture.hh
100  */
103  class IGNITION_RENDERING_VISIBLE RenderTexture :
104  public virtual RenderTarget
105  {
107  public: virtual ~RenderTexture() { }
108 
110  // if this is an OpenGL render texture
111  public: virtual unsigned int GLId() const = 0;
112  };
113 
114  /* \class RenderWindow RenderWindow.hh \
115  * ignition/rendering/RenderWindow.hh
116  */
119  class IGNITION_RENDERING_VISIBLE RenderWindow :
120  public virtual RenderTarget
121  {
123  public: virtual ~RenderWindow() { }
124 
127  public: virtual std::string Handle() const = 0;
128 
131  public: virtual void SetHandle(const std::string &_handle) = 0;
132 
135  public: virtual double DevicePixelRatio() const = 0;
136 
139  public: virtual void SetDevicePixelRatio(const double _ratio) = 0;
140 
144  public: virtual void OnResize(unsigned int _width,
145  unsigned int _height) = 0;
146 
148  public: virtual void OnMove() = 0;
149  };
150  }
151  }
152 }
153 #endif
STL class.
STL class.
virtual unsigned int RenderPassCount() const =0
Get the number of render passes applied to the render target.
Represents a off-screen render-texture to which cameras can render images.
Definition: gz/rendering/RenderTarget.hh:103
PixelFormat
Image pixel format types.
Definition: gz/rendering/PixelFormat.hh:32
virtual void AddRenderPass(const RenderPassPtr &_pass)=0
Add a render pass to the render target.
virtual void SetDevicePixelRatio(const double _ratio)=0
Set the device to pixel ratio.
Represents a on-screen render-window to which cameras can render images.
Definition: gz/rendering/RenderTarget.hh:119
Encapsulates a raw image buffer and relevant properties.
Definition: gz/rendering/Image.hh:36
virtual ~RenderWindow()
Deconstructor.
Definition: gz/rendering/RenderTarget.hh:123
virtual unsigned int Width() const =0
Get render target width in pixels.
virtual unsigned int Height() const =0
Get render target height in pixels.
virtual void Copy(Image &_image) const =0
Write rendered image to given Image. The RenderTarget will convert the underlying image to the specif...
virtual std::string Handle() const =0
Get the window handle that the render window is attached to.
virtual ~RenderTarget()
Destructor.
Definition: gz/rendering/RenderTarget.hh:41
virtual ~RenderTexture()
Deconstructor.
Definition: gz/rendering/RenderTarget.hh:107
virtual math::Color BackgroundColor() const =0
Get the background color of the render target. This should be the same as the scene background color.
virtual RenderPassPtr RenderPassByIndex(unsigned int _index) const =0
Get a render pass by index.
Represents a render-target to which cameras can render images.
Definition: gz/rendering/RenderTarget.hh:37
virtual void OnResize(unsigned int _width, unsigned int _height)=0
Alert the window of a window resize event.
virtual void SetHandle(const std::string &_handle)=0
Set the window handle to attach the render window to.
virtual double DevicePixelRatio() const =0
Get the device to pixel ratio.
Represents an object present in the scene graph. This includes sub-meshes, materials,...
Definition: gz/rendering/Object.hh:34
virtual PixelFormat Format() const =0
Set the render target image format.
virtual void SetWidth(const unsigned int _width)=0
Set the render target width in pixels.
virtual void RemoveRenderPass(const RenderPassPtr &_pass)=0
Remove a render pass from the render target.
virtual void SetHeight(const unsigned int _height)=0
Set the render target height in pixels.
virtual void OnMove()=0
Alert the window of a window move event.
virtual void SetFormat(PixelFormat _format)=0
Set the render target image format.
virtual unsigned int GLId() const =0
Returns the OpenGL texture Id. A valid Id is returned only.