Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 119-graphicspipeline-refactoring
  • 129-projekte-und-assets-auslagern
  • 132-denoising-module
  • 143-ar-vr-support-via-openxr
  • 43-multi-threading
  • 91-compute-first-network
  • 95-arm64-raspberry-pi-4-support
  • develop
  • master
  • optimizations
  • 0.1.0
  • 0.2.0
12 results

Target

Select target project
  • vulkan2021/vkcv-framework
1 result
Select Git revision
  • 119-graphicspipeline-refactoring
  • 129-projekte-und-assets-auslagern
  • 132-denoising-module
  • 143-ar-vr-support-via-openxr
  • 43-multi-threading
  • 91-compute-first-network
  • 95-arm64-raspberry-pi-4-support
  • develop
  • master
  • optimizations
  • 0.1.0
  • 0.2.0
12 results
Show changes
Commits on Source (53)
Showing
with 355 additions and 141 deletions
......@@ -50,10 +50,7 @@ set(vkcv_sources
${vkcv_include}/vkcv/QueueManager.hpp
${vkcv_source}/vkcv/QueueManager.cpp
${vkcv_source}/vkcv/Surface.hpp
${vkcv_source}/vkcv/Surface.cpp
${vkcv_source}/vkcv/ImageLayoutTransitions.hpp
${vkcv_source}/vkcv/ImageLayoutTransitions.cpp
......@@ -72,4 +69,12 @@ set(vkcv_sources
${vkcv_source}/vkcv/SamplerManager.cpp
${vkcv_include}/vkcv/DescriptorWrites.hpp
${vkcv_include}/vkcv/DrawcallRecording.hpp
${vkcv_source}/vkcv/DrawcallRecording.cpp
${vkcv_include}/vkcv/CommandStreamManager.hpp
${vkcv_source}/vkcv/CommandStreamManager.cpp
${vkcv_include}/vkcv/CommandRecordingFunctionTypes.hpp
)
......@@ -37,6 +37,11 @@ namespace vkcv {
size_t getSize() const {
return m_count * sizeof(T);
}
[[nodiscard]]
const vk::Buffer getVulkanHandle() const {
return m_manager->getBuffer(m_handle);
}
void fill(const T* data, size_t count = 0, size_t offset = 0) {
m_manager->fillBuffer(m_handle, data, count * sizeof(T), offset * sizeof(T));
......
......@@ -44,6 +44,14 @@ namespace vkcv
void init();
/**
* Destroys and deallocates buffer represented by a given
* buffer handle id.
*
* @param id Buffer handle id
*/
void destroyBufferById(uint64_t id);
public:
~BufferManager() noexcept;
......@@ -123,14 +131,6 @@ namespace vkcv
* @param handle Buffer handle
*/
void unmapBuffer(const BufferHandle& handle);
/**
* Destroys and deallocates buffer represented by a given
* buffer handle.
*
* @param handle Buffer handle
*/
void destroyBuffer(const BufferHandle& handle);
};
......
#pragma once
#include "vkcv/Event.hpp"
#include <vulkan/vulkan.hpp>
namespace vkcv {
typedef typename event_function<const vk::CommandBuffer&>::type RecordCommandFunction;
typedef typename event_function<>::type FinishCommandFunction;
}
\ No newline at end of file
#pragma once
#include <vulkan/vulkan.hpp>
#include <vector>
#include "vkcv/Event.hpp"
#include "vkcv/Handles.hpp"
#include "vkcv/CommandRecordingFunctionTypes.hpp"
namespace vkcv {
class Core;
class CommandStreamManager
{
friend class Core;
private:
struct CommandStream {
inline CommandStream(vk::CommandBuffer cmdBuffer, vk::Queue queue, vk::CommandPool cmdPool)
: cmdBuffer(cmdBuffer), cmdPool(cmdPool), queue(queue) {};
vk::CommandBuffer cmdBuffer;
vk::CommandPool cmdPool;
vk::Queue queue;
std::vector<FinishCommandFunction> callbacks;
};
Core* m_core;
std::vector<CommandStream> m_commandStreams;
CommandStreamManager() noexcept;
void init(Core* core);
public:
~CommandStreamManager() noexcept;
CommandStreamManager(CommandStreamManager&& other) = delete;
CommandStreamManager(const CommandStreamManager& other) = delete;
CommandStreamManager& operator=(CommandStreamManager&& other) = delete;
CommandStreamManager& operator=(const CommandStreamManager& other) = delete;
CommandStreamHandle createCommandStream(
const vk::Queue queue,
vk::CommandPool cmdPool);
void recordCommandsToStream(const CommandStreamHandle handle, const RecordCommandFunction record);
void addFinishCallbackToStream(const CommandStreamHandle handle, const FinishCommandFunction finish);
void submitCommandStreamSynchronous(
const CommandStreamHandle handle,
std::vector<vk::Semaphore> &waitSemaphores,
std::vector<vk::Semaphore> &signalSemaphores);
vk::CommandBuffer getStreamCommandBuffer(const CommandStreamHandle handle);
};
}
\ No newline at end of file
......@@ -21,13 +21,12 @@
#include "vkcv/DescriptorConfig.hpp"
#include "Sampler.hpp"
#include "DescriptorWrites.hpp"
#include "Event.hpp"
#include "DrawcallRecording.hpp"
#include "CommandRecordingFunctionTypes.hpp"
namespace vkcv
{
struct VertexBufferBinding {
vk::DeviceSize offset;
BufferHandle buffer;
};
// forward declarations
class PassManager;
......@@ -36,15 +35,13 @@ namespace vkcv
class BufferManager;
class SamplerManager;
class ImageManager;
class CommandStreamManager;
struct SubmitInfo {
QueueType queueType;
std::vector<vk::Semaphore> waitSemaphores;
std::vector<vk::Semaphore> signalSemaphores;
};
typedef std::function<void(const vk::CommandBuffer& cmdBuffer)> RecordCommandFunction;
typedef std::function<void(void)> FinishCommandFunction;
class Core final
{
......@@ -55,38 +52,38 @@ namespace vkcv
*
* @param context encapsulates various Vulkan objects
*/
Core(Context &&context, Window &window, SwapChain swapChain, std::vector<vk::ImageView> imageViews,
Core(Context &&context, Window &window, const SwapChain& swapChain, std::vector<vk::ImageView> imageViews,
const CommandResources& commandResources, const SyncResources& syncResources) noexcept;
// explicit destruction of default constructor
Core() = delete;
Result acquireSwapchainImage();
void destroyTemporaryFramebuffers();
Context m_Context;
SwapChain m_swapchain;
std::vector<vk::ImageView> m_swapchainImageViews;
const Window& m_window;
SwapChain m_swapchain;
std::vector<vk::ImageView> m_swapchainImageViews;
std::vector<vk::Image> m_swapchainImages;
std::vector<vk::ImageLayout> m_swapchainImageLayouts;
const Window& m_window;
std::unique_ptr<PassManager> m_PassManager;
std::unique_ptr<PipelineManager> m_PipelineManager;
std::unique_ptr<DescriptorManager> m_DescriptorManager;
std::unique_ptr<BufferManager> m_BufferManager;
std::unique_ptr<SamplerManager> m_SamplerManager;
std::unique_ptr<ImageManager> m_ImageManager;
std::unique_ptr<PassManager> m_PassManager;
std::unique_ptr<PipelineManager> m_PipelineManager;
std::unique_ptr<DescriptorManager> m_DescriptorManager;
std::unique_ptr<BufferManager> m_BufferManager;
std::unique_ptr<SamplerManager> m_SamplerManager;
std::unique_ptr<ImageManager> m_ImageManager;
std::unique_ptr<CommandStreamManager> m_CommandStreamManager;
CommandResources m_CommandResources;
SyncResources m_SyncResources;
uint32_t m_currentSwapchainImageIndex;
std::vector<vk::Framebuffer> m_TemporaryFramebuffers;
CommandResources m_CommandResources;
SyncResources m_SyncResources;
uint32_t m_currentSwapchainImageIndex;
/**
* recreates the swapchain
* @param[in] width new window width
* @param[in] height new window hight
*/
static void recreateSwapchain(int width, int height);
std::function<void(int, int)> e_resizeHandle;
static std::vector<vk::ImageView> createImageViews( Context &context, SwapChain& swapChain);
void recordSwapchainImageLayoutTransition(vk::CommandBuffer cmdBuffer, vk::ImageLayout newLayout);
public:
/**
......@@ -213,31 +210,23 @@ namespace vkcv
* @return
*/
[[nodiscard]]
ResourcesHandle createResourceDescription(const std::vector<DescriptorSetConfig> &descriptorSets);
void writeResourceDescription(ResourcesHandle handle, size_t setIndex, const DescriptorWrites& writes);
DescriptorSetHandle createDescriptorSet(const std::vector<DescriptorBinding> &bindings);
void writeResourceDescription(DescriptorSetHandle handle, size_t setIndex, const DescriptorWrites& writes);
vk::DescriptorSetLayout getDescritorSetLayout(ResourcesHandle handle, size_t setIndex);
DescriptorSet getDescriptorSet(const DescriptorSetHandle handle) const;
/**
* @brief start recording command buffers and increment frame index
*/
void beginFrame();
bool beginFrame(uint32_t& width, uint32_t& height);
/**
* @brief render a beautiful triangle
*/
void renderMesh(
const PassHandle renderpassHandle,
const PipelineHandle pipelineHandle,
const int width,
const int height,
const size_t pushConstantSize,
const void* pushConstantData,
const std::vector<VertexBufferBinding> &vertexBufferBindings,
const BufferHandle indexBuffer,
const size_t indexCount,
const vkcv::ResourcesHandle resourceHandle,
const size_t resourceDescriptorSetIndex);
void recordDrawcallsToCmdStream(
const CommandStreamHandle cmdStreamHandle,
const PassHandle renderpassHandle,
const PipelineHandle pipelineHandle,
const PushConstantData &pushConstantData,
const std::vector<DrawcallInfo> &drawcalls,
const std::vector<ImageHandle> &renderTargets);
/**
* @brief end recording and present image
......@@ -255,6 +244,20 @@ namespace vkcv
* @param record Record-command-function
* @param finish Finish-command-function or nullptr
*/
void submitCommands(const SubmitInfo &submitInfo, const RecordCommandFunction& record, const FinishCommandFunction& finish);
void recordAndSubmitCommands(
const SubmitInfo &submitInfo,
const RecordCommandFunction &record,
const FinishCommandFunction &finish);
CommandStreamHandle createCommandStream(QueueType queueType);
void recordCommandsToStream(
const CommandStreamHandle cmdStreamHandle,
const RecordCommandFunction &record,
const FinishCommandFunction &finish);
void submitCommandStream(const CommandStreamHandle handle);
void prepareSwapchainImageForPresent(const CommandStreamHandle handle);
void prepareImageForSampling(const CommandStreamHandle cmdStream, const ImageHandle image);
};
}
#pragma once
#include <vkcv/ShaderProgram.hpp>
#include <vkcv/Handles.hpp>
#include <vulkan/vulkan.hpp>
namespace vkcv
{
struct DescriptorSet
{
vk::DescriptorSet vulkanHandle;
vk::DescriptorSetLayout layout;
};
/*
* All the types of descriptors (resources) that can be retrieved by the shaders
*/
......@@ -24,7 +32,6 @@ namespace vkcv
*/
struct DescriptorBinding
{
DescriptorBinding() = delete;
DescriptorBinding(
DescriptorType descriptorType,
uint32_t descriptorCount,
......@@ -35,16 +42,4 @@ namespace vkcv
uint32_t descriptorCount;
ShaderStage shaderStage;
};
/*
* One descriptor set struct that contains all the necessary information for the actual creation.
* @param[in] a number of bindings that were created beforehand
* @param[in] the number of (identical) sets that should be created from the attached bindings
*/
struct DescriptorSetConfig
{
explicit DescriptorSetConfig(std::vector<DescriptorBinding> bindings) noexcept;
std::vector<DescriptorBinding> bindings;
};
}
#pragma once
#include <vulkan/vulkan.hpp>
#include <vkcv/Handles.hpp>
#include <vkcv/DescriptorConfig.hpp>
namespace vkcv {
struct VertexBufferBinding {
inline VertexBufferBinding(vk::DeviceSize offset, vk::Buffer buffer) noexcept
: offset(offset), buffer(buffer) {}
vk::DeviceSize offset;
vk::Buffer buffer;
};
struct DescriptorSetUsage {
inline DescriptorSetUsage(uint32_t setLocation, vk::DescriptorSet vulkanHandle) noexcept
: setLocation(setLocation), vulkanHandle(vulkanHandle) {}
const uint32_t setLocation;
const vk::DescriptorSet vulkanHandle;
};
struct Mesh {
inline Mesh(std::vector<VertexBufferBinding> vertexBufferBindings, vk::Buffer indexBuffer, size_t indexCount) noexcept
: vertexBufferBindings(vertexBufferBindings), indexBuffer(indexBuffer), indexCount(indexCount){}
std::vector<VertexBufferBinding> vertexBufferBindings;
vk::Buffer indexBuffer;
size_t indexCount;
};
struct PushConstantData {
inline PushConstantData(void* data, size_t sizePerDrawcall) : data(data), sizePerDrawcall(sizePerDrawcall) {}
void* data;
size_t sizePerDrawcall;
};
struct DrawcallInfo {
inline DrawcallInfo(const Mesh& mesh, const std::vector<DescriptorSetUsage>& descriptorSets)
: mesh(mesh), descriptorSets(descriptorSets) {}
Mesh mesh;
std::vector<DescriptorSetUsage> descriptorSets;
};
void recordDrawcall(
const DrawcallInfo &drawcall,
vk::CommandBuffer cmdBuffer,
vk::PipelineLayout pipelineLayout,
const PushConstantData &pushConstantData,
const size_t drawcallIndex);
}
\ No newline at end of file
......@@ -7,31 +7,51 @@
#include <iostream>
#include "Event.hpp"
namespace vkcv
{
typedef typename event_function<uint64_t>::type HandleDestroyFunction;
class Handle {
friend std::ostream& operator << (std::ostream& out, const Handle& handle);
private:
uint64_t m_id;
uint64_t* m_rc;
HandleDestroyFunction m_destroy;
protected:
Handle();
explicit Handle(uint64_t id);
explicit Handle(uint64_t id, const HandleDestroyFunction& destroy = nullptr);
/**
* Returns the actual handle id of a handle.
*
* @return Handle id
*/
[[nodiscard]]
uint64_t getId() const;
/**
* Returns the reference counter of a handle
*
* @return Reference counter
*/
[[nodiscard]]
uint64_t getRC() const;
public:
virtual ~Handle() = default;
virtual ~Handle();
Handle(const Handle& other) = default;
Handle(Handle&& other) = default;
Handle(const Handle& other);
Handle(Handle&& other) noexcept;
Handle& operator=(const Handle& other) = default;
Handle& operator=(Handle&& other) = default;
Handle& operator=(const Handle& other);
Handle& operator=(Handle&& other) noexcept;
explicit operator bool() const;
bool operator!() const;
......@@ -59,7 +79,7 @@ namespace vkcv
using Handle::Handle;
};
class ResourcesHandle : public Handle {
class DescriptorSetHandle : public Handle {
friend class DescriptorManager;
private:
using Handle::Handle;
......@@ -73,8 +93,19 @@ namespace vkcv
class ImageHandle : public Handle {
friend class ImageManager;
private:
using Handle::Handle;
public:
[[nodiscard]]
bool isSwapchainImage() const;
static ImageHandle createSwapchainImageHandle(const HandleDestroyFunction& destroy = nullptr);
};
class CommandStreamHandle : public Handle {
friend class CommandStreamManager;
private:
using Handle::Handle;
};
}
......@@ -9,8 +9,12 @@
#include "Handles.hpp"
namespace vkcv {
class ImageManager;
// forward declares
class ImageManager;
bool isDepthFormat(const vk::Format format);
class Image {
friend class Core;
public:
......@@ -37,14 +41,9 @@ namespace vkcv {
void fill(void* data, size_t size = SIZE_MAX);
private:
ImageManager* const m_manager;
const ImageHandle m_handle;
const vk::Format m_format;
const uint32_t m_width;
const uint32_t m_height;
const uint32_t m_depth;
vk::ImageLayout m_layout;
const ImageHandle m_handle;
Image(ImageManager* manager, const ImageHandle& handle, vk::Format format, uint32_t width, uint32_t height, uint32_t depth);
Image(ImageManager* manager, const ImageHandle& handle);
static Image create(ImageManager* manager, vk::Format format, uint32_t width, uint32_t height, uint32_t depth);
......
......@@ -32,23 +32,15 @@ namespace vkcv
struct AttachmentDescription
{
AttachmentDescription() = delete;
AttachmentDescription(
AttachmentLayout initial,
AttachmentLayout in_pass,
AttachmentLayout final,
AttachmentOperation store_op,
AttachmentOperation load_op,
vk::Format format) noexcept;
AttachmentLayout layout_initial;
AttachmentLayout layout_in_pass;
AttachmentLayout layout_final;
AttachmentOperation store_op,
AttachmentOperation load_op,
vk::Format format) noexcept;
AttachmentOperation store_operation;
AttachmentOperation load_operation;
vk::Format format;
vk::Format format;
};
struct PassConfig
......
......@@ -24,19 +24,22 @@ namespace vkcv {
* @param passHandle handle for Render Pass
*/
PipelineConfig(
const ShaderProgram& shaderProgram,
uint32_t width,
uint32_t height,
PassHandle &passHandle,
const std::vector<VertexAttribute> &vertexAttributes,
const std::vector<vk::DescriptorSetLayout> &descriptorLayouts);
const ShaderProgram& shaderProgram,
uint32_t width,
uint32_t height,
const PassHandle &passHandle,
const std::vector<VertexAttribute> &vertexAttributes,
const std::vector<vk::DescriptorSetLayout> &descriptorLayouts,
bool useDynamicViewport);
ShaderProgram m_ShaderProgram;
uint32_t m_Height;
uint32_t m_Width;
PassHandle m_PassHandle;
std::vector<VertexAttribute> m_VertexAttributes;
std::vector<vk::DescriptorSetLayout> m_DescriptorLayouts;
bool m_UseDynamicViewport;
ShaderProgram m_ShaderProgram;
uint32_t m_Height;
uint32_t m_Width;
PassHandle m_PassHandle;
std::vector<VertexAttribute> m_vertexAttributes;
std::vector<vk::DescriptorSetLayout> m_descriptorLayouts;
};
}
\ No newline at end of file
......@@ -58,10 +58,12 @@ namespace vkcv {
void reflectShader(ShaderStage shaderStage);
const VertexLayout &getVertexLayout() const;
size_t getPushConstantSize() const;
private:
std::unordered_map<ShaderStage, Shader> m_Shaders;
VertexLayout m_VertexLayout;
size_t m_pushConstantSize = 0;
};
}
......@@ -3,15 +3,32 @@
#include "Context.hpp"
#include "vkcv/Window.hpp"
namespace vkcv {
#include <atomic>
namespace vkcv
{
class SwapChain final {
private:
vk::SurfaceKHR m_surface;
vk::SwapchainKHR m_swapchain;
vk::SurfaceFormatKHR m_format;
struct Surface
{
vk::SurfaceKHR handle;
std::vector<vk::SurfaceFormatKHR> formats;
vk::SurfaceCapabilitiesKHR capabilities;
std::vector<vk::PresentModeKHR> presentModes;
};
Surface m_Surface;
uint32_t m_ImageCount;
vk::SwapchainKHR m_Swapchain;
vk::Format m_SwapchainFormat;
vk::ColorSpaceKHR m_SwapchainColorSpace;
vk::PresentModeKHR m_SwapchainPresentMode;
uint32_t m_SwapchainImageCount;
vk::Extent2D m_Extent;
std::atomic<bool> m_RecreationRequired;
/**
* Constructor of a SwapChain object
......@@ -21,11 +38,17 @@ namespace vkcv {
* @param swapchain to show images in the window
* @param format
*/
SwapChain(vk::SurfaceKHR surface, vk::SwapchainKHR swapchain, vk::SurfaceFormatKHR format, uint32_t imageCount);
// TODO:
SwapChain(const Surface &surface,
vk::SwapchainKHR swapchain,
vk::Format format,
vk::ColorSpaceKHR colorSpace,
vk::PresentModeKHR presentMode,
uint32_t imageCount,
vk::Extent2D extent) noexcept;
public:
SwapChain(const SwapChain &other) = default;
SwapChain(SwapChain &&other) = default;
SwapChain(const SwapChain& other);
/**
* @return The swapchain linked with the #SwapChain class
......@@ -39,13 +62,14 @@ namespace vkcv {
* @return current surface
*/
[[nodiscard]]
vk::SurfaceKHR getSurface();
vk::SurfaceKHR getSurface() const;
/**
* gets the current surface format
* @return gets the surface format
* gets the chosen swapchain format
* @return gets the chosen swapchain format
*/
[[nodiscard]]
vk::SurfaceFormatKHR getSurfaceFormat();
vk::Format getSwapchainFormat() const;
/**
* creates a swap chain object out of the given window and the given context
......@@ -53,7 +77,7 @@ namespace vkcv {
* @param context of the application
* @return returns an object of swapChain
*/
static SwapChain create(const Window &window, const Context &context, const vk::SurfaceKHR surface);
static SwapChain create(const Window &window, const Context &context);
/**
* Destructor of SwapChain
......@@ -64,6 +88,34 @@ namespace vkcv {
* @return number of images in swapchain
*/
uint32_t getImageCount();
};
/**
* TODO
*
* @return
*/
bool shouldUpdateSwapchain() const;
/**
* TODO
*
* context
* window
*/
void updateSwapchain(const Context &context, const Window &window);
/**
*
*/
void signalSwapchainRecreation();
/**
* TODO
*
* @return
*/
[[nodiscard]]
const vk::Extent2D& getExtent() const;
};
}
......@@ -17,7 +17,6 @@ namespace vkcv {
private:
GLFWwindow *m_window;
/**
*
* @param GLFWwindow of the class
......
......@@ -63,7 +63,7 @@ namespace vkcv {
void changeFov(double fov);
void updateRatio(float ratio);
void updateRatio(int width, int height);
float getRatio() const;
......
......@@ -9,10 +9,11 @@ namespace vkcv{
class CameraManager{
private:
std::function<void(int, int, int, int)> m_keyHandle;
std::function<void(double, double)> m_mouseMoveHandle;
std::function<void(double, double)> m_mouseScrollHandle;
std::function<void(int, int, int)> m_mouseButtonHandle;
std::function<void(int, int, int, int)> e_keyHandle;
std::function<void(double, double)> e_mouseMoveHandle;
std::function<void(double, double)> e_mouseScrollHandle;
std::function<void(int, int, int)> e_mouseButtonHandle;
std::function<void(int, int)> e_resizeHandle;
Window &m_window;
Camera m_camera;
......@@ -29,6 +30,7 @@ namespace vkcv{
void scrollCallback( double offsetX, double offsetY);
void mouseMoveCallback( double offsetX, double offsetY);
void mouseButtonCallback(int button, int action, int mods);
void resizeCallback(int width, int height);
public:
CameraManager(Window &window, float width, float height, glm::vec3 up = glm::vec3(0.0f,-1.0f,0.0f), glm::vec3 position = glm::vec3(0.0f,0.0f,0.0f));
......
......@@ -82,13 +82,15 @@ namespace vkcv {
setFov(fov);
}
void Camera::updateRatio( float ratio){
m_ratio = ratio;
void Camera::updateRatio( int width, int height){
m_width = width;
m_height = height;
m_ratio = static_cast<float>(width)/glm::max(height, 1);
setPerspective( m_fov, m_ratio, m_near, m_far);
}
float Camera::getRatio() const {
return 0.0f;
return m_ratio;
}
void Camera::setNearFar( float near, float far){
......
......@@ -15,10 +15,11 @@ namespace vkcv{
}
void CameraManager::bindCamera(){
m_keyHandle = m_window.e_key.add( [&](int key, int scancode, int action, int mods) { this->keyCallback(key, scancode, action, mods); });
m_mouseMoveHandle = m_window.e_mouseMove.add( [&]( double offsetX, double offsetY) {this->mouseMoveCallback( offsetX, offsetY);} );
m_mouseScrollHandle = m_window.e_mouseScroll.add([&](double offsetX, double offsetY) {this->scrollCallback( offsetX, offsetY);} );
m_mouseButtonHandle = m_window.e_mouseButton.add([&] (int button, int action, int mods) {this->mouseButtonCallback( button, action, mods);});
e_keyHandle = m_window.e_key.add( [&](int key, int scancode, int action, int mods) { this->keyCallback(key, scancode, action, mods); });
e_mouseMoveHandle = m_window.e_mouseMove.add( [&]( double offsetX, double offsetY) {this->mouseMoveCallback( offsetX, offsetY);} );
e_mouseScrollHandle = m_window.e_mouseScroll.add([&](double offsetX, double offsetY) {this->scrollCallback( offsetX, offsetY);} );
e_mouseButtonHandle = m_window.e_mouseButton.add([&] (int button, int action, int mods) {this->mouseButtonCallback( button, action, mods);});
e_resizeHandle = m_window.e_resize.add([&] (int width, int height) {this->resizeCallback( width, height);});
}
void CameraManager::mouseButtonCallback(int button, int action, int mods){
......@@ -75,6 +76,11 @@ namespace vkcv{
break;
}
}
void CameraManager::resizeCallback(int width, int height){
m_camera.updateRatio(width, height);
}
Camera &CameraManager::getCamera(){
return m_camera;
}
......
......@@ -2,3 +2,4 @@
# Add new projects/examples here:
add_subdirectory(first_triangle)
add_subdirectory(first_mesh)
add_subdirectory(cmd_sync_test)
\ No newline at end of file