From d52e9bb2a3b5c83a625f545ddd7d89ce526bd32e Mon Sep 17 00:00:00 2001 From: lveyoupad <1339484752@qq.com> Date: Tue, 31 Dec 2024 02:33:01 +0800 Subject: [PATCH] =?UTF-8?q?*=20vk=E6=8A=A5=E9=94=99=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 35 +++++++++------- dl/math/dl_random.h | 5 +++ dl/render/dl_factory.h | 1 + dl/system/dl_midi.cpp | 8 +++- dl/system/dl_midi.h | 1 + dl/vk/dl_vertex.h | 74 +++++++++++++++++++-------------- dl/vk/dl_vk.h | 4 +- project/dl_midi | 2 +- project/dl_test/CMakeLists.txt | 6 ++- project/dl_test/main.cpp | 36 ++++++++-------- project/dl_test/ui_main.cpp | 4 +- res/dl/shader/vert_bone.spv | Bin 4092 -> 4716 bytes shader/compile_copy.bat | 24 +++++------ shader/shader.vert | 6 ++- shader/shader_pbr.vert | 13 ++++-- 15 files changed, 131 insertions(+), 88 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 105a7c68..3824f922 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ else() set(DL_DISABLE_AUDIO false) set(DL_DISABLE_OPENSSL false) set(DL_DISABLE_CURL false) - set(DL_DISABLE_CONSOLE false) + set(DL_DISABLE_CONSOLE false) # 仅控制是否有控制台 set(DL_USE_MT false) endif() @@ -144,23 +144,30 @@ add_subdirectory ("dl") if(NOT DL_DISABLE_RENDER) message("------------------解析dl_test-----------------------") add_subdirectory ("project/dl_test") + + if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_editor/CMakeLists.txt) + message("------------------解析dl_editor-----------------------") + add_subdirectory ("project/dl_editor") + endif() + if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_midi/CMakeLists.txt) + message("------------------解析dl_midi-----------------------") + add_subdirectory ("project/dl_midi") + endif() + if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_chess/CMakeLists.txt) + message("------------------解析dl_chess-----------------------") + add_subdirectory ("project/dl_chess") + endif() + if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_snake/CMakeLists.txt) + message("------------------解析dl_snake-----------------------") + add_subdirectory ("project/dl_snake") + endif() endif() + message("------------------解析dl_console-----------------------") add_subdirectory ("project/dl_console") - -if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_editor/CMakeLists.txt) - message("------------------解析dl_editor-----------------------") - add_subdirectory ("project/dl_editor") -endif() -if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_midi/CMakeLists.txt) - message("------------------解析dl_midi-----------------------") - add_subdirectory ("project/dl_midi") -endif() -if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_chess/CMakeLists.txt) - message("------------------解析dl_chess-----------------------") - add_subdirectory ("project/dl_chess") -endif() if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_config/CMakeLists.txt) message("------------------解析dl_config-----------------------") add_subdirectory ("project/dl_config") endif() + + diff --git a/dl/math/dl_random.h b/dl/math/dl_random.h index 7b7816f4..bb287518 100644 --- a/dl/math/dl_random.h +++ b/dl/math/dl_random.h @@ -84,6 +84,11 @@ public: return Integer(min, max); } + static unsigned Uint(unsigned min, unsigned max) + { + return Integer(min, max); + } + /** * @brief 从容器随机选择一个 * @param[in] container 容器(不能为空) diff --git a/dl/render/dl_factory.h b/dl/render/dl_factory.h index 50e69709..cda07134 100644 --- a/dl/render/dl_factory.h +++ b/dl/render/dl_factory.h @@ -151,6 +151,7 @@ public: /** * @brief 创建默认精灵 */ + [[nodiscard]] gcSprite CreateSpriteDefault(const Color& col = ColorDef::WHITE); /** diff --git a/dl/system/dl_midi.cpp b/dl/system/dl_midi.cpp index 0ea7f058..3a1de5bc 100644 --- a/dl/system/dl_midi.cpp +++ b/dl/system/dl_midi.cpp @@ -54,7 +54,7 @@ namespace dl // message[1] = 64; // message[2] = 91; // _out->sendMessage(&message); - // std::this_thread::sleep_for(std::chrono::milliseconds(500)); + // std::this_thread::sleep_for(std::chrono::milliseconds(500)); // message[0] = 128; // message[1] = 70; // message[2] = 40; @@ -98,4 +98,10 @@ namespace dl _imp->_out->sendMessage((unsigned char*)buf.data(), buf.size()); } + void Midi::PlayC() + { + /*unsigned char + _imp->_out->sendMessage(,);*/ + } + } diff --git a/dl/system/dl_midi.h b/dl/system/dl_midi.h index 42e27936..5dce25a5 100644 --- a/dl/system/dl_midi.h +++ b/dl/system/dl_midi.h @@ -24,6 +24,7 @@ public: ~Midi(); void Play(BufferView buf); + void PlayC(); private: MidiImp* _imp; }; diff --git a/dl/vk/dl_vertex.h b/dl/vk/dl_vertex.h index 25ed16cb..71f0c6a0 100644 --- a/dl/vk/dl_vertex.h +++ b/dl/vk/dl_vertex.h @@ -22,8 +22,8 @@ namespace dl struct Vertex { Position3 _pos; - Position3 _normal; Position2 _uv; + Position3 _normal; Position3 _tangent; static VkVertexInputBindingDescription getBindingDescription() { @@ -36,22 +36,26 @@ struct Vertex static std::array getAttributeDescriptions() { std::array attributeDescriptions{}; - attributeDescriptions[0].binding = 0; - attributeDescriptions[0].location = 0; - attributeDescriptions[0].format = VK_FORMAT_R32G32B32_SFLOAT; - attributeDescriptions[0].offset = offsetof(Vertex, _pos); - attributeDescriptions[1].binding = 0; - attributeDescriptions[1].location = 2; - attributeDescriptions[1].format = VK_FORMAT_R32G32B32_SFLOAT; - attributeDescriptions[1].offset = offsetof(Vertex, _normal); - attributeDescriptions[2].binding = 0; - attributeDescriptions[2].location = 1; - attributeDescriptions[2].format = VK_FORMAT_R32G32_SFLOAT; - attributeDescriptions[2].offset = offsetof(Vertex, _uv); - attributeDescriptions[3].binding = 0; - attributeDescriptions[3].location = 3; - attributeDescriptions[3].format = VK_FORMAT_R32G32B32_SFLOAT; - attributeDescriptions[3].offset = offsetof(Vertex, _tangent); + uint32_t i = 0; + attributeDescriptions[i].binding = 0; + attributeDescriptions[i].location = i; + attributeDescriptions[i].format = VK_FORMAT_R32G32B32_SFLOAT; + attributeDescriptions[i].offset = offsetof(Vertex, _pos); + ++i; + attributeDescriptions[i].binding = 0; + attributeDescriptions[i].location = i; + attributeDescriptions[i].format = VK_FORMAT_R32G32_SFLOAT; + attributeDescriptions[i].offset = offsetof(Vertex, _uv); + ++i; + attributeDescriptions[i].binding = 0; + attributeDescriptions[i].location = i; + attributeDescriptions[i].format = VK_FORMAT_R32G32B32_SFLOAT; + attributeDescriptions[i].offset = offsetof(Vertex, _normal); + ++i; + attributeDescriptions[i].binding = 0; + attributeDescriptions[i].location = i; + attributeDescriptions[i].format = VK_FORMAT_R32G32B32_SFLOAT; + attributeDescriptions[i].offset = offsetof(Vertex, _tangent); return attributeDescriptions; } }; @@ -61,11 +65,12 @@ constexpr size_t NUM_BONE = 4; struct VertexBone { Position3 _pos; - Position3 _normal; Position2 _uv0; Position2 _uv1; - std::array _joint0; + Position3 _normal; + Position3 _tangent; Position4 _weight0; + std::array _joint0; Position4 _color; static VkVertexInputBindingDescription getBindingDescription() { @@ -75,19 +80,14 @@ struct VertexBone bindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX; return bindingDescription; } - static std::array getAttributeDescriptions() + static std::array getAttributeDescriptions() { - std::array attributeDescriptions{}; + std::array attributeDescriptions{}; uint32_t i = 0; attributeDescriptions[i].binding = 0; attributeDescriptions[i].location = i; attributeDescriptions[i].format = VK_FORMAT_R32G32B32_SFLOAT; attributeDescriptions[i].offset = offsetof(VertexBone, _pos); - ++i; - attributeDescriptions[i].binding = 0; - attributeDescriptions[i].location = i; - attributeDescriptions[i].format = VK_FORMAT_R32G32B32_SFLOAT; - attributeDescriptions[i].offset = offsetof(VertexBone, _normal); ++i; attributeDescriptions[i].binding = 0; attributeDescriptions[i].location = i; @@ -98,6 +98,21 @@ struct VertexBone attributeDescriptions[i].location = i; attributeDescriptions[i].format = VK_FORMAT_R32G32_SFLOAT; attributeDescriptions[i].offset = offsetof(VertexBone, _uv1); + ++i; + attributeDescriptions[i].binding = 0; + attributeDescriptions[i].location = i; + attributeDescriptions[i].format = VK_FORMAT_R32G32B32_SFLOAT; + attributeDescriptions[i].offset = offsetof(VertexBone, _normal); + ++i; + attributeDescriptions[i].binding = 0; + attributeDescriptions[i].location = i; + attributeDescriptions[i].format = VK_FORMAT_R32G32B32_SFLOAT; + attributeDescriptions[i].offset = offsetof(VertexBone, _tangent); + ++i; + attributeDescriptions[i].binding = 0; + attributeDescriptions[i].location = i; + attributeDescriptions[i].format = VK_FORMAT_R32G32B32A32_SFLOAT; + attributeDescriptions[i].offset = offsetof(VertexBone, _weight0); ++i; attributeDescriptions[i].binding = 0; attributeDescriptions[i].location = i; @@ -106,12 +121,7 @@ struct VertexBone ++i; attributeDescriptions[i].binding = 0; attributeDescriptions[i].location = i; - attributeDescriptions[i].format = VK_FORMAT_R32G32B32A32_UINT; - attributeDescriptions[i].offset = offsetof(VertexBone, _weight0); - ++i; - attributeDescriptions[i].binding = 0; - attributeDescriptions[i].location = i; - attributeDescriptions[i].format = VK_FORMAT_R32G32B32A32_UINT; + attributeDescriptions[i].format = VK_FORMAT_R32G32B32A32_SFLOAT; attributeDescriptions[i].offset = offsetof(VertexBone, _color); return attributeDescriptions; diff --git a/dl/vk/dl_vk.h b/dl/vk/dl_vk.h index cc7a3f26..fb2928b4 100644 --- a/dl/vk/dl_vk.h +++ b/dl/vk/dl_vk.h @@ -352,9 +352,9 @@ public: void* pUserData) { if (messageSeverity == VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT) - ;// log_test0(pCallbackData->pMessage); + log_test0(pCallbackData->pMessage); else if (messageSeverity == VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) - log_info0(pCallbackData->pMessage);//提高了一个等级,方便断点 + log_info0(pCallbackData->pMessage); return VK_FALSE; } diff --git a/project/dl_midi b/project/dl_midi index ae96c815..7c18afc8 160000 --- a/project/dl_midi +++ b/project/dl_midi @@ -1 +1 @@ -Subproject commit ae96c81546a6b83c2e1e7a6c2309015602cb813f +Subproject commit 7c18afc83138da7df33f3f1f62ebd43da294a0b4 diff --git a/project/dl_test/CMakeLists.txt b/project/dl_test/CMakeLists.txt index 19586ae2..14884384 100644 --- a/project/dl_test/CMakeLists.txt +++ b/project/dl_test/CMakeLists.txt @@ -8,7 +8,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # 设置处理 if (DL_DISABLE_RENDER) - message(SEND_ERROR "dl_test必须启动绘图系统,将会编译失败(DL_DISABLE_RENDER)!") + message(SEND_ERROR ${PROJECT_NAME}"必须启动绘图系统,将会编译失败(DL_DISABLE_RENDER)!") endif() # dl目录 @@ -49,6 +49,10 @@ include_directories(${CMAKE_SOURCE_DIR}/third/tinyxml2) include_directories(${CMAKE_SOURCE_DIR}/third/asio/include) # angelscript include_directories(${CMAKE_SOURCE_DIR}/third/angelscript/angelscript/include) +# lua +include_directories(${CMAKE_SOURCE_DIR}/third/lua) +# lua bridge +include_directories(${CMAKE_SOURCE_DIR}/third/LuaBridge3/Source) # dl资源文件夹 set(DL_PATH_RES ${CMAKE_SOURCE_DIR}/res) diff --git a/project/dl_test/main.cpp b/project/dl_test/main.cpp index e4384ef0..8559158e 100644 --- a/project/dl_test/main.cpp +++ b/project/dl_test/main.cpp @@ -154,24 +154,24 @@ void Init() //g_factory->LoadModel("axis.glb", "axis"); // 脚本加载 - { - g_as->SetPathRoot("as/"); - std::vector vec; - File::GetPathFileAll("as/", vec, {}, false); - for (auto& iter : vec) - { - g_as->LoadModule(iter); - } - } - // mod加载 - { - std::vector vec; - File::GetPathFileAll("mod/", vec, {}, false); - for (auto& iter : vec) - { - g_mod->LoadMod(iter); - } - } + //{ + // g_as->SetPathRoot("as/"); + // std::vector vec; + // File::GetPathFileAll("as/", vec, {}, false); + // for (auto& iter : vec) + // { + // g_as->LoadModule(iter); + // } + //} + //// mod加载 + //{ + // std::vector vec; + // File::GetPathFileAll("mod/", vec, {}, false); + // for (auto& iter : vec) + // { + // g_mod->LoadMod(iter); + // } + //} g_ui->SetStandardSize({ 800, 600 }); g_ui->RegisterAll("ui/"); diff --git a/project/dl_test/ui_main.cpp b/project/dl_test/ui_main.cpp index 2b9c404f..02d84e7d 100644 --- a/project/dl_test/ui_main.cpp +++ b/project/dl_test/ui_main.cpp @@ -49,8 +49,8 @@ UIMain::UIMain() _ruler = Tool::Ruler::Create(); - g_as->ExcuteFunction("mod管理器", "UI::Panel@ initUI(string)", - _panelMod, std::string{ "dddddddddd" }); + /*g_as->ExcuteFunction("mod管理器", "UI::Panel@ initUI(string)", + _panelMod, std::string{ "dddddddddd" });*/ int x = 3; } diff --git a/res/dl/shader/vert_bone.spv b/res/dl/shader/vert_bone.spv index c30d0463f12b5324b2133f1c0a3109fe185f933a..a5d307a9caa3643d1ef0e99a157159e43a61b31f 100644 GIT binary patch literal 4716 zcmZ9MX?Ijb5QZ<11QZ0^H;h5tP(V>|Uw|kg}rP>Z-moXZEtWSvD&>H9IZ)Eo-gQv)M3NHb3hs zWncf+{#A|U*s3*auhnB=Hm7vdXHmAe)I0dUYa}l;7J!XlGswX{a0pC;W8gUW8T<<7 z@HZRz2gy39qOX6bZ(yLW|L&pD$;qKc^Vw=;sG1j*p|QMP8ExjfEBeiA^UI6T>eN`f zLnj{X^=O~M8G9=E#Exbo>*UWGx7Uiw!zGu&bY#onCTop;L}{-;7Pb1Wk!pV#vl6>G zQcP5eX7ZVn*%0s8na$1CBOfgCaY8msjgMFA8#n;2i(U6z&H6~uKzd#;(i-Hg$)0K7 zQ;b#iCa&yZF<5Kl&Adi;_4B;E*j!eIT5|R{FSfO+E4i-h4dg_1Xs}X$s8Vm1DXFE! zvsLaz;x6jf-n0I+3RGs&fR5y z-a`JbKLgu$GSjjq_guU4%AUb`ZKt~N?;xkP*U-DN_s|EY8asMxg{L?5vA6QBUA3`F z6&aj&8Ld@ob)JQ#`|vR@eFIc@Aw3_ z8m6Os*Ll&(*oVCUpYAe8mT9j;?*htA*zq!#}U$aTOoHz2*IoW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Nc*C+BaXzmNW|Db06wUjXMY%Nx<2EVwe#e0_4wzq$TC`a9T-yar}~zgIDj z>jiJjZS=3eEzlhEb-_O(rVITWV4i&3?OXJvz!~|5W`Ue5xI5@__Bpuk3a$kizj5EA z&jRE1H~+@{fbIUqc;>svA3+UxX8WLRoc{aBpMiI>PjTK~3f}m8=-T=oARmHxpl`0Q J|K-$&z<)G`L*4)Y diff --git a/shader/compile_copy.bat b/shader/compile_copy.bat index 075233f0..68c2dd1c 100644 --- a/shader/compile_copy.bat +++ b/shader/compile_copy.bat @@ -1,30 +1,30 @@ ::3d普通 -glslc.exe shader.vert -o vert.spv -glslc.exe shader.frag -o frag.spv -copy vert.spv ..\res\shader\ -copy frag.spv ..\res\shader\ +glslc.exe shader_pbr.vert -o vert.spv +glslc.exe shader_pbr.frag -o frag.spv +copy vert.spv ..\res\dl\shader\ +copy frag.spv ..\res\dl\shader\ del vert.spv del frag.spv ::3d骨骼 -glslc.exe shader.vert -D=BONE -o vert_bone.spv -glslc.exe shader.frag -D=BONE -o frag_bone.spv -copy vert_bone.spv ..\res\shader\ -copy frag_bone.spv ..\res\shader\ +glslc.exe shader_pbr.vert -D=BONE -o vert_bone.spv +glslc.exe shader_pbr.frag -D=BONE -o frag_bone.spv +copy vert_bone.spv ..\res\dl\shader\ +copy frag_bone.spv ..\res\dl\shader\ del vert_bone.spv del frag_bone.spv glslc.exe shader_2d.vert -o vert_2d.spv glslc.exe shader_2d.frag -o frag_2d.spv -copy vert_2d.spv ..\res\shader\ -copy frag_2d.spv ..\res\shader\ +copy vert_2d.spv ..\res\dl\shader\ +copy frag_2d.spv ..\res\dl\shader\ del vert_2d.spv del frag_2d.spv glslc.exe shader_gfx.vert -o vert_gfx.spv glslc.exe shader_gfx.frag -o frag_gfx.spv -copy vert_gfx.spv ..\res\shader\ -copy frag_gfx.spv ..\res\shader\ +copy vert_gfx.spv ..\res\dl\shader\ +copy frag_gfx.spv ..\res\dl\shader\ del vert_gfx.spv del frag_gfx.spv diff --git a/shader/shader.vert b/shader/shader.vert index e4b37822..a49fafe1 100644 --- a/shader/shader.vert +++ b/shader/shader.vert @@ -20,12 +20,14 @@ layout (set = 1, binding = 0) uniform UniformBufferBone layout(location = 0) in vec3 inPosition; -layout(location = 1) in vec2 inTexCoord; -layout(location = 2) in vec3 inNormal; +layout(location = 1) in vec3 inNormal; +layout(location = 2) in vec2 inTexCoord; layout(location = 3) in vec3 inTangent; #ifdef BONE layout(location = 4) in vec4 boneWeight; layout(location = 5) in uvec4 boneIndex; +layout(location = 6) in vec2 inTexCoord1; +layout(location = 7) in vec4 inColor; #endif layout(location = 0) out vec3 fragColor; diff --git a/shader/shader_pbr.vert b/shader/shader_pbr.vert index 1dd9cac7..c53b525c 100644 --- a/shader/shader_pbr.vert +++ b/shader/shader_pbr.vert @@ -19,13 +19,20 @@ layout (set = 1, binding = 0) uniform UniformBufferBone #endif +#ifdef BONE +layout(location = 0) in vec3 inPosition; +layout(location = 1) in vec2 inTexCoord; +layout(location = 2) in vec2 inTexCoord1; +layout(location = 3) in vec3 inNormal; +layout(location = 4) in vec3 inTangent; +layout(location = 5) in vec3 boneWeight; +layout(location = 6) in uvec4 boneIndex; +layout(location = 7) in vec4 inColor; +#else layout(location = 0) in vec3 inPosition; layout(location = 1) in vec2 inTexCoord; layout(location = 2) in vec3 inNormal; layout(location = 3) in vec3 inTangent; -#ifdef BONE -layout(location = 4) in vec3 boneWeight; -layout(location = 5) in uvec4 boneIndex; #endif layout(location = 0) out vec3 fragColor;