17 #ifndef GZ_RENDERING_BASE_BASERENDERTARGET_HH_
18 #define GZ_RENDERING_BASE_BASERENDERTARGET_HH_
31 #if defined(__GNUC__) || defined(__clang__)
32 # pragma GCC diagnostic push
33 # pragma GCC diagnostic ignored "-Woverloaded-virtual"
40 inline namespace GZ_RENDERING_VERSION_NAMESPACE {
60 public:
virtual unsigned int Width()
const override;
62 public:
virtual void SetWidth(
const unsigned int _width)
override;
64 public:
virtual unsigned int Height()
const override;
66 public:
virtual void SetHeight(
const unsigned int _height)
override;
71 bool _reinterpretable =
false)
override;
102 protected:
bool reinterpretable =
false;
104 protected:
bool targetDirty =
true;
107 protected:
bool renderPassDirty =
false;
109 protected:
unsigned int width = 0u;
111 protected:
unsigned int height = 0u;
127 public:
virtual unsigned int GLId()
const override;
130 public:
virtual void MetalId(
void *_textureIdPtr)
const override;
150 public:
virtual void OnResize(
const unsigned int _width,
151 const unsigned int _height);
157 protected:
double ratio = 1.0;
179 for (
auto &pass : this->renderPasses)
180 pass->PreRender(_camera);
202 if (this->targetDirty)
205 this->targetDirty =
false;
220 this->width = _width;
221 this->targetDirty =
true;
235 this->height = _height;
236 this->targetDirty =
true;
249 bool _reinterpretable)
252 this->reinterpretable = _reinterpretable;
253 this->targetDirty =
true;
260 return this->reinterpretable;
274 this->renderPasses.push_back(_pass);
275 this->renderPassDirty =
true;
282 auto it =
std::find(this->renderPasses.begin(), this->renderPasses.end(),
284 if (it != this->renderPasses.end())
287 this->renderPasses.erase(it);
288 this->renderPassDirty =
true;
296 if (!this->renderPasses.empty())
300 renderPass->Destroy();
302 this->renderPasses.clear();
303 this->renderPassDirty =
true;
311 return this->renderPasses.size();
319 if (_index > this->renderPasses.size())
321 gzerr <<
"RenderPass index out of range: " << _index <<
std::endl;
324 return this->renderPasses[_index];
379 this->handle = _handle;
380 this->targetDirty =
true;
394 this->ratio = _ratio;
395 this->targetDirty =
true;
401 const unsigned int _height)
403 this->width = _width;
404 this->height = _height;
405 this->targetDirty =
true;
412 this->targetDirty =
true;
418 #if defined(__GNUC__) || defined(__clang__)
419 # pragma GCC diagnostic pop