Init commit
This commit is contained in:
@@ -38,3 +38,4 @@ CMakeLocalPath.cmake
|
|||||||
# Folders
|
# Folders
|
||||||
camke-build-debug/
|
camke-build-debug/
|
||||||
.idea/
|
.idea/
|
||||||
|
build/
|
||||||
@@ -47,10 +47,12 @@ add_library(${TG_RENDER} SHARED
|
|||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
target_compile_definitions(${TG_RENDER}
|
target_compile_definitions(${TG_RENDER}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
RENDER_SHARED_LIB
|
RENDER_SHARED_LIB
|
||||||
RENDER_DLL_OUTPUT
|
RENDER_DLL_OUTPUT
|
||||||
|
PROJECT_ROOT="${PROJECT_SOURCE_DIR}"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${TG_RENDER}
|
target_link_libraries(${TG_RENDER}
|
||||||
|
|||||||
@@ -4,10 +4,19 @@
|
|||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
std::filesystem::path tempPath_defaultShader{L"I:/source/render/assets/shaders/_this_is_fuckin_default_shader.hlsl"};
|
std::filesystem::path project_src_root{PROJECT_ROOT};
|
||||||
std::filesystem::path tempPath_defaultPBRShader{L"I:/source/render/assets/shaders/pbr_forward.hlsl"};
|
std::filesystem::path tempPath_defaultShader =
|
||||||
std::filesystem::path tempPath_shadowDepth{L"I:/source/render/assets/shaders/shadow_depth_vs.hlsl"};
|
project_src_root / std::filesystem::path{L"assets/shaders/_this_is_fuckin_default_shader.hlsl"};
|
||||||
std::filesystem::path tempPath_PbrWithIbl{L"I:/source/render/assets/shaders/pbr_forward_ibl.hlsl"};
|
std::filesystem::path tempPath_defaultPBRShader =
|
||||||
|
project_src_root / std::filesystem::path{L"assets/shaders/pbr_forward.hlsl"};
|
||||||
|
std::filesystem::path tempPath_shadowDepth =
|
||||||
|
project_src_root / std::filesystem::path{L"assets/shaders/shadow_depth_vs.hlsl"};
|
||||||
|
std::filesystem::path tempPath_PbrWithIbl =
|
||||||
|
project_src_root / std::filesystem::path{L"assets/shaders/pbr_forward_ibl.hlsl"};
|
||||||
|
// std::filesystem::path tempPath_defaultShader{L"I:/source/render/assets/shaders/_this_is_fuckin_default_shader.hlsl"};
|
||||||
|
// std::filesystem::path tempPath_defaultPBRShader{L"I:/source/render/assets/shaders/pbr_forward.hlsl"};
|
||||||
|
// std::filesystem::path tempPath_shadowDepth{L"I:/source/render/assets/shaders/shadow_depth_vs.hlsl"};
|
||||||
|
// std::filesystem::path tempPath_PbrWithIbl{L"I:/source/render/assets/shaders/pbr_forward_ibl.hlsl"};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,16 +54,18 @@ const std::wstring &StatesRender::S_GetExeDir() {
|
|||||||
|
|
||||||
const std::filesystem::path &StatesRender::S_GetDefaultShaderPath() {
|
const std::filesystem::path &StatesRender::S_GetDefaultShaderPath() {
|
||||||
// DEBUG MODE
|
// DEBUG MODE
|
||||||
|
#ifdef _DEBUG
|
||||||
return tempPath_PbrWithIbl;
|
return tempPath_PbrWithIbl;
|
||||||
return tempPath_defaultPBRShader;
|
return tempPath_defaultPBRShader;
|
||||||
return tempPath_defaultShader;
|
return tempPath_defaultShader;
|
||||||
|
#endif
|
||||||
|
|
||||||
// 正确的
|
// 正确的
|
||||||
static std::filesystem::path shaderpath = []()-> std::filesystem::path {
|
static std::filesystem::path shaderpath = []()-> std::filesystem::path {
|
||||||
std::filesystem::path rootdir{S_GetExeDir()};
|
std::filesystem::path rootdir{S_GetExeDir()};
|
||||||
std::filesystem::path _shaderpath = rootdir / L"assets/shaders/_this_is_fuckin_default_shader.hlsl";
|
std::filesystem::path _shaderpath = rootdir / L"assets/shaders/pbr_forward_ibl.hlsl";
|
||||||
if (!std::filesystem::exists(_shaderpath)) {
|
if (!std::filesystem::exists(_shaderpath)) {
|
||||||
MessageBoxW(nullptr, L"exe目录下找不到assets/shaders/_default_shader.hlsl", L"StatesRender.cpp",MB_OK);
|
MessageBoxW(nullptr, L"exe目录下找不到assets/shaders/pbr_forward_ibl.hlsl", L"StatesRender.cpp",MB_OK);
|
||||||
throw std::runtime_error{"default shader does not exist"};
|
throw std::runtime_error{"default shader does not exist"};
|
||||||
}
|
}
|
||||||
return _shaderpath;
|
return _shaderpath;
|
||||||
@@ -66,7 +77,9 @@ const std::filesystem::path &StatesRender::S_GetDefaultShaderPath() {
|
|||||||
const std::filesystem::path &StatesRender::S_GetShadowDepthShaderPath() {
|
const std::filesystem::path &StatesRender::S_GetShadowDepthShaderPath() {
|
||||||
|
|
||||||
// DEBUG MODE
|
// DEBUG MODE
|
||||||
|
#ifdef _DEBUG
|
||||||
return tempPath_shadowDepth;
|
return tempPath_shadowDepth;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// 正确的
|
// 正确的
|
||||||
|
|||||||
Reference in New Issue
Block a user