修复编译link错误
parent
f3212fc19d
commit
dc8e2a5979
|
@ -14,9 +14,14 @@ include_directories(external/tinygltf)
|
||||||
include_directories(external/ktx/include)
|
include_directories(external/ktx/include)
|
||||||
include_directories(external/ktx/other_include)
|
include_directories(external/ktx/other_include)
|
||||||
include_directories(external/glfw-3.4/include)
|
include_directories(external/glfw-3.4/include)
|
||||||
include_directories(external/glfw)
|
|
||||||
include_directories(base)
|
include_directories(base)
|
||||||
|
|
||||||
|
add_subdirectory(external/glfw-3.4)
|
||||||
|
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
|
||||||
|
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||||
|
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||||
|
|
||||||
|
|
||||||
OPTION(USE_D2D_WSI "Build the project using Direct to Display swapchain" OFF)
|
OPTION(USE_D2D_WSI "Build the project using Direct to Display swapchain" OFF)
|
||||||
OPTION(USE_DIRECTFB_WSI "Build the project using DirectFB swapchain" OFF)
|
OPTION(USE_DIRECTFB_WSI "Build the project using DirectFB swapchain" OFF)
|
||||||
OPTION(USE_WAYLAND_WSI "Build the project using Wayland swapchain" OFF)
|
OPTION(USE_WAYLAND_WSI "Build the project using Wayland swapchain" OFF)
|
||||||
|
|
|
@ -12,7 +12,7 @@ set(KTX_SOURCES
|
||||||
|
|
||||||
add_library(base STATIC ${BASE_SRC} ${KTX_SOURCES})
|
add_library(base STATIC ${BASE_SRC} ${KTX_SOURCES})
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_link_libraries(base ${Vulkan_LIBRARY} ${WINLIBS})
|
target_link_libraries(base ${Vulkan_LIBRARY} )
|
||||||
else(WIN32)
|
else(WIN32)
|
||||||
target_link_libraries(base ${Vulkan_LIBRARY} ${XCB_LIBRARIES} ${WAYLAND_CLIENT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
target_link_libraries(base ${Vulkan_LIBRARY} ${XCB_LIBRARIES} ${WAYLAND_CLIENT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
||||||
endif(WIN32)
|
endif(WIN32)
|
|
@ -8,80 +8,20 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <chrono>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <sstream>
|
|
||||||
#include <array>
|
|
||||||
#include <numeric>
|
|
||||||
|
|
||||||
|
|
||||||
#include "vulkan/vulkan.h"
|
|
||||||
|
|
||||||
#include "VulkanTools.h"
|
|
||||||
#include "camera.hpp"
|
|
||||||
#include "keycodes.hpp"
|
|
||||||
|
|
||||||
#include "VulkanDevice.hpp"
|
|
||||||
#include "VulkanSwapChain.hpp"
|
|
||||||
|
|
||||||
//#include "imgui/imgui.h"
|
//#include "imgui/imgui.h"
|
||||||
|
|
||||||
class VulkanExampleBase
|
class VulkanExampleBase
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
uint32_t frameCounter = 0;
|
|
||||||
|
|
||||||
bool resizing = false;
|
|
||||||
//void handleMouseMove(int32_t x, int32_t y);
|
|
||||||
PFN_vkCreateDebugReportCallbackEXT vkCreateDebugReportCallback;
|
|
||||||
PFN_vkDestroyDebugReportCallbackEXT vkDestroyDebugReportCallback;
|
|
||||||
VkDebugReportCallbackEXT debugReportCallback;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
VkInstance instance;
|
|
||||||
|
|
||||||
VkPhysicalDeviceProperties deviceProperties;
|
|
||||||
|
|
||||||
VkPhysicalDeviceMemoryProperties deviceMemoryProperties;
|
|
||||||
|
|
||||||
|
|
||||||
VkQueue queue;
|
|
||||||
VkFormat depthFormat;
|
|
||||||
VkCommandPool cmdPool;
|
|
||||||
|
|
||||||
std::vector<VkFramebuffer>frameBuffers;
|
|
||||||
uint32_t currentBuffer = 0;
|
|
||||||
|
|
||||||
|
|
||||||
//VulkanSwapChain swapChain;
|
|
||||||
void windowResize();
|
|
||||||
public:
|
public:
|
||||||
static std::vector<const char*> args;
|
|
||||||
uint32_t selectedPhysicalDeviceIndex = 0;
|
|
||||||
bool prepared = false;
|
|
||||||
uint32_t width = 1280;
|
|
||||||
uint32_t height = 720;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool paused = false;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct GamePadState {
|
|
||||||
glm::vec2 axisLeft = glm::vec2(0.0f);
|
|
||||||
glm::vec2 axisRight = glm::vec2(0.0f);
|
|
||||||
} gamePadState;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,17 +29,5 @@ public:
|
||||||
|
|
||||||
VulkanExampleBase();
|
VulkanExampleBase();
|
||||||
virtual ~VulkanExampleBase();
|
virtual ~VulkanExampleBase();
|
||||||
|
|
||||||
//virtual void render() = 0;
|
|
||||||
virtual void windowResized();
|
|
||||||
virtual void setupFrameBuffer();
|
|
||||||
void createSwapChainFramebuffer();
|
|
||||||
virtual void prepare();
|
|
||||||
virtual void fileDropped(std::string filename);
|
|
||||||
|
|
||||||
void initSwapchain();
|
|
||||||
void setupSwapChain();
|
|
||||||
VkFormat findDepthFormat();
|
|
||||||
VkFormat findSupportedFormat(const std::vector<VkFormat>& candidates, VkImageTiling tiling, VkFormatFeatureFlags features);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,6 +16,10 @@ function(buildHomework HOMEWORK_NAME)
|
||||||
file(GLOB ADD_SOURCE "../external/imgui/*.cpp")
|
file(GLOB ADD_SOURCE "../external/imgui/*.cpp")
|
||||||
SET(SOURCE ${SOURCE} ${ADD_SOURCE} )
|
SET(SOURCE ${SOURCE} ${ADD_SOURCE} )
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
IF(${HOMEWORK_NAME} STREQUAL "glfw")
|
||||||
|
file(GLOB ADD_SOURCE "../external/glfw-3.4/include/GLFW/*.cpp")
|
||||||
|
SET(SOURCE ${SOURCE} ${ADD_SOURCE} )
|
||||||
|
ENDIF()
|
||||||
# wayland requires additional source files
|
# wayland requires additional source files
|
||||||
IF(USE_WAYLAND_WSI)
|
IF(USE_WAYLAND_WSI)
|
||||||
SET(SOURCE ${SOURCE} ${CMAKE_BINARY_DIR}/xdg-shell-client-protocol.h ${CMAKE_BINARY_DIR}/xdg-shell-protocol.c )
|
SET(SOURCE ${SOURCE} ${CMAKE_BINARY_DIR}/xdg-shell-client-protocol.h ${CMAKE_BINARY_DIR}/xdg-shell-protocol.c )
|
||||||
|
@ -30,12 +34,12 @@ function(buildHomework HOMEWORK_NAME)
|
||||||
# Add optional readme / tutorial
|
# Add optional readme / tutorial
|
||||||
#file(GLOB README_FILES "${HOMEWORK_FOLDER}/*.md")
|
#file(GLOB README_FILES "${HOMEWORK_FOLDER}/*.md")
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
add_executable(${HOMEWORK_NAME} WIN32 ${MAIN_CPP} ${SOURCE} ${MAIN_HEADER} ${SHADERS_GLSL} ${SHADERS_HLSL} ${README_FILES}
|
add_executable(${HOMEWORK_NAME} ${MAIN_CPP} ${SOURCE} ${MAIN_HEADER} ${SHADERS_GLSL} ${SHADERS_HLSL} ${README_FILES}
|
||||||
"render/glTFModel.h"
|
"render/glTFModel.h"
|
||||||
"render/glTFModel.cpp"
|
"render/glTFModel.cpp"
|
||||||
|
|
||||||
"render/renderFoundation.h" "render/renderFoundation.cpp")
|
"render/renderFoundation.h" "render/renderFoundation.cpp")
|
||||||
target_link_libraries(${HOMEWORK_NAME} base ${Vulkan_LIBRARY} ${WINLIBS})
|
target_link_libraries(${HOMEWORK_NAME} base ${Vulkan_LIBRARY} glfw )
|
||||||
else(WIN32)
|
else(WIN32)
|
||||||
add_executable(${HOMEWORK_NAME} ${MAIN_CPP} ${SOURCE} ${MAIN_HEADER} ${SHADERS_GLSL} ${SHADERS_HLSL} ${README_FILES})
|
add_executable(${HOMEWORK_NAME} ${MAIN_CPP} ${SOURCE} ${MAIN_HEADER} ${SHADERS_GLSL} ${SHADERS_HLSL} ${README_FILES})
|
||||||
target_link_libraries(${HOMEWORK_NAME} base )
|
target_link_libraries(${HOMEWORK_NAME} base )
|
||||||
|
|
|
@ -14,8 +14,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
//#include "VulkanUtils.hpp"
|
|
||||||
//#include "assetLoader.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -3583,20 +3582,18 @@ void PlumageRender::updateUIOverlay()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
PlumageRender* plumageRender;
|
PlumageRender plumageRender;
|
||||||
plumageRender = new PlumageRender();
|
|
||||||
plumageRender->initVulkan();
|
plumageRender.initVulkan();
|
||||||
if (plumageRender->settings.headless)
|
if (plumageRender.settings.headless)
|
||||||
{
|
{
|
||||||
plumageRender->initWindow(plumageRender->settings.width,plumageRender->settings.height);
|
plumageRender.initWindow(plumageRender.settings.width,plumageRender.settings.height);
|
||||||
}
|
}
|
||||||
plumageRender->prepare();
|
plumageRender.prepare();
|
||||||
plumageRender->renderLoop();
|
plumageRender.renderLoop();
|
||||||
delete(plumageRender);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,16 @@
|
||||||
|
|
||||||
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
||||||
#include "stb/stb_image_write.h"
|
#include "stb/stb_image_write.h"
|
||||||
#define GLFW_INCLUDE_VULKAN
|
|
||||||
#include <GLFW/glfw3.h>
|
|
||||||
|
|
||||||
#define GLM_FORCE_RADIANS
|
#define GLM_FORCE_RADIANS
|
||||||
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
|
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
|
||||||
#define GLM_ENABLE_EXPERIMENTAL
|
#define GLM_ENABLE_EXPERIMENTAL
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
|
#define GLFW_INCLUDE_VULKAN
|
||||||
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
@ -69,7 +71,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string title;
|
std::string title;
|
||||||
std::string name;
|
std::string name = "plumage";
|
||||||
Camera camera;
|
Camera camera;
|
||||||
|
|
||||||
VkPhysicalDevice physicalDevice;
|
VkPhysicalDevice physicalDevice;
|
||||||
|
@ -454,7 +456,10 @@ public:
|
||||||
|
|
||||||
|
|
||||||
PlumageRender();
|
PlumageRender();
|
||||||
~PlumageRender();
|
~PlumageRender()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue