Compare commits
22 Commits
4288c6fa08
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| ce8bc3a96b | |||
| 2f485d11e6 | |||
| a4a1847f95 | |||
| edc4931b67 | |||
| b458f432ff | |||
| 6d986f496e | |||
| 881a43177e | |||
| 80012fc7e7 | |||
| 45b362be82 | |||
| b1c47589bc | |||
| 997e32f9bf | |||
| 71be91d2b1 | |||
| 3562c0308a | |||
| 49d32224af | |||
| cf88fecf08 | |||
| 8e0234c1fb | |||
| e2e84eb42c | |||
| aa91619805 | |||
| 24a6e0086b | |||
| 5a241c546e | |||
| 5944a08abc | |||
| 811b5e0ae6 |
+17
-9
@@ -7,26 +7,37 @@ set(GLFW_USE_WAYLAND ON)
|
||||
find_package(Vulkan REQUIRED)
|
||||
find_package(glfw3 3.3 REQUIRED)
|
||||
|
||||
# Suche nach dem glslc Compiler
|
||||
find_program(GLSLC glslc)
|
||||
if(NOT GLSLC)
|
||||
message(FATAL_ERROR "glslc compiler not found. Please install the Vulkan SDK.")
|
||||
endif()
|
||||
|
||||
# Alle Shader-Dateien im Verzeichnis ./shaders sammeln
|
||||
# Copy textures into cmake output
|
||||
file(GLOB TEXTURE_FILES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/textures/*"
|
||||
)
|
||||
foreach(TEXTURE ${TEXTURE_FILES})
|
||||
file(COPY ${TEXTURE_FILES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/textures/")
|
||||
endforeach()
|
||||
|
||||
# Copy models into cmake output
|
||||
file(GLOB MODEL_FILES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/models/*"
|
||||
)
|
||||
foreach(MODEL ${MODEL_FILES})
|
||||
file(COPY ${MODEL_FILES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/models/")
|
||||
endforeach()
|
||||
|
||||
# Copy shaders into cmake output
|
||||
file(GLOB SHADER_FILES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/shaders/*.vert"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/shaders/*.frag"
|
||||
)
|
||||
|
||||
set(SPIRV_SHADERS "")
|
||||
foreach(SHADER ${SHADER_FILES})
|
||||
# Dateiname extrahieren
|
||||
get_filename_component(SHADER_NAME ${SHADER} NAME)
|
||||
# Zielpfad für die kompilierten Shader im Build-Verzeichnis
|
||||
set(SPIRV "${CMAKE_CURRENT_BINARY_DIR}/shaders/${SHADER_NAME}.spv")
|
||||
|
||||
# Custom Command zum Kompilieren des Shaders
|
||||
add_custom_command(
|
||||
OUTPUT ${SPIRV}
|
||||
COMMAND ${GLSLC} ${SHADER} -o ${SPIRV}
|
||||
@@ -37,10 +48,8 @@ foreach(SHADER ${SHADER_FILES})
|
||||
list(APPEND SPIRV_SHADERS ${SPIRV})
|
||||
endforeach()
|
||||
|
||||
# Custom Target, das alle Shader kompiliert
|
||||
add_custom_target(compile_shaders ALL DEPENDS ${SPIRV_SHADERS})
|
||||
|
||||
# Das eigentliche Executable
|
||||
add_executable(vulkan_test
|
||||
main.cpp
|
||||
vulkan/vulkan_app.cpp
|
||||
@@ -49,5 +58,4 @@ add_executable(vulkan_test
|
||||
|
||||
target_link_libraries(vulkan_test PRIVATE Vulkan::Vulkan glfw)
|
||||
|
||||
# Sicherstellen, dass die Shader vor dem Bauen des Executables kompiliert werden
|
||||
add_dependencies(vulkan_test compile_shaders)
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# Vulkan_TestApp
|
||||
|
||||
Triangle Test App with Vulkan API strictly following documentation.
|
||||
Test App with Vulkan API strictly following documentation.
|
||||
@@ -1,12 +1,25 @@
|
||||
#define DEBUG
|
||||
/**
|
||||
* Required external Libraries:
|
||||
* - Vulkan
|
||||
* - glfw
|
||||
* - glm
|
||||
* - stb
|
||||
* - tinyobjloader
|
||||
*/
|
||||
|
||||
#define DEBUG 1
|
||||
|
||||
#include <iostream>
|
||||
#include "vulkan/vulkan_app.hpp"
|
||||
|
||||
int main(){
|
||||
int main(int argc, char **argv){
|
||||
std::cout << "Program path: " << argv[0] << std::endl;
|
||||
try{
|
||||
vapp::Vulkan app;
|
||||
app.run("Vulkan", 1200, 900);
|
||||
|
||||
app.MODEL_PATH = "models/viking_room.obj";
|
||||
app.TEXTURE_PATH = "textures/viking_room.png";
|
||||
|
||||
app.run("Vulkan", 800, 800);
|
||||
}
|
||||
catch(const std::exception& e){
|
||||
std::cerr << e.what() << std::endl;
|
||||
|
||||
+16053
File diff suppressed because it is too large
Load Diff
+5
-1
@@ -1,9 +1,13 @@
|
||||
#version 450
|
||||
|
||||
layout(location = 0) in vec3 fragColor;
|
||||
layout(location = 1) in vec2 fragTexCoord;
|
||||
|
||||
layout(location = 0) out vec4 outColor;
|
||||
|
||||
layout(binding = 1) uniform sampler2D texSampler;
|
||||
|
||||
void main(){
|
||||
outColor = vec4(fragColor, 1.0);
|
||||
// outColor = vec4(fragTexCoord, 0.0, 1.0);
|
||||
outColor = texture(texSampler, fragTexCoord);
|
||||
}
|
||||
|
||||
+14
-14
@@ -1,20 +1,20 @@
|
||||
#version 450
|
||||
|
||||
layout(set = 0, binding = 0) uniform UniformBufferObject{
|
||||
mat4 model;
|
||||
mat4 view;
|
||||
mat4 proj;
|
||||
}ubo;
|
||||
|
||||
layout(location = 0) in vec3 inPosition;
|
||||
layout(location = 1) in vec3 inColor;
|
||||
layout(location = 2) in vec2 inTexCoord;
|
||||
|
||||
layout(location = 0) out vec3 fragColor;
|
||||
|
||||
vec2 positions[3] = vec2[](
|
||||
vec2(0.0, -0.5),
|
||||
vec2(0.5, 0.5),
|
||||
vec2(-0.5, 0.5)
|
||||
);
|
||||
|
||||
vec3 colors[3] = vec3[](
|
||||
vec3(0.0, 1.0, 1.0),
|
||||
vec3(0.0, 1.0, 0.0),
|
||||
vec3(0.0, 0.0, 1.0)
|
||||
);
|
||||
layout(location = 1) out vec2 fragTexCoord;
|
||||
|
||||
void main(){
|
||||
gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0);
|
||||
fragColor = colors[gl_VertexIndex];
|
||||
gl_Position = ubo.proj * ubo.view * ubo.model * vec4(inPosition, 1.0);
|
||||
fragColor = inColor;
|
||||
fragTexCoord = inTexCoord;
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.0 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 940 KiB |
+1562
-762
File diff suppressed because it is too large
Load Diff
+238
-81
@@ -8,118 +8,275 @@
|
||||
#define GLFW_INCLUDE_VULKAN
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#define GLM_FORCE_RADIANS
|
||||
#define GLM_FORCE_DEFAULT_ALIGNED_GENTYPES
|
||||
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#define GLM_ENABLE_EXPERIMENTAL
|
||||
#include <glm/gtx/hash.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include <optional>
|
||||
#include <set>
|
||||
#include <limits>
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <array>
|
||||
#include <chrono>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace vapp{
|
||||
// Change here for other presentMode
|
||||
const VkPresentModeKHR WISHED_PRESENT_MODE = VK_PRESENT_MODE_MAILBOX_KHR;
|
||||
|
||||
// Change here for other presentMode
|
||||
const VkPresentModeKHR WISHED_PRESENT_MODE = VK_PRESENT_MODE_MAILBOX_KHR;
|
||||
struct Vertex{
|
||||
glm::vec3 pos;
|
||||
glm::vec3 color;
|
||||
glm::vec2 texCoord;
|
||||
|
||||
typedef struct _QueueFamilyIndices{
|
||||
std::optional<uint32_t> graphicsFamily;
|
||||
std::optional<uint32_t> presentFamily;
|
||||
static VkVertexInputBindingDescription getBindingDescription(){
|
||||
VkVertexInputBindingDescription bindingDescription{};
|
||||
|
||||
bool isComplete(){
|
||||
return graphicsFamily.has_value();
|
||||
}
|
||||
} QueueFamilyIndices;
|
||||
bindingDescription.binding = 0;
|
||||
bindingDescription.stride = sizeof(Vertex);
|
||||
bindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
|
||||
|
||||
typedef struct{
|
||||
VkSurfaceCapabilitiesKHR capabilities;
|
||||
std::vector<VkSurfaceFormatKHR> formats;
|
||||
std::vector<VkPresentModeKHR> presentModes;
|
||||
} SwapChainSupportDetails;
|
||||
return bindingDescription;
|
||||
}
|
||||
|
||||
static std::vector<char> readFile(const std::string &filename);
|
||||
static std::array<VkVertexInputAttributeDescription, 3> getAttributeDescriptions(){
|
||||
std::array<VkVertexInputAttributeDescription, 3> attributeDescriptions{};
|
||||
|
||||
class Vulkan{
|
||||
private:
|
||||
#pragma region Fields
|
||||
GLFWwindow *window;
|
||||
uint32_t _width, _height;
|
||||
attributeDescriptions[0].binding = 0;
|
||||
attributeDescriptions[0].location = 0;
|
||||
attributeDescriptions[0].format = VK_FORMAT_R32G32B32_SFLOAT;
|
||||
attributeDescriptions[0].offset = offsetof(Vertex, pos);
|
||||
|
||||
VkInstance instance;
|
||||
VkDebugUtilsMessengerEXT debugMessenger;
|
||||
attributeDescriptions[1].binding = 0;
|
||||
attributeDescriptions[1].location = 1;
|
||||
attributeDescriptions[1].format = VK_FORMAT_R32G32B32_SFLOAT;
|
||||
attributeDescriptions[1].offset = offsetof(Vertex, color);
|
||||
|
||||
VkSurfaceKHR surface;
|
||||
attributeDescriptions[2].binding = 0;
|
||||
attributeDescriptions[2].location = 2;
|
||||
attributeDescriptions[2].format = VK_FORMAT_R32G32_SFLOAT;
|
||||
attributeDescriptions[2].offset = offsetof(Vertex, texCoord);
|
||||
|
||||
VkPhysicalDevice physicalDevice = VK_NULL_HANDLE;
|
||||
VkDevice device;
|
||||
return attributeDescriptions;
|
||||
}
|
||||
|
||||
VkQueue graphicsQueue;
|
||||
VkQueue presentQueue;
|
||||
bool operator==(const Vertex &other) const{
|
||||
return pos == other.pos && color == other.color && texCoord == other.texCoord;
|
||||
}
|
||||
};
|
||||
|
||||
VkSwapchainKHR swapChain;
|
||||
std::vector<VkImage> swapChainImages;
|
||||
VkFormat swapChainImageFormat;
|
||||
VkExtent2D swapChainExtent;
|
||||
/*
|
||||
const std::vector<Vertex> vertices = {
|
||||
{{-0.5f, -0.5f, 0.0f}, {0.0f, 1.0f, 0.0f}, {0.0f, 0.0f}},
|
||||
{{0.5f, -0.5f, 0.0f}, {0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}},
|
||||
{{0.5f, 0.5f, 0.0f}, {0.0f, 1.0f, 0.0f}, {1.0f, 1.0f}},
|
||||
{{-0.5f, 0.5f, 0.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}},
|
||||
|
||||
std::vector<VkImageView> swapChainImageViews;
|
||||
{{-0.5f, -0.5f, -0.5f}, {0.0f, 1.0f, 0.0f}, {0.0f, 0.0f}},
|
||||
{{0.5f, -0.5f, -0.5f}, {0.0f, 0.0f, 1.0f}, {1.0f, 0.0f}},
|
||||
{{0.5f, 0.5f, -0.5f}, {0.0f, 1.0f, 0.0f}, {1.0f, 1.0f}},
|
||||
{{-0.5f, 0.5f, -0.5f}, {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f}}
|
||||
};
|
||||
|
||||
VkRenderPass renderPass;
|
||||
VkPipelineLayout pipelineLayout;
|
||||
// uint16_t also possible -> change in vkCmdBindIndexBuffer also
|
||||
const std::vector<uint32_t> indices = {
|
||||
0, 1, 2, 2, 3, 0,
|
||||
4, 5, 6, 6, 7, 4
|
||||
};
|
||||
*/
|
||||
// END Remove
|
||||
|
||||
VkPipeline graphicsPipeline;
|
||||
struct UniformBufferObject{
|
||||
alignas(16) glm::mat4 model;
|
||||
alignas(16) glm::mat4 view;
|
||||
alignas(16) glm::mat4 proj;
|
||||
};
|
||||
|
||||
VkCommandPool commandPool;
|
||||
VkCommandBuffer commandBuffer;
|
||||
struct QueueFamilyIndices{
|
||||
std::optional<uint32_t> graphicsFamily;
|
||||
std::optional<uint32_t> presentFamily;
|
||||
|
||||
VkSemaphore imageAvailableSemaphore, renderFinishedSemaphore;
|
||||
VkFence inFlightFence;
|
||||
bool isComplete(){
|
||||
return graphicsFamily.has_value();
|
||||
}
|
||||
};
|
||||
|
||||
std::vector<VkFramebuffer> swapChainFramebuffers;
|
||||
struct SwapChainSupportDetails{
|
||||
VkSurfaceCapabilitiesKHR capabilities;
|
||||
std::vector<VkSurfaceFormatKHR> formats;
|
||||
std::vector<VkPresentModeKHR> presentModes;
|
||||
};
|
||||
|
||||
static std::vector<char> readFile(const std::string& filename);
|
||||
static std::array<VkVertexInputAttributeDescription, 2> getAttributeDescription();
|
||||
|
||||
|
||||
class Vulkan{
|
||||
private:
|
||||
#pragma region PrivateFields
|
||||
GLFWwindow *window;
|
||||
uint32_t _width, _height;
|
||||
|
||||
VkInstance instance;
|
||||
VkDebugUtilsMessengerEXT debugMessenger;
|
||||
|
||||
VkSurfaceKHR surface;
|
||||
|
||||
VkPhysicalDevice physicalDevice = VK_NULL_HANDLE;
|
||||
VkDevice device;
|
||||
|
||||
VkQueue graphicsQueue;
|
||||
VkQueue presentQueue;
|
||||
|
||||
VkSwapchainKHR swapChain;
|
||||
std::vector<VkImage> swapChainImages;
|
||||
VkFormat swapChainImageFormat;
|
||||
VkExtent2D swapChainExtent;
|
||||
|
||||
std::vector<VkImageView> swapChainImageViews;
|
||||
|
||||
VkRenderPass renderPass;
|
||||
VkDescriptorSetLayout descriptorSetLayout;
|
||||
VkPipelineLayout pipelineLayout;
|
||||
|
||||
VkPipeline graphicsPipeline;
|
||||
|
||||
VkCommandPool commandPool;
|
||||
std::vector<VkCommandBuffer> commandBuffers;
|
||||
|
||||
std::vector<VkSemaphore> imageAvailableSemaphores, renderFinishedSemaphores;
|
||||
std::vector<VkFence> inFlightFences;
|
||||
|
||||
std::vector<VkFramebuffer> swapChainFramebuffers;
|
||||
|
||||
const int MAX_FRAMES_IN_FLIGHT = 2;
|
||||
uint32_t currentFrame = 0;
|
||||
|
||||
std::vector<Vertex> vertices;
|
||||
std::vector<uint32_t> indices;
|
||||
VkBuffer vertexBuffer;
|
||||
VkDeviceMemory vertexBufferMemory;
|
||||
VkBuffer indexBuffer;
|
||||
VkDeviceMemory indexBufferMemory;
|
||||
|
||||
std::vector<VkBuffer> uniformBuffers;
|
||||
std::vector<VkDeviceMemory> uniformBuffersMemory;
|
||||
std::vector<void*> uniformBuffersMapped;
|
||||
|
||||
VkDescriptorPool descriptorPool;
|
||||
std::vector<VkDescriptorSet> descriptorSets;
|
||||
|
||||
int32_t mipLevels;
|
||||
VkImage textureImage;
|
||||
VkDeviceMemory textureImageMemory;
|
||||
|
||||
VkImageView textureImageView;
|
||||
VkSampler textureSampler;
|
||||
|
||||
VkImage depthImage;
|
||||
VkDeviceMemory depthImageMemory;
|
||||
VkImageView depthImageView;
|
||||
|
||||
VkImage colorImage;
|
||||
VkDeviceMemory colorImageMemory;
|
||||
VkImageView colorImageView;
|
||||
#pragma endregion
|
||||
#pragma region PrivateFunctions
|
||||
bool checkValidationLayerSupport();
|
||||
std::vector<const char*> getRequiredExtensions();
|
||||
VkSampleCountFlagBits getMaxUsableSampleCount();
|
||||
|
||||
bool checkValidationLayerSupport();
|
||||
std::vector<const char*> getRequiredExtensions();
|
||||
|
||||
void createInstance();
|
||||
void setupDebugMessenger();
|
||||
void pickPhysicalDevice();
|
||||
void createLogicalDevice();
|
||||
QueueFamilyIndices findQueueFamilies(VkPhysicalDevice device);
|
||||
bool checkDeviceExtensionSupport(VkPhysicalDevice device);
|
||||
bool isDeviceSuitable(VkPhysicalDevice device);
|
||||
void createSurface();
|
||||
SwapChainSupportDetails querySwapChainSupport(VkPhysicalDevice device);
|
||||
VkSurfaceFormatKHR chooseSwapSurfaceFormat(const std::vector<VkSurfaceFormatKHR>& availableFormats);
|
||||
VkPresentModeKHR chooseSwapPresentMode(const std::vector<VkPresentModeKHR> availablePresentModes);
|
||||
VkExtent2D chooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities);
|
||||
void createSwapChain();
|
||||
void createImageViews();
|
||||
void createGraphicsPipeline();
|
||||
VkShaderModule createShaderModule(const std::vector<char> &code);
|
||||
void createRenderPass();
|
||||
void createFrameBuffers();
|
||||
void createCommandPool();
|
||||
void createCommandBuffer();
|
||||
void recordCommandBuffer(VkCommandBuffer commandBuffer, uint32_t imageIndex);
|
||||
void createSyncObjects();
|
||||
void drawFrame();
|
||||
void initWindow(const char* windowName);
|
||||
void initVulkan();
|
||||
void mainLoop();
|
||||
void cleanup();
|
||||
|
||||
public:
|
||||
#ifdef DEBUG
|
||||
void createInstance();
|
||||
void setupDebugMessenger();
|
||||
void pickPhysicalDevice();
|
||||
void createLogicalDevice();
|
||||
QueueFamilyIndices findQueueFamilies(VkPhysicalDevice device);
|
||||
bool checkDeviceExtensionSupport(VkPhysicalDevice device);
|
||||
bool isDeviceSuitable(VkPhysicalDevice device);
|
||||
void createSurface();
|
||||
SwapChainSupportDetails querySwapChainSupport(VkPhysicalDevice device);
|
||||
VkSurfaceFormatKHR chooseSwapSurfaceFormat(const std::vector<VkSurfaceFormatKHR>& availableFormats);
|
||||
VkPresentModeKHR chooseSwapPresentMode(const std::vector<VkPresentModeKHR> availablePresentModes);
|
||||
VkExtent2D chooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities);
|
||||
void createSwapChain();
|
||||
void createImageViews();
|
||||
void createDescriptorSetLayout();
|
||||
void createGraphicsPipeline();
|
||||
VkShaderModule createShaderModule(const std::vector<char>& code);
|
||||
void createRenderPass();
|
||||
void createFramebuffers();
|
||||
void createCommandPool();
|
||||
VkFormat findSupportedFormat(const std::vector<VkFormat> &candidates, VkImageTiling tiling, VkFormatFeatureFlags features);
|
||||
VkFormat findDepthFormat();
|
||||
void createColorResources();
|
||||
void createDepthResources();
|
||||
VkCommandBuffer beginSingleTimeCommands();
|
||||
void endSingleTimeCommands(VkCommandBuffer commandBuffer);
|
||||
void transitionImageLayout(VkImage image, VkFormat format, VkImageLayout oldLayout, VkImageLayout newLayout, uint32_t mipLevels);
|
||||
void copyBufferToImage(VkBuffer buffer, VkImage image, uint32_t width, uint32_t height);
|
||||
void createImage(uint32_t width, uint32_t height, uint32_t mipLevels, VkSampleCountFlagBits numSamples, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties, VkImage& image, VkDeviceMemory &imageMemory);
|
||||
void generateMipmaps(VkImage image, VkFormat imageFormat, int32_t texWidth, int32_t texHeight, uint32_t mipLevels);
|
||||
void createTextureImage();
|
||||
VkImageView createImageView(VkImage image, VkFormat format, VkImageAspectFlags aspectFlags, uint32_t mipLevels);
|
||||
void createTextureImageView();
|
||||
void createTextureSampler();
|
||||
uint32_t findMemoryType(uint32_t typeFilter, VkMemoryPropertyFlags properties);
|
||||
void createBuffer(VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties, VkBuffer &buffer, VkDeviceMemory &bufferMemory);
|
||||
void copyBuffer(VkBuffer srcBuffer, VkBuffer dstBuffer, VkDeviceSize size);
|
||||
void copyBufferOld(VkBuffer srcBuffer, VkBuffer dstBuffer, VkDeviceSize size);
|
||||
void loadModel();
|
||||
void createVertexBuffer();
|
||||
void createIndexBuffer();
|
||||
void createUniformBuffers();
|
||||
void createDescriptorPool();
|
||||
void createDescriptorSets();
|
||||
void createCommandBuffers();
|
||||
void recordCommandBuffer(VkCommandBuffer commandBuffer, uint32_t imageIndex);
|
||||
void createSyncObjects();
|
||||
void updateUniformBuffer(uint32_t currentFrame);
|
||||
void drawFrame();
|
||||
void cleanupSwapChain();
|
||||
void recreateSwapChain();
|
||||
void initWindow(const char *windowName);
|
||||
void initVulkan();
|
||||
void mainLoop();
|
||||
void cleanup();
|
||||
#pragma endregion
|
||||
public:
|
||||
#pragma region PublicFields
|
||||
#ifdef DEBUG
|
||||
const bool enableValidationLayers = true;
|
||||
#else
|
||||
#else
|
||||
const bool enableValidationLayers = false;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void run(const char* windowName, const uint32_t width = 800, const uint32_t height = 600);
|
||||
};
|
||||
bool framebufferResized = false;
|
||||
std::string MODEL_PATH;
|
||||
std::string TEXTURE_PATH;
|
||||
|
||||
VkSampleCountFlagBits msaaSamples = VK_SAMPLE_COUNT_1_BIT;
|
||||
#pragma endregion
|
||||
#pragma region PublicFunctions
|
||||
void run(const char *windowName, const uint32_t width = 800, const uint32_t height = 600);
|
||||
#pragma endregion
|
||||
};
|
||||
} // vapp
|
||||
|
||||
namespace std{
|
||||
template<> struct hash<vapp::Vertex>{
|
||||
size_t operator()(vapp::Vertex const &vertex) const{
|
||||
return ((hash<glm::vec3>()(vertex.pos) ^
|
||||
(hash<glm::vec3>()(vertex.color) << 1)) >> 1) ^
|
||||
(hash<glm::vec2>()(vertex.texCoord) << 1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //VULKAN_APP_H
|
||||
|
||||
Reference in New Issue
Block a user