-
Notifications
You must be signed in to change notification settings - Fork 0
/
scene.h
79 lines (59 loc) · 1.91 KB
/
scene.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#pragma once
#include <map>
#include "loaderGltf.h"
#include "VulkanBuffer.h"
//#define DRAW_RASTERIZE
struct StorageImage;
struct UniformBufferObject {
glm::mat4 model;
glm::mat4 view;
glm::mat4 invView;
glm::mat4 proj;
};
struct UBOParams {
glm::vec4 lightDir;
float envRot;
float exposure;
glm::mat4 SHRed;
glm::mat4 SHGreen;
glm::mat4 SHBlue;
};
struct UniformBufferObjectMotionVector {
glm::mat4 modelViewProjectionMat, prevModelViewProjectionMat, jitterMat;
};
struct SceneVulkanite {
textureGLTF envMap;
std::vector<objectGLTF> roots;
VkBuffer allVerticesBuffer;
VkBuffer allIndicesBuffer;
Buffer offsetPrimsBuffer;
Buffer materialsCacheBuffer;
std::map<uint32_t, std::shared_ptr<textureGLTF>> textureCache;
std::map<uint32_t, std::shared_ptr<primMeshGLTF>> primsMeshCache;
std::vector<matGLTF> materialsCache;
std::vector<StorageImage> storageImagesRaytrace;
std::vector<StorageImage> storageImagesMotionVector, storageImagesDepth;
std::vector<StorageImage> storageImagesDLSS;
std::vector<VkFramebuffer> rasterizerFramebuffers;
VkRenderPass renderPass;
VkDescriptorSetLayout descriptorSetLayout;
VkPipelineLayout pipelineLayout, pipelineLayoutAlpha;
VkPipeline graphicsPipeline, graphicsPipelineAlpha;
#ifdef DRAW_RASTERIZE
std::vector<StorageImage> storageImagesRasterize;
UBOParams uboParams;
VkBuffer uboParamsBuffer;
std::vector<VkBuffer> uniformParamsBuffers;
std::vector<VkDeviceMemory> uniformParamsBuffersMemory;
std::vector<void *> uniformParamsBuffersMapped;
#endif
};
extern SceneVulkanite sceneGLTF;
extern bool USE_DLSS;
void loadSceneGLTF();
void initSceneGLTF();
void updateSceneGLTF(float deltaTime);
void drawSceneGLTF(VkCommandBuffer commandBuffer, uint32_t currentFrame);
void recordCommandBuffer(VkCommandBuffer commandBuffer, uint32_t imageIndex);
void destroyScene();
void deleteModel();