CMSC23740 Common Code Library
Support code for CS23740 programming projects
Toggle main menu visibility
Loading...
Searching...
No Matches
depth-buffer.hpp
Go to the documentation of this file.
1
7
8
/*
9
* COPYRIGHT (c) 2026 John Reppy (https://cs.uchicago.edu/~jhr)
10
* All rights reserved.
11
*/
12
13
#ifndef _CS237_DEPTH_BUFFER_HPP_
14
#define _CS237_DEPTH_BUFFER_HPP_
15
16
#ifndef _CS237_HPP_
17
#error "cs237/depth-buffer.hpp should not be included directly"
18
#endif
19
20
namespace
cs237
{
21
22
/* TODO: perhaps this class should be replaced in favor of DepthAttachment? */
23
26
class
DepthBuffer
{
27
public
:
28
40
//
41
DepthBuffer
(
Application
*app, uint32_t wid, uint32_t ht);
42
44
~DepthBuffer
();
45
47
uint32_t
width
()
const
{
return
this->_wid; }
48
50
uint32_t
height
()
const
{
return
this->_ht; }
51
53
vk::Extent2D
extent
()
const
{
return
vk::Extent2D(this->_wid, this->_ht); }
54
56
vk::Format
format
()
const
{
return
this->_fmt; }
57
59
vk::Sampler
sampler
()
const
{
return
this->_sampler; }
60
62
vk::Image
image
()
const
{
return
this->_image; }
63
65
vk::ImageView
imageView
()
const
{
return
this->_imageView; }
66
68
vk::DescriptorImageInfo
imageInfo
()
const
69
{
70
return
vk::DescriptorImageInfo(
71
this->_sampler,
72
this->_imageView,
73
vk::ImageLayout::eDepthReadOnlyOptimal);
74
}
75
80
void
genRenderBarrier
(vk::CommandBuffer &cmdBuf);
81
82
private
:
83
uint32_t _wid;
84
uint32_t _ht;
85
Application
*_app;
86
vk::Format _fmt;
87
vk::Image _image;
88
vk::ImageView _imageView;
89
vk::DeviceMemory _mem;
90
vk::Sampler _sampler;
91
92
};
93
94
}
// namespace cs237
95
96
#endif
// !_CS237_DEPTH_BUFFER_HPP_
cs237::Application
the base class for applications
Definition
application.hpp:25
cs237::DepthBuffer::height
uint32_t height() const
get the height of the buffer
Definition
depth-buffer.hpp:50
cs237::DepthBuffer::width
uint32_t width() const
get the width of the buffer
Definition
depth-buffer.hpp:47
cs237::DepthBuffer::imageInfo
vk::DescriptorImageInfo imageInfo() const
get the image information for the depth buffer
Definition
depth-buffer.hpp:68
cs237::DepthBuffer::extent
vk::Extent2D extent() const
get the extent of the buffer
Definition
depth-buffer.hpp:53
cs237::DepthBuffer::format
vk::Format format() const
get the depth-buffer image format
Definition
depth-buffer.hpp:56
cs237::DepthBuffer::imageView
vk::ImageView imageView() const
get the image view for the depth buffer
Definition
depth-buffer.hpp:65
cs237::DepthBuffer::genRenderBarrier
void genRenderBarrier(vk::CommandBuffer &cmdBuf)
generate a barrier command into the given command buffer that will synchronize rendering access and c...
cs237::DepthBuffer::DepthBuffer
DepthBuffer(Application *app, uint32_t wid, uint32_t ht)
construct and initialize a new depth buffer of the give size
cs237::DepthBuffer::sampler
vk::Sampler sampler() const
get the sampler
Definition
depth-buffer.hpp:59
cs237::DepthBuffer::image
vk::Image image() const
get the depth buffer's image
Definition
depth-buffer.hpp:62
cs237::DepthBuffer::~DepthBuffer
~DepthBuffer()
destructor; this will free the underlying resources
cs237
Definition
aabb.hpp:22
cs237-library
include
cs237
depth-buffer.hpp
Generated by
1.18.0