Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
color_buffer.h
1 #pragma once
2 
3 #include "pixel_buffer.h"
4 
5 namespace blowbox
6 {
14  class ColorBuffer : public PixelBuffer
15  {
16  public:
18  ColorBuffer();
19 
24  ColorBuffer(float clear_color[4]);
25 
32  void CreateFromSwapChain(const WString& name, ID3D12Resource* swap_chain_resource, float clear_color[4]);
33 
41  void Create(const WString& name, UINT width, UINT height, DXGI_FORMAT format);
42 
44  const UINT& GetSRV() const { return srv_id_; }
45 
47  const UINT& GetRTV() const { return rtv_id_; }
48 
50  const UINT& GetUAV() const { return uav_id_; }
51 
53  const float* GetClearColor() const { return clear_color_; }
54 
56  const D3D12_CLEAR_VALUE& GetClearValue() const { return clear_value_; }
57 
58  protected:
63  void CreateDerivedViews(DXGI_FORMAT format);
64 
65  private:
66  UINT srv_id_;
67  UINT rtv_id_;
68  UINT uav_id_;
69  float clear_color_[4];
70  D3D12_CLEAR_VALUE clear_value_;
71  };
72 }
void CreateFromSwapChain(const WString &name, ID3D12Resource *swap_chain_resource, float clear_color[4])
Creates a ColorBuffer from a SwapChain buffer.
Definition: color_buffer.cc:25
D3D12_CLEAR_VALUE clear_value_
The clear value for this ColorBuffer.
Definition: color_buffer.h:70
const float * GetClearColor() const
Definition: color_buffer.h:53
UINT uav_id_
The UAV for this ColorBuffer.
Definition: color_buffer.h:68
Buffer-type for buffers with color data in them.
Definition: color_buffer.h:14
const UINT & GetRTV() const
Definition: color_buffer.h:47
void CreateDerivedViews(DXGI_FORMAT format)
Creates all the descriptors (views) for this ColorBuffer.
Definition: color_buffer.cc:65
Wrapper for pixel-type resources.
Definition: pixel_buffer.h:16
eastl::wstring WString
Typedef for wrapping the EASTL wstring.
Definition: string.h:20
UINT rtv_id_
The RTV for this ColorBuffer.
Definition: color_buffer.h:67
UINT srv_id_
The SRV for this ColorBuffer.
Definition: color_buffer.h:66
void Create(const WString &name, UINT width, UINT height, DXGI_FORMAT format)
Creates a new ColorBuffer.
Definition: color_buffer.cc:40
const UINT & GetUAV() const
Definition: color_buffer.h:50
const UINT & GetSRV() const
Definition: color_buffer.h:44
The main Blowbox namespace.
Definition: image.cc:8
const D3D12_CLEAR_VALUE & GetClearValue() const
Definition: color_buffer.h:56
float clear_color_[4]
The clear color for this ColorBuffer.
Definition: color_buffer.h:69
ColorBuffer()
Constructs a ColorBuffer.
Definition: color_buffer.cc:10