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"
28
29namespace gz
30{
31 namespace rendering
32 {
33 inline namespace GZ_RENDERING_VERSION_NAMESPACE {
34 //
37 class GZ_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
68 public: virtual void SetFormat(PixelFormat _format,
69 bool _reinterpretable = false) = 0;
70
73 public: virtual bool Reinterpretable() const = 0;
74
81 public: virtual void Copy(Image &_image) const = 0;
82
86 public: virtual math::Color BackgroundColor() const = 0;
87
88 // Documentation inherited
89 public: using Object::PreRender;
90
95 public: virtual void PreRender(const CameraPtr &_camera) = 0;
96
99 public: virtual void AddRenderPass(const RenderPassPtr &_pass) = 0;
100
103 public: virtual void RemoveRenderPass(const RenderPassPtr &_pass) = 0;
104
106 public: virtual void RemoveAllRenderPasses() = 0;
107
110 public: virtual unsigned int RenderPassCount() const = 0;
111
114 public: virtual RenderPassPtr RenderPassByIndex(unsigned int _index)
115 const = 0;
116 };
117
118 /* \class RenderTexture RenderTexture.hh \
119 * gz/rendering/RenderTexture.hh
120 */
123 class GZ_RENDERING_VISIBLE RenderTexture :
124 public virtual RenderTarget
125 {
127 public: virtual ~RenderTexture();
128
130 // if this is an OpenGL render texture
131 public: virtual unsigned int GLId() const = 0;
132
138 public: virtual void MetalId(void *_textureIdPtr) const = 0;
139 };
140
141 /* \class RenderWindow RenderWindow.hh \
142 * gz/rendering/RenderWindow.hh
143 */
146 class GZ_RENDERING_VISIBLE RenderWindow :
147 public virtual RenderTarget
148 {
150 public: virtual ~RenderWindow();
151
154 public: virtual std::string Handle() const = 0;
155
158 public: virtual void SetHandle(const std::string &_handle) = 0;
159
162 public: virtual double DevicePixelRatio() const = 0;
163
166 public: virtual void SetDevicePixelRatio(const double _ratio) = 0;
167
171 public: virtual void OnResize(unsigned int _width,
172 unsigned int _height) = 0;
173
175 public: virtual void OnMove() = 0;
176 };
177 }
178 }
179}
180#endif