reconstruct dependency to device.hpp

pull/2/head
ink-soul 2023-06-06 11:40:59 +08:00
parent a8fe5397c2
commit 14f0b51c75
12 changed files with 1120 additions and 961 deletions

View File

@ -12,7 +12,7 @@
#include <iterator>
#include <vector>
#include "vulkan/vulkan.h"
#include "VulkanDevice.h"
#include "VulkanDevice.hpp"
#include "VulkanTools.h"
namespace vks

View File

@ -10,7 +10,7 @@
#include <glm/glm.hpp>
#include "vulkan/vulkan.h"
#include "VulkanDevice.h"
#include "VulkanDevice.hpp"
#include "VulkanBuffer.h"
#include <ktx.h>
#include <ktxvulkan.h>

View File

@ -11,7 +11,7 @@
#include "vulkan/vulkan.h"
#include "vulkanexamplebase.h"
#include "VulkanTools.h"
#include "VulkanDevice.h"
#include "VulkanDevice.hpp"
class VulkanRaytracingSample : public VulkanExampleBase
{

View File

@ -19,7 +19,7 @@
#include <ktxvulkan.h>
#include "VulkanBuffer.h"
#include "VulkanDevice.h"
#include "VulkanDevice.hpp"
#include "VulkanTools.h"
#if defined(__ANDROID__)

View File

@ -20,7 +20,7 @@
#include "VulkanTools.h"
#include "VulkanDebug.h"
#include "VulkanBuffer.h"
#include "VulkanDevice.h"
#include "VulkanDevice.hpp"
#include "../external/imgui/imgui.h"

View File

@ -14,7 +14,7 @@
#include <vector>
#include "vulkan/vulkan.h"
#include "VulkanDevice.h"
#include "VulkanDevice.hpp"
#include <ktx.h>
#include <ktxvulkan.h>

View File

@ -66,7 +66,7 @@
#include "VulkanUIOverlay.h"
#include "VulkanSwapChain.h"
#include "VulkanBuffer.h"
#include "VulkanDevice.h"
#include "VulkanDevice.hpp"
#include "VulkanTexture.h"
#include "VulkanInitializers.hpp"

View File

@ -0,0 +1,36 @@
#include "assetLoader.h"
void assetLoader::readDirectory(const std::string& directory, const std::string& pattern, std::map<std::string, std::string>& filelist, bool recursive)
{
std::string searchpattern(directory + "/" + pattern);
WIN32_FIND_DATA data;
HANDLE hFind;
if ((hFind = FindFirstFile(searchpattern.c_str(), &data)) != INVALID_HANDLE_VALUE) {
do {
std::string filename(data.cFileName);
filename.erase(filename.find_last_of("."), std::string::npos);
filelist[filename] = directory + "/" + data.cFileName;
} while (FindNextFile(hFind, &data) != 0);
FindClose(hFind);
}
if (recursive) {
std::string dirpattern = directory + "/*";
if ((hFind = FindFirstFile(dirpattern.c_str(), &data)) != INVALID_HANDLE_VALUE) {
do {
if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
char subdir[MAX_PATH];
strcpy(subdir, directory.c_str());
strcat(subdir, "/");
strcat(subdir, data.cFileName);
if ((strcmp(data.cFileName, ".") != 0) && (strcmp(data.cFileName, "..") != 0)) {
readDirectory(subdir, pattern, filelist, recursive);
}
}
} while (FindNextFile(hFind, &data) != 0);
FindClose(hFind);
}
}
}

View File

@ -0,0 +1,19 @@
#pragma once
#include <stdlib.h>
#include <stdio.h>
#include <fstream>
#include <iostream>
#include <string>
#include <map>
#include "vulkan/vulkan.h"
#include "VulkanDevice.hpp"
namespace assetLoader
{
void readDirectory(const std::string& directory, const std::string& pattern, std::map<std::string, std::string>& filelist, bool recursive);
};

View File

@ -23,7 +23,7 @@
#include "tiny_gltf.h"
#include "VulkanDevice.h"
#include "VulkanDevice.hpp"
#include "vulkan/vulkan.h"
#define ENABLE_VALIDATION false

File diff suppressed because it is too large Load Diff

View File

@ -7,14 +7,14 @@
#include <vector>
#include <chrono>
#include <map>
#include<io.h>
#include "algorithm"
#include <vulkan/vulkan.h>
#include "vulkanexamplebase.h"
#include "VulkanExampleBase.h"
#include "glTFModel.h"
//#include "VulkanDevice.hpp"
#define ENABLE_VALIDATION false
@ -29,6 +29,12 @@ public:
bool ToneMapping = true;
bool pbrEnabled = true;
struct stat
{
} info ;
struct Models
{
glTFModel::Model scene;
@ -84,22 +90,36 @@ public:
} pushConstBlockMaterial;
struct FilePath
{
std::string glTFModelFilePath = getAssetPath() + "buster_drone/busterDrone.gltf";
std::string skyboxModleFilePath = getAssetPath() + "models/cube.gltf";
std::string iblTexturesFilePath = getAssetPath() + "textures/hdr/pisa_cube.ktx";
{ //model path
std::string glTFModelFilePath = getAssetPath() + "DamagedHelmet.gltf";
std::string modelVertShaderPath = getAssetPath() + "buster_drone/shaders/glsl/mesh.vert.spv";
std::string modelFragShaderPath = getAssetPath() + "buster_drone/shaders/glsl/mesh.frag.spv";
// skybox path
std::string skyboxModleFilePath = getAssetPath() + "models/cube.gltf";
std::string skyboxVertShaderPath = getAssetPath() + "shaders/skybox.vert.spv";
std::string skyboxFragShaderPath = getAssetPath() + "shaders/skybox.frag.spv";
std::string iblTexturesFilePath = getAssetPath() + "textures/hdr/pisa_cube.ktx";
//tonemapping
std::string tonemappingVertShaderPath = getAssetPath() + "buster_drone/shaders/glsl/genbrdflut.vert.spv";
std::string tonemappingEnableFragShaderPath = getAssetPath() + "buster_drone/shaders/glsl/tonemapping_enable.frag.spv";
std::string tonemappingDisableFragShaderPath = getAssetPath() + "buster_drone/shaders/glsl/tonemapping_disable.frag.spv";
std::string irradianceVertShaderPath = getAssetPath() + "buster_drone/shaders/glsl/filtercube.vert.spv";
std::string irradianceFragShaderPath = getAssetPath() + "buster_drone/shaders/glsl/irradiancecube.frag.spv";
std::string prefilterVertShaderPath = getAssetPath() + "buster_drone/shaders/glsl/filtercube.vert.spv";
std::string prefilterFragShaderPath = getAssetPath() + "buster_drone/shaders/glsl/prefilterenvmap.frag.spv";
// cube map
std::string irradianceFragShaderPath = getAssetPath() + "shaders/irradiancecube.frag.spv";
std::string filterVertShaderPath = getAssetPath() + "shaders/filtercube.vert.spv";
std::string prefilterEnvmapFragShaderPath = getAssetPath() + "shaders/prefilterenvmap.frag.spv";
//brdf cube map
std::string brdfVertShaderPath = getAssetPath() + "buster_drone/shaders/glsl/genbrdflut.vert.spv";
std::string brdfFragShaderPath = getAssetPath() + "buster_drone/shaders/glsl/genbrdflut.frag.spv";
// environment map texture
std::string envMapFilePath = getAssetPath() + "environments/papermill.ktx";
// pbr shader
std::string pbrVertShaderPath = getAssetPath() + "shaders/pbr.vert.spv";
std::string pbrFragShaderPath = getAssetPath() + "shaders/pbr_khr.frag.spv";
} filePath;
@ -188,8 +208,8 @@ public:
} lightSource;
/*
//cube map generation
struct OffScreen
{
VkImage image;
@ -197,7 +217,7 @@ public:
VkDeviceMemory memory;
VkFramebuffer framebuffer;
} offscreen;
*/
struct IrradiancePushBlock
{
glm::mat4 mvp;
@ -259,11 +279,11 @@ public:
void loadEnvironment(std::string filename);
void buildCommandBuffers();
void loadAssets();
void setupDescriptors();
void setupNodeDescriptorSet(glTFModel::Node* node);
void setupDescriptors();
void preparePipelines();
void CreateToneMappingPipeline();
void GenerateIrradianceCubemap();
void GeneratePrefilteredCubemap();
void generateCubemaps();
void GenerateBRDFLUT();
void prepareUniformBuffers();
void updateUniformBuffers();