NAP
rendertexture2d.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4 
5 #pragma once
6 
7 // Local Includes
8 #include "texture.h"
9 #include "irendertarget.h"
10 
11 // External Includes
12 #include <color.h>
13 
14 namespace nap
15 {
16  // Forward Declares
17  class Core;
18 
24  class NAPAPI RenderTexture2D : public Texture2D
25  {
26  RTTI_ENABLE(Texture2D)
27  public:
31  enum class EFormat
32  {
33  RGBA8,
34  BGRA8,
35  R8,
36  RGBA16,
37  R16,
38  RGBA32,
39  R32
40  };
41 
42  RenderTexture2D(Core& core);
43 
49  virtual bool init(utility::ErrorState& errorState) override;
50 
54  virtual const ImageData& getHandle() const override { return mImageData; }
55 
56  int mWidth = 0;
57  int mHeight = 0;
59  EFormat mColorFormat = EFormat::RGBA8;
60  RGBAColorFloat mClearColor = { 0.0f, 0.0f, 0.0f, 0.0f };
61  };
62 
63 
69  class NAPAPI DepthRenderTexture2D : public Texture2D
70  {
71  friend class DepthRenderTarget;
72  RTTI_ENABLE(Texture2D)
73  public:
77  enum class EDepthFormat
78  {
79  D16,
80  D32
81  };
82 
84 
90  virtual bool init(utility::ErrorState& errorState) override;
91 
95  virtual const ImageData& getHandle() const override { return mImageData; }
96 
97  int mWidth = 0;
98  int mHeight = 0;
100  EDepthFormat mDepthFormat = EDepthFormat::D16;
101  float mClearValue = 1.0f;
102  bool mFill = false;
103  };
104 }
nap::DepthRenderTexture2D
Definition: rendertexture2d.h:69
nap::RGBAColor< float >
nap::EColorSpace::Linear
@ Linear
Linear color space.
nap::DepthRenderTexture2D::getHandle
virtual const ImageData & getHandle() const override
Definition: rendertexture2d.h:95
nap::utility::ErrorState
Definition: errorstate.h:19
nap::DepthRenderTarget
Definition: depthrendertarget.h:49
nap::Texture2D
Definition: texture.h:128
nap::ImageData
Definition: imagedata.h:23
nap::Core
Definition: core.h:82
nap::RenderTexture2D::getHandle
virtual const ImageData & getHandle() const override
Definition: rendertexture2d.h:54
nap
Definition: templateapp.h:17
nap::RenderTexture2D::EFormat
EFormat
Definition: rendertexture2d.h:31
nap::EColorSpace
EColorSpace
Definition: surfacedescriptor.h:37
nap::DepthRenderTexture2D::EDepthFormat
EDepthFormat
Definition: rendertexture2d.h:77
nap::RenderTexture2D
Definition: rendertexture2d.h:24