CMSC23700 Common Code Library
Support code for CS23700 programming projects
Loading...
Searching...
No Matches
cs237-depth-buffer.hpp
Go to the documentation of this file.
1
8/*
9 * COPYRIGHT (c) 2023 John Reppy (http://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
20namespace cs237 {
21
24public:
25
37 //
38 DepthBuffer (Application *app, uint32_t wid, uint32_t ht);
39
42
44 uint32_t width() const { return this->_wid; }
45
47 uint32_t height() const { return this->_ht; }
48
50 vk::Format format() const { return this->_fmt; }
51
53 vk::Sampler sampler() const { return this->_sampler; }
54
56 vk::ImageView imageView() const { return this->_imageView; }
57
59 vk::DescriptorImageInfo imageInfo() const
60 {
61 return vk::DescriptorImageInfo(
62 this->_sampler,
63 this->_imageView,
64 vk::ImageLayout::eShaderReadOnlyOptimal);
65 }
66
70 vk::Framebuffer createFramebuffer (vk::RenderPass rp);
71
72private:
73 uint32_t _wid;
74 uint32_t _ht;
75 Application *_app;
76 vk::Format _fmt;
77 vk::Image _image;
78 vk::ImageView _imageView;
79 vk::DeviceMemory _mem;
80 vk::Sampler _sampler;
81
82};
83
84} // namespace cs237
85
86#endif // !_CS237_DEPTH_BUFFER_HPP_
the base class for applications
Definition cs237-application.hpp:25
This class is a wrapper around the.
Definition cs237-depth-buffer.hpp:23
uint32_t height() const
get the height of the buffer
Definition cs237-depth-buffer.hpp:47
uint32_t width() const
get the width of the buffer
Definition cs237-depth-buffer.hpp:44
vk::DescriptorImageInfo imageInfo() const
get the image information for the depth buffer
Definition cs237-depth-buffer.hpp:59
vk::Format format() const
get the depth-buffer image format
Definition cs237-depth-buffer.hpp:50
vk::ImageView imageView() const
get the image view for the depth buffer
Definition cs237-depth-buffer.hpp:56
DepthBuffer(Application *app, uint32_t wid, uint32_t ht)
construct and initialize a new depth buffer of the give size
vk::Sampler sampler() const
get the sampler
Definition cs237-depth-buffer.hpp:53
vk::Framebuffer createFramebuffer(vk::RenderPass rp)
~DepthBuffer()
destructor; this will free the underlying resources
Definition cs237-aabb.hpp:22