CMSC23740 Common Code Library
Support code for CS23740 programming projects
Loading...
Searching...
No Matches
attachment.hpp
Go to the documentation of this file.
1
8/*
9 * COPYRIGHT (c) 2024 John Reppy (https://cs.uchicago.edu/~jhr)
10 * All rights reserved.
11 */
12
13#ifndef _CS237_ATTACHMENT_HPP_
14#define _CS237_ATTACHMENT_HPP_
15
16#ifndef _CS237_HPP_
17#error "cs237/attachment.hpp should not be included directly"
18#endif
19
20namespace cs237 {
21
24public:
25
34 uint32_t wid,
35 uint32_t ht,
36 vk::Format fmt,
37 vk::ImageUsageFlags usage);
38
41
43 uint32_t width() const { return this->_wid; }
44
46 uint32_t height() const { return this->_ht; }
47
49 vk::Format format() const { return this->_fmt; }
50
52 vk::ImageView imageView () const { return this->_view; }
53
54protected:
56 vk::Image _img;
57 vk::DeviceMemory _mem;
58 vk::ImageView _view;
59 uint32_t _wid;
60 uint32_t _ht;
61 vk::Format _fmt;
62
63};
64
67public:
68
74 DepthAttachment (cs237::Application *app, uint32_t wid, uint32_t ht)
75 : Attachment (app, wid, ht,
76 app->_depthStencilBufferFormat(true, false),
77 vk::ImageUsageFlagBits::eDepthStencilAttachment)
78 { }
79
82
83};
84
85} // namespace cs237
86
87#endif // !_CS237_ATTACHMENT_HPP_
the base class for applications
Definition application.hpp:25
Frame-buffer attachments for off-screen rendering support.
Definition attachment.hpp:23
vk::ImageView _view
image view for attachment image
Definition attachment.hpp:58
vk::DeviceMemory _mem
device memory for the attachment image
Definition attachment.hpp:57
uint32_t _wid
attachment width
Definition attachment.hpp:59
~Attachment()
destructor
vk::Format _fmt
the pixel format
Definition attachment.hpp:61
Attachment(cs237::Application *app, uint32_t wid, uint32_t ht, vk::Format fmt, vk::ImageUsageFlags usage)
Construct a frame-buffer attachment.
uint32_t height() const
get the height of the buffer
Definition attachment.hpp:46
uint32_t _ht
attachment height
Definition attachment.hpp:60
uint32_t width() const
get the width of the buffer
Definition attachment.hpp:43
vk::ImageView imageView() const
return the image view for the attachment
Definition attachment.hpp:52
vk::Format format() const
get the pixel format
Definition attachment.hpp:49
vk::Image _img
Vulkan image to hold the attachment.
Definition attachment.hpp:56
cs237::Application * _app
the owning application
Definition attachment.hpp:55
Depth-buffer attachment for off-screen rendering.
Definition attachment.hpp:66
~DepthAttachment()
destructor
Definition attachment.hpp:81
DepthAttachment(cs237::Application *app, uint32_t wid, uint32_t ht)
Construct a depth-buffer attachment using the "best" format for a depth buffer.
Definition attachment.hpp:74
Definition aabb.hpp:22