PeriDyno 1.0.0
Loading...
Searching...
No Matches
VkGraphicsPipeline.h
Go to the documentation of this file.
1#pragma once
2#include <array>
3
4#include "VkSystem.h"
5#include "VulkanTools.h"
6#include "VkContext.h"
7#include "VkSystem.h"
8#include "VkDeviceArray.h"
9#include "VkUniform.h"
10#include "VkVisualModule.h"
12
13namespace dyno {
14
15 struct Vertex
16 {
17 glm::vec4 pos;
18 glm::vec3 normal;
19 glm::vec2 uv;
20 };
21
22 //TODO: implement an easy to use graphics pipeline that can be adapted into the framework
24 {
25 public:
27
29
30 void prepare(VkRenderPass renderPass) override
31 {
32 this->updateGraphicsUBO();
33
34 this->setupDescriptorPool();
36
37 this->preparePipelines(renderPass);
38 }
39
41
43
44 void preparePipelines(VkRenderPass renderPass);
45
46// void addGraphicsToComputeBarriers(VkCommandBuffer commandBuffer);
47//
48// void addComputeToGraphicsBarriers(VkCommandBuffer commandBuffer);
49
50 void buildCommandBuffers(VkCommandBuffer drawCmdBuffer) override;
51
53 {
54 mUniform.setValue(ubo);
55 }
56
57 void viewChanged(const glm::mat4& perspective, const glm::mat4& view) override
58 {
59 ubo.projection = perspective;
60 ubo.view = view;
61 mUniform.setValue(ubo);
62 }
63
64 protected:
65 std::string getShadersPath() const;
66
67 VkPipelineShaderStageCreateInfo loadShader(std::string fileName, VkShaderStageFlagBits stage);
68
69 private:
70 std::string shaderDir = "glsl";
71
73
74 VkDescriptorPool descriptorPool = VK_NULL_HANDLE;
75
77
78 // Resources for the rendering pipeline
79 VkDescriptorSetLayout descriptorSetLayout;
80 VkDescriptorSet descriptorSet;
81 VkPipelineLayout pipelineLayout;
82 VkPipeline pipeline;
83 VkPipeline spherePipeline;
84 VkPipeline capsulePipeline;
85 VkPipeline trianglePipeline;
86 std::vector<VkShaderModule> shaderModules;
87
88 public:
89 struct GraphicsUBO {
90 glm::mat4 projection;
91 glm::mat4 view;
92 glm::vec4 lightPos = glm::vec4(-2.0f, 4.0f, -2.0f, 1.0f);
93 } ubo;
94
95// VkDeviceArray<Vertex> mVertex;
96// VkDeviceArray<uint32_t> mIndex;
97
101
105
109
111 };
112}
113
VkDeviceArray< Vertex > mSphereVertex
void preparePipelines(VkRenderPass renderPass)
VkDeviceArray< uint32_t > mCapsuleIndex
VkDeviceArray< uint32_t > mSphereIndex
VkDeviceArray< Vertex > mCubeVertex
std::vector< VkShaderModule > shaderModules
VkPipelineShaderStageCreateInfo loadShader(std::string fileName, VkShaderStageFlagBits stage)
void buildCommandBuffers(VkCommandBuffer drawCmdBuffer) override
void prepare(VkRenderPass renderPass) override
struct dyno::VkGraphicsPipeline::GraphicsUBO ubo
VkUniform< GraphicsUBO > mUniform
VkDeviceArray< px::Sphere > mSphereInstanceData
VkDeviceArray< px::Capsule > mCapsuleInstanceData
void viewChanged(const glm::mat4 &perspective, const glm::mat4 &view) override
VkDeviceArray< px::Box > mCubeInstanceData
VkDescriptorPool descriptorPool
VkPipelineLayout pipelineLayout
VkDescriptorSetLayout descriptorSetLayout
VkDeviceArray< uint32_t > mCubeIndex
std::string getShadersPath() const
VkDeviceArray< Vertex > mCapsuleVertex
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25