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  friend class RenderTarget;
27 
28  RTTI_ENABLE(Texture2D)
29  public:
33  enum class EFormat
34  {
35  RGBA8,
36  BGRA8,
37  R8,
38  RGBA16,
39  R16,
40  RGBA32,
41  R32
42  };
43 
44  RenderTexture2D(Core& core);
45 
51  virtual bool init(utility::ErrorState& errorState) override;
52 
53  int mWidth = 0;
54  int mHeight = 0;
56  EFormat mColorFormat = EFormat::RGBA8;
57  RGBAColorFloat mClearColor = { 0.0f, 0.0f, 0.0f, 0.0f };
58  EUsage mUsage = EUsage::Internal;
59  };
60 
61 
67  class NAPAPI DepthRenderTexture2D : public Texture2D
68  {
69  RTTI_ENABLE(Texture2D)
70  public:
74  enum class EDepthFormat
75  {
76  D16,
77  D32
78  };
79 
81 
87  virtual bool init(utility::ErrorState& errorState) override;
88 
89  int mWidth = 0;
90  int mHeight = 0;
92  EDepthFormat mDepthFormat = EDepthFormat::D16;
93  float mClearValue = 1.0f;
94  EUsage mUsage = EUsage::Internal;
95  };
96 }
nap::DepthRenderTexture2D
Definition: rendertexture2d.h:67
nap::RGBAColor< float >
nap::EColorSpace::Linear
@ Linear
Linear color space.
nap::utility::ErrorState
Definition: errorstate.h:19
nap::Texture2D::EUsage
EUsage
Definition: texture.h:129
nap::Texture2D
Definition: texture.h:117
nap::Core
Definition: core.h:82
nap::RenderTarget
Definition: rendertarget.h:48
nap
Definition: templateapp.h:17
nap::RenderTexture2D::EFormat
EFormat
Definition: rendertexture2d.h:33
nap::EColorSpace
EColorSpace
Definition: surfacedescriptor.h:37
nap::DepthRenderTexture2D::EDepthFormat
EDepthFormat
Definition: rendertexture2d.h:74
nap::RenderTexture2D
Definition: rendertexture2d.h:24