VkCV Framework
0.0.1
CV Vulkan framework
|
template buffer class, template for type security, implemented here because template classes can't be written in .cpp
More...
#include "Handles.hpp"
#include "BufferManager.hpp"
#include <vector>
Go to the source code of this file.
template buffer class, template for type security, implemented here because template classes can't be written in .cpp
class for image handles
- Authors
- Lars Hoerttrich, Tobias Frisch
-
Lars Hoerttrich
Definition in file Buffer.hpp.
void setActiveCamera(uint32_t cameraIndex)
Sets the stored camera object located at cameraIndex as the active camera.
Definition: CameraManager.cpp:145
virtual ~Window()
Definition: Window.cpp:35
void operator()(T... arguments)
Definition: Event.hpp:38
Definition: PBRMaterial.hpp:19
Definition: PassConfig.hpp:47
void getNearFar(float &near, float &far) const
Gets the near and far bounds of the view frustum of the camera.
Definition: Camera.cpp:27
Window & operator=(const Window &other)=delete
virtual ~GUI()
Definition: GUI.cpp:153
Definition: PipelineManager.hpp:11
Image createImage(vk::Format format, uint32_t width, uint32_t height, uint32_t depth=1, bool createMipChain=false, bool supportStorage=false, bool supportColorAttachment=false, Multisampling multisampling=Multisampling::None)
Definition: Core.cpp:497
GUI(Core &core, Window &window)
Definition: GUI.cpp:18
Buffer< T > createBuffer(vkcv::BufferType type, size_t count, BufferMemoryType memoryType=BufferMemoryType::DEVICE_LOCAL)
Definition: Core.hpp:188
Definition: DrawcallRecording.hpp:39
bool addShader(ShaderStage shaderStage, const std::filesystem::path &shaderPath)
Definition: ShaderProgram.cpp:79
Definition: DescriptorWrites.hpp:6
void destroyBufferById(uint64_t id)
Definition: BufferManager.cpp:319
ControllerType getControllerType(uint32_t cameraIndex)
Gets the currently bound camera controller type of the stored camera object located at cameraIndex.
Definition: CameraManager.cpp:167
Definition: Material.hpp:6
Definition: SyncResources.hpp:5
void setCenter(const glm::vec3 ¢er)
Sets center as the new center point.
Definition: Camera.cpp:120
void unlock()
Definition: Event.hpp:84
static void pollEvents()
Definition: Window.cpp:69
void setRatio(float ratio)
Updates the aspect ratio of the camera with ratio and, thus, changes the projection matrix.
Definition: Camera.cpp:81
void recordAndSubmitCommandsImmediate(const SubmitInfo &submitInfo, const RecordCommandFunction &record, const FinishCommandFunction &finish)
Definition: Core.cpp:436
void setNearFar(float near, float far)
Sets near and far as new values for the view frustum of the camera. This leads to changes in the proj...
Definition: Camera.cpp:85
void moveForward(int action)
Indicates forward movement of the camera depending on the performed action.
Definition: PilotCameraController.cpp:167
Definition: DescriptorWrites.hpp:29
bool shouldUpdateSwapchain() const
Definition: Swapchain.cpp:213
Definition: PassManager.hpp:10
Definition: DescriptorConfig.hpp:10
Definition: DescriptorWrites.hpp:35
uint32_t searchImageMemoryType(const vk::PhysicalDeviceMemoryProperties &physicalMemoryProperties, uint32_t typeBits, vk::MemoryPropertyFlags requirements)
searches memory type index for image allocation, combines requirements of image and application
Definition: ImageManager.cpp:42
Definition: DescriptorWrites.hpp:41
CameraController()=default
The constructor of the CameraController (default behavior).
virtual ~Swapchain()
Definition: Swapchain.cpp:266
event< int, int, int > e_mouseButton
Definition: Window.hpp:109
Definition: Handles.hpp:70
float getYaw() const
Gets the yaw value of the camera in degrees.
Definition: Camera.cpp:140
PBRTextureTarget
Definition: asset_loader.hpp:91
CameraManager(Window &window)
The constructor of the CameraManager.
Definition: CameraManager.cpp:7
Definition: ShaderProgram.hpp:27
void keyCallback(int key, int scancode, int action, int mods, Camera &camera)
A callback function for key events. Currently, 3D camera movement via W, A, S, D, E,...
Definition: PilotCameraController.cpp:83
Definition: DrawcallRecording.hpp:23
static void onMouseScrollEvent(GLFWwindow *callbackWindow, double xoffset, double yoffset)
A callback function for handling mouse scrolling events.
Definition: Window.cpp:120
GLFWwindow * getWindow() const
Definition: Window.cpp:181
void lock()
Definition: Event.hpp:77
void keyCallback(int key, int scancode, int action, int mods, Camera &camera)
A callback function for key events. Currently, the trackball camera does not support camera movement....
Definition: TrackballCameraController.cpp:68
static void queueCreateInfosQueueHandles(vk::PhysicalDevice &physicalDevice, std::vector< float > &queuePriorities, std::vector< vk::QueueFlagBits > &queueFlags, std::vector< vk::DeviceQueueCreateInfo > &queueCreateInfos, std::vector< std::pair< int, int >> &queuePairsGraphics, std::vector< std::pair< int, int >> &queuePairsCompute, std::vector< std::pair< int, int >> &queuePairsTransfer)
Definition: QueueManager.cpp:29
Definition: Context.hpp:9
CameraController & getControllerByType(ControllerType controllerType)
Gets a camera controller object of specified controllerType.
Definition: CameraManager.cpp:176
Definition: PipelineConfig.hpp:25
Definition: PassConfig.hpp:34
Definition: QueueManager.hpp:15
Definition: Handles.hpp:88
void moveRight(int action)
Indicates right movement of the camera depending on the performed action.
Definition: PilotCameraController.cpp:179
PrimitiveType
Definition: asset_loader.hpp:113
template buffer class, template for type security, implemented here because template classes can't be...
Definition: DrawcallRecording.hpp:15
virtual void updateCamera(double deltaTime, Camera &camera)=0
Updates camera in respect to deltaTime.
const glm::mat4 & getView() const
Gets the view matrix of the camera.
Definition: Camera.cpp:32
PrimitiveMode
Definition: asset_loader.hpp:51
void remove(event_handle< T... > handle)
Definition: Event.hpp:65
bool beginFrame(uint32_t &width, uint32_t &height)
start recording command buffers and increment frame index
Definition: Core.cpp:186
Used to move around a camera object in world space.
Definition: PilotCameraController.hpp:10
PilotCameraController()
The default constructor of the PilotCameraController.
Definition: PilotCameraController.cpp:6
Window(GLFWwindow *window)
Definition: Window.cpp:14
Definition: DescriptorManager.cpp:88
void updateSwapchain(const Context &context, const Window &window)
Definition: Swapchain.cpp:217
Swapchain(const Surface &surface, vk::SwapchainKHR swapchain, vk::Format format, vk::ColorSpaceKHR colorSpace, vk::PresentModeKHR presentMode, uint32_t imageCount, vk::Extent2D extent) noexcept
Definition: Swapchain.cpp:29
std::vector< DescriptorSet > m_DescriptorSets
Definition: DescriptorManager.hpp:46
Definition: CommandResources.hpp:7
DescriptorManager(vk::Device device) noexcept
Definition: DescriptorManager.cpp:7
glm::vec3 getFront() const
Gets the current front vector of the camera in world space.
Definition: Camera.cpp:95
Definition: BufferManager.hpp:25
glm::mat4 getMVP() const
Gets the model-view-projection matrix of the camera with y-axis-correction applied.
Definition: Camera.cpp:55
Definition: asset_loader.hpp:133
Definition: asset_loader.hpp:166
Definition: Handles.hpp:105
Definition: DrawcallRecording.hpp:7
Definition: Swapchain.hpp:17
static Core create(Window &window, const char *applicationName, uint32_t applicationVersion, std::vector< vk::QueueFlagBits > queueFlags={}, std::vector< const char * > instanceExtensions={}, std::vector< const char * > deviceExtensions={})
Definition: Core.cpp:53
Definition: BufferManager.hpp:30
Definition: asset_loader.hpp:194
bool materialHasTexture(const Material *const m, const PBRTextureTarget t)
Definition: asset_loader.cpp:117
Used as a base class for defining camera controller classes with different behaviors,...
Definition: CameraController.hpp:12
Definition: Window.hpp:17
uint32_t addCamera(ControllerType controllerType=ControllerType::NONE)
Adds a new camera object to the CameraManager and binds it to a camera controller object of specified...
Definition: CameraManager.cpp:117
void fillBuffer(const BufferHandle &handle, const void *data, size_t size, size_t offset)
Definition: BufferManager.cpp:222
void print_what(const std::exception &e, const std::string &path)
Definition: asset_loader.cpp:41
void reflectShader(ShaderStage shaderStage)
Definition: ShaderProgram.cpp:110
vk::Buffer getBuffer(const BufferHandle &handle) const
Definition: BufferManager.cpp:186
float getFov() const
Gets the current field of view of the camera in radians.
Definition: Camera.cpp:59
BufferHandle createBuffer(BufferType type, size_t size, BufferMemoryType memoryType)
Definition: BufferManager.cpp:57
Definition: Buffer.hpp:15
ComponentType
Definition: asset_loader.hpp:127
void updateCamera(double deltaTime, Camera &camera)
Updates camera in respect to deltaTime.
Definition: PilotCameraController.cpp:67
IndexType
Definition: asset_loader.hpp:57
void * mapBuffer(const BufferHandle &handle, size_t offset, size_t size)
Definition: BufferManager.cpp:272
int getWidth() const
Definition: Window.cpp:169
vk::SurfaceKHR getSurface() const
Definition: Swapchain.cpp:61
Used to create a camera which governs the view and projection matrices.
Definition: Camera.hpp:12
void scrollCallback(double offsetX, double offsetY, Camera &camera)
A callback function for mouse scrolling events. Currently, this leads to changes in the field of view...
Definition: TrackballCameraController.cpp:70
void mouseButtonCallback(int button, int action, int mods)
A callback function for mouse button events.
Definition: CameraManager.cpp:44
Definition: asset_loader.hpp:67
virtual void scrollCallback(double offsetX, double offsetY, Camera &camera)=0
A callback function for mouse scrolling events.
Camera & getActiveCamera()
Gets the stored camera object set as the active camera.
Definition: CameraManager.cpp:141
Definition: ImageManager.hpp:16
void keyCallback(int key, int scancode, int action, int mods)
A callback function for key events. Currently, cycling between all existing camera controllers via Ta...
Definition: CameraManager.cpp:66
uint8_t convertTypeToInt(const fx::gltf::Accessor::Type type)
Definition: asset_loader.cpp:20
Definition: DescriptorManager.hpp:18
Definition: DescriptorWrites.hpp:15
Definition: GLSLCompiler.hpp:10
TrackballCameraController()
The default constructor of the TrackballCameraController.
Definition: TrackballCameraController.cpp:6
static void onCharEvent(GLFWwindow *callbackWindow, unsigned int c)
Definition: Window.cpp:144
void setUp(const glm::vec3 &up)
Sets up as the new up vector.
Definition: Camera.cpp:128
PipelineHandle createComputePipeline(const ShaderProgram &config, const std::vector< vk::DescriptorSetLayout > &descriptorSetLayouts)
Definition: Core.cpp:142
static void onKeyEvent(GLFWwindow *callbackWindow, int key, int scancode, int action, int mods)
Definition: Window.cpp:136
void scrollCallback(double offsetX, double offsetY)
A callback function for mouse scrolling events.
Definition: CameraManager.cpp:62
void changeFov(double offset, Camera &camera)
Changes the field of view of camera with an offset in degrees.
Definition: PilotCameraController.cpp:27
Definition: ShaderProgram.hpp:21
int getHeight() const
Definition: Window.cpp:175
void setView(const glm::mat4 &view)
Sets the view matrix of the camera to view.
Definition: Camera.cpp:36
Definition: Swapchain.hpp:13
static void onMouseButtonEvent(GLFWwindow *callbackWindow, int button, int action, int mods)
Definition: Window.cpp:104
void moveDownward(int action)
Indicates downward movement of the camera depending on the performed action.
Definition: PilotCameraController.cpp:187
Definition: PBRMaterial.hpp:13
void lookAt(const glm::vec3 &position, const glm::vec3 ¢er, const glm::vec3 &up)
Sets the view matrix of the camera according to position, center and up.
Definition: Camera.cpp:19
void setFov(float fov)
Sets the field of view of the camera to fov in radians.
Definition: Camera.cpp:70
int loadScene(const std::string &path, Scene &scene)
Definition: asset_loader.cpp:122
VertexLayout() noexcept
Definition: VertexLayout.cpp:55
void getFramebufferSize(int &width, int &height) const
Definition: Window.cpp:185
virtual void gamepadCallback(int gamepadIndex, Camera &camera, double frametime)=0
A callback function for gamepad input events.
void setControllerType(uint32_t cameraIndex, ControllerType controllerType)
Binds a stored camera object located at cameraIndex to a camera controller of specified controllerTyp...
Definition: CameraManager.cpp:158
void unmapBuffer(const BufferHandle &handle)
Definition: BufferManager.cpp:300
static void onGamepadEvent(int gamepadIndex)
A callback function for gamepad input events.
Definition: Window.cpp:152
const vk::Extent2D & getExtent() const
Definition: Swapchain.cpp:262
const vk::SwapchainKHR & getSwapchain() const
Definition: Swapchain.cpp:57
Definition: BufferManager.cpp:126
Definition: VertexLayout.hpp:21
vk::DeviceMemory getDeviceMemory(const BufferHandle &handle) const
Definition: BufferManager.cpp:210
vk::Format getFormat() const
Definition: Swapchain.cpp:65
static Swapchain create(const Window &window, const Context &context)
Definition: Swapchain.cpp:167
enum IndexType getIndexType(const enum fx::gltf::Accessor::ComponentType &t)
Definition: asset_loader.cpp:56
~TrackballCameraController()=default
The destructor of the TrackballCameraController (default behavior).
void endGUI()
Definition: GUI.cpp:186
Camera & getCamera(uint32_t cameraIndex)
Gets the stored camera object located at cameraIndex.
Definition: CameraManager.cpp:132
std::array< float, 16 > computeModelMatrix(std::array< float, 3 > translation, std::array< float, 3 > scale, std::array< float, 4 > rotation, std::array< float, 16 > matrix)
Definition: asset_loader.cpp:79
void moveBackward(int action)
Indicates backward movement of the camera depending on the performed action.
Definition: PilotCameraController.cpp:171
Definition: Handles.hpp:76
Definition: asset_loader.hpp:147
vk::DescriptorPool allocateDescriptorPool()
Definition: DescriptorManager.cpp:283
PassHandle createPass(const PassConfig &config)
Definition: Core.cpp:149
static vk::DescriptorType convertDescriptorTypeFlag(DescriptorType type)
Definition: DescriptorManager.cpp:230
void gamepadCallback(int gamepadIndex)
A callback function for gamepad input events. Currently, inputs are handled only for the first connec...
Definition: CameraManager.cpp:90
Definition: Compiler.hpp:9
Definition: asset_loader.hpp:47
Definition: asset_loader.hpp:59
void moveLeft(int action)
Indicates left movement of the camera depending on the performed action.
Definition: PilotCameraController.cpp:175
class creating and managing images
static Window create(const char *windowTitle, int width=-1, int height=-1, bool resizable=false)
Definition: Window.cpp:52
Definition: SamplerManager.hpp:13
Definition: CommandStreamManager.hpp:12
void mouseMoveCallback(double x, double y)
A callback function for mouse movement events.
Definition: CameraManager.cpp:54
DescriptorSetHandle createDescriptorSet(const std::vector< DescriptorBinding > &bindings)
Definition: Core.cpp:535
void setRadius(const float radius)
Sets radius as the new radius for orbiting around the camera's center point.
Definition: TrackballCameraController.cpp:13
glm::mat4 getProjection() const
Gets the current projection of the camera.
Definition: Camera.cpp:47
Definition: asset_loader.hpp:76
void setPitch(float pitch)
Sets the pitch value of the camera to pitch in degrees.
Definition: Camera.cpp:136
Definition: ImageManager.hpp:20
SamplerHandle createSampler(SamplerFilterType magFilter, SamplerFilterType minFilter, SamplerMipmapMode mipmapMode, SamplerAddressMode addressMode)
Definition: Core.cpp:492
void mouseButtonCallback(int button, int action, int mods, Camera &camera)
A callback function for mouse button events. Currently, the right mouse button enables panning the vi...
Definition: PilotCameraController.cpp:124
void setProjection(const glm::mat4 &projection)
Sets the projection matrix of the camera to projection.
Definition: Camera.cpp:51
void bindCameraToEvents()
Binds the camera object to the window event handles.
Definition: CameraManager.cpp:27
uint32_t getImageCount() const
Definition: Swapchain.cpp:270
float getRatio() const
Gets the current aspect ratio of the camera.
Definition: Camera.cpp:74
Definition: PassManager.hpp:13
bool isWindowOpen() const
Definition: Window.cpp:165
const glm::vec3 & getPosition() const
Gets the current position of the camera in world space.
Definition: Camera.cpp:108
virtual void keyCallback(int key, int scancode, int action, int mods, Camera &camera)=0
A callback function for key events.
void setYaw(float yaw)
Sets the yaw value of the camera to yaw.
Definition: Camera.cpp:144
void mouseButtonCallback(int button, int action, int mods, Camera &camera)
A callback function for mouse button events. Currently, the right mouse button enables panning the vi...
Definition: TrackballCameraController.cpp:86
Definition: Handles.hpp:64
void resizeCallback(int width, int height)
A callback function for handling the window resizing event. Each existing camera is resized in respec...
Definition: CameraManager.cpp:36
void panView(double xOffset, double yOffset, Camera &camera)
Pans the view of camera according to the pitch and yaw values and additional offsets xOffset and yOff...
Definition: TrackballCameraController.cpp:17
size_t getBufferSize(const BufferHandle &handle) const
Definition: BufferManager.cpp:198
void update(double deltaTime)
Updates all stored camera controllers in respect to deltaTime.
Definition: CameraManager.cpp:187
Definition: CommandStreamManager.hpp:16
const glm::vec3 & getUp() const
Gets the up vector.
Definition: Camera.cpp:124
void beginGUI()
Definition: GUI.cpp:173
Definition: DrawcallRecording.hpp:32
void destroyDescriptorSetById(uint64_t id)
Definition: DescriptorManager.cpp:269
void setFront(const glm::vec3 &front)
Sets the front vector of the camera in world space to front.
Definition: Camera.cpp:103
void updateCamera(double deltaTime, Camera &camera)
Updates camera in respect to deltaTime.
Definition: TrackballCameraController.cpp:46
void copyFromStagingBuffer(Core *core, StagingStepInfo &info)
Definition: BufferManager.cpp:149
uint32_t getActiveCameraIndex() const
Gets the index of the stored active camera object.
Definition: CameraManager.cpp:154
Definition: PBRMaterial.hpp:16
void destroyImageById(uint64_t id)
Definition: ImageManager.cpp:614
void panView(double xOffset, double yOffset, Camera &camera)
Pans the view of camera according to the pitch and yaw values and additional offsets xOffset and yOff...
Definition: PilotCameraController.cpp:46
Definition: DescriptorConfig.hpp:35
Definition: QueueManager.hpp:8
const Shader & getShader(ShaderStage shaderStage) const
Definition: ShaderProgram.cpp:97
~PilotCameraController()=default
The destructor of the PilotCameraController (default behavior).
event_handle< T... > add(typename event_function< T... >::type callback)
Definition: Event.hpp:53
Definition: Handles.hpp:17
void mouseMoveCallback(double x, double y, Camera &camera)
A callback function for mouse movement events. Currently, this leads to panning the view of the camer...
Definition: PilotCameraController.cpp:112
float getPitch() const
Gets the pitch value of the camera in degrees.
Definition: Camera.cpp:132
Used for managing an arbitrary amount of camera controllers.
Definition: CameraManager.hpp:26
void setPerspective(float fov, float ratio, float near, float far)
Sets the perspective object according to fov, ratio, near and far. This leads to changes in the proje...
Definition: Camera.cpp:89
~Core() noexcept
Definition: Core.cpp:125
CameraController & getActiveController()
Definition: CameraManager.cpp:112
Definition: VertexLayout.hpp:55
Definition: PipelineManager.hpp:14
Used to orbit a camera around its center point.
Definition: TrackballCameraController.hpp:10
Camera()
The default constructor of the camera.
Definition: Camera.cpp:7
void endFrame()
end recording and present image
Definition: Core.cpp:396
std::vector< char > readShaderCode(const std::filesystem::path &shaderPath)
Definition: ShaderProgram.cpp:17
~Camera()
The destructor of the camera (default behavior)
static void onResize(GLFWwindow *callbackWindow, int width, int height)
Definition: Window.cpp:128
static void onMouseMoveEvent(GLFWwindow *window, double x, double y)
Definition: Window.cpp:112
void moveUpward(int action)
Indicates upward movement of the camera depending on the performed action.
Definition: PilotCameraController.cpp:183
void updateRadius(double offset, Camera &camera)
Updates the current radius of camera in respect to the offset.
Definition: TrackballCameraController.cpp:34
void mouseMoveCallback(double xoffset, double yoffset, Camera &camera)
A callback function for mouse movement events. Currently, this leads to panning the view of the camer...
Definition: TrackballCameraController.cpp:74
Core & operator=(const Core &other)=delete
virtual void mouseButtonCallback(int button, int action, int mods, Camera &camera)=0
A callback function for mouse button events.
virtual void mouseMoveCallback(double offsetX, double offsetY, Camera &camera)=0
A callback function for mouse movement events.
void setPosition(const glm::vec3 &position)
Sets the position of the camera to position.
Definition: Camera.cpp:112
uint64_t getId() const
Definition: Handles.cpp:67
const glm::vec3 & getCenter() const
Gets the center point.
Definition: Camera.cpp:116
Definition: Handles.hpp:94
void scrollCallback(double offsetX, double offsetY, Camera &camera)
A callback function for mouse scrolling events. Currently, this leads to changes in the field of view...
Definition: PilotCameraController.cpp:108
Definition: VertexLayout.hpp:39
uint64_t getRC() const
Definition: Handles.cpp:71
Definition: asset_loader.hpp:177
Definition: Handles.hpp:82
void gamepadCallback(int gamepadIndex, Camera &camera, double frametime)
A callback function for gamepad input events.
Definition: TrackballCameraController.cpp:95
PipelineHandle createGraphicsPipeline(const PipelineConfig &config)
Definition: Core.cpp:137
~CameraManager()
The destructor of the CameraManager. Destroying the CameraManager leads to deletion of all stored cam...
Definition: CameraManager.cpp:18
void gamepadCallback(int gamepadIndex, Camera &camera, double frametime)
A callback function for gamepad input events.
Definition: PilotCameraController.cpp:133
static vk::ShaderStageFlagBits convertShaderStageFlag(ShaderStage stage)
Definition: DescriptorManager.cpp:249
uint32_t searchBufferMemoryType(const vk::PhysicalDeviceMemoryProperties &physicalMemoryProperties, uint32_t typeBits, vk::MemoryPropertyFlags requirements)
searches memory type index for buffer allocation, combines requirements of buffer and application
Definition: BufferManager.cpp:38