Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
depth_buffer.h
1 #pragma once
2 
3 #include "pixel_buffer.h"
4 
5 namespace blowbox
6 {
14  class DepthBuffer : public PixelBuffer
15  {
16  public:
22  DepthBuffer(float depth_clear = 1.0f, UINT stencil_clear = 0);
23 
31  void Create(const eastl::wstring& name, UINT width, UINT height, DXGI_FORMAT format);
32 
34  const UINT& GetDSV() const { return dsv_id_; }
35 
37  const UINT& GetDSVDepthReadOnly() const { return dsv_depth_read_id_; }
38 
40  const UINT& GetDSVStencilReadOnly() const { return dsv_stencil_read_id_; }
41 
43  const UINT& GetDSVReadOnly() const { return dsv_read_id_; }
44 
46  const UINT& GetDepthSRV() const { return srv_depth_id_; }
47 
49  const UINT& GetStencilSRV() const { return srv_stencil_id_; }
50 
52  const UINT& GetStencilClearValue() const { return stencil_clear_; }
53 
55  const float& GetDepthClearValue() const { return depth_clear_; }
56 
57  protected:
59  void CreateDerivedViews(DXGI_FORMAT format);
60 
61  private:
62  UINT dsv_id_;
65  UINT dsv_read_id_;
69  float depth_clear_;
70  };
71 }
const UINT & GetDSV() const
Definition: depth_buffer.h:34
DepthBuffer(float depth_clear=1.0f, UINT stencil_clear=0)
Constructs a DepthBuffer with a preset depth and stencil clear value.
Definition: depth_buffer.cc:10
Wrapper for DepthBuffer-like resources.
Definition: depth_buffer.h:14
UINT dsv_depth_read_id_
The Depth Stencil View for this DepthBuffer with depth read only.
Definition: depth_buffer.h:63
UINT dsv_id_
The base Depth Stencil View for this DepthBuffer.
Definition: depth_buffer.h:62
const UINT & GetDSVReadOnly() const
Definition: depth_buffer.h:43
const UINT & GetStencilClearValue() const
Definition: depth_buffer.h:52
UINT dsv_read_id_
The Depth Stencil View for this DepthBuffer which is completely read only.
Definition: depth_buffer.h:65
UINT dsv_stencil_read_id_
The Depth Stencil View for this DepthBuffer with stencil read only.
Definition: depth_buffer.h:64
void Create(const eastl::wstring &name, UINT width, UINT height, DXGI_FORMAT format)
Creates the actual DepthBuffer.
Definition: depth_buffer.cc:24
const UINT & GetDSVDepthReadOnly() const
Definition: depth_buffer.h:37
Wrapper for pixel-type resources.
Definition: pixel_buffer.h:16
const UINT & GetDSVStencilReadOnly() const
Definition: depth_buffer.h:40
UINT srv_stencil_id_
The Shader Resource View for this DepthBuffer for the stencil part.
Definition: depth_buffer.h:67
float depth_clear_
The depth clear value.
Definition: depth_buffer.h:69
void CreateDerivedViews(DXGI_FORMAT format)
Creates all the resource descriptors (views) for this resource.
Definition: depth_buffer.cc:43
The main Blowbox namespace.
Definition: image.cc:8
UINT stencil_clear_
The stencil clear value.
Definition: depth_buffer.h:68
const float & GetDepthClearValue() const
Definition: depth_buffer.h:55
const UINT & GetDepthSRV() const
Definition: depth_buffer.h:46
UINT srv_depth_id_
The Shader Resource View for this DepthBuffer for the depth part.
Definition: depth_buffer.h:66
const UINT & GetStencilSRV() const
Definition: depth_buffer.h:49