├── Engine ├── Shader │ ├── BasePassPS.esl │ ├── BasePassVS.esl │ └── Platform.esh ├── Source │ ├── RHI-Vulkan │ │ ├── Src │ │ │ ├── VmaImport.cpp │ │ │ ├── VulkanRHIModule.cpp │ │ │ ├── Surface.cpp │ │ │ ├── Platform │ │ │ │ ├── Win32Surface.cpp │ │ │ │ └── MacosSurface.mm │ │ │ └── BufferView.cpp │ │ ├── Include │ │ │ └── RHI │ │ │ │ └── Vulkan │ │ │ │ ├── VulkanRHIModule.h │ │ │ │ ├── Sampler.h │ │ │ │ ├── Surface.h │ │ │ │ ├── Queue.h │ │ │ │ ├── PipelineLayout.h │ │ │ │ ├── BindGroupLayout.h │ │ │ │ ├── CommandBuffer.h │ │ │ │ ├── ShaderModule.h │ │ │ │ ├── BindGroup.h │ │ │ │ ├── BufferView.h │ │ │ │ ├── Gpu.h │ │ │ │ ├── Synchronous.h │ │ │ │ ├── TextureView.h │ │ │ │ ├── SwapChain.h │ │ │ │ ├── Buffer.h │ │ │ │ └── Texture.h │ │ └── CMakeLists.txt │ ├── Test │ │ ├── Include │ │ │ └── Test │ │ │ │ └── Test.h │ │ ├── CMakeLists.txt │ │ └── Src │ │ │ └── Main.cpp │ ├── RHI-DirectX12 │ │ ├── Src │ │ │ ├── Common.cpp │ │ │ ├── Surface.cpp │ │ │ ├── ShaderModule.cpp │ │ │ ├── DX12RHIModule.cpp │ │ │ └── Gpu.cpp │ │ ├── CMakeLists.txt │ │ └── Include │ │ │ └── RHI │ │ │ └── DirectX12 │ │ │ ├── Surface.h │ │ │ ├── DX12RHIModule.h │ │ │ ├── ShaderModule.h │ │ │ ├── Queue.h │ │ │ ├── Sampler.h │ │ │ ├── Gpu.h │ │ │ ├── TextureView.h │ │ │ ├── Texture.h │ │ │ ├── BindGroup.h │ │ │ ├── BufferView.h │ │ │ ├── Buffer.h │ │ │ ├── SwapChain.h │ │ │ ├── Synchronous.h │ │ │ └── BindGroupLayout.h │ ├── RHI │ │ ├── CMakeLists.txt │ │ ├── Src │ │ │ ├── Gpu.cpp │ │ │ ├── RHIModule.cpp │ │ │ ├── CommandBuffer.cpp │ │ │ ├── Surface.cpp │ │ │ ├── Device.cpp │ │ │ ├── Common.cpp │ │ │ ├── BindGroup.cpp │ │ │ ├── Synchronous.cpp │ │ │ ├── ShaderModule.cpp │ │ │ ├── Queue.cpp │ │ │ └── BindGroupLayout.cpp │ │ └── Include │ │ │ └── RHI │ │ │ ├── RHIModule.h │ │ │ ├── CommandBuffer.h │ │ │ ├── Surface.h │ │ │ ├── RHI.h │ │ │ ├── Gpu.h │ │ │ ├── ShaderModule.h │ │ │ ├── Instance.h │ │ │ ├── BindGroup.h │ │ │ ├── Queue.h │ │ │ ├── PipelineLayout.h │ │ │ └── Buffer.h │ ├── Common │ │ ├── Test │ │ │ ├── FileSystemTest.cpp │ │ │ ├── UtilityTest.cpp │ │ │ ├── FileTest.cpp │ │ │ ├── HashTest.cpp │ │ │ └── DelegateTest.cpp │ │ ├── CMakeLists.txt │ │ ├── Src │ │ │ ├── Serialization.cpp │ │ │ ├── IO.cpp │ │ │ ├── Platform.cpp │ │ │ ├── Hash.cpp │ │ │ └── Debug.cpp │ │ └── Include │ │ │ └── Common │ │ │ ├── Math │ │ │ ├── Math.h │ │ │ └── Common.h │ │ │ ├── File.h │ │ │ ├── Platform.h │ │ │ ├── IO.h │ │ │ └── DynamicLibrary.h │ ├── Runtime │ │ ├── Src │ │ │ ├── RuntimeModule.cpp │ │ │ ├── Client.cpp │ │ │ ├── Component │ │ │ │ ├── Primitive.cpp │ │ │ │ ├── Scene.cpp │ │ │ │ ├── Camera.cpp │ │ │ │ ├── Light.cpp │ │ │ │ └── Player.cpp │ │ │ ├── Settings │ │ │ │ └── Game.cpp │ │ │ ├── Asset │ │ │ │ ├── Mesh.cpp │ │ │ │ ├── Level.cpp │ │ │ │ └── Asset.cpp │ │ │ ├── Viewport.cpp │ │ │ ├── SystemGraphPresets.cpp │ │ │ ├── System │ │ │ │ └── Player.cpp │ │ │ └── GameThread.cpp │ │ ├── Include │ │ │ └── Runtime │ │ │ │ ├── RuntimeModule.h │ │ │ │ ├── Meta.h │ │ │ │ ├── SystemGraphPresets.h │ │ │ │ ├── GameModule.h │ │ │ │ ├── Client.h │ │ │ │ ├── Component │ │ │ │ ├── Primitive.h │ │ │ │ ├── Scene.h │ │ │ │ ├── Camera.h │ │ │ │ ├── Light.h │ │ │ │ └── Player.h │ │ │ │ ├── Asset │ │ │ │ ├── Level.h │ │ │ │ └── Mesh.h │ │ │ │ ├── Settings │ │ │ │ └── Game.h │ │ │ │ ├── System │ │ │ │ └── Transform.h │ │ │ │ ├── Viewport.h │ │ │ │ └── World.h │ │ ├── Test │ │ │ ├── RuntimeTestModule.h │ │ │ ├── RuntimeTestModule.cpp │ │ │ └── AssetTest.h │ │ └── CMakeLists.txt │ ├── RHI-Dummy │ │ ├── CMakeLists.txt │ │ ├── Src │ │ │ ├── Sampler.cpp │ │ │ ├── Surface.cpp │ │ │ ├── BindGroup.cpp │ │ │ ├── BufferView.cpp │ │ │ ├── TextureView.cpp │ │ │ ├── PipelineLayout.cpp │ │ │ ├── BindGroupLayout.cpp │ │ │ ├── CommandBuffer.cpp │ │ │ ├── Queue.cpp │ │ │ ├── ShaderModule.cpp │ │ │ ├── Texture.cpp │ │ │ ├── Pipeline.cpp │ │ │ ├── Gpu.cpp │ │ │ ├── Synchronous.cpp │ │ │ ├── Buffer.cpp │ │ │ ├── DummyRHIModule.cpp │ │ │ ├── Instance.cpp │ │ │ └── SwapChain.cpp │ │ └── Include │ │ │ └── RHI │ │ │ └── Dummy │ │ │ ├── Sampler.h │ │ │ ├── Surface.h │ │ │ ├── BindGroup.h │ │ │ ├── BufferView.h │ │ │ ├── CommandBuffer.h │ │ │ ├── TextureView.h │ │ │ ├── PipelineLayout.h │ │ │ ├── BindGroupLayout.h │ │ │ ├── Queue.h │ │ │ ├── Texture.h │ │ │ ├── DummyRHIModule.h │ │ │ ├── ShaderModule.h │ │ │ ├── Gpu.h │ │ │ ├── Instance.h │ │ │ ├── Buffer.h │ │ │ ├── Pipeline.h │ │ │ ├── Synchronous.h │ │ │ └── SwapChain.h │ ├── Core │ │ ├── Include │ │ │ └── Core │ │ │ │ ├── EngineVersion.h │ │ │ │ └── Thread.h │ │ ├── CMakeLists.txt │ │ └── Test │ │ │ ├── ConsoleTest.cpp │ │ │ └── CmdlineTest.cpp │ ├── Render │ │ ├── Src │ │ │ ├── Scene.cpp │ │ │ ├── Renderer.cpp │ │ │ └── View.cpp │ │ ├── Include │ │ │ └── Render │ │ │ │ ├── SceneProxy │ │ │ │ ├── Primitive.h │ │ │ │ └── Light.h │ │ │ │ ├── RenderModule.h │ │ │ │ └── View.h │ │ └── CMakeLists.txt │ ├── Launch │ │ ├── CMakeLists.txt │ │ ├── Src │ │ │ ├── Main.cpp │ │ │ └── GameClient.cpp │ │ └── Include │ │ │ └── Launch │ │ │ ├── GameClient.h │ │ │ └── GameApplication.h │ ├── Mirror │ │ ├── CMakeLists.txt │ │ ├── Include │ │ │ └── Mirror │ │ │ │ └── Meta.h │ │ └── Test │ │ │ └── RegistryTest.h │ └── CMakeLists.txt └── CMakeLists.txt ├── Editor ├── Web │ ├── .npmrc │ ├── src │ │ ├── vite-env.d.ts │ │ ├── styles │ │ │ └── globals.css │ │ ├── qwebchannel.d.ts │ │ ├── App.tsx │ │ ├── main.tsx │ │ └── provider.tsx │ ├── favicon.ico │ ├── vercel.json │ ├── postcss.config.js │ ├── public │ │ ├── logo.png │ │ └── vite.svg │ ├── tsconfig.node.json │ ├── vite.config.ts │ ├── .gitignore │ ├── tailwind.config.js │ ├── tsconfig.json │ ├── index.html │ └── LICENSE ├── Resource │ └── ProjectTemplates │ │ ├── 2D │ │ └── CMakeLists.txt │ │ └── 3D │ │ └── CMakeLists.txt ├── Src │ ├── Widget │ │ ├── Editor.cpp │ │ └── WebWidget.cpp │ ├── EditorEngine.cpp │ └── EditorModule.cpp ├── Include │ └── Editor │ │ ├── Widget │ │ ├── Editor.h │ │ ├── WebWidget.h │ │ └── GraphicsWidget.h │ │ ├── EditorModule.h │ │ ├── EditorEngine.h │ │ └── WebUIServer.h └── Shader │ └── GraphicsWindowSample.esl ├── Tool ├── CMakeLists.txt └── MirrorTool │ ├── Test │ └── MirrorToolInput.h │ ├── CMakeLists.txt │ └── Include │ └── MirrorTool │ └── Generator.h ├── .gitattributes ├── .github └── resource │ ├── Logo.png │ └── JetBrains.png ├── ThirdParty └── ConanRecipes │ ├── vulkan-validationlayers │ ├── test_package │ │ ├── test_package.cpp │ │ ├── conanfile.py │ │ └── CMakeLists.txt │ ├── conandata.yml │ └── patches │ │ └── 0000-fix-spirv-tools-includes.patch │ ├── glfw │ ├── conandata.yml │ └── test_package │ │ ├── test_package.cpp │ │ ├── CMakeLists.txt │ │ └── conanfile.py │ ├── molten-vk │ ├── test_package │ │ ├── test_package.cpp │ │ ├── CMakeLists.txt │ │ └── conanfile.py │ └── conandata.yml │ ├── dxc │ ├── conandata.yml │ └── test_package │ │ ├── CMakeLists.txt │ │ └── conanfile.py │ ├── vulkan-utility-libraries │ ├── conandata.yml │ └── test_package │ │ ├── test_package.cpp │ │ ├── CMakeLists.txt │ │ └── conanfile.py │ ├── debugbreak │ ├── test_package │ │ ├── test_package.cpp │ │ ├── CMakeLists.txt │ │ └── conanfile.py │ ├── conandata.yml │ └── conanfile.py │ ├── rapidjson │ ├── conandata.yml │ ├── test_package │ │ ├── CMakeLists.txt │ │ ├── test_package.cpp │ │ └── conanfile.py │ └── conanfile.py │ ├── assimp │ ├── conandata.yml │ └── test_package │ │ ├── CMakeLists.txt │ │ ├── test_package.cpp │ │ └── conanfile.py │ ├── libclang │ ├── conandata.yml │ └── test_package │ │ ├── CMakeLists.txt │ │ ├── test_package.cpp │ │ └── conanfile.py │ ├── qt │ ├── debug.py │ └── test_package │ │ ├── test_package.cpp │ │ ├── conanfile.py │ │ └── CMakeLists.txt │ └── clipp │ ├── test_package │ ├── CMakeLists.txt │ ├── test_package.cpp │ └── conanfile.py │ ├── conandata.yml │ └── conanfile.py ├── Sample ├── RHI-TexSampling │ ├── Awesomeface.png │ └── TexSampling.esl ├── Rendering-BaseTexture │ ├── Awesomeface.png │ └── BaseTexture.esl ├── Rendering-Triangle │ └── Triangle.esl ├── RHI-ParallelCompute │ └── Compute.esl ├── RHI-Triangle │ └── Triangle.esl ├── RHI-SSAO │ └── Shader │ │ └── Blur.esl └── Rendering-SSAO │ └── Shader │ └── Blur.esl ├── .gitignore ├── CMakeLists.txt ├── .clang-tidy ├── LICENSE ├── conanfile.py └── CMake └── Common.cmake /Engine/Shader/BasePassPS.esl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Engine/Shader/BasePassVS.esl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Editor/Web/.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=true -------------------------------------------------------------------------------- /Tool/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(MirrorTool) -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ThirdParty/ConanRecipes/**/* text eol=lf -------------------------------------------------------------------------------- /Editor/Web/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /Editor/Web/src/styles/globals.css: -------------------------------------------------------------------------------- 1 | @import "tailwindcss"; 2 | 3 | @config "../../tailwind.config.js" -------------------------------------------------------------------------------- /Editor/Web/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ExplosionEngine/Explosion/HEAD/Editor/Web/favicon.ico -------------------------------------------------------------------------------- /Editor/Web/vercel.json: -------------------------------------------------------------------------------- 1 | { 2 | "rewrites": [ 3 | { "source": "/(.*)", "destination": "/" } 4 | ] 5 | } -------------------------------------------------------------------------------- /.github/resource/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ExplosionEngine/Explosion/HEAD/.github/resource/Logo.png -------------------------------------------------------------------------------- /Editor/Web/postcss.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | plugins: { 3 | "@tailwindcss/postcss": {}, 4 | }, 5 | }; -------------------------------------------------------------------------------- /Editor/Web/public/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ExplosionEngine/Explosion/HEAD/Editor/Web/public/logo.png -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/vulkan-validationlayers/test_package/test_package.cpp: -------------------------------------------------------------------------------- 1 | int main() { 2 | return 0; 3 | } -------------------------------------------------------------------------------- /.github/resource/JetBrains.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ExplosionEngine/Explosion/HEAD/.github/resource/JetBrains.png -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/glfw/conandata.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | "3.4-exp": 3 | commit: "7b6aead9fb88b3623e3b3725ebb42670cbe4c579" 4 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/molten-vk/test_package/test_package.cpp: -------------------------------------------------------------------------------- 1 | int main(int argc, char* argv[]) 2 | { 3 | return 0; 4 | } 5 | -------------------------------------------------------------------------------- /Sample/RHI-TexSampling/Awesomeface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ExplosionEngine/Explosion/HEAD/Sample/RHI-TexSampling/Awesomeface.png -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/dxc/conandata.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | "1.8.2505.1-exp": 3 | commit: "b106a961d09221b3c5bdb37be45b679257da08b8" 4 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/molten-vk/conandata.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | "1.4.1-exp": 3 | commit: "db445ff2042d9ce348c439ad8451112f354b8d2a" 4 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/vulkan-utility-libraries/conandata.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | "1.4.313.0-exp": 3 | branch: "vulkan-sdk-1.4.313" 4 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/debugbreak/test_package/test_package.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) { 4 | return 0; 5 | } 6 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/rapidjson/conandata.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | "cci.20250205-exp": 3 | commit: "24b5e7a8b27f42fa16b96fc70aade9106cf7102f" 4 | -------------------------------------------------------------------------------- /Sample/Rendering-BaseTexture/Awesomeface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ExplosionEngine/Explosion/HEAD/Sample/Rendering-BaseTexture/Awesomeface.png -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/assimp/conandata.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | "6.0.2-exp": 3 | url: "https://github.com/assimp/assimp/archive/refs/tags/v6.0.2.tar.gz" 4 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Vulkan/Src/VmaImport.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Junkang on 2023/6/5. 3 | // 4 | 5 | #define VMA_IMPLEMENTATION 6 | #include 7 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/debugbreak/conandata.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | "1.0-exp": 3 | url: "https://github.com/scottt/debugbreak/archive/refs/tags/v1.0.tar.gz" 4 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/libclang/conandata.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | "21.1.7-exp": 3 | url: "https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-21.1.7.tar.gz" 4 | -------------------------------------------------------------------------------- /Engine/Source/Test/Include/Test/Test.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2024/7/28. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace Test {} 10 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/glfw/test_package/test_package.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) { 4 | glfwInit(); 5 | glfwTerminate(); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /Editor/Resource/ProjectTemplates/2D/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.25) 2 | project(%{projectName}%) 3 | 4 | include(ExternalProject) 5 | include(GenerateExportHeader) 6 | -------------------------------------------------------------------------------- /Editor/Resource/ProjectTemplates/3D/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.25) 2 | project(%{projectName}%) 3 | 4 | include(ExternalProject) 5 | include(GenerateExportHeader) 6 | -------------------------------------------------------------------------------- /Editor/Web/src/qwebchannel.d.ts: -------------------------------------------------------------------------------- 1 | export { QWebChannel } from './qwebchannel.js'; 2 | 3 | declare global { 4 | interface Window { 5 | qt: any; 6 | backend: any; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Engine/Source/RHI-DirectX12/Src/Common.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 13/1/2022. 3 | // 4 | 5 | #include 6 | 7 | namespace RHI::DirectX12 { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /Engine/Source/RHI/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB sources Src/*.cpp) 2 | exp_add_library( 3 | NAME RHI 4 | TYPE STATIC 5 | SRC ${sources} 6 | PUBLIC_INC Include 7 | PUBLIC_LIB Core 8 | ) 9 | -------------------------------------------------------------------------------- /Engine/Source/Common/Test/FileSystemTest.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/1/3. 3 | // 4 | 5 | #include 6 | 7 | TEST(FileSystemTest, PathTest) 8 | { 9 | // TODO 10 | } 11 | -------------------------------------------------------------------------------- /Engine/Source/Test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | exp_add_library( 2 | NAME Test 3 | TYPE STATIC 4 | SRC Src/Main.cpp 5 | PUBLIC_INC Include 6 | PUBLIC_LIB Core 7 | PUBLIC_MERGE_LIB GTest::gtest 8 | ) -------------------------------------------------------------------------------- /Engine/Source/Runtime/Src/RuntimeModule.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2024/8/21. 3 | // 4 | 5 | #include 6 | 7 | IMPLEMENT_DYNAMIC_MODULE(RUNTIME_API, Runtime::RuntimeModule) 8 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB sources Src/*.cpp) 2 | exp_add_library( 3 | NAME RHI-Dummy 4 | TYPE SHARED 5 | SRC ${sources} 6 | PUBLIC_INC Include 7 | PUBLIC_LIB RHI 8 | ) 9 | -------------------------------------------------------------------------------- /Engine/Source/RHI/Src/Gpu.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 12/1/2022. 3 | // 4 | 5 | #include 6 | 7 | namespace RHI { 8 | Gpu::Gpu() = default; 9 | 10 | Gpu::~Gpu() = default; 11 | } 12 | -------------------------------------------------------------------------------- /Engine/Source/Core/Include/Core/EngineVersion.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/8/16. 3 | // 4 | 5 | #pragma once 6 | 7 | #define ENGINE_VERSION_MAJOR 0 8 | #define ENGINE_VERSION_MINOR 0 9 | #define ENGINE_VERSION_PATCH 1 10 | -------------------------------------------------------------------------------- /Engine/Source/Render/Src/Scene.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/8/17. 3 | // 4 | 5 | #include 6 | 7 | namespace Render { 8 | Scene::Scene() = default; 9 | 10 | Scene::~Scene() = default; 11 | } 12 | -------------------------------------------------------------------------------- /Engine/Source/Launch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB_RECURSE sources Src/*.cpp) 2 | exp_add_library( 3 | NAME Launch 4 | TYPE STATIC 5 | SRC ${sources} 6 | PUBLIC_INC Include 7 | PUBLIC_LIB Runtime 8 | PUBLIC_MERGE_LIB glfw::glfw 9 | ) -------------------------------------------------------------------------------- /Engine/Source/Runtime/Src/Client.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/2/18. 3 | // 4 | 5 | #include 6 | 7 | namespace Runtime { 8 | Client::Client() = default; 9 | 10 | Client::~Client() = default; 11 | } 12 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Src/Component/Primitive.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/3/24. 3 | // 4 | 5 | #include 6 | 7 | namespace Runtime { 8 | StaticPrimitive::StaticPrimitive() = default; 9 | } 10 | -------------------------------------------------------------------------------- /Engine/Source/RHI/Src/RHIModule.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/8/7. 3 | // 4 | 5 | #include 6 | 7 | namespace RHI { 8 | RHIModule::RHIModule() = default; 9 | 10 | RHIModule::~RHIModule() = default; 11 | } 12 | -------------------------------------------------------------------------------- /Engine/Source/RHI/Src/CommandBuffer.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 21/2/2022. 3 | // 4 | 5 | #include 6 | 7 | namespace RHI { 8 | CommandBuffer::CommandBuffer() = default; 9 | 10 | CommandBuffer::~CommandBuffer() = default; 11 | } 12 | -------------------------------------------------------------------------------- /Editor/Src/Widget/Editor.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Kindem on 2025/3/22. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | namespace Editor { 9 | ExplosionEditor::ExplosionEditor() = default; 10 | } // namespace Editor 11 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/qt/debug.py: -------------------------------------------------------------------------------- 1 | from conan.api.conan_api import ConanAPI 2 | from conan.cli.cli import Cli 3 | 4 | if __name__ == '__main__': 5 | api = ConanAPI() 6 | api.command = Cli(api) 7 | api.command.run(["build", ".\conanfile.py", "--version=\"6.10.1-exp\""]) 8 | -------------------------------------------------------------------------------- /Engine/Shader/Platform.esh: -------------------------------------------------------------------------------- 1 | #ifndef __PLATFORM_H__ 2 | #define __PLATFORM_H__ 3 | 4 | #if VULKAN 5 | #define VkBinding(x, y) [[vk::binding(x, y)]] 6 | #define VkLocation(x) [[vk::location(x)]] 7 | #else 8 | #define VkBinding(x, y) 9 | #define VkLocation(x) 10 | #endif 11 | 12 | #endif -------------------------------------------------------------------------------- /Engine/Source/Runtime/Src/Component/Scene.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/3/13. 3 | // 4 | 5 | #include 6 | 7 | namespace Runtime { 8 | SceneHolder::SceneHolder(Render::Scene* inScene) 9 | : scene(inScene) 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/clipp/test_package/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(test_package LANGUAGES CXX) 3 | 4 | find_package(clipp REQUIRED) 5 | 6 | add_executable(${PROJECT_NAME} test_package.cpp) 7 | target_link_libraries(${PROJECT_NAME} PRIVATE clipp::clipp) 8 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/assimp/test_package/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(test_package LANGUAGES CXX) 3 | 4 | find_package(assimp REQUIRED) 5 | 6 | add_executable(${PROJECT_NAME} test_package.cpp) 7 | target_link_libraries(${PROJECT_NAME} PRIVATE assimp::assimp) 8 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/vulkan-utility-libraries/test_package/test_package.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char* argv[]) 5 | { 6 | vku::safe_VkInstanceCreateInfo safe_info; 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /Engine/Source/RHI-DirectX12/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB sources Src/*.cpp) 2 | exp_add_library( 3 | NAME RHI-DirectX12 4 | TYPE SHARED 5 | SRC ${sources} 6 | PUBLIC_INC Include 7 | PUBLIC_LIB RHI d3d12 8 | PUBLIC_MERGE_LIB Microsoft::DirectX-Headers dxgi d3dcompiler 9 | ) 10 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/libclang/test_package/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(test_package LANGUAGES CXX) 3 | 4 | find_package(libclang REQUIRED) 5 | 6 | add_executable(${PROJECT_NAME} test_package.cpp) 7 | target_link_libraries(${PROJECT_NAME} PRIVATE libclang::libclang) 8 | -------------------------------------------------------------------------------- /Editor/Web/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "skipLibCheck": true, 5 | "module": "ESNext", 6 | "moduleResolution": "bundler", 7 | "allowSyntheticDefaultImports": true, 8 | "strict": true 9 | }, 10 | "include": ["vite.config.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /Engine/Source/Render/Include/Render/SceneProxy/Primitive.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/3/24. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace Render { 10 | struct PrimitiveSceneProxy { 11 | PrimitiveSceneProxy(); 12 | 13 | // TODO 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/debugbreak/test_package/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(test_package LANGUAGES CXX) 3 | 4 | find_package(debugbreak REQUIRED) 5 | 6 | add_executable(${PROJECT_NAME} test_package.cpp) 7 | target_link_libraries(${PROJECT_NAME} PRIVATE debugbreak::debugbreak) 8 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/rapidjson/test_package/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(test_package LANGUAGES CXX) 3 | 4 | find_package(rapidjson REQUIRED) 5 | 6 | add_executable(${PROJECT_NAME} test_package.cpp) 7 | target_link_libraries(${PROJECT_NAME} PRIVATE rapidjson::rapidjson) 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # JetBrains 2 | .idea 3 | 4 | # Visual Studio Code 5 | .vscode 6 | 7 | # Binaries 8 | cmake-build* 9 | build* 10 | 11 | # 3rd 12 | ThirdParty/Zip 13 | ThirdParty/Lib 14 | ThirdParty/ConanRecipes/**/src 15 | ThirdParty/ConanRecipes/**/build 16 | ThirdParty/ConanRecipes/**/CMakeUserPresets.json 17 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Include/Runtime/RuntimeModule.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2024/8/21. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace Runtime { 11 | DECLARE_MIN_MODULE(RUNTIME_API, RuntimeModule, Core::ModuleType::mDynamic) 12 | } 13 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Src/Settings/Game.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/2/28. 3 | // 4 | 5 | #include 6 | 7 | namespace Runtime { 8 | GameSettings::GameSettings() 9 | : maxLocalPlayerNum(1) 10 | , initialLocalPlayerNum(1) 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/clipp/conandata.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | "1.2.3-exp": 3 | url: "https://github.com/muellan/clipp/archive/refs/tags/v1.2.3.tar.gz" 4 | patches: 5 | "1.2.3-exp": 6 | - patch_file: patches/0000-fix-cpp23.patch 7 | patch_description: fix build for c++23 8 | patch_type: portability 9 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Src/Component/Camera.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2024/10/14. 3 | // 4 | 5 | #include 6 | 7 | namespace Runtime { 8 | Camera::Camera() 9 | : perspective(true) 10 | , nearPlane(0.1f) 11 | , fov(90.0f) 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/libclang/test_package/test_package.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) { 4 | CXIndex index = clang_createIndex(0, 0); 5 | CXTranslationUnit translationUnit = clang_parseTranslationUnit(index, nullptr, nullptr, 0, nullptr, 0, CXTranslationUnit_None); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/vulkan-validationlayers/conandata.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | "1.4.313.0-exp": 3 | branch: "vulkan-sdk-1.4.313" 4 | patches: 5 | "1.4.313.0-exp": 6 | - patch_file: patches/0000-fix-spirv-tools-includes.patch 7 | patch_description: fix spir-v tools includes 8 | patch_type: portability 9 | -------------------------------------------------------------------------------- /Editor/Include/Editor/Widget/Editor.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Kindem on 2025/3/22. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace Editor { 10 | class ExplosionEditor final : public QWidget { 11 | Q_OBJECT 12 | 13 | public: 14 | ExplosionEditor(); 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /Editor/Web/src/App.tsx: -------------------------------------------------------------------------------- 1 | import { Route, Routes } from 'react-router-dom'; 2 | import ProjectHubPage from '@/pages/project-hub'; 3 | 4 | function App() { 5 | return ( 6 | 7 | } path='/project-hub'/> 8 | 9 | ); 10 | } 11 | 12 | export default App; 13 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/rapidjson/test_package/test_package.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) { 4 | const char* json = "{\"a\": true, \"b\": 1, \"c\": \"2\"}"; 5 | rapidjson::Document document; 6 | document.Parse(json); 7 | assert(document.IsObject()); 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /Engine/Source/Launch/Src/Main.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/2/19. 3 | // 4 | 5 | #include 6 | 7 | int main(int argc, char* argv[]) 8 | { 9 | Launch::GameApplication app(argc, argv); 10 | while (!app.ShouldClose()) { 11 | app.Tick(); 12 | } 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /Engine/Source/Test/Src/Main.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2022/9/5. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | int main(int argc, char* argv[]) 9 | { 10 | Core::Cli::Get().Parse(argc, argv); 11 | testing::InitGoogleTest(&argc, argv); 12 | return RUN_ALL_TESTS(); 13 | } 14 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Src/Asset/Mesh.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/3/21. 3 | // 4 | 5 | #include 6 | 7 | namespace Runtime { 8 | StaticMesh::StaticMesh(Core::Uri inUri) 9 | : Asset(std::move(inUri)) 10 | { 11 | } 12 | 13 | StaticMesh::~StaticMesh() = default; 14 | } 15 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Src/Component/Light.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2024/10/14. 3 | // 4 | 5 | #include 6 | 7 | namespace Runtime { 8 | DirectionalLight::DirectionalLight() = default; 9 | 10 | PointLight::PointLight() = default; 11 | 12 | SpotLight::SpotLight() = default; 13 | } 14 | -------------------------------------------------------------------------------- /Editor/Web/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vite"; 2 | import react from "@vitejs/plugin-react"; 3 | import tsconfigPaths from "vite-tsconfig-paths"; 4 | import tailwindcss from "@tailwindcss/vite"; 5 | 6 | // https://vitejs.dev/config/ 7 | export default defineConfig({ 8 | plugins: [react(), tsconfigPaths(), tailwindcss()], 9 | }); 10 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Src/Sampler.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #include 6 | 7 | namespace RHI::Dummy { 8 | DummySampler::DummySampler(const SamplerCreateInfo& createInfo) 9 | : Sampler(createInfo) 10 | { 11 | } 12 | 13 | DummySampler::~DummySampler() = default; 14 | } 15 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Src/Surface.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/4/17. 3 | // 4 | 5 | #include 6 | 7 | namespace RHI::Dummy { 8 | DummySurface::DummySurface(const SurfaceCreateInfo& createInfo) 9 | : Surface(createInfo) 10 | { 11 | } 12 | 13 | DummySurface::~DummySurface() = default; 14 | } 15 | -------------------------------------------------------------------------------- /Engine/Source/Common/Test/UtilityTest.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2024/5/4. 3 | // 4 | 5 | #include 6 | 7 | #include 8 | using namespace Common; 9 | 10 | TEST(UtilityTest, AlignUpTest) 11 | { 12 | ASSERT_EQ(AlignUp<4>(3), 4); 13 | ASSERT_EQ(AlignUp<4>(7), 8); 14 | ASSERT_EQ(AlignUp<256>(258), 512); 15 | } 16 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/dxc/test_package/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(test_package LANGUAGES CXX) 3 | 4 | find_package(dxc REQUIRED) 5 | 6 | add_definitions(-DPLATFORM_WINDOWS=$,1,0>) 7 | 8 | add_executable(${PROJECT_NAME} test_package.cpp) 9 | target_link_libraries(${PROJECT_NAME} PRIVATE dxc::dxc) 10 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Src/BindGroup.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #include 6 | 7 | namespace RHI::Dummy { 8 | DummyBindGroup::DummyBindGroup(const BindGroupCreateInfo& createInfo) 9 | : BindGroup(createInfo) 10 | { 11 | } 12 | 13 | DummyBindGroup::~DummyBindGroup() = default; 14 | } 15 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Src/BufferView.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #include 6 | 7 | namespace RHI::Dummy { 8 | DummyBufferView::DummyBufferView(const BufferViewCreateInfo& createInfo) 9 | : BufferView(createInfo) 10 | { 11 | } 12 | 13 | DummyBufferView::~DummyBufferView() = default; 14 | } 15 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/vulkan-utility-libraries/test_package/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(test_package LANGUAGES CXX) 3 | 4 | find_package(VulkanUtilityLibraries REQUIRED) 5 | 6 | add_executable(${PROJECT_NAME} test_package.cpp) 7 | target_link_libraries(${PROJECT_NAME} PRIVATE Vulkan::LayerSettings Vulkan::UtilityHeaders Vulkan::SafeStruct) 8 | -------------------------------------------------------------------------------- /Engine/Source/Core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB sources Src/*.cpp) 2 | exp_add_library( 3 | NAME Core 4 | TYPE SHARED 5 | SRC ${sources} 6 | PUBLIC_INC Include 7 | PUBLIC_LIB Common 8 | PUBLIC_MERGE_LIB clipp::clipp 9 | ) 10 | 11 | file(GLOB test_sources Test/*.cpp) 12 | exp_add_test( 13 | NAME Core.Test 14 | SRC ${test_sources} 15 | LIB Core 16 | ) 17 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Src/TextureView.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #include 6 | 7 | namespace RHI::Dummy { 8 | DummyTextureView::DummyTextureView(const TextureViewCreateInfo& createInfo) 9 | : TextureView(createInfo) 10 | { 11 | } 12 | 13 | DummyTextureView::~DummyTextureView() = default; 14 | } 15 | -------------------------------------------------------------------------------- /Engine/Source/Mirror/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB sources Src/*.cpp) 2 | exp_add_library( 3 | NAME Mirror 4 | TYPE SHARED 5 | SRC ${sources} 6 | PUBLIC_INC Include 7 | PUBLIC_LIB Common 8 | ) 9 | 10 | file(GLOB test_sources Test/*.cpp) 11 | exp_add_test( 12 | NAME Mirror.Test 13 | SRC ${test_sources} 14 | LIB Mirror 15 | INC Test 16 | REFLECT Test 17 | ) 18 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Src/Asset/Level.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/2/19. 3 | // 4 | 5 | #include 6 | 7 | namespace Runtime { 8 | Level::Level(Core::Uri inUri) 9 | : Asset(std::move(inUri)) 10 | { 11 | } 12 | 13 | Level::~Level() = default; 14 | 15 | ECArchive& Level::GetArchive() 16 | { 17 | return archive; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Src/PipelineLayout.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #include 6 | 7 | namespace RHI::Dummy { 8 | DummyPipelineLayout::DummyPipelineLayout(const PipelineLayoutCreateInfo& createInfo) 9 | : PipelineLayout(createInfo) 10 | { 11 | } 12 | 13 | DummyPipelineLayout::~DummyPipelineLayout() = default; 14 | } 15 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/assimp/test_package/test_package.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(int argc, char **argv) { 6 | Assimp::Importer importer; 7 | const aiScene* scene = importer.ReadFile("", aiProcess_CalcTangentSpace | aiProcess_Triangulate | aiProcess_JoinIdenticalVertices | aiProcess_SortByPType); 8 | return 0; 9 | } -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Src/BindGroupLayout.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #include 6 | 7 | namespace RHI::Dummy { 8 | DummyBindGroupLayout::DummyBindGroupLayout(const BindGroupLayoutCreateInfo& createInfo) 9 | : BindGroupLayout(createInfo) 10 | { 11 | } 12 | 13 | DummyBindGroupLayout::~DummyBindGroupLayout() = default; 14 | } 15 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Include/Runtime/Meta.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/2/28. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace Runtime { 11 | struct RUNTIME_API MetaPresets { 12 | static constexpr const auto* globalComp = "globalComp"; 13 | static constexpr const auto* gameReadOnly = "gameReadOnly"; 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Include/Runtime/SystemGraphPresets.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/3/13. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace Runtime { 11 | class RUNTIME_API SystemGraphPresets { 12 | public: 13 | static const SystemGraph& Default3DWorld(); 14 | 15 | SystemGraphPresets() = delete; 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Include/Runtime/GameModule.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/3/24. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace Runtime { 10 | struct RUNTIME_API GameModule : EngineModule { // NOLINT 11 | Engine* CreateEngine(const EngineInitParams& inParams) override = 0; 12 | 13 | virtual std::string_view GetGameName() const = 0; 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Test/RuntimeTestModule.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2024/8/22. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | class RuntimeTestModule final : public Runtime::EngineModule { 10 | public: 11 | void OnUnload() override; 12 | Core::ModuleType Type() const override; 13 | Runtime::Engine* CreateEngine(const Runtime::EngineInitParams& inParams) override; 14 | }; 15 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Include/RHI/Dummy/Sampler.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace RHI::Dummy { 10 | class DummySampler final : public Sampler { 11 | public: 12 | NonCopyable(DummySampler) 13 | explicit DummySampler(const SamplerCreateInfo& createInfo); 14 | ~DummySampler() override; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Include/RHI/Dummy/Surface.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/4/17. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace RHI::Dummy { 10 | class DummySurface final : public Surface { 11 | public: 12 | NonCopyable(DummySurface) 13 | explicit DummySurface(const SurfaceCreateInfo& createInfo); 14 | ~DummySurface() override; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /Engine/Source/RHI/Include/RHI/RHIModule.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/8/7. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace RHI { 11 | class RHIModule : public Core::Module { 12 | public: 13 | ~RHIModule() override; 14 | virtual Instance* GetRHIInstance() = 0; 15 | 16 | protected: 17 | RHIModule(); 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Src/CommandBuffer.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | namespace RHI::Dummy { 9 | DummyCommandBuffer::DummyCommandBuffer() = default; 10 | 11 | Common::UniquePtr DummyCommandBuffer::Begin() 12 | { 13 | return { new DummyCommandRecorder(*this) }; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Include/RHI/Dummy/BindGroup.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace RHI::Dummy { 10 | class DummyBindGroup final : public BindGroup { 11 | public: 12 | NonCopyable(DummyBindGroup) 13 | explicit DummyBindGroup(const BindGroupCreateInfo& createInfo); 14 | ~DummyBindGroup() override; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Src/Viewport.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/2/18. 3 | // 4 | 5 | #include 6 | 7 | namespace Runtime { 8 | Viewport::~Viewport() = default; 9 | 10 | Viewport::Viewport() = default; 11 | 12 | PresentInfo::PresentInfo() 13 | : backTexture(nullptr) 14 | , imageReadySemaphore(nullptr) 15 | , renderFinishedSemaphore(nullptr) 16 | { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Editor/Web/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | !.vscode/extensions.json 17 | .idea 18 | .DS_Store 19 | *.suo 20 | *.ntvs* 21 | *.njsproj 22 | *.sln 23 | *.sw? 24 | 25 | 26 | pnpm-lock.yaml 27 | yarn.lock 28 | package-lock.json 29 | bun.lockb -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/qt/test_package/test_package.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication app(argc, argv); 8 | 9 | QWebEngineView view; 10 | view.load(QUrl("https://qt-project.org/")); 11 | view.resize(1024, 768); 12 | 13 | QTimer::singleShot(100, []() -> void { QApplication::quit(); }); 14 | return app.exec(); 15 | } -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Include/RHI/Dummy/BufferView.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace RHI::Dummy { 10 | class DummyBufferView final : public BufferView { 11 | public: 12 | NonCopyable(DummyBufferView) 13 | explicit DummyBufferView(const BufferViewCreateInfo& createInfo); 14 | ~DummyBufferView() override; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Include/RHI/Dummy/CommandBuffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace RHI::Dummy { 10 | class DummyCommandBuffer final : public CommandBuffer { 11 | public: 12 | NonCopyable(DummyCommandBuffer) 13 | DummyCommandBuffer(); 14 | 15 | Common::UniquePtr Begin() override; 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Include/Runtime/Client.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/2/18. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace Runtime { 10 | class World; 11 | 12 | class Client { 13 | public: 14 | virtual ~Client(); 15 | 16 | virtual World& GetWorld() = 0; 17 | virtual Viewport& GetViewport() = 0; 18 | 19 | protected: 20 | Client(); 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /Editor/Include/Editor/EditorModule.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2024/8/21. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace Editor { 10 | class EditorModule final : public Runtime::EngineModule { 11 | public: 12 | void OnUnload() override; 13 | ::Core::ModuleType Type() const override; 14 | Runtime::Engine* CreateEngine(const Runtime::EngineInitParams&) override; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Include/RHI/Dummy/TextureView.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace RHI::Dummy { 10 | class DummyTextureView final : public TextureView { 11 | public: 12 | NonCopyable(DummyTextureView) 13 | explicit DummyTextureView(const TextureViewCreateInfo& createInfo); 14 | ~DummyTextureView() override; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /Engine/Source/Common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB_RECURSE sources Src/*.cpp) 2 | exp_add_library( 3 | NAME Common 4 | TYPE STATIC 5 | SRC ${sources} 6 | PUBLIC_INC Include 7 | PUBLIC_MERGE_LIB rapidjson::rapidjson debugbreak::debugbreak cityhash::cityhash Taskflow::Taskflow 8 | ) 9 | 10 | file(GLOB test_sources Test/*.cpp) 11 | exp_add_test( 12 | NAME Common.Test 13 | INC Test 14 | SRC ${test_sources} 15 | LIB Common 16 | ) 17 | -------------------------------------------------------------------------------- /Engine/Source/Common/Src/Serialization.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/7/13. 3 | // 4 | 5 | #include 6 | 7 | namespace Common { 8 | BinarySerializeStream::BinarySerializeStream() = default; 9 | 10 | BinarySerializeStream::~BinarySerializeStream() = default; 11 | 12 | BinaryDeserializeStream::BinaryDeserializeStream() = default; 13 | 14 | BinaryDeserializeStream::~BinaryDeserializeStream() = default; 15 | } 16 | -------------------------------------------------------------------------------- /Engine/Source/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (${BUILD_TEST}) 2 | add_subdirectory(Test) 3 | endif() 4 | 5 | add_subdirectory(Common) 6 | add_subdirectory(Core) 7 | add_subdirectory(Mirror) 8 | 9 | add_subdirectory(RHI) 10 | add_subdirectory(RHI-Dummy) 11 | add_subdirectory(RHI-Vulkan) 12 | if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") 13 | add_subdirectory(RHI-DirectX12) 14 | endif() 15 | 16 | add_subdirectory(Render) 17 | add_subdirectory(Runtime) 18 | add_subdirectory(Launch) 19 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Src/Queue.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #include 6 | 7 | namespace RHI::Dummy { 8 | DummyQueue::DummyQueue() = default; 9 | 10 | DummyQueue::~DummyQueue() = default; 11 | 12 | void DummyQueue::Submit(RHI::CommandBuffer* commandBuffer, const QueueSubmitInfo& submitInfo) 13 | { 14 | } 15 | 16 | void DummyQueue::Flush(RHI::Fence* fenceToSignal) 17 | { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Include/RHI/Dummy/PipelineLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace RHI::Dummy { 10 | class DummyPipelineLayout final : public PipelineLayout { 11 | public: 12 | NonCopyable(DummyPipelineLayout) 13 | explicit DummyPipelineLayout(const PipelineLayoutCreateInfo& createInfo); 14 | ~DummyPipelineLayout() override; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Include/RHI/Dummy/BindGroupLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace RHI::Dummy { 10 | class DummyBindGroupLayout final : public BindGroupLayout { 11 | public: 12 | NonCopyable(DummyBindGroupLayout) 13 | explicit DummyBindGroupLayout(const BindGroupLayoutCreateInfo& createInfo); 14 | ~DummyBindGroupLayout() override; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /Engine/Source/Common/Src/IO.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2024/6/6. 3 | // 4 | 5 | #include 6 | 7 | namespace Common { 8 | ScopedCoutFlusher::ScopedCoutFlusher() = default; 9 | 10 | ScopedCoutFlusher::~ScopedCoutFlusher() 11 | { 12 | std::cout << std::flush; 13 | } 14 | 15 | ScopedCerrFlusher::ScopedCerrFlusher() = default; 16 | 17 | ScopedCerrFlusher::~ScopedCerrFlusher() 18 | { 19 | std::cerr << std::flush; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sample/Rendering-Triangle/Triangle.esl: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #if VERTEX_SHADER 4 | float4 VSMain( 5 | VkLocation(0) float4 position : POSITION) : SV_POSITION 6 | { 7 | float4 pos = position; 8 | #if VULKAN 9 | pos.y = - pos.y; 10 | #endif 11 | return pos; 12 | } 13 | #endif 14 | 15 | #if PIXEL_SHADER 16 | cbuffer psUniform { 17 | float3 pixelColor; 18 | }; 19 | 20 | float4 PSMain() : SV_TARGET 21 | { 22 | return float4(pixelColor, 1.0f); 23 | } 24 | #endif 25 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Src/ShaderModule.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #include 6 | 7 | namespace RHI::Dummy { 8 | DummyShaderModule::DummyShaderModule(const ShaderModuleCreateInfo& createInfo) 9 | : ShaderModule(createInfo) 10 | { 11 | } 12 | 13 | DummyShaderModule::~DummyShaderModule() = default; 14 | 15 | const std::string& DummyShaderModule::GetEntryPoint() 16 | { 17 | return entryPoint; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB_RECURSE sources Src/*.cpp) 2 | exp_add_library( 3 | NAME Runtime 4 | TYPE SHARED 5 | SRC ${sources} 6 | PUBLIC_INC Include 7 | REFLECT Include 8 | PUBLIC_LIB Core Mirror Render 9 | PUBLIC_MERGE_LIB assimp::assimp 10 | ) 11 | 12 | file(GLOB test_sources Test/*.cpp) 13 | exp_add_test( 14 | NAME Runtime.Test 15 | SRC ${test_sources} 16 | LIB Runtime 17 | INC Test 18 | REFLECT Test 19 | DEP_TARGET RHI-Dummy 20 | ) 21 | -------------------------------------------------------------------------------- /Editor/Web/tailwind.config.js: -------------------------------------------------------------------------------- 1 | import {heroui} from "@heroui/theme" 2 | 3 | /** @type {import('tailwindcss').Config} */ 4 | export default { 5 | content: [ 6 | "./index.html", 7 | './src/layouts/**/*.{js,ts,jsx,tsx,mdx}', 8 | './src/pages/**/*.{js,ts,jsx,tsx,mdx}', 9 | './src/components/**/*.{js,ts,jsx,tsx,mdx}', 10 | "./node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}", 11 | ], 12 | theme: { 13 | extend: {}, 14 | }, 15 | darkMode: "class", 16 | plugins: [heroui()], 17 | } 18 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Include/Runtime/Component/Primitive.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/3/24. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace Runtime { 13 | struct RUNTIME_API EClass() StaticPrimitive final { 14 | EClassBody(StaticPrimitive) 15 | 16 | StaticPrimitive(); 17 | 18 | EProperty() AssetPtr mesh; 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /Engine/Source/RHI-DirectX12/Src/Surface.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/4/17. 3 | // 4 | 5 | #include 6 | 7 | namespace RHI::DirectX12 { 8 | DX12Surface::DX12Surface(const SurfaceCreateInfo& inCreateInfo) 9 | : Surface(inCreateInfo) 10 | , hWnd(static_cast(inCreateInfo.window)) 11 | { 12 | } 13 | 14 | DX12Surface::~DX12Surface() = default; 15 | 16 | HWND DX12Surface::GetNative() const 17 | { 18 | return hWnd; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Engine/Source/RHI/Include/RHI/CommandBuffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 21/2/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace RHI { 11 | class CommandRecorder; 12 | 13 | class CommandBuffer { 14 | public: 15 | NonCopyable(CommandBuffer) 16 | virtual ~CommandBuffer(); 17 | 18 | virtual Common::UniquePtr Begin() = 0; 19 | 20 | protected: 21 | CommandBuffer(); 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /Engine/Source/RHI/Src/Surface.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/4/17. 3 | // 4 | 5 | #include 6 | 7 | namespace RHI { 8 | SurfaceCreateInfo::SurfaceCreateInfo(void* inWindow) 9 | : window(inWindow) 10 | { 11 | } 12 | 13 | SurfaceCreateInfo& SurfaceCreateInfo::SetWindow(void* inWindow) 14 | { 15 | window = inWindow; 16 | return *this; 17 | } 18 | 19 | Surface::Surface(const SurfaceCreateInfo&) {} 20 | 21 | Surface::~Surface() = default; 22 | } 23 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/glfw/test_package/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(test_package LANGUAGES CXX) 3 | 4 | find_package(glfw REQUIRED) 5 | 6 | if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") 7 | set(platform_ext_libs 8 | "-framework Cocoa" 9 | "-framework IOKit" 10 | "-framework CoreFoundation") 11 | endif() 12 | 13 | add_executable(${PROJECT_NAME} test_package.cpp) 14 | target_link_libraries(${PROJECT_NAME} PRIVATE glfw::glfw ${platform_ext_libs}) 15 | -------------------------------------------------------------------------------- /Editor/Include/Editor/EditorEngine.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2024/8/21. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace Editor { 10 | class EditorEngine final : public Runtime::Engine { 11 | public: 12 | ~EditorEngine() override; 13 | 14 | bool IsEditor() override; 15 | 16 | private: 17 | friend class EditorModule; 18 | 19 | explicit EditorEngine(const Runtime::EngineInitParams& inParams); 20 | }; 21 | 22 | EditorEngine& GetEditorEngine(); 23 | } 24 | -------------------------------------------------------------------------------- /Engine/Source/Common/Test/FileTest.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/7/8. 3 | // 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | TEST(FileTest, ReadWriteTextFileTest) 10 | { 11 | static Common::Path file = "../Test/Generated/Common/ReadTextFileTest.txt"; 12 | 13 | Common::FileUtils::WriteTextFile(file.Absolute().String(), "hello"); 14 | const std::string content = Common::FileUtils::ReadTextFile(file.Absolute().String()); 15 | ASSERT_EQ(content, "hello"); 16 | } 17 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Include/RHI/Dummy/Queue.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace RHI::Dummy { 10 | class DummyQueue final : public Queue { 11 | public: 12 | NonCopyable(DummyQueue) 13 | DummyQueue(); 14 | ~DummyQueue() override; 15 | 16 | void Submit(RHI::CommandBuffer* commandBuffer, const RHI::QueueSubmitInfo& submitInfo) override; 17 | void Flush(RHI::Fence* fenceToSignal) override; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Include/RHI/Dummy/Texture.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace RHI::Dummy { 10 | class DummyTexture final : public Texture { 11 | public: 12 | NonCopyable(DummyTexture) 13 | explicit DummyTexture(const TextureCreateInfo& createInfo); 14 | ~DummyTexture() override; 15 | 16 | Common::UniquePtr CreateTextureView(const TextureViewCreateInfo& createInfo) override; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Include/Runtime/Component/Scene.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/3/13. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace Runtime { 13 | struct RUNTIME_API EClass(globalComp, transient) SceneHolder final { 14 | EClassBody(SceneHolder) 15 | 16 | explicit SceneHolder(Render::Scene* inScene); 17 | 18 | RenderThreadPtr scene; 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /Sample/RHI-ParallelCompute/Compute.esl: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // spir-v treat vec2 and vec4 as built-in type? 4 | struct Data { 5 | float4 v1; 6 | float4 v2; 7 | }; 8 | 9 | VkBinding(0, 0) StructuredBuffer input : register(t0); 10 | 11 | VkBinding(1, 0) RWStructuredBuffer output : register(u0); 12 | 13 | [numthreads(32, 1, 1)] 14 | void CSMain(uint3 id : SV_DispatchThreadID) { 15 | output[id.x].v1 = input[id.x].v1 * input[id.x].v1; 16 | output[id.x].v2 = input[id.x].v2 * input[id.x].v2; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/Surface.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/4/17. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include 10 | 11 | namespace RHI::DirectX12 { 12 | class DX12Surface final : public Surface { 13 | public: 14 | NonCopyable(DX12Surface) 15 | explicit DX12Surface(const SurfaceCreateInfo& inCreateInfo); 16 | ~DX12Surface() override; 17 | 18 | HWND GetNative() const; 19 | 20 | private: 21 | HWND hWnd; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Src/Component/Player.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/3/13. 3 | // 4 | 5 | #include 6 | 7 | namespace Runtime { 8 | PlayersInfo::PlayersInfo() = default; 9 | 10 | LocalPlayer::LocalPlayer() 11 | : localPlayerIndex(0) 12 | , viewState(nullptr) 13 | { 14 | } 15 | 16 | #if BUILD_EDITOR 17 | EditorPlayer::EditorPlayer() 18 | : viewState(nullptr) 19 | { 20 | } 21 | #endif 22 | 23 | PlayerStart::PlayerStart() = default; 24 | } // namespace Runtime 25 | -------------------------------------------------------------------------------- /Engine/Source/Common/Include/Common/Math/Math.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Kindem on 2025/8/21. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | -------------------------------------------------------------------------------- /Editor/Src/EditorEngine.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2024/8/21. 3 | // 4 | 5 | #include 6 | 7 | namespace Editor { 8 | EditorEngine::~EditorEngine() = default; 9 | 10 | bool EditorEngine::IsEditor() 11 | { 12 | return true; 13 | } 14 | 15 | EditorEngine::EditorEngine(const Runtime::EngineInitParams& inParams) 16 | : Engine(inParams) 17 | { 18 | } 19 | 20 | EditorEngine& GetEditorEngine() 21 | { 22 | return static_cast(Runtime::EngineHolder::Get()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Engine/Source/Common/Src/Platform.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/12/21. 3 | // 4 | 5 | #if PLATFORM_WINDOWS 6 | #include 7 | #else 8 | #include 9 | #endif 10 | 11 | #include 12 | #include 13 | 14 | namespace Common { 15 | void PlatformUtils::SetEnvVar(const std::string& inKey, const std::string& inValue) 16 | { 17 | #if PLATFORM_WINDOWS 18 | Assert(SetEnvironmentVariableA(inKey.c_str(), inValue.c_str())); 19 | #else 20 | setenv(inKey.c_str(), inValue.c_str(), 1); 21 | #endif 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Include/RHI/Dummy/DummyRHIModule.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/8/7. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace RHI::Dummy { 11 | class RHI_DUMMY_API DummyRHIModule final : public RHIModule { 12 | public: 13 | DummyRHIModule(); 14 | ~DummyRHIModule() override; 15 | 16 | void OnLoad() override; 17 | void OnUnload() override; 18 | Core::ModuleType Type() const override; 19 | Instance* GetRHIInstance() override; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Include/RHI/Dummy/ShaderModule.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace RHI::Dummy { 10 | class DummyShaderModule final : public ShaderModule { 11 | public: 12 | NonCopyable(DummyShaderModule) 13 | explicit DummyShaderModule(const ShaderModuleCreateInfo& createInfo); 14 | ~DummyShaderModule() override; 15 | 16 | const std::string & GetEntryPoint() override; 17 | 18 | private: 19 | std::string entryPoint; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Vulkan/Include/RHI/Vulkan/VulkanRHIModule.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/8/7. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace RHI::Vulkan { 11 | class RHI_VULKAN_API VulkanRHIModule final : public RHIModule { 12 | public: 13 | VulkanRHIModule(); 14 | ~VulkanRHIModule() override; 15 | 16 | void OnLoad() override; 17 | void OnUnload() override; 18 | Core::ModuleType Type() const override; 19 | Instance* GetRHIInstance() override; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Test/RuntimeTestModule.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2024/8/22. 3 | // 4 | 5 | #include 6 | 7 | void RuntimeTestModule::OnUnload() 8 | { 9 | Runtime::EngineHolder::Unload(); 10 | } 11 | 12 | Core::ModuleType RuntimeTestModule::Type() const 13 | { 14 | return Core::ModuleType::mStatic; 15 | } 16 | 17 | Runtime::Engine* RuntimeTestModule::CreateEngine(const Runtime::EngineInitParams& inParams) 18 | { 19 | return new Runtime::MinEngine(inParams); 20 | } 21 | 22 | IMPLEMENT_STATIC_MODULE(RuntimeTest, "RuntimeTest", RuntimeTestModule) 23 | -------------------------------------------------------------------------------- /Editor/Include/Editor/Widget/WebWidget.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/8/9. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace Editor { 11 | class WebWidget : public QWebEngineView { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit WebWidget(QWidget* inParent = nullptr); 16 | ~WebWidget() override; 17 | 18 | void Load(const std::string& inUrl); 19 | 20 | protected: 21 | QWebChannel* GetWebChannel() const; 22 | 23 | private: 24 | QWebChannel* webChannel; 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /Editor/Web/src/main.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import { BrowserRouter } from 'react-router-dom'; 4 | 5 | import App from './App.tsx'; 6 | import { Provider } from './provider.tsx'; 7 | import '@/styles/globals.css'; 8 | 9 | ReactDOM.createRoot(document.getElementById('root')!).render( 10 | 11 | 12 | 13 |
14 | 15 |
16 |
17 |
18 |
, 19 | ); 20 | -------------------------------------------------------------------------------- /Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/DX12RHIModule.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/8/7. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace RHI::DirectX12 { 11 | class RHI_DIRECTX12_API DX12RHIModule final : public RHIModule { 12 | public: 13 | DX12RHIModule(); 14 | ~DX12RHIModule() override; 15 | 16 | void OnLoad() override; 17 | void OnUnload() override; 18 | Core::ModuleType Type() const override; 19 | Instance* GetRHIInstance() override; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /Editor/Web/src/provider.tsx: -------------------------------------------------------------------------------- 1 | import type { NavigateOptions } from 'react-router-dom'; 2 | 3 | import { HeroUIProvider } from '@heroui/system'; 4 | import { useHref, useNavigate } from 'react-router-dom'; 5 | 6 | declare module '@react-types/shared' { 7 | interface RouterConfig { 8 | routerOptions: NavigateOptions; 9 | } 10 | } 11 | 12 | export function Provider({ children }: { children: React.ReactNode }) { 13 | const navigate = useNavigate(); 14 | 15 | return ( 16 | 17 | {children} 18 | 19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Src/Texture.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | namespace RHI::Dummy { 9 | DummyTexture::DummyTexture(const TextureCreateInfo& createInfo) 10 | : Texture(createInfo) 11 | { 12 | } 13 | 14 | DummyTexture::~DummyTexture() = default; 15 | 16 | Common::UniquePtr DummyTexture::CreateTextureView(const TextureViewCreateInfo& createInfo) 17 | { 18 | return Common::UniquePtr(new DummyTextureView(createInfo)); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Include/Runtime/Asset/Level.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/2/19. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace Runtime { 13 | class RUNTIME_API EClass() Level final : public Asset { 14 | EPolyClassBody(Level) 15 | 16 | public: 17 | explicit Level(Core::Uri inUri); 18 | ~Level() override; 19 | 20 | EFunc() ECArchive& GetArchive(); 21 | 22 | private: 23 | EProperty() ECArchive archive; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Src/Pipeline.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #include 6 | 7 | namespace RHI::Dummy { 8 | DummyComputePipeline::DummyComputePipeline(const ComputePipelineCreateInfo& createInfo) 9 | : ComputePipeline(createInfo) 10 | { 11 | } 12 | 13 | DummyComputePipeline::~DummyComputePipeline() = default; 14 | 15 | DummyRasterPipeline::DummyRasterPipeline(const RasterPipelineCreateInfo& createInfo) 16 | : RasterPipeline(createInfo) 17 | { 18 | } 19 | 20 | DummyRasterPipeline::~DummyRasterPipeline() = default; 21 | } 22 | -------------------------------------------------------------------------------- /Sample/RHI-Triangle/Triangle.esl: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct FragmentInput { 4 | float4 position : SV_POSITION; 5 | float4 color : COLOR; 6 | }; 7 | 8 | FragmentInput VSMain( 9 | VkLocation(0) float4 position : POSITION, 10 | VkLocation(1) float4 color : COLOR) 11 | { 12 | FragmentInput fragmentInput; 13 | fragmentInput.position = position; 14 | #if VULKAN 15 | fragmentInput.position.y = - fragmentInput.position.y; 16 | #endif 17 | fragmentInput.color = color; 18 | return fragmentInput; 19 | } 20 | 21 | float4 PSMain(FragmentInput input) : SV_TARGET 22 | { 23 | return input.color; 24 | } -------------------------------------------------------------------------------- /Engine/Source/Launch/Src/GameClient.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/2/19. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | namespace Launch { 9 | GameClient::GameClient(GameViewport& inViewport) 10 | : viewport(inViewport) 11 | , world("GameWorld", this, Runtime::PlayType::game) 12 | { 13 | } 14 | 15 | GameClient::~GameClient() = default; 16 | 17 | Runtime::Viewport& GameClient::GetViewport() 18 | { 19 | return viewport; 20 | } 21 | 22 | Runtime::World& GameClient::GetWorld() 23 | { 24 | return world; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Engine/Source/Launch/Include/Launch/GameClient.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/2/19. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace Launch { 11 | class GameViewport; 12 | 13 | class GameClient final : public Runtime::Client { 14 | public: 15 | explicit GameClient(GameViewport& inViewport); 16 | ~GameClient() override; 17 | 18 | Runtime::Viewport& GetViewport() override; 19 | Runtime::World& GetWorld() override; 20 | 21 | private: 22 | GameViewport& viewport; 23 | Runtime::World world; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /Engine/Source/Render/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB sources Src/*.cpp) 2 | exp_add_library( 3 | NAME Render.Static 4 | TYPE STATIC 5 | SRC ${sources} 6 | PUBLIC_INC Include 7 | PUBLIC_LIB Core RHI 8 | PUBLIC_MERGE_LIB dxc::dxc spirv-cross::spirv-cross 9 | ) 10 | 11 | file(GLOB shader_sources SharedSrc/*.cpp) 12 | exp_add_library( 13 | NAME Render 14 | TYPE SHARED 15 | SRC ${shader_sources} 16 | PUBLIC_LIB Render.Static 17 | ) 18 | 19 | file(GLOB test_sources Test/*.cpp) 20 | exp_add_test( 21 | NAME Render.Test 22 | SRC ${test_sources} 23 | LIB RHI Render.Static 24 | DEP_TARGET RHI-Dummy 25 | ) 26 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/clipp/test_package/test_package.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace clipp; 5 | using std::cout; 6 | using std::string; 7 | 8 | int main(int argc, char* argv[]) { 9 | bool rec = false, utf16 = false; 10 | string infile = "", fmt = "csv"; 11 | 12 | auto cli = ( 13 | value("input file", infile), 14 | option("-r", "--recursive").set(rec).doc("convert files recursively"), 15 | option("-o") & value("output format", fmt), 16 | option("-utf16").set(utf16).doc("use UTF-16 encoding") 17 | ); 18 | 19 | parse(argc, argv, cli); 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /Engine/Source/RHI/Include/RHI/Surface.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/4/17. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace RHI { 10 | struct SurfaceCreateInfo { 11 | // Windows: HWND 12 | // macOS: NSView* 13 | void* window; 14 | 15 | explicit SurfaceCreateInfo(void* inWindow = nullptr); 16 | SurfaceCreateInfo& SetWindow(void* inWindow); 17 | }; 18 | 19 | class Surface { 20 | public: 21 | NonCopyable(Surface) 22 | virtual ~Surface(); 23 | 24 | protected: 25 | explicit Surface(const SurfaceCreateInfo& createInfo); 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /Editor/Src/EditorModule.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2024/8/21. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | namespace Editor { 9 | void EditorModule::OnUnload() 10 | { 11 | Runtime::EngineHolder::Unload(); 12 | } 13 | 14 | ::Core::ModuleType EditorModule::Type() const 15 | { 16 | return ::Core::ModuleType::mStatic; 17 | } 18 | 19 | Runtime::Engine* EditorModule::CreateEngine(const Runtime::EngineInitParams& inParams) 20 | { 21 | return new EditorEngine(inParams); 22 | } 23 | } 24 | 25 | IMPLEMENT_STATIC_MODULE(Editor, "Editor", Editor::EditorModule) 26 | -------------------------------------------------------------------------------- /Engine/Source/Common/Include/Common/File.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2022/7/25. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include 10 | 11 | namespace Common { 12 | class FileUtils { 13 | public: 14 | static std::string ReadTextFile(const std::string& inFileName); 15 | static void WriteTextFile(const std::string& inFileName, const std::string& inContent); 16 | static rapidjson::Document ReadJsonFile(const std::string& inFileName); 17 | static void WriteJsonFile(const std::string& inFileName, const rapidjson::Document& inJsonDocument, bool inPretty = true); 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /Engine/Source/RHI/Src/Device.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 15/1/2022. 3 | // 4 | 5 | #include 6 | 7 | namespace RHI { 8 | QueueRequestInfo::QueueRequestInfo(const QueueType inType, const uint8_t inNum) 9 | : type(inType) 10 | , num(inNum) 11 | { 12 | } 13 | 14 | DeviceCreateInfo::DeviceCreateInfo() = default; 15 | 16 | DeviceCreateInfo& DeviceCreateInfo::AddQueueRequest(const QueueRequestInfo& inQueue) 17 | { 18 | queueRequests.emplace_back(inQueue); 19 | return *this; 20 | } 21 | 22 | Device::Device(const DeviceCreateInfo&) {} 23 | 24 | Device::~Device() = default; 25 | } 26 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Include/Runtime/Component/Camera.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2024/10/14. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | namespace Runtime { 13 | struct RUNTIME_API EClass(transient) Camera final { 14 | EClassBody(Camera) 15 | 16 | Camera(); 17 | 18 | EProperty() bool perspective; 19 | EProperty() float nearPlane; 20 | EProperty() std::optional farPlane; 21 | // only need when perspective 22 | EProperty() std::optional fov; 23 | }; 24 | 25 | // TODO scene capture 26 | } 27 | -------------------------------------------------------------------------------- /Editor/Include/Editor/WebUIServer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/8/8. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | namespace Editor { 13 | class WebUIServer { 14 | public: 15 | static WebUIServer& Get(); 16 | 17 | void Start(); 18 | void Stop(); 19 | const std::string& BaseUrl() const; 20 | 21 | private: 22 | WebUIServer(); 23 | 24 | std::string baseUrl; 25 | Common::UniquePtr productServerThread; 26 | Common::UniquePtr productServer; 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /Tool/MirrorTool/Test/MirrorToolInput.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2022/12/12. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | enum class EEnum() TestEnum { 10 | a, 11 | b, 12 | max 13 | }; 14 | 15 | EProperty() 16 | int gv0; 17 | 18 | EProperty() 19 | float gv1; 20 | 21 | EFunc() 22 | int gf0(int a, int b) { 23 | return a + b; 24 | } 25 | 26 | struct EClass() C0 { 27 | public: 28 | EProperty() 29 | static int sv0; 30 | 31 | EProperty(editorHide) 32 | int v0; 33 | 34 | EProperty() 35 | float v1; 36 | 37 | EFunc() 38 | static void sf0() {} 39 | 40 | EFunc() 41 | int f0() { return 0; } 42 | }; 43 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Include/RHI/Dummy/Gpu.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace RHI::Dummy { 11 | class DummyGpu final : public Gpu { 12 | public: 13 | NonCopyable(DummyGpu) 14 | explicit DummyGpu(DummyInstance& inInstance); 15 | ~DummyGpu() override; 16 | GpuProperty GetProperty() override; 17 | Common::UniquePtr RequestDevice(const DeviceCreateInfo& createInfo) override; 18 | DummyInstance& GetInstance() const override; 19 | 20 | private: 21 | DummyInstance& instance; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/molten-vk/test_package/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(test_package LANGUAGES CXX) 3 | 4 | find_package(MoltenVK REQUIRED) 5 | 6 | add_executable(${PROJECT_NAME} test_package.cpp) 7 | target_link_libraries(${PROJECT_NAME} PRIVATE molten-vk::molten-vk) 8 | add_custom_command( 9 | TARGET ${PROJECT_NAME} POST_BUILD 10 | COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MoltenVK_INCLUDE_DIR}/../lib/libMoltenVK.dylib $/libMoltenVK.dylib 11 | COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MoltenVK_INCLUDE_DIR}/../lib/MoltenVK_icd.json $/MoltenVK_icd.json 12 | ) 13 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Include/RHI/Dummy/Instance.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace RHI::Dummy { 10 | class DummyGpu; 11 | 12 | extern Instance* gInstance; 13 | 14 | class DummyInstance final : public Instance { 15 | public: 16 | NonCopyable(DummyInstance) 17 | DummyInstance(); 18 | ~DummyInstance() override; 19 | RHIType GetRHIType() override; 20 | uint32_t GetGpuNum() override; 21 | Gpu* GetGpu(uint32_t index) override; 22 | void Destroy() override; 23 | 24 | private: 25 | Common::UniquePtr dummyGpu; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Include/Runtime/Settings/Game.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/2/28. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | namespace Runtime { 12 | class RUNTIME_API EClass(gameReadOnly) GameSettings { 13 | public: 14 | EClassBody(GameSettings) 15 | 16 | GameSettings(); 17 | 18 | EProperty(category=Player) uint8_t maxLocalPlayerNum; 19 | EProperty(category=Player) uint8_t initialLocalPlayerNum; 20 | 21 | EProperty(category=Map) Core::Uri editorStartupLevel; 22 | EProperty(category=Map) Core::Uri gameStartupLevel; 23 | 24 | // TODO more 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Include/RHI/Dummy/Buffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace RHI::Dummy { 11 | class DummyBuffer final : public Buffer { 12 | public: 13 | NonCopyable(DummyBuffer) 14 | explicit DummyBuffer(const BufferCreateInfo& createInfo); 15 | ~DummyBuffer() override; 16 | 17 | void* Map(MapMode mapMode, size_t offset, size_t length) override; 18 | void UnMap() override; 19 | Common::UniquePtr CreateBufferView(const BufferViewCreateInfo& createInfo) override; 20 | private: 21 | std::vector dummyData; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Src/Gpu.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | namespace RHI::Dummy { 9 | DummyGpu::DummyGpu(DummyInstance& inInstance) 10 | : instance(inInstance) 11 | { 12 | } 13 | 14 | DummyGpu::~DummyGpu() = default; 15 | 16 | GpuProperty DummyGpu::GetProperty() 17 | { 18 | return {}; 19 | } 20 | 21 | Common::UniquePtr DummyGpu::RequestDevice(const DeviceCreateInfo& createInfo) 22 | { 23 | return { new DummyDevice(*this, createInfo) }; 24 | } 25 | 26 | DummyInstance& DummyGpu::GetInstance() const 27 | { 28 | return instance; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Include/RHI/Dummy/Pipeline.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace RHI::Dummy { 10 | class DummyComputePipeline final : public ComputePipeline { 11 | public: 12 | NonCopyable(DummyComputePipeline) 13 | explicit DummyComputePipeline(const ComputePipelineCreateInfo& createInfo); 14 | ~DummyComputePipeline() override; 15 | }; 16 | 17 | class DummyRasterPipeline final : public RasterPipeline { 18 | public: 19 | NonCopyable(DummyRasterPipeline) 20 | explicit DummyRasterPipeline(const RasterPipelineCreateInfo& createInfo); 21 | ~DummyRasterPipeline() override; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/ShaderModule.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 16/3/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include 10 | 11 | namespace RHI::DirectX12 { 12 | class DX12ShaderModule final : public ShaderModule { 13 | public: 14 | NonCopyable(DX12ShaderModule) 15 | explicit DX12ShaderModule(const ShaderModuleCreateInfo& inCreateInfo); 16 | ~DX12ShaderModule() override; 17 | 18 | const std::string& GetEntryPoint() override; 19 | 20 | const D3D12_SHADER_BYTECODE& GetNative() const; 21 | 22 | private: 23 | CD3DX12_SHADER_BYTECODE nativeShaderBytecode; 24 | std::string entryPoint; 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Vulkan/Include/RHI/Vulkan/Sampler.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Zach Lee on 2022/3/6. 3 | // 4 | 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | namespace RHI::Vulkan { 13 | class VulkanDevice; 14 | 15 | class VulkanSampler final : public Sampler { 16 | public: 17 | NonCopyable(VulkanSampler) 18 | VulkanSampler(VulkanDevice& inDevice, const SamplerCreateInfo& inCreateInfo); 19 | ~VulkanSampler() override; 20 | 21 | VkSampler GetNative() const; 22 | 23 | private: 24 | void CreateSampler(const SamplerCreateInfo& inCreateInfo); 25 | 26 | VulkanDevice& device; 27 | VkSampler nativeSampler; 28 | }; 29 | } -------------------------------------------------------------------------------- /Engine/Source/Runtime/Test/AssetTest.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/10/16. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | using namespace Common; 10 | using namespace Runtime; 11 | 12 | struct EClass() TestAsset : public Asset { 13 | EClassBody(TestAsset) 14 | 15 | explicit TestAsset(Core::Uri uri) 16 | : Asset(std::move(uri)) 17 | , a(0) 18 | , b() 19 | { 20 | } 21 | 22 | TestAsset(Core::Uri inUri, uint32_t inA, std::string inB) 23 | : Asset(std::move(inUri)) 24 | , a(inA) 25 | , b(std::move(inB)) 26 | { 27 | } 28 | 29 | EProperty() 30 | uint32_t a; 31 | 32 | EProperty() 33 | std::string b; 34 | }; 35 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Vulkan/Include/RHI/Vulkan/Surface.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/4/17. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include 10 | 11 | namespace RHI::Vulkan { 12 | class VulkanDevice; 13 | 14 | VkSurfaceKHR CreateNativeSurface(const VkInstance& instance, const SurfaceCreateInfo& createInfo); 15 | 16 | class VulkanSurface final : public Surface { 17 | public: 18 | NonCopyable(VulkanSurface) 19 | VulkanSurface(VulkanDevice& inDevice, const SurfaceCreateInfo& inCreateInfo); 20 | ~VulkanSurface() override; 21 | 22 | VkSurfaceKHR GetNative() const; 23 | 24 | private: 25 | VulkanDevice& device; 26 | VkSurfaceKHR nativeSurface; 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /Engine/Source/RHI-DirectX12/Src/ShaderModule.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 16/3/2022. 3 | // 4 | 5 | #include 6 | 7 | namespace RHI::DirectX12 { 8 | DX12ShaderModule::DX12ShaderModule(const ShaderModuleCreateInfo& inCreateInfo) 9 | : ShaderModule(inCreateInfo) 10 | , nativeShaderBytecode(inCreateInfo.byteCode, inCreateInfo.size) 11 | , entryPoint(inCreateInfo.entryPoint) 12 | { 13 | } 14 | 15 | DX12ShaderModule::~DX12ShaderModule() = default; 16 | 17 | const std::string& DX12ShaderModule::GetEntryPoint() 18 | { 19 | return entryPoint; 20 | } 21 | 22 | const D3D12_SHADER_BYTECODE& DX12ShaderModule::GetNative() const 23 | { 24 | return nativeShaderBytecode; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Editor/Include/Editor/Widget/GraphicsWidget.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Kindem on 2025/3/16. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | namespace Editor { 14 | class GraphicsWidget : public QWidget { 15 | Q_OBJECT 16 | 17 | public: 18 | explicit GraphicsWidget(QWidget* inParent = nullptr); 19 | ~GraphicsWidget() override; 20 | 21 | RHI::Device& GetDevice() const; 22 | RHI::Surface& GetSurface() const; 23 | 24 | protected: 25 | QPaintEngine* paintEngine() const override; 26 | 27 | void WaitDeviceIdle() const; 28 | 29 | RHI::Device* device; 30 | Common::UniquePtr surface; 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /Editor/Web/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "useDefineForClassFields": true, 5 | "lib": ["ES2020", "DOM", "DOM.Iterable"], 6 | "module": "ESNext", 7 | "skipLibCheck": true, 8 | "paths": { 9 | "@/*": ["./src/*"] 10 | }, 11 | 12 | /* Bundler mode */ 13 | "moduleResolution": "bundler", 14 | "allowImportingTsExtensions": true, 15 | "resolveJsonModule": true, 16 | "isolatedModules": true, 17 | "noEmit": true, 18 | "jsx": "react-jsx", 19 | 20 | /* Linting */ 21 | "strict": true, 22 | "noUnusedLocals": true, 23 | "noUnusedParameters": true, 24 | "noFallthroughCasesInSwitch": true 25 | }, 26 | "include": ["src"], 27 | "references": [{ "path": "./tsconfig.node.json" }] 28 | } 29 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Src/Synchronous.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | namespace RHI::Dummy { 9 | DummyFence::DummyFence(DummyDevice& device, const bool bInitAsSignal) 10 | : Fence(device, bInitAsSignal) 11 | { 12 | } 13 | 14 | DummyFence::~DummyFence() = default; 15 | 16 | bool DummyFence::IsSignaled() 17 | { 18 | return false; 19 | } 20 | 21 | void DummyFence::Reset() 22 | { 23 | } 24 | 25 | void DummyFence::Wait() 26 | { 27 | } 28 | 29 | DummySemaphore::DummySemaphore(DummyDevice& device) 30 | : Semaphore(device) 31 | { 32 | } 33 | 34 | DummySemaphore::~DummySemaphore() = default; 35 | } 36 | -------------------------------------------------------------------------------- /Engine/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(Source) 2 | 3 | function(get_engine_shader_resources) 4 | set(options "") 5 | set(singleValueArgs OUTPUT) 6 | set(multiValueArgs "") 7 | cmake_parse_arguments(arg "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN}) 8 | 9 | file(GLOB_RECURSE engine_shaders ${CMAKE_SOURCE_DIR}/${ENGINE_SUB_PROJECT_NAME}/Shader/*.es*) 10 | foreach (shader ${engine_shaders}) 11 | get_filename_component(shader_absolute ${shader} ABSOLUTE) 12 | string(REPLACE ${CMAKE_SOURCE_DIR}/${ENGINE_SUB_PROJECT_NAME}/Shader ../Shader/${ENGINE_SUB_PROJECT_NAME} copy_dst ${shader_absolute}) 13 | list(APPEND result ${shader}->${copy_dst}) 14 | endforeach () 15 | 16 | set(${arg_OUTPUT} ${result} PARENT_SCOPE) 17 | endfunction() 18 | -------------------------------------------------------------------------------- /Engine/Source/Launch/Include/Launch/GameApplication.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/3/24. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace Launch { 13 | class GameApplication { 14 | public: 15 | GameApplication(int argc, char* argv[]); 16 | ~GameApplication(); 17 | 18 | void Tick(); 19 | bool ShouldClose() const; 20 | 21 | private: 22 | double lastFrameTimeSeconds; 23 | double thisFrameTimeSeconds; 24 | float deltaTimeSeconds; 25 | Common::UniquePtr viewport; 26 | Runtime::Engine* engine; 27 | Runtime::GameModule* gameModule; 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Vulkan/Include/RHI/Vulkan/Queue.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 16/1/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | namespace RHI::Vulkan { 13 | class VulkanDevice; 14 | 15 | class VulkanQueue final : public Queue { 16 | public: 17 | NonCopyable(VulkanQueue) 18 | explicit VulkanQueue(VulkanDevice& inDevice, VkQueue inNativeQueue); 19 | ~VulkanQueue() override; 20 | 21 | void Submit(CommandBuffer* inCmdBuffer, const QueueSubmitInfo& inSubmitInfo) override; 22 | void Flush(Fence* inFenceToSignal) override; 23 | 24 | VkQueue GetNative() const; 25 | 26 | private: 27 | VkQueue nativeQueue; 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /Engine/Source/Common/Src/Hash.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2024/4/14. 3 | // 4 | 5 | #include 6 | 7 | namespace Common { 8 | uint32_t HashUtils::StrCrc32(const char* str, size_t length) 9 | { 10 | uint32_t result = 0xffffffff; 11 | for (auto i = 0; i < length; i++) { 12 | result = (result >> 8) ^ Internal::crcTable[(result ^ str[i]) & 0x000000ff]; 13 | } 14 | return result ^ 0xffffffff; 15 | } 16 | 17 | uint32_t HashUtils::StrCrc32(const std::string& str) 18 | { 19 | return StrCrc32(str.c_str(), str.length()); 20 | } 21 | 22 | uint64_t HashUtils::CityHash(const void* buffer, const size_t length) 23 | { 24 | return CityHash64(static_cast(buffer), length); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Include/RHI/Dummy/Synchronous.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace RHI::Dummy { 10 | class DummyDevice; 11 | 12 | class DummyFence final : public Fence { 13 | public: 14 | NonCopyable(DummyFence) 15 | explicit DummyFence(DummyDevice& device, bool bInitAsSignal); 16 | ~DummyFence() override; 17 | 18 | bool IsSignaled() override; 19 | void Reset() override; 20 | void Wait() override; 21 | }; 22 | 23 | class DummySemaphore final : public Semaphore { 24 | public: 25 | NonCopyable(DummySemaphore) 26 | explicit DummySemaphore(DummyDevice& device); 27 | ~DummySemaphore() override; 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /Engine/Source/Common/Include/Common/Platform.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 13/3/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace Common { 10 | enum class DevelopmentPlatform { 11 | windows, 12 | macos, 13 | linux, 14 | max 15 | }; 16 | 17 | enum class TargetPlatform { 18 | windows, 19 | macos, 20 | linux, 21 | android, 22 | ios, 23 | xbox, 24 | playStation, 25 | nintendoSwitch, 26 | max 27 | }; 28 | 29 | enum class CpuArch { 30 | x86, 31 | x64, 32 | max 33 | }; 34 | 35 | class PlatformUtils { 36 | public: 37 | static void SetEnvVar(const std::string& inKey, const std::string& inValue); 38 | }; 39 | } 40 | -------------------------------------------------------------------------------- /Engine/Source/RHI/Include/RHI/RHI.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 19/4/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #if PLATFORM_WINDOWS 29 | #undef CreateSemaphore 30 | #endif 31 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/dxc/test_package/conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | from conan.tools.build import can_run 3 | from conan.tools.cmake import cmake_layout, CMake 4 | import os 5 | 6 | 7 | class TestPackageConan(ConanFile): 8 | settings = "os", "arch", "compiler", "build_type" 9 | generators = "CMakeDeps", "CMakeToolchain" 10 | 11 | def layout(self): 12 | cmake_layout(self) 13 | 14 | def requirements(self): 15 | self.requires(self.tested_reference_str) 16 | 17 | def build(self): 18 | cmake = CMake(self) 19 | cmake.configure() 20 | cmake.build() 21 | 22 | def test(self): 23 | if can_run(self): 24 | bin_path = os.path.join(self.cpp.build.bindir, "test_package") 25 | self.run(bin_path, env="conanrun") 26 | -------------------------------------------------------------------------------- /Engine/Source/RHI/Include/RHI/Gpu.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 12/1/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | namespace RHI { 13 | class Device; 14 | class Instance; 15 | struct DeviceCreateInfo; 16 | 17 | struct GpuProperty { 18 | uint32_t vendorId; 19 | uint32_t deviceId; 20 | GpuType type; 21 | }; 22 | 23 | class Gpu { 24 | public: 25 | NonCopyable(Gpu) 26 | virtual ~Gpu(); 27 | virtual GpuProperty GetProperty() = 0; 28 | virtual Common::UniquePtr RequestDevice(const DeviceCreateInfo& createInfo) = 0; 29 | virtual Instance& GetInstance() const = 0; 30 | 31 | protected: 32 | Gpu(); 33 | }; 34 | } 35 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/assimp/test_package/conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | from conan.tools.build import can_run 3 | from conan.tools.cmake import cmake_layout, CMake 4 | import os 5 | 6 | 7 | class TestPackageConan(ConanFile): 8 | settings = "os", "arch", "compiler", "build_type" 9 | generators = "CMakeDeps", "CMakeToolchain" 10 | 11 | def layout(self): 12 | cmake_layout(self) 13 | 14 | def requirements(self): 15 | self.requires(self.tested_reference_str) 16 | 17 | def build(self): 18 | cmake = CMake(self) 19 | cmake.configure() 20 | cmake.build() 21 | 22 | def test(self): 23 | if can_run(self): 24 | bin_path = os.path.join(self.cpp.build.bindir, "test_package") 25 | self.run(bin_path, env="conanrun") 26 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/clipp/test_package/conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | from conan.tools.build import can_run 3 | from conan.tools.cmake import cmake_layout, CMake 4 | import os 5 | 6 | 7 | class TestPackageConan(ConanFile): 8 | settings = "os", "arch", "compiler", "build_type" 9 | generators = "CMakeDeps", "CMakeToolchain" 10 | 11 | def layout(self): 12 | cmake_layout(self) 13 | 14 | def requirements(self): 15 | self.requires(self.tested_reference_str) 16 | 17 | def build(self): 18 | cmake = CMake(self) 19 | cmake.configure() 20 | cmake.build() 21 | 22 | def test(self): 23 | if can_run(self): 24 | bin_path = os.path.join(self.cpp.build.bindir, "test_package") 25 | self.run(bin_path, env="conanrun") 26 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/glfw/test_package/conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | from conan.tools.build import can_run 3 | from conan.tools.cmake import cmake_layout, CMake 4 | import os 5 | 6 | 7 | class TestPackageConan(ConanFile): 8 | settings = "os", "arch", "compiler", "build_type" 9 | generators = "CMakeDeps", "CMakeToolchain" 10 | 11 | def layout(self): 12 | cmake_layout(self) 13 | 14 | def requirements(self): 15 | self.requires(self.tested_reference_str) 16 | 17 | def build(self): 18 | cmake = CMake(self) 19 | cmake.configure() 20 | cmake.build() 21 | 22 | def test(self): 23 | if can_run(self): 24 | bin_path = os.path.join(self.cpp.build.bindir, "test_package") 25 | self.run(bin_path, env="conanrun") 26 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/libclang/test_package/conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | from conan.tools.build import can_run 3 | from conan.tools.cmake import cmake_layout, CMake 4 | import os 5 | 6 | 7 | class TestPackageConan(ConanFile): 8 | settings = "os", "arch", "compiler", "build_type" 9 | generators = "CMakeDeps", "CMakeToolchain" 10 | 11 | def layout(self): 12 | cmake_layout(self) 13 | 14 | def requirements(self): 15 | self.requires(self.tested_reference_str) 16 | 17 | def build(self): 18 | cmake = CMake(self) 19 | cmake.configure() 20 | cmake.build() 21 | 22 | def test(self): 23 | if can_run(self): 24 | bin_path = os.path.join(self.cpp.build.bindir, "test_package") 25 | self.run(bin_path, env="conanrun") 26 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/debugbreak/test_package/conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | from conan.tools.build import can_run 3 | from conan.tools.cmake import cmake_layout, CMake 4 | import os 5 | 6 | 7 | class TestPackageConan(ConanFile): 8 | settings = "os", "arch", "compiler", "build_type" 9 | generators = "CMakeDeps", "CMakeToolchain" 10 | 11 | def layout(self): 12 | cmake_layout(self) 13 | 14 | def requirements(self): 15 | self.requires(self.tested_reference_str) 16 | 17 | def build(self): 18 | cmake = CMake(self) 19 | cmake.configure() 20 | cmake.build() 21 | 22 | def test(self): 23 | if can_run(self): 24 | bin_path = os.path.join(self.cpp.build.bindir, "test_package") 25 | self.run(bin_path, env="conanrun") 26 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/molten-vk/test_package/conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | from conan.tools.build import can_run 3 | from conan.tools.cmake import cmake_layout, CMake 4 | import os 5 | 6 | 7 | class TestPackageConan(ConanFile): 8 | settings = "os", "arch", "compiler", "build_type" 9 | generators = "CMakeDeps", "CMakeToolchain" 10 | 11 | def layout(self): 12 | cmake_layout(self) 13 | 14 | def requirements(self): 15 | self.requires(self.tested_reference_str) 16 | 17 | def build(self): 18 | cmake = CMake(self) 19 | cmake.configure() 20 | cmake.build() 21 | 22 | def test(self): 23 | if can_run(self): 24 | bin_path = os.path.join(self.cpp.build.bindir, "test_package") 25 | self.run(bin_path, env="conanrun") 26 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/rapidjson/test_package/conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | from conan.tools.build import can_run 3 | from conan.tools.cmake import cmake_layout, CMake 4 | import os 5 | 6 | 7 | class TestPackageConan(ConanFile): 8 | settings = "os", "arch", "compiler", "build_type" 9 | generators = "CMakeDeps", "CMakeToolchain" 10 | 11 | def layout(self): 12 | cmake_layout(self) 13 | 14 | def requirements(self): 15 | self.requires(self.tested_reference_str) 16 | 17 | def build(self): 18 | cmake = CMake(self) 19 | cmake.configure() 20 | cmake.build() 21 | 22 | def test(self): 23 | if can_run(self): 24 | bin_path = os.path.join(self.cpp.build.bindir, "test_package") 25 | self.run(bin_path, env="conanrun") 26 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Src/Buffer.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | namespace RHI::Dummy { 9 | DummyBuffer::DummyBuffer(const BufferCreateInfo& createInfo) 10 | : Buffer(createInfo) 11 | , dummyData(1) 12 | { 13 | } 14 | 15 | DummyBuffer::~DummyBuffer() = default; 16 | 17 | void* DummyBuffer::Map(MapMode mapMode, size_t offset, size_t length) 18 | { 19 | return dummyData.data(); 20 | } 21 | 22 | void DummyBuffer::UnMap() 23 | { 24 | } 25 | 26 | Common::UniquePtr DummyBuffer::CreateBufferView(const BufferViewCreateInfo& createInfo) 27 | { 28 | return Common::UniquePtr(new DummyBufferView(createInfo)); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/Queue.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 15/1/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | using Microsoft::WRL::ComPtr; 13 | 14 | namespace RHI::DirectX12 { 15 | class DX12Queue final : public Queue { 16 | public: 17 | NonCopyable(DX12Queue) 18 | explicit DX12Queue(ComPtr&& inNativeCmdQueue); 19 | ~DX12Queue() override; 20 | 21 | void Submit(CommandBuffer* inCmdBuffer, const QueueSubmitInfo& inSubmitInfo) override; 22 | void Flush(Fence* inFenceToSignal) override; 23 | 24 | ID3D12CommandQueue* GetNative() const; 25 | 26 | private: 27 | ComPtr nativeCmdQueue; 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Vulkan/Include/RHI/Vulkan/PipelineLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Zach Lee on 2022/4/2. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include 10 | 11 | namespace RHI::Vulkan { 12 | class VulkanDevice; 13 | 14 | class VulkanPipelineLayout final : public PipelineLayout { 15 | public: 16 | NonCopyable(VulkanPipelineLayout) 17 | VulkanPipelineLayout(VulkanDevice& inDevice, const PipelineLayoutCreateInfo& inCreateInfo); 18 | ~VulkanPipelineLayout() override; 19 | 20 | VkPipelineLayout GetNative() const; 21 | 22 | private: 23 | void CreateNativePipelineLayout(const PipelineLayoutCreateInfo& inCreateInfo); 24 | 25 | VulkanDevice& device; 26 | VkPipelineLayout nativePipelineLayout; 27 | }; 28 | } -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/vulkan-validationlayers/test_package/conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | from conan.tools.build import can_run 3 | from conan.tools.cmake import cmake_layout, CMake 4 | import os 5 | 6 | 7 | class TestPackageConan(ConanFile): 8 | settings = "os", "arch", "compiler", "build_type" 9 | generators = "CMakeDeps", "CMakeToolchain" 10 | 11 | def layout(self): 12 | cmake_layout(self) 13 | 14 | def requirements(self): 15 | self.requires(self.tested_reference_str) 16 | 17 | def build(self): 18 | cmake = CMake(self) 19 | cmake.configure() 20 | cmake.build() 21 | 22 | def test(self): 23 | if can_run(self): 24 | bin_path = os.path.join(self.cpp.build.bindir, "test_package") 25 | self.run(bin_path, env="conanrun") 26 | -------------------------------------------------------------------------------- /Engine/Source/Common/Src/Debug.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2024/4/14. 3 | // 4 | 5 | #if BUILD_CONFIG_DEBUG 6 | #include 7 | #endif 8 | 9 | #include 10 | #include 11 | 12 | namespace Common { 13 | void Debug::AssertImpl(const bool expression, const std::string& name, const std::string& file, const uint32_t line, const std::string& reason) 14 | { 15 | AutoCerrFlush; 16 | 17 | if (expression) { 18 | return; 19 | } 20 | std::cerr << "Assert failed: " << name << ", " << file << ", " << line << newline; 21 | std::cerr << "Reason: " << reason << newline; 22 | 23 | #if BUILD_CONFIG_DEBUG 24 | debug_break(); 25 | #endif 26 | } 27 | 28 | Debug::Debug() = default; 29 | 30 | Debug::~Debug() = default; 31 | } 32 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/vulkan-utility-libraries/test_package/conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | from conan.tools.build import can_run 3 | from conan.tools.cmake import cmake_layout, CMake 4 | import os 5 | 6 | 7 | class TestPackageConan(ConanFile): 8 | settings = "os", "arch", "compiler", "build_type" 9 | generators = "CMakeDeps", "CMakeToolchain" 10 | 11 | def layout(self): 12 | cmake_layout(self) 13 | 14 | def requirements(self): 15 | self.requires(self.tested_reference_str) 16 | 17 | def build(self): 18 | cmake = CMake(self) 19 | cmake.configure() 20 | cmake.build() 21 | 22 | def test(self): 23 | if can_run(self): 24 | bin_path = os.path.join(self.cpp.build.bindir, "test_package") 25 | self.run(bin_path, env="conanrun") 26 | -------------------------------------------------------------------------------- /Tool/MirrorTool/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB sources Src/*.cpp) 2 | exp_add_library( 3 | NAME MirrorTool.Static 4 | SRC ${sources} 5 | PUBLIC_INC Include 6 | PUBLIC_LIB Mirror 7 | PUBLIC_MERGE_LIB libclang::libclang clipp::clipp 8 | NOT_INSTALL 9 | ) 10 | 11 | file(GLOB exe_sources ExeSrc/*.cpp) 12 | exp_add_executable( 13 | NAME MirrorTool 14 | SRC ${exe_sources} 15 | INC Include 16 | LIB MirrorTool.Static 17 | ) 18 | 19 | exp_add_test( 20 | NAME MirrorTool.Test 21 | SRC Test/Main.cpp 22 | INC Include 23 | LIB MirrorTool.Static 24 | RES 25 | ${CMAKE_CURRENT_SOURCE_DIR}/Test/MirrorToolInput.h->../Test/Resource/Mirror/MirrorToolInput.h 26 | ${CMAKE_SOURCE_DIR}/${ENGINE_SUB_PROJECT_NAME}/Source/Mirror/Include/Mirror/Meta.h->../Test/Resource/Mirror/Mirror/Meta.h 27 | ) 28 | -------------------------------------------------------------------------------- /Engine/Source/Common/Test/HashTest.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2022/7/3. 3 | // 4 | 5 | #include 6 | 7 | #include 8 | 9 | #include 10 | 11 | TEST(HashTest, CityHashTest) 12 | { 13 | constexpr std::string_view testString = "Hello, World"; 14 | ASSERT_EQ(7750308374451649530, Common::HashUtils::CityHash(testString.data(), testString.size())); 15 | } 16 | 17 | TEST(HashTest, StrCrc32Test) 18 | { 19 | ASSERT_EQ(Common::HashUtils::StrCrc32("hello"), 0x3610a686); 20 | ASSERT_EQ(Common::HashUtils::StrCrc32("explosion game engine"), 0xdb39167f); 21 | } 22 | 23 | TEST(HashTest, StrCrc32DynTest) 24 | { 25 | ASSERT_EQ(Common::HashUtils::StrCrc32(std::string("hello")), 0x3610a686); 26 | ASSERT_EQ(Common::HashUtils::StrCrc32(std::string("explosion game engine")), 0xdb39167f); 27 | } 28 | -------------------------------------------------------------------------------- /Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/Sampler.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 5/3/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | namespace RHI::DirectX12 { 14 | class DX12Device; 15 | 16 | class DX12Sampler final : public Sampler { 17 | public: 18 | NonCopyable(DX12Sampler) 19 | explicit DX12Sampler(DX12Device& inDevice, const SamplerCreateInfo& inCreateInfo); 20 | ~DX12Sampler() override; 21 | 22 | CD3DX12_CPU_DESCRIPTOR_HANDLE GetNativeCpuDescriptorHandle() const; 23 | 24 | private: 25 | void CreateDX12Descriptor(DX12Device& inDevice, const SamplerCreateInfo& inCreateInfo); 26 | 27 | Common::UniquePtr descriptorAllocation; 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Src/DummyRHIModule.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/8/7. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | namespace RHI::Dummy { 9 | DummyRHIModule::DummyRHIModule() = default; 10 | 11 | DummyRHIModule::~DummyRHIModule() = default; 12 | 13 | void DummyRHIModule::OnLoad() 14 | { 15 | gInstance = new DummyInstance(); 16 | } 17 | 18 | void DummyRHIModule::OnUnload() 19 | { 20 | delete gInstance; 21 | } 22 | 23 | Core::ModuleType DummyRHIModule::Type() const 24 | { 25 | return Core::ModuleType::mDynamic; 26 | } 27 | 28 | Instance* DummyRHIModule::GetRHIInstance() // NOLINT 29 | { 30 | return gInstance; 31 | } 32 | } 33 | 34 | IMPLEMENT_DYNAMIC_MODULE(RHI_DUMMY_API, RHI::Dummy::DummyRHIModule); 35 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Vulkan/Include/RHI/Vulkan/BindGroupLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Zach Lee on 2022/3/6. 3 | // 4 | 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace RHI::Vulkan { 13 | class VulkanDevice; 14 | 15 | class VulkanBindGroupLayout final : public BindGroupLayout { 16 | public: 17 | NonCopyable(VulkanBindGroupLayout) 18 | VulkanBindGroupLayout(VulkanDevice& inDevice, const BindGroupLayoutCreateInfo& inCreateInfo); 19 | ~VulkanBindGroupLayout() override; 20 | 21 | VkDescriptorSetLayout GetNative() const; 22 | 23 | private: 24 | void CreateNativeDescriptorSetLayout(const BindGroupLayoutCreateInfo& inCreateInfo); 25 | 26 | VulkanDevice& device; 27 | VkDescriptorSetLayout nativeDescriptorSetLayout; 28 | }; 29 | } -------------------------------------------------------------------------------- /Engine/Source/RHI-DirectX12/Src/DX12RHIModule.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/8/7. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | namespace RHI::DirectX12 { 9 | DX12RHIModule::DX12RHIModule() = default; 10 | 11 | DX12RHIModule::~DX12RHIModule() = default; 12 | 13 | void DX12RHIModule::OnLoad() 14 | { 15 | gInstance = new DX12Instance(); 16 | } 17 | 18 | void DX12RHIModule::OnUnload() 19 | { 20 | delete gInstance; 21 | } 22 | 23 | Core::ModuleType DX12RHIModule::Type() const 24 | { 25 | return Core::ModuleType::mDynamic; 26 | } 27 | 28 | Instance* DX12RHIModule::GetRHIInstance() // NOLINT 29 | { 30 | return gInstance; 31 | } 32 | } 33 | 34 | IMPLEMENT_DYNAMIC_MODULE(RHI_DIRECTX12_API, RHI::DirectX12::DX12RHIModule); 35 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Include/RHI/Dummy/SwapChain.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include 10 | 11 | namespace RHI::Dummy { 12 | class DummyTexture; 13 | 14 | class DummySwapChain final : public SwapChain { 15 | public: 16 | NonCopyable(DummySwapChain) 17 | explicit DummySwapChain(const SwapChainCreateInfo& createInfo); 18 | ~DummySwapChain() override; 19 | 20 | uint8_t GetTextureNum() override; 21 | Texture* GetTexture(uint8_t index) override; 22 | uint8_t AcquireBackTexture(Semaphore* signalSemaphore) override; 23 | void Present(Semaphore* waitSemaphore) override; 24 | 25 | private: 26 | bool pingPong; 27 | std::vector> dummyTextures; 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Include/Runtime/System/Transform.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/1/21. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace Runtime { 13 | class RUNTIME_API EClass() TransformSystem final : public System { 14 | EPolyClassBody(TransformSystem) 15 | 16 | public: 17 | explicit TransformSystem(ECRegistry& inRegistry, const SystemSetupContext& inContext); 18 | ~TransformSystem() override; 19 | 20 | NonCopyable(TransformSystem) 21 | NonMovable(TransformSystem) 22 | 23 | void Tick(float inDeltaTimeSeconds) override; 24 | 25 | private: 26 | Observer worldTransformUpdatedObserver; 27 | Observer localTransformUpdatedObserver; 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Vulkan/Src/VulkanRHIModule.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/8/7. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | namespace RHI::Vulkan { 9 | VulkanRHIModule::VulkanRHIModule() = default; 10 | 11 | VulkanRHIModule::~VulkanRHIModule() = default; 12 | 13 | void VulkanRHIModule::OnLoad() 14 | { 15 | gInstance = new VulkanInstance(); 16 | } 17 | 18 | void VulkanRHIModule::OnUnload() 19 | { 20 | delete gInstance; 21 | } 22 | 23 | Core::ModuleType VulkanRHIModule::Type() const 24 | { 25 | return Core::ModuleType::mDynamic; 26 | } 27 | 28 | Instance* VulkanRHIModule::GetRHIInstance() // NOLINT 29 | { 30 | return gInstance; 31 | } 32 | } 33 | 34 | IMPLEMENT_DYNAMIC_MODULE(RHI_VULKAN_API, RHI::Vulkan::VulkanRHIModule); 35 | -------------------------------------------------------------------------------- /Sample/RHI-TexSampling/TexSampling.esl: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | VkBinding(0, 0) Texture2D colorTex : register(t0); 4 | VkBinding(1, 0) SamplerState colorSampler : register(s0); 5 | VkBinding(2, 0) cbuffer passParams : register(b0) 6 | { 7 | float4x4 model; 8 | }; 9 | 10 | struct FragmentInput { 11 | float4 position : SV_POSITION; 12 | float2 uv : TEXCOORD; 13 | }; 14 | 15 | FragmentInput VSMain( 16 | VkLocation(0) float4 position : POSITION, 17 | VkLocation(1) float2 uv : TEXCOORD) 18 | { 19 | FragmentInput fragmentInput; 20 | fragmentInput.position = mul(model, position); 21 | fragmentInput.uv = uv; 22 | #if VULKAN 23 | fragmentInput.uv.y = 1 - fragmentInput.uv.y; 24 | #endif 25 | return fragmentInput; 26 | } 27 | 28 | float4 PSMain(FragmentInput input) : SV_TARGET 29 | { 30 | return colorTex.Sample(colorSampler, input.uv); 31 | } 32 | -------------------------------------------------------------------------------- /Editor/Shader/GraphicsWindowSample.esl: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct FragmentInput { 4 | float4 position : SV_POSITION; 5 | float4 color : COLOR; 6 | }; 7 | 8 | #if VERTEX_SHADER 9 | cbuffer vsUniform { 10 | float3 vertexColor; 11 | }; 12 | 13 | FragmentInput VSMain( 14 | uint vertexId : SV_VertexID, 15 | VkLocation(0) float3 position : POSITION) 16 | { 17 | FragmentInput fragmentInput; 18 | fragmentInput.position = float4(position.xyz, 1.0f); 19 | #if VULKAN 20 | fragmentInput.position.y = - fragmentInput.position.y; 21 | #endif 22 | 23 | fragmentInput.color = float4(0.0f, 0.0f, 0.0f, 1.0f); 24 | fragmentInput.color[vertexId % 3] = vertexColor[vertexId % 3]; 25 | return fragmentInput; 26 | } 27 | #endif 28 | 29 | #if PIXEL_SHADER 30 | float4 PSMain(FragmentInput input) : SV_TARGET 31 | { 32 | return input.color; 33 | } 34 | #endif 35 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Src/Instance.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | namespace RHI::Dummy { 10 | Instance* gInstance = nullptr; 11 | 12 | DummyInstance::DummyInstance() 13 | : dummyGpu(Common::MakeUnique(*this)) 14 | { 15 | } 16 | 17 | DummyInstance::~DummyInstance() = default; 18 | 19 | RHIType DummyInstance::GetRHIType() 20 | { 21 | return RHIType::dummy; 22 | } 23 | 24 | uint32_t DummyInstance::GetGpuNum() 25 | { 26 | return 1; 27 | } 28 | 29 | Gpu* DummyInstance::GetGpu(const uint32_t index) 30 | { 31 | Assert(index == 0); 32 | return dummyGpu.Get(); 33 | } 34 | 35 | void DummyInstance::Destroy() 36 | { 37 | delete this; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Sample/Rendering-BaseTexture/BaseTexture.esl: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | VkBinding(0, 0) Texture2D colorTex : register(t0); 4 | VkBinding(1, 0) SamplerState colorSampler : register(s0); 5 | VkBinding(2, 0) cbuffer constantBuffer : register(b0) 6 | { 7 | float4x4 model; 8 | }; 9 | 10 | struct FragmentInput { 11 | float4 position : SV_POSITION; 12 | float2 uv : TEXCOORD; 13 | }; 14 | 15 | FragmentInput VSMain( 16 | VkLocation(0) float4 position : POSITION, 17 | VkLocation(1) float2 uv : TEXCOORD) 18 | { 19 | FragmentInput fragmentInput; 20 | fragmentInput.position = mul(model, position); 21 | fragmentInput.uv = uv; 22 | #if VULKAN 23 | fragmentInput.uv.y = 1 - fragmentInput.uv.y; 24 | #endif 25 | return fragmentInput; 26 | } 27 | 28 | float4 PSMain(FragmentInput input) : SV_TARGET 29 | { 30 | return colorTex.Sample(colorSampler, input.uv); 31 | } 32 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Vulkan/Include/RHI/Vulkan/CommandBuffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Zach Lee on 2022/6/4. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include 10 | 11 | #include 12 | 13 | namespace RHI::Vulkan { 14 | class VulkanDevice; 15 | 16 | class VulkanCommandBuffer final : public CommandBuffer { 17 | public: 18 | NonCopyable(VulkanCommandBuffer) 19 | VulkanCommandBuffer(VulkanDevice& inDevice, VkCommandPool inNativeCmdPool); 20 | ~VulkanCommandBuffer() override; 21 | 22 | Common::UniquePtr Begin() override; 23 | 24 | VkCommandBuffer GetNative() const; 25 | 26 | private: 27 | void CreateNativeCommandBuffer(); 28 | 29 | VulkanDevice& device; 30 | VkCommandPool pool; 31 | VkCommandBuffer nativeCmdBuffer; 32 | }; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Src/Asset/Asset.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/10/10. 3 | // 4 | 5 | #include 6 | 7 | namespace Runtime { 8 | Asset::Asset() = default; 9 | 10 | Asset::Asset(Core::Uri inUri) 11 | : uri(std::move(inUri)) 12 | { 13 | } 14 | 15 | Asset::~Asset() = default; 16 | 17 | const Core::Uri& Asset::Uri() const 18 | { 19 | return uri; 20 | } 21 | 22 | void Asset::SetUri(Core::Uri inUri) 23 | { 24 | uri = std::move(inUri); 25 | } 26 | 27 | void Asset::PostLoad() {} 28 | 29 | AssetManager& AssetManager::Get() 30 | { 31 | static AssetManager instance; 32 | return instance; 33 | } 34 | 35 | AssetManager::AssetManager() 36 | : threadPool("AssetThreadPool", 4) 37 | { 38 | } 39 | 40 | AssetManager::~AssetManager() = default; 41 | } 42 | -------------------------------------------------------------------------------- /Engine/Source/Core/Test/ConsoleTest.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/2/27. 3 | // 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | static Core::ConsoleSettingValue csA("a", "", 1); 11 | static Core::ConsoleSettingValue csB("b", "", true); 12 | static Core::ConsoleSettingValue csC("c", "", "hello"); 13 | 14 | TEST(ConsoleTest, ConsoleSettingTest) 15 | { 16 | Core::ScopedThreadTag tag(Core::ThreadTag::game); 17 | 18 | ASSERT_EQ(csA.Get(), 1); 19 | ASSERT_TRUE(csB.Get()); 20 | ASSERT_EQ(csC.Get(), "hello"); 21 | 22 | auto& console = Core::Console::Get(); 23 | console.GetSetting("a").SetI32(2); 24 | console.GetSetting("b").SetBool(false); 25 | console.GetSetting("c").SetI32(1); 26 | 27 | ASSERT_EQ(csA.Get(), 2); 28 | ASSERT_FALSE(csB.Get()); 29 | ASSERT_EQ(csC.Get(), "1"); 30 | } 31 | -------------------------------------------------------------------------------- /Engine/Source/RHI/Src/Common.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/25. 3 | // 4 | 5 | #include 6 | 7 | namespace RHI { 8 | size_t GetBytesPerPixel(PixelFormat format) 9 | { 10 | if (format > PixelFormat::begin8Bits && format < PixelFormat::begin16Bits) { 11 | return 1; 12 | } 13 | if (format > PixelFormat::begin16Bits && format < PixelFormat::begin32Bits) { 14 | return 2; 15 | } 16 | if (format > PixelFormat::begin32Bits && format < PixelFormat::begin64Bits) { 17 | return 4; 18 | } 19 | if (format > PixelFormat::begin64Bits && format < PixelFormat::begin128Bits) { 20 | return 8; 21 | } 22 | if (format > PixelFormat::begin128Bits && format < PixelFormat::max) { 23 | return 16; 24 | } 25 | return Assert(false), 1; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Engine/Source/RHI/Src/BindGroup.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 19/2/2022. 3 | // 4 | 5 | #include 6 | 7 | #include 8 | 9 | namespace RHI { 10 | BindGroupEntry::BindGroupEntry(const ResourceBinding& inBinding, const std::variant& inEntity) 11 | : binding(inBinding) 12 | , entity(inEntity) 13 | { 14 | } 15 | 16 | BindGroupCreateInfo::BindGroupCreateInfo(BindGroupLayout* inLayout, std::string inDebugName) 17 | : layout(inLayout) 18 | , debugName(std::move(inDebugName)) 19 | { 20 | } 21 | 22 | BindGroupCreateInfo& BindGroupCreateInfo::AddEntry(const BindGroupEntry& inEntry) 23 | { 24 | entries.emplace_back(inEntry); 25 | return *this; 26 | } 27 | 28 | BindGroup::BindGroup(const BindGroupCreateInfo&) {} 29 | 30 | BindGroup::~BindGroup() = default; 31 | } 32 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Vulkan/Src/Surface.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/4/17. 3 | // 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | namespace RHI::Vulkan { 11 | VulkanSurface::VulkanSurface(VulkanDevice& inDevice, const SurfaceCreateInfo& inCreateInfo) 12 | : Surface(inCreateInfo) 13 | , device(inDevice) 14 | { 15 | nativeSurface = CreateNativeSurface(device.GetGpu().GetInstance().GetNative(), inCreateInfo); 16 | } 17 | 18 | VulkanSurface::~VulkanSurface() 19 | { 20 | if (nativeSurface != VK_NULL_HANDLE) { 21 | vkDestroySurfaceKHR(device.GetGpu().GetInstance().GetNative(), nativeSurface, nullptr); 22 | } 23 | } 24 | 25 | VkSurfaceKHR VulkanSurface::GetNative() const 26 | { 27 | return nativeSurface; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Vulkan/Include/RHI/Vulkan/ShaderModule.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Zach Lee on 2022/4/2. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include 10 | 11 | #include 12 | 13 | namespace RHI::Vulkan { 14 | class VulkanDevice; 15 | 16 | class VulkanShaderModule final : public ShaderModule { 17 | public: 18 | NonCopyable(VulkanShaderModule) 19 | VulkanShaderModule(VulkanDevice& inDevice, const ShaderModuleCreateInfo& inCreateInfo); 20 | ~VulkanShaderModule() override; 21 | 22 | const std::string& GetEntryPoint() override; 23 | 24 | VkShaderModule GetNative() const; 25 | 26 | private: 27 | void CreateNativeShaderModule(const ShaderModuleCreateInfo& createInfo); 28 | 29 | VulkanDevice& device; 30 | VkShaderModule nativeShaderModule; 31 | std::string entryPoint; 32 | }; 33 | } -------------------------------------------------------------------------------- /Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/Gpu.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 13/1/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | using Microsoft::WRL::ComPtr; 14 | 15 | namespace RHI::DirectX12 { 16 | class DX12Gpu final : public Gpu { 17 | public: 18 | NonCopyable(DX12Gpu) 19 | DX12Gpu(DX12Instance& inInstance, ComPtr&& inNativeAdapter); 20 | ~DX12Gpu() override; 21 | 22 | GpuProperty GetProperty() override; 23 | Common::UniquePtr RequestDevice(const DeviceCreateInfo& inCreateInfo) override; 24 | DX12Instance& GetInstance() const override; 25 | 26 | IDXGIAdapter1* GetNative() const; 27 | 28 | private: 29 | DX12Instance& instance; 30 | ComPtr nativeAdapter; 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Vulkan/Include/RHI/Vulkan/BindGroup.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Zach Lee on 2022/3/20. 3 | // 4 | 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace RHI::Vulkan { 13 | class VulkanDevice; 14 | 15 | class VulkanBindGroup final : public BindGroup { 16 | public: 17 | NonCopyable(VulkanBindGroup) 18 | VulkanBindGroup(VulkanDevice& inDevice, const BindGroupCreateInfo& inCreateInfo); 19 | ~VulkanBindGroup() noexcept override; 20 | 21 | VkDescriptorSet GetNative() const; 22 | 23 | private: 24 | void CreateNativeDescriptorPool(const BindGroupCreateInfo& inCreateInfo); 25 | void CreateNativeDescriptorSet(const BindGroupCreateInfo& inCreateInfo); 26 | 27 | VulkanDevice& device; 28 | VkDescriptorSet nativeDescriptorSet; 29 | VkDescriptorPool nativeDescriptorPool; 30 | }; 31 | } -------------------------------------------------------------------------------- /Engine/Source/Runtime/Include/Runtime/Viewport.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/2/18. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace Runtime { 11 | class Client; 12 | 13 | struct PresentInfo { 14 | PresentInfo(); 15 | 16 | RHI::Texture* backTexture; 17 | RHI::Semaphore* imageReadySemaphore; 18 | RHI::Semaphore* renderFinishedSemaphore; 19 | }; 20 | 21 | class Viewport { 22 | public: 23 | virtual ~Viewport(); 24 | 25 | virtual Client& GetClient() = 0; 26 | virtual PresentInfo GetNextPresentInfo() = 0; 27 | virtual uint32_t GetWidth() const = 0; 28 | virtual uint32_t GetHeight() const = 0; 29 | virtual void Resize(uint32_t inWidth, uint32_t inHeight) = 0; 30 | // TODO mouse keyboard inputs etc. 31 | 32 | protected: 33 | Viewport(); 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Vulkan/Include/RHI/Vulkan/BufferView.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by swtpotato on 2022/8/2. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace RHI::Vulkan { 10 | class VulkanBuffer; 11 | class VulkanDevice; 12 | 13 | class VulkanBufferView final : public BufferView { 14 | public: 15 | NonCopyable(VulkanBufferView) 16 | VulkanBufferView(VulkanBuffer& inBuffer, const BufferViewCreateInfo& inCreateInfo); 17 | ~VulkanBufferView() override; 18 | 19 | size_t GetOffset() const; 20 | size_t GetBufferSize() const; 21 | IndexFormat GetIndexFormat() const; 22 | VulkanBuffer& GetBuffer() const; 23 | 24 | private: 25 | void InitializeBufferAttrib(const BufferViewCreateInfo& inCreateInfo); 26 | 27 | VulkanBuffer& buffer; 28 | size_t size; 29 | size_t offset; 30 | IndexFormat indexFormat; 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/qt/test_package/conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | from conan.tools.build import can_run 3 | from conan.tools.cmake import cmake_layout, CMake 4 | import os 5 | 6 | 7 | class TestPackageConan(ConanFile): 8 | settings = "os", "arch", "compiler", "build_type" 9 | generators = "CMakeDeps", "CMakeToolchain" 10 | 11 | def layout(self): 12 | cmake_layout(self) 13 | 14 | def requirements(self): 15 | self.requires(self.tested_reference_str) 16 | 17 | def build(self): 18 | cmake = CMake(self) 19 | cmake.configure() 20 | cmake.build() 21 | 22 | def test(self): 23 | if can_run(self): 24 | bin_path = os.path.join(self.cpp.build.bindir, "test_package") 25 | if self.settings.os == "Macos": 26 | self.run(f"open {bin_path}.app", env="conanrun") 27 | else: 28 | self.run(bin_path, env="conanrun") 29 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Vulkan/Src/Platform/Win32Surface.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Zach Lee on 2022/4/4. 3 | // 4 | 5 | #if PLATFORM_WINDOWS 6 | #include 7 | 8 | #include 9 | 10 | #define VK_USE_PLATFORM_WIN32_KHR 11 | #include 12 | #include 13 | #include 14 | 15 | namespace RHI::Vulkan { 16 | VkSurfaceKHR CreateNativeSurface(const VkInstance& instance, const SurfaceCreateInfo& createInfo) 17 | { 18 | VkWin32SurfaceCreateInfoKHR surfaceInfo = {}; 19 | surfaceInfo.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR; 20 | surfaceInfo.hwnd = static_cast(createInfo.window); 21 | surfaceInfo.hinstance = GetModuleHandle(nullptr); 22 | VkSurfaceKHR surface = VK_NULL_HANDLE; 23 | Assert(vkCreateWin32SurfaceKHR(instance, &surfaceInfo, nullptr, &surface) == VK_SUCCESS); 24 | return surface; 25 | } 26 | } 27 | #endif -------------------------------------------------------------------------------- /Engine/Source/Render/Include/Render/SceneProxy/Light.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/8/14. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | namespace Render { 11 | enum class LightType : uint8_t { 12 | directional, 13 | point, 14 | spot, 15 | max 16 | }; 17 | 18 | struct LightSceneProxy { 19 | LightSceneProxy(); 20 | 21 | LightType type; 22 | Common::FMat4x4 localToWorld; 23 | Common::Color color; 24 | float intensity; 25 | // point light only 26 | float radius; 27 | }; 28 | } 29 | 30 | namespace Render { 31 | inline LightSceneProxy::LightSceneProxy() 32 | : type(LightType::max) 33 | , localToWorld(Common::FMat4x4Consts::identity) 34 | , color(Common::ColorConsts::white) 35 | , intensity(0.0f) 36 | , radius(0.0f) 37 | { 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Vulkan/Include/RHI/Vulkan/Gpu.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 12/1/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | namespace RHI::Vulkan { 13 | class VulkanGpu final : public Gpu { 14 | public: 15 | NonCopyable(VulkanGpu) 16 | explicit VulkanGpu(VulkanInstance& inInstance, VkPhysicalDevice inNativePhysicalDevice); 17 | ~VulkanGpu() override; 18 | 19 | GpuProperty GetProperty() override; 20 | Common::UniquePtr RequestDevice(const DeviceCreateInfo& inCreateInfo) override; 21 | VulkanInstance& GetInstance() const override; 22 | 23 | VkPhysicalDevice GetNative() const; 24 | uint32_t FindMemoryType(uint32_t inFilter, VkMemoryPropertyFlags inPropertyFlag) const; 25 | 26 | private: 27 | VulkanInstance& instance; 28 | VkPhysicalDevice nativePhysicalDevice; 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Vulkan/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB sources Src/*.cpp) 2 | 3 | if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") 4 | set(platform_sources Src/Platform/Win32Surface.cpp) 5 | elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") 6 | set(platform_sources Src/Platform/MacosSurface.mm) 7 | set(platform_ext_libs molten-vk::molten-vk "-framework Cocoa" "-framework IOKit" "-framework CoreFoundation") 8 | endif() 9 | 10 | exp_add_library( 11 | NAME RHI-Vulkan 12 | TYPE SHARED 13 | SRC ${sources} ${platform_sources} 14 | PUBLIC_INC Include 15 | PUBLIC_LIB RHI ${platform_ext_libs} 16 | PUBLIC_MERGE_LIB Vulkan::Headers Vulkan::Loader vulkan-validationlayers::vulkan-validationlayers spirv-cross::spirv-cross GPUOpen::VulkanMemoryAllocator 17 | ) 18 | 19 | # .mm files can not perform unity build with .cpp files 20 | if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") 21 | set_target_properties( 22 | RHI-Vulkan PROPERTIES 23 | UNITY_BUILD OFF) 24 | endif() 25 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/vulkan-validationlayers/patches/0000-fix-spirv-tools-includes.patch: -------------------------------------------------------------------------------- 1 | From 2e18b94238535157d98b0ccfa9df9e6d8a96fe7b Mon Sep 17 00:00:00 2001 2 | From: kindem 3 | Date: Sat, 20 Dec 2025 17:16:43 +0800 4 | Subject: [PATCH] fix: spirv tools includes 5 | 6 | --- 7 | CMakeLists.txt | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/CMakeLists.txt b/CMakeLists.txt 11 | index f2c844b7a..9af78879d 100644 12 | --- a/CMakeLists.txt 13 | +++ b/CMakeLists.txt 14 | @@ -115,7 +115,7 @@ find_package(VulkanUtilityLibraries CONFIG QUIET) 15 | 16 | find_package(SPIRV-Headers CONFIG QUIET) 17 | 18 | -find_package(SPIRV-Tools-opt CONFIG QUIET) 19 | +find_package(SPIRV-Tools CONFIG QUIET) 20 | 21 | # NOTE: Our custom code generation target isn't desirable for system package managers or add_subdirectory users. 22 | # So this target needs to be off by default to avoid obtuse build errors or patches. 23 | -- 24 | 2.50.1.windows.1 25 | 26 | -------------------------------------------------------------------------------- /Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/TextureView.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2022/2/25. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | using Microsoft::WRL::ComPtr; 10 | 11 | #include 12 | 13 | namespace RHI::DirectX12 { 14 | class DX12Device; 15 | class DX12Texture; 16 | 17 | class DX12TextureView final : public TextureView { 18 | public: 19 | NonCopyable(DX12TextureView) 20 | explicit DX12TextureView(DX12Device& inDevice, DX12Texture& inTexture, const TextureViewCreateInfo& inCreateInfo); 21 | ~DX12TextureView() override; 22 | 23 | CD3DX12_CPU_DESCRIPTOR_HANDLE GetNativeCpuDescriptorHandle() const; 24 | 25 | private: 26 | void CreateNativeDescriptor(DX12Device& inDevice, const TextureViewCreateInfo& inCreateInfo); 27 | 28 | DX12Texture& texture; 29 | Common::UniquePtr descriptorAllocation; 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /Tool/MirrorTool/Include/MirrorTool/Generator.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2022/11/24. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include 10 | 11 | #include 12 | 13 | namespace MirrorTool { 14 | struct MetaInfo; 15 | 16 | class Generator { 17 | public: 18 | using Result = std::pair; 19 | 20 | NonCopyable(Generator) 21 | explicit Generator(std::string inInputFile, std::string inOutputFile, std::vector inHeaderDirs, const MetaInfo& inMetaInfo, bool inDynamic); 22 | ~Generator(); 23 | 24 | Result Generate() const; 25 | 26 | private: 27 | Result GenerateCode(std::ifstream& inFile, std::ofstream& outFile, size_t uniqueId) const; 28 | 29 | const MetaInfo& metaInfo; 30 | std::string inputFile; 31 | std::string outputFile; 32 | std::vector headerDirs; 33 | bool dynamic; 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.25) 2 | 3 | set(CONAN_INSTALL_BUILD_CONFIGURATIONS "Release" CACHE STRING "" FORCE) 4 | set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES ${CMAKE_SOURCE_DIR}/conan_provider.cmake CACHE PATH "" FORCE) 5 | 6 | project(Explosion) 7 | 8 | option(BUILD_EDITOR "Build Explosion editor" ON) 9 | 10 | set(SUB_PROJECT_NAME "Engine" CACHE STRING "" FORCE) 11 | set(ENGINE_SUB_PROJECT_NAME "Engine" CACHE STRING "" FORCE) 12 | 13 | set(CMAKE_MAP_IMPORTED_CONFIG_DEBUG "Release" CACHE STRING "" FORCE) 14 | set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO "Release" CACHE STRING "" FORCE) 15 | set(CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL "Release" CACHE STRING "" FORCE) 16 | 17 | add_definitions(-DBUILD_EDITOR=$) 18 | 19 | include(CMake/Common.cmake) 20 | include(CMake/Target.cmake) 21 | 22 | add_subdirectory(ThirdParty) 23 | add_subdirectory(Engine) 24 | add_subdirectory(Tool) 25 | add_subdirectory(Sample) 26 | 27 | if (${BUILD_EDITOR}) 28 | add_subdirectory(Editor) 29 | endif() 30 | -------------------------------------------------------------------------------- /Editor/Web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite + HeroUI 8 | 9 | 13 | 17 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Editor/Src/Widget/WebWidget.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/8/9. 3 | // 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | namespace Editor { 11 | WebWidget::WebWidget(QWidget* inParent) 12 | : QWebEngineView(inParent) 13 | { 14 | webChannel = new QWebChannel(this); 15 | page()->setWebChannel(webChannel); 16 | } 17 | 18 | WebWidget::~WebWidget() = default; 19 | 20 | void WebWidget::Load(const std::string& inUrl) 21 | { 22 | static Core::CmdlineArg& caWebUIPort = Core::Cli::Get().GetArg("webUIPort"); 23 | 24 | Assert(inUrl.starts_with("/")); 25 | const auto& baseUrl = WebUIServer::Get().BaseUrl(); 26 | const auto fullUrl = baseUrl + inUrl; 27 | load(QUrl(fullUrl.c_str())); 28 | } 29 | 30 | QWebChannel* WebWidget::GetWebChannel() const 31 | { 32 | return webChannel; 33 | } 34 | } // namespace Editor 35 | -------------------------------------------------------------------------------- /Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/Texture.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2022/2/21. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | using Microsoft::WRL::ComPtr; 9 | 10 | #include 11 | 12 | namespace RHI::DirectX12 { 13 | class DX12Device; 14 | 15 | class DX12Texture final : public Texture { 16 | public: 17 | NonCopyable(DX12Texture) 18 | DX12Texture(DX12Device& inDevice, const TextureCreateInfo& inCreateInfo); 19 | DX12Texture(DX12Device& inDevice, const TextureCreateInfo& inCreateInfo, ComPtr&& nativeResource); 20 | ~DX12Texture() override; 21 | 22 | Common::UniquePtr CreateTextureView(const TextureViewCreateInfo& inCreateInfo) override; 23 | 24 | ID3D12Resource* GetNative() const; 25 | 26 | private: 27 | void CreateNativeTexture(const TextureCreateInfo& inCreateInfo); 28 | 29 | DX12Device& device; 30 | ComPtr nativeResource; 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /Engine/Source/Common/Include/Common/IO.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2024/6/6. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace Common { 10 | constexpr char newline = '\n'; 11 | 12 | template 13 | struct Tab { 14 | template 15 | friend S& operator<<(S& stream, const Tab& tab) 16 | { 17 | for (auto i = 0; i < N * 4; i++) { 18 | stream << " "; 19 | } 20 | return stream; 21 | } 22 | }; 23 | 24 | template 25 | const Tab tab = Tab(); 26 | 27 | class ScopedCoutFlusher { 28 | public: 29 | ScopedCoutFlusher(); 30 | ~ScopedCoutFlusher(); 31 | }; 32 | 33 | class ScopedCerrFlusher { 34 | public: 35 | ScopedCerrFlusher(); 36 | ~ScopedCerrFlusher(); 37 | }; 38 | } 39 | 40 | #define AutoCoutFlush Common::ScopedCoutFlusher _scopedCoutFlusher; 41 | #define AutoCerrFlush Common::ScopedCerrFlusher _scopedCerrFlusher; 42 | -------------------------------------------------------------------------------- /Engine/Source/Common/Include/Common/Math/Common.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/5/10. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | namespace Common { 13 | static constexpr float epsilon = 0.000001f; 14 | static constexpr float halfEpsilon = 0.001f; 15 | static constexpr float pi = std::numbers::pi_v; 16 | } 17 | 18 | namespace Common { 19 | template bool CompareNumber(T lhs, T rhs); 20 | template T DivideAndRoundUp(T lhs, T rhs); 21 | } 22 | 23 | namespace Common { 24 | template 25 | bool CompareNumber(T lhs, T rhs) 26 | { 27 | if constexpr (std::is_floating_point_v) { 28 | return std::abs(lhs - rhs) < epsilon; 29 | } else { 30 | return lhs == rhs; 31 | } 32 | } 33 | 34 | template 35 | T DivideAndRoundUp(T lhs, T rhs) 36 | { 37 | return (lhs + rhs - 1) / rhs; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Engine/Source/Common/Test/DelegateTest.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2024/11/5. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | static int counter = 0; 9 | 10 | static void StaticReceiver(int a, bool b) 11 | { 12 | counter++; 13 | ASSERT_EQ(a, 1); 14 | ASSERT_EQ(b, true); 15 | } 16 | 17 | class Receiver { 18 | public: 19 | Receiver() = default; 20 | 21 | void Receive(int a, bool b) // NOLINT 22 | { 23 | counter++; 24 | ASSERT_EQ(a, 1); 25 | ASSERT_EQ(b, true); 26 | } 27 | }; 28 | 29 | TEST(DelegateTest, BasicTest) 30 | { 31 | Receiver receiver; 32 | 33 | Common::Delegate event; 34 | ASSERT_EQ(event.BindStatic<&StaticReceiver>(), 0); 35 | ASSERT_EQ(event.BindMember<&Receiver::Receive>(receiver), 1); 36 | ASSERT_EQ(event.BindLambda([](int a, bool b) -> void { 37 | counter++; 38 | ASSERT_EQ(a, 1); 39 | ASSERT_EQ(b, true); 40 | }), 2); 41 | 42 | event.Broadcast(1, true); 43 | ASSERT_EQ(counter, 3); 44 | } 45 | -------------------------------------------------------------------------------- /Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/BindGroup.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 20/3/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | #include 13 | 14 | namespace RHI::DirectX12 { 15 | class DX12BindGroupLayout; 16 | 17 | class DX12BindGroup final : public BindGroup { 18 | public: 19 | NonCopyable(DX12BindGroup) 20 | explicit DX12BindGroup(const BindGroupCreateInfo& inCreateInfo); 21 | ~DX12BindGroup() override; 22 | 23 | DX12BindGroupLayout& GetBindGroupLayout() const; 24 | const std::vector>& GetNativeBindings(); 25 | 26 | private: 27 | void SaveBindGroupLayout(const BindGroupCreateInfo& inCreateInfo); 28 | void CacheBindings(const BindGroupCreateInfo& inCreateInfo); 29 | 30 | DX12BindGroupLayout* bindGroupLayout; 31 | std::vector> nativeBindings; 32 | }; 33 | } 34 | -------------------------------------------------------------------------------- /Engine/Source/RHI/Src/Synchronous.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 30/3/2022. 3 | // 4 | 5 | #include 6 | 7 | namespace RHI { 8 | Barrier Barrier::Transition(Buffer* buffer, const BufferState before, const BufferState after) 9 | { 10 | Barrier barrier {}; 11 | barrier.type = ResourceType::buffer; 12 | barrier.buffer.pointer = buffer; 13 | barrier.buffer.before = before; 14 | barrier.buffer.after = after; 15 | return barrier; 16 | } 17 | 18 | Barrier Barrier::Transition(Texture* texture, const TextureState before, const TextureState after) 19 | { 20 | Barrier barrier {}; 21 | barrier.type = ResourceType::texture; 22 | barrier.texture.pointer = texture; 23 | barrier.texture.before = before; 24 | barrier.texture.after = after; 25 | return barrier; 26 | } 27 | 28 | Fence::Fence(Device&, bool) {} 29 | 30 | Fence::~Fence() = default; 31 | 32 | Semaphore::Semaphore(Device&) {} 33 | 34 | Semaphore::~Semaphore() = default; 35 | } 36 | -------------------------------------------------------------------------------- /Engine/Source/RHI/Include/RHI/ShaderModule.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 19/2/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | namespace RHI { 13 | struct ShaderModuleCreateInfo { 14 | std::string entryPoint; 15 | const void* byteCode; 16 | size_t size; 17 | 18 | explicit ShaderModuleCreateInfo(const std::string& inEntryPoint = "", const void* inByteCode = nullptr, size_t inSize = 0); 19 | explicit ShaderModuleCreateInfo(const std::string& inEntryPoint = "", const std::vector& inByteCode = {}); 20 | 21 | ShaderModuleCreateInfo& SetByteCode(const void* inByteCode); 22 | ShaderModuleCreateInfo& SetSize(size_t inSize); 23 | }; 24 | 25 | class ShaderModule { 26 | public: 27 | NonCopyable(ShaderModule) 28 | virtual ~ShaderModule(); 29 | 30 | virtual const std::string& GetEntryPoint() = 0; 31 | 32 | protected: 33 | explicit ShaderModule(const ShaderModuleCreateInfo& createInfo); 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /.clang-tidy: -------------------------------------------------------------------------------- 1 | Checks: > 2 | -*, 3 | bugprone-*, 4 | modernize-*, 5 | performance-*, 6 | portability-*, 7 | readability-*, 8 | mpi-*, 9 | 10 | google-default-arguments, 11 | google-explicit-constructor, 12 | google-runtime-int, 13 | google-runtime-operator, 14 | 15 | misc-misplaced-const, 16 | misc-new-delete-overloads, 17 | misc-no-recursion, 18 | misc-non-copyable-objects, 19 | misc-throw-by-value-catch-by-reference, 20 | misc-unconventional-assign-operator, 21 | misc-uniqueptr-reset-release, 22 | 23 | -modernize-avoid-c-arrays, 24 | -modernize-concat-nested-namespaces, 25 | -modernize-use-nodiscard, 26 | -modernize-use-trailing-return-type, 27 | -modernize-use-default-member-init, 28 | 29 | -bugprone-easily-swappable-parameters, 30 | -bugprone-implicit-widening-of-multiplication-result, 31 | 32 | -readability-implicit-bool-cast, 33 | -readability-magic-numbers, 34 | -readability-named-parameter, 35 | -readability-uppercase-literal-suffix, 36 | -readability-identifier-length 37 | -------------------------------------------------------------------------------- /Engine/Source/RHI/Include/RHI/Instance.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 9/1/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include 10 | 11 | #include 12 | 13 | namespace RHI { 14 | class Gpu; 15 | 16 | RHIType GetPlatformRHIType(); 17 | std::string GetPlatformDefaultRHIAbbrString(); 18 | std::string GetAbbrStringByType(RHIType type); 19 | RHIType GetRHITypeByAbbrString(const std::string& abbrString); 20 | std::string GetRHIModuleNameByType(RHIType type); 21 | 22 | class Instance { 23 | public: 24 | static Instance* GetByPlatform(); 25 | static Instance* GetByType(const RHIType& type); 26 | static void UnloadByType(const RHIType& type); 27 | static void UnloadAllInstances(); 28 | 29 | NonCopyable(Instance) 30 | virtual ~Instance(); 31 | virtual RHIType GetRHIType() = 0; 32 | virtual uint32_t GetGpuNum() = 0; 33 | virtual Gpu* GetGpu(uint32_t index) = 0; 34 | virtual void Destroy() = 0; 35 | 36 | protected: 37 | explicit Instance(); 38 | }; 39 | } 40 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Include/Runtime/Component/Light.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2024/10/14. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | namespace Runtime { 12 | struct RUNTIME_API EClass() DirectionalLight final { 13 | EClassBody(DirectionalLight) 14 | 15 | DirectionalLight(); 16 | 17 | EProperty() Common::Color color; 18 | EProperty() float intensity; 19 | EProperty() bool castShadows; 20 | }; 21 | 22 | struct RUNTIME_API EClass() PointLight final { 23 | EClassBody(PointLight) 24 | 25 | PointLight(); 26 | 27 | EProperty() Common::Color color; 28 | EProperty() float intensity; 29 | EProperty() bool castShadows; 30 | EProperty() float radius; 31 | }; 32 | 33 | struct RUNTIME_API EClass() SpotLight final { 34 | EClassBody(SpotLight) 35 | 36 | SpotLight(); 37 | 38 | EProperty() Common::Color color; 39 | EProperty() float intensity; 40 | EProperty() bool castShadows; 41 | }; 42 | } 43 | -------------------------------------------------------------------------------- /Sample/RHI-SSAO/Shader/Blur.esl: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | VkBinding(0, 0) Texture2D ssaoTex : register(t0); 4 | VkBinding(1, 0) SamplerState ssaoSampler : register(s0); 5 | 6 | struct VSOutput 7 | { 8 | float4 position : SV_POSITION; 9 | float2 uv : TEXCOORD; 10 | }; 11 | 12 | VSOutput VSMain( 13 | VkLocation(0) float4 postion : POSITION, 14 | VkLocation(1) float2 uv : TEXCOORD) 15 | { 16 | VSOutput output = (VSOutput)0; 17 | output.uv = uv; 18 | output.position = postion; 19 | 20 | #if VULKAN 21 | output.uv.y = 1 - output.uv.y; 22 | #endif 23 | 24 | return output; 25 | } 26 | 27 | float4 PSMain(VSOutput input) : SV_TARGET 28 | { 29 | const int blurRange = 2; 30 | int n = 0; 31 | int2 texDim; 32 | ssaoTex.GetDimensions(texDim.x, texDim.y); 33 | float2 texelSize = 1.0 / (float2)texDim; 34 | float result = 0.0; 35 | for (int x = -blurRange; x < blurRange; x++) { 36 | for (int y = -blurRange; y < blurRange; y++) { 37 | float2 offset = float2(float(x), float(y)) * texelSize; 38 | result += ssaoTex.Sample(ssaoSampler, input.uv + offset).r; 39 | n++; 40 | } 41 | } 42 | return result / (float(n)); 43 | } -------------------------------------------------------------------------------- /Editor/Web/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Next UI 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Engine/Source/RHI-Vulkan/Include/RHI/Vulkan/Synchronous.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by swtpotato on 2022/8/2. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include 10 | 11 | namespace RHI::Vulkan { 12 | class VulkanDevice; 13 | 14 | class VulkanFence final : public Fence { 15 | public: 16 | NonCopyable(VulkanFence) 17 | explicit VulkanFence(VulkanDevice& inDevice, bool inInitAsSignaled); 18 | ~VulkanFence() override; 19 | 20 | bool IsSignaled() override; 21 | void Reset() override; 22 | void Wait() override; 23 | 24 | VkFence GetNative() const; 25 | 26 | private: 27 | VulkanDevice& device; 28 | VkFence nativeFence; 29 | }; 30 | 31 | class VulkanSemaphore final : public Semaphore { 32 | public: 33 | NonCopyable(VulkanSemaphore) 34 | explicit VulkanSemaphore(VulkanDevice& inDevice); 35 | ~VulkanSemaphore() override; 36 | 37 | VkSemaphore GetNative() const; 38 | 39 | private: 40 | VulkanDevice& device; 41 | VkSemaphore nativeSemaphore; 42 | }; 43 | } 44 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Explosion 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Sample/Rendering-SSAO/Shader/Blur.esl: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | VkBinding(0, 0) Texture2D ssaoTex : register(t0); 4 | VkBinding(1, 0) SamplerState ssaoSampler : register(s0); 5 | 6 | struct VSOutput 7 | { 8 | float4 position : SV_POSITION; 9 | float2 uv : TEXCOORD; 10 | }; 11 | 12 | VSOutput VSMain( 13 | VkLocation(0) float4 postion : POSITION, 14 | VkLocation(1) float2 uv : TEXCOORD) 15 | { 16 | VSOutput output = (VSOutput)0; 17 | output.uv = uv; 18 | output.position = postion; 19 | 20 | #if VULKAN 21 | output.uv.y = 1 - output.uv.y; 22 | #endif 23 | 24 | return output; 25 | } 26 | 27 | float4 PSMain(VSOutput input) : SV_TARGET 28 | { 29 | const int blurRange = 2; 30 | int n = 0; 31 | int2 texDim; 32 | ssaoTex.GetDimensions(texDim.x, texDim.y); 33 | float2 texelSize = 1.0 / (float2)texDim; 34 | float result = 0.0; 35 | for (int x = -blurRange; x < blurRange; x++) { 36 | for (int y = -blurRange; y < blurRange; y++) { 37 | float2 offset = float2(float(x), float(y)) * texelSize; 38 | result += ssaoTex.Sample(ssaoSampler, input.uv + offset).r; 39 | n++; 40 | } 41 | } 42 | return result / (float(n)); 43 | } -------------------------------------------------------------------------------- /Engine/Source/RHI/Src/ShaderModule.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 19/2/2022. 3 | // 4 | 5 | #include 6 | 7 | namespace RHI { 8 | ShaderModuleCreateInfo::ShaderModuleCreateInfo(const std::string& inEntryPoint, const void* inByteCode, const size_t inSize) 9 | : entryPoint(inEntryPoint) 10 | , byteCode(inByteCode) 11 | , size(inSize) 12 | { 13 | } 14 | 15 | ShaderModuleCreateInfo::ShaderModuleCreateInfo(const std::string& inEntryPoint, const std::vector& inByteCode) 16 | : entryPoint(inEntryPoint) 17 | , byteCode(inByteCode.data()) 18 | , size(inByteCode.size()) 19 | { 20 | } 21 | 22 | ShaderModuleCreateInfo& ShaderModuleCreateInfo::SetByteCode(const void* inByteCode) 23 | { 24 | byteCode = inByteCode; 25 | return *this; 26 | } 27 | 28 | ShaderModuleCreateInfo& ShaderModuleCreateInfo::SetSize(const size_t inSize) 29 | { 30 | size = inSize; 31 | return *this; 32 | } 33 | 34 | ShaderModule::ShaderModule(const ShaderModuleCreateInfo&) {} 35 | 36 | ShaderModule::~ShaderModule() = default; 37 | } 38 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Include/Runtime/Component/Player.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/3/13. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace Runtime { 14 | struct RUNTIME_API EClass(globalComp, transient) PlayersInfo { 15 | EClassBody(PlayersInfo) 16 | 17 | PlayersInfo(); 18 | 19 | std::vector players; 20 | }; 21 | 22 | struct RUNTIME_API EClass(transient) LocalPlayer { 23 | EClassBody(Player) 24 | 25 | LocalPlayer(); 26 | 27 | uint8_t localPlayerIndex; 28 | RenderThreadPtr viewState; 29 | }; 30 | 31 | #if BUILD_EDITOR 32 | struct RUNTIME_API EClass(transient) EditorPlayer { 33 | EClassBody(EditorVirtualPlayer) 34 | 35 | EditorPlayer(); 36 | 37 | RenderThreadPtr viewState; 38 | }; 39 | #endif 40 | 41 | struct RUNTIME_API EClass() PlayerStart { 42 | EClassBody(PlayerStart) 43 | 44 | PlayerStart(); 45 | }; 46 | } 47 | -------------------------------------------------------------------------------- /Engine/Source/Core/Include/Core/Thread.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/1/17. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include 10 | 11 | namespace Core { 12 | enum class ThreadTag : uint8_t { 13 | unknown, 14 | game, 15 | render, 16 | gameWorker, 17 | renderWorker, 18 | max 19 | }; 20 | 21 | class CORE_API ThreadContext { 22 | public: 23 | static void SetTag(ThreadTag inTag); 24 | static void IncFrameNumber(); 25 | 26 | static ThreadTag Tag(); 27 | static uint64_t FrameNumber(); 28 | static bool IsUnknownThread(); 29 | static bool IsGameThread(); 30 | static bool IsRenderThread(); 31 | static bool IsGameWorkerThread(); 32 | static bool IsRenderWorkerThread(); 33 | static bool IsGameOrWorkerThread(); 34 | static bool IsRenderOrWorkerThread(); 35 | }; 36 | 37 | class CORE_API ScopedThreadTag { 38 | public: 39 | explicit ScopedThreadTag(ThreadTag inTag); 40 | ~ScopedThreadTag(); 41 | 42 | private: 43 | ThreadTag tagToRestore; 44 | }; 45 | } 46 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Vulkan/Include/RHI/Vulkan/TextureView.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Zach Lee on 2022/3/7. 3 | // 4 | 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | 12 | #include 13 | 14 | namespace RHI::Vulkan { 15 | class VulkanTexture; 16 | class VulkanDevice; 17 | 18 | class VulkanTextureView final : public TextureView { 19 | public: 20 | NonCopyable(VulkanTextureView) 21 | VulkanTextureView(VulkanTexture& inTexture, VulkanDevice& nDevice, const TextureViewCreateInfo& inCreateInfo); 22 | ~VulkanTextureView() override; 23 | 24 | VkImageView GetNative() const; 25 | VulkanTexture& GetTexture() const; 26 | uint8_t GetArrayLayerNum() const; 27 | 28 | private: 29 | void CreateImageView(const TextureViewCreateInfo& inCreateInfo); 30 | void DestroyImageView() const; 31 | 32 | VulkanDevice& device; 33 | VulkanTexture& texture; 34 | uint8_t baseMipLevel; 35 | uint8_t mipLevelNum; 36 | uint8_t baseArrayLayer; 37 | uint8_t arrayLayerNum; 38 | VkImageView nativeImageView; 39 | }; 40 | } -------------------------------------------------------------------------------- /Engine/Source/RHI-Vulkan/Src/Platform/MacosSurface.mm: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Zach Lee on 2022/4/4. 3 | // 4 | 5 | #if PLATFORM_MACOS 6 | #include 7 | 8 | #include 9 | #include 10 | 11 | #define VK_USE_PLATFORM_METAL_EXT 12 | #include 13 | 14 | namespace RHI::Vulkan { 15 | VkSurfaceKHR CreateNativeSurface(const VkInstance& instance, const SurfaceCreateInfo& createInfo) 16 | { 17 | NSBundle* bundle = [NSBundle bundleWithPath: @"/System/Library/Frameworks/QuartzCore.framework"]; 18 | CALayer* layer = [[bundle classNamed: @"CAMetalLayer"] layer]; 19 | auto* view = static_cast(createInfo.window); 20 | [view setLayer: layer]; 21 | [view setWantsLayer: YES]; 22 | 23 | VkMetalSurfaceCreateInfoEXT surfaceInfo = {}; 24 | surfaceInfo.sType = VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT; 25 | surfaceInfo.pLayer = static_cast(layer); 26 | 27 | VkSurfaceKHR surface = VK_NULL_HANDLE; 28 | vkCreateMetalSurfaceEXT(instance, &surfaceInfo, nullptr, &surface); 29 | return surface; 30 | } 31 | } 32 | #endif 33 | -------------------------------------------------------------------------------- /Engine/Source/Render/Src/Renderer.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2022/8/3. 3 | // 4 | 5 | #include 6 | 7 | namespace Render { 8 | Renderer::Renderer(const Params& inParams) 9 | : device(inParams.device) 10 | , scene(inParams.scene) 11 | , surface(inParams.surface) 12 | , surfaceExtent(inParams.surfaceExtent) 13 | , views(inParams.views) 14 | , waitSemaphore(inParams.waitSemaphore) 15 | , signalSemaphore(inParams.signalSemaphore) 16 | , signalFence(inParams.signalFence) 17 | { 18 | } 19 | 20 | Renderer::~Renderer() = default; 21 | 22 | StandardRenderer::StandardRenderer(const Params& inParams) 23 | : Renderer(inParams) 24 | , rgBuilder(*device) 25 | { 26 | } 27 | 28 | StandardRenderer::~StandardRenderer() = default; 29 | 30 | void StandardRenderer::Render(float inDeltaTimeSeconds) 31 | { 32 | // TODO 33 | FinalizeViews(); 34 | } 35 | 36 | void StandardRenderer::FinalizeViews() const 37 | { 38 | for (const auto& view : views) { 39 | view.state->prevData = view.data; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/BufferView.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 20/3/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | using Microsoft::WRL::ComPtr; 10 | 11 | #include 12 | #include 13 | 14 | namespace RHI::DirectX12 { 15 | class DX12Buffer; 16 | class DX12Device; 17 | 18 | class DX12BufferView final : public BufferView { 19 | public: 20 | NonCopyable(DX12BufferView) 21 | DX12BufferView(DX12Buffer& inBuffer, const BufferViewCreateInfo& inCreateInfo); 22 | ~DX12BufferView() override; 23 | 24 | CD3DX12_CPU_DESCRIPTOR_HANDLE GetNativeCpuDescriptorHandle() const; 25 | [[nodiscard]] const D3D12_VERTEX_BUFFER_VIEW& GetNativeVertexBufferView() const; 26 | [[nodiscard]] const D3D12_INDEX_BUFFER_VIEW& GetNativeIndexBufferView() const; 27 | 28 | private: 29 | void CreateNativeView(const BufferViewCreateInfo& inCreateInfo); 30 | 31 | DX12Buffer& buffer; 32 | std::variant, D3D12_VERTEX_BUFFER_VIEW, D3D12_INDEX_BUFFER_VIEW> nativeView; 33 | }; 34 | } 35 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Dummy/Src/SwapChain.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/3/21. 3 | // 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | namespace RHI::Dummy { 10 | DummySwapChain::DummySwapChain(const SwapChainCreateInfo& createInfo) 11 | : SwapChain(createInfo) 12 | { 13 | dummyTextures.reserve(2); 14 | for (auto i = 0; i < 2; i++) { 15 | dummyTextures.emplace_back(Common::MakeUnique(TextureCreateInfo {})); 16 | } 17 | } 18 | 19 | DummySwapChain::~DummySwapChain() = default; 20 | 21 | uint8_t DummySwapChain::GetTextureNum() 22 | { 23 | return dummyTextures.size(); 24 | } 25 | 26 | Texture* DummySwapChain::GetTexture(uint8_t index) 27 | { 28 | Assert(index < dummyTextures.size()); 29 | return dummyTextures[index].Get(); 30 | } 31 | 32 | uint8_t DummySwapChain::AcquireBackTexture(RHI::Semaphore* signalSemaphore) 33 | { 34 | pingPong = !pingPong; 35 | return pingPong ? 0 : 1; 36 | } 37 | 38 | void DummySwapChain::Present(RHI::Semaphore* waitSemaphore) 39 | { 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Vulkan/Include/RHI/Vulkan/SwapChain.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Zach Lee on 2022/4/4. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include 10 | 11 | #include 12 | 13 | namespace RHI::Vulkan { 14 | class VulkanDevice; 15 | class VulkanQueue; 16 | 17 | class VulkanSwapChain final : public SwapChain { 18 | public: 19 | NonCopyable(VulkanSwapChain) 20 | explicit VulkanSwapChain(VulkanDevice& inDevice, const SwapChainCreateInfo& inCreateInfo); 21 | ~VulkanSwapChain() override; 22 | 23 | uint8_t GetTextureNum() override; 24 | Texture* GetTexture(uint8_t inIndex) override; 25 | uint8_t AcquireBackTexture(Semaphore* inSignalSemaphore) override; 26 | void Present(Semaphore* inWaitSemaphore) override; 27 | 28 | private: 29 | void CreateNativeSwapChain(const SwapChainCreateInfo& inCreateInfo); 30 | 31 | VulkanDevice& device; 32 | std::vector textures; 33 | VkSwapchainKHR nativeSwapChain; 34 | VkQueue nativeQueue; 35 | uint32_t swapChainImageCount = 0; 36 | uint32_t currentImage = 0; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/qt/test_package/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(test_package LANGUAGES CXX) 3 | 4 | find_package(Qt6 COMPONENTS Core Gui Widgets WebEngineWidgets REQUIRED) 5 | set(QT_ROOT ${_Qt6_COMPONENT_PATH}/../..) 6 | 7 | qt_standard_project_setup() 8 | 9 | if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") 10 | set(platform_executable_hint MACOSX_BUNDLE) 11 | endif () 12 | 13 | qt_add_executable(${PROJECT_NAME} ${platform_executable_hint} test_package.cpp) 14 | target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets Qt6::WebEngineWidgets) 15 | 16 | if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") 17 | set(qt_win_deploy_executable ${QT_ROOT}/bin/windeployqt.exe) 18 | add_custom_command( 19 | TARGET ${PROJECT_NAME} POST_BUILD 20 | COMMAND ${qt_win_deploy_executable} $ 21 | ) 22 | elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") 23 | set(qt_mac_deploy_executable ${QT_ROOT}/bin/macdeployqt) 24 | add_custom_command( 25 | TARGET ${PROJECT_NAME} POST_BUILD 26 | COMMAND ${qt_mac_deploy_executable} $ -no-strip 27 | ) 28 | endif () 29 | -------------------------------------------------------------------------------- /Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/Buffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2022/1/24. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | using Microsoft::WRL::ComPtr; 13 | 14 | namespace RHI::DirectX12 { 15 | class DX12Device; 16 | 17 | class DX12Buffer final : public Buffer { 18 | public: 19 | NonCopyable(DX12Buffer) 20 | explicit DX12Buffer(DX12Device& device, const BufferCreateInfo& inCreateInfo); 21 | ~DX12Buffer() override; 22 | 23 | void* Map(MapMode inMapMode, size_t inOffset, size_t inLength) override; 24 | void UnMap() override; 25 | Common::UniquePtr CreateBufferView(const BufferViewCreateInfo& inCreateInfo) override; 26 | 27 | ID3D12Resource* GetNative() const; 28 | DX12Device& GetDevice() const; 29 | BufferUsageFlags GetUsages() const; 30 | 31 | private: 32 | void CreateNativeBuffer(DX12Device& inDevice, const BufferCreateInfo& inCreateInfo); 33 | 34 | DX12Device& device; 35 | MapMode mapMode; 36 | BufferUsageFlags usages; 37 | ComPtr nativeResource; 38 | }; 39 | } 40 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Vulkan/Include/RHI/Vulkan/Buffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2022/1/26. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | namespace RHI::Vulkan { 14 | class VulkanDevice; 15 | 16 | class VulkanBuffer final : public Buffer { 17 | public: 18 | NonCopyable(VulkanBuffer) 19 | VulkanBuffer(VulkanDevice& inDevice, const BufferCreateInfo& inCreateInfo); 20 | ~VulkanBuffer() override; 21 | 22 | void* Map(MapMode inMapMode, size_t inOffset, size_t inLength) override; 23 | void UnMap() override; 24 | Common::UniquePtr CreateBufferView(const BufferViewCreateInfo& inCreateInfo) override; 25 | 26 | VkBuffer GetNative() const; 27 | BufferUsageFlags GetUsages() const; 28 | 29 | private: 30 | void CreateNativeBuffer(const BufferCreateInfo& inCreateInfo); 31 | void TransitionToInitState(const BufferCreateInfo& inCreateInfo); 32 | 33 | VulkanDevice& device; 34 | VkBuffer nativeBuffer; 35 | VmaAllocation nativeAllocation; 36 | BufferUsageFlags usages; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Src/SystemGraphPresets.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/3/13. 3 | // 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | namespace Runtime { 12 | const SystemGraph& SystemGraphPresets::Default3DWorld() 13 | { 14 | static SystemGraph graph = []() -> SystemGraph { 15 | SystemGraph systemGraph; 16 | 17 | auto& preTransformGroup = systemGraph.AddGroup("PreTransformConcurrent", SystemExecuteStrategy::concurrent); 18 | preTransformGroup.EmplaceSystem(); 19 | 20 | auto& transformGroup = systemGraph.AddGroup("Transform", SystemExecuteStrategy::sequential); 21 | transformGroup.EmplaceSystem(); 22 | 23 | auto& sceneRenderingGroup = systemGraph.AddGroup("SceneRendering", SystemExecuteStrategy::sequential); 24 | sceneRenderingGroup.EmplaceSystem(); 25 | sceneRenderingGroup.EmplaceSystem(); 26 | 27 | return systemGraph; 28 | }(); 29 | return graph; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Engine/Source/RHI/Include/RHI/BindGroup.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 19/2/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | namespace RHI { 15 | class BufferView; 16 | class Sampler; 17 | class TextureView; 18 | 19 | struct BindGroupEntry { 20 | ResourceBinding binding; 21 | std::variant entity; 22 | 23 | BindGroupEntry(const ResourceBinding& inBinding, const std::variant& inEntity); 24 | }; 25 | 26 | struct BindGroupCreateInfo { 27 | BindGroupLayout* layout; 28 | std::vector entries; 29 | std::string debugName; 30 | 31 | explicit BindGroupCreateInfo(BindGroupLayout* inLayout, std::string inDebugName = ""); 32 | BindGroupCreateInfo& AddEntry(const BindGroupEntry& inEntry); 33 | }; 34 | 35 | class BindGroup { 36 | public: 37 | NonCopyable(BindGroup) 38 | virtual ~BindGroup(); 39 | 40 | protected: 41 | explicit BindGroup(const BindGroupCreateInfo& createInfo); 42 | }; 43 | } 44 | -------------------------------------------------------------------------------- /Engine/Source/RHI/Include/RHI/Queue.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 15/1/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | namespace RHI { 13 | class CommandBuffer; 14 | class Fence; 15 | class Semaphore; 16 | 17 | struct QueueSubmitInfo { 18 | std::vector waitSemaphores; 19 | std::vector signalSemaphores; 20 | Fence* signalFence; 21 | 22 | QueueSubmitInfo(); 23 | QueueSubmitInfo& AddWaitSemaphore(Semaphore* inSemaphore); 24 | QueueSubmitInfo& AddSignalSemaphore(Semaphore* inSemaphore); 25 | QueueSubmitInfo& SetSignalFence(Fence* inSignalFence); 26 | QueueSubmitInfo& SetWaitSemaphores(const std::vector& inSemaphores); 27 | QueueSubmitInfo& SetSignalSemaphores(const std::vector& inSemaphores); 28 | }; 29 | 30 | class Queue { 31 | public: 32 | NonCopyable(Queue) 33 | virtual ~Queue(); 34 | 35 | virtual void Submit(CommandBuffer* commandBuffer, const QueueSubmitInfo& submitInfo) = 0; 36 | virtual void Flush(Fence* fenceToSignal) = 0; 37 | 38 | protected: 39 | Queue(); 40 | }; 41 | } 42 | -------------------------------------------------------------------------------- /Engine/Source/Mirror/Include/Mirror/Meta.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2022/11/20. 3 | // 4 | 5 | #pragma once 6 | 7 | #if __clang__ 8 | #define EProperty(...) __attribute__((annotate("property," #__VA_ARGS__))) 9 | #define EFunc(...) __attribute__((annotate("func," #__VA_ARGS__))) 10 | #define EClass(...) __attribute__((annotate("class," #__VA_ARGS__))) 11 | #define EEnum(...) __attribute__((annotate("enum," #__VA_ARGS__))) 12 | #define EMeta(...) __attribute__((annotate(#__VA_ARGS__))) 13 | #else 14 | #define EProperty(...) 15 | #define EFunc(...) 16 | #define EClass(...) 17 | #define EEnum(...) 18 | #define EMeta(...) 19 | #endif 20 | 21 | namespace Mirror::Internal { 22 | class ScopedReleaser; 23 | } 24 | namespace Mirror { 25 | class Class; 26 | } 27 | 28 | #define EClassBody(className) \ 29 | private: \ 30 | static Mirror::Internal::ScopedReleaser _mirrorRegistry; \ 31 | public: \ 32 | static const Mirror::Class& GetStaticClass(); \ 33 | const Mirror::Class& GetClass() const; \ 34 | 35 | #define EPolyClassBody(className) \ 36 | private: \ 37 | static Mirror::Internal::ScopedReleaser _mirrorRegistry; \ 38 | public: \ 39 | static const Mirror::Class& GetStaticClass(); \ 40 | virtual const Mirror::Class& GetClass() const; \ 41 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Src/System/Player.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/3/13. 3 | // 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | namespace Runtime { 11 | PlayerSystem::PlayerSystem(ECRegistry& inRegistry, const SystemSetupContext& inContext) 12 | : System(inRegistry, inContext) 13 | , activeLocalPlayerNum(0) 14 | , renderModule(EngineHolder::Get().GetRenderModule()) 15 | { 16 | auto& playersInfo = registry.GEmplace(); 17 | 18 | #if BUILD_EDITOR 19 | if (inContext.playType == PlayType::editor) { 20 | playersInfo.players.emplace_back(CreatePlayer()); 21 | } 22 | #endif 23 | if (inContext.playType == PlayType::game) { 24 | const auto& gameSettings = SettingsRegistry::Get().GetSettings(); 25 | playersInfo.players.resize(gameSettings.initialLocalPlayerNum); 26 | for (auto& playerEntity : playersInfo.players) { 27 | playerEntity = CreatePlayer(); 28 | } 29 | } 30 | } 31 | 32 | PlayerSystem::~PlayerSystem() = default; 33 | } // namespace Runtime 34 | -------------------------------------------------------------------------------- /Engine/Source/RHI/Src/Queue.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 15/1/2022. 3 | // 4 | 5 | #include 6 | 7 | namespace RHI { 8 | QueueSubmitInfo::QueueSubmitInfo() 9 | : signalFence(nullptr) 10 | { 11 | } 12 | 13 | QueueSubmitInfo& QueueSubmitInfo::AddWaitSemaphore(Semaphore* inSemaphore) 14 | { 15 | waitSemaphores.emplace_back(inSemaphore); 16 | return *this; 17 | } 18 | 19 | QueueSubmitInfo& QueueSubmitInfo::AddSignalSemaphore(Semaphore* inSemaphore) 20 | { 21 | signalSemaphores.emplace_back(inSemaphore); 22 | return *this; 23 | } 24 | 25 | QueueSubmitInfo& QueueSubmitInfo::SetSignalFence(Fence* inSignalFence) 26 | { 27 | signalFence = inSignalFence; 28 | return *this; 29 | } 30 | 31 | QueueSubmitInfo& QueueSubmitInfo::SetWaitSemaphores(const std::vector& inSemaphores) 32 | { 33 | waitSemaphores = inSemaphores; 34 | return *this; 35 | } 36 | 37 | QueueSubmitInfo& QueueSubmitInfo::SetSignalSemaphores(const std::vector& inSemaphores) 38 | { 39 | signalSemaphores = inSemaphores; 40 | return *this; 41 | } 42 | 43 | Queue::Queue() = default; 44 | 45 | Queue::~Queue() = default; 46 | } 47 | -------------------------------------------------------------------------------- /Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/SwapChain.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 28/3/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | using Microsoft::WRL::ComPtr; 10 | 11 | #include 12 | 13 | namespace RHI::DirectX12 { 14 | class DX12Device; 15 | class DX12Texture; 16 | 17 | class DX12SwapChain final : public SwapChain { 18 | public: 19 | NonCopyable(DX12SwapChain) 20 | explicit DX12SwapChain(DX12Device& inDevice, const SwapChainCreateInfo& inCreateInfo); 21 | ~DX12SwapChain() override; 22 | 23 | uint8_t GetTextureNum() override; 24 | Texture* GetTexture(uint8_t inIndex) override; 25 | uint8_t AcquireBackTexture(Semaphore* inSignalSemaphore) override; 26 | void Present(RHI::Semaphore* inWaitSemaphore) override; 27 | 28 | private: 29 | void CreateDX12SwapChain(const SwapChainCreateInfo& inCreateInfo) ; 30 | void FetchTextures(const SwapChainCreateInfo& inCreateInfo); 31 | 32 | DX12Device& device; 33 | DX12Queue& queue; 34 | uint8_t textureNum; 35 | PresentMode presentMode; 36 | ComPtr nativeSwapChain; 37 | std::vector> textures; 38 | }; 39 | } 40 | -------------------------------------------------------------------------------- /conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | 3 | class ExplosionConan(ConanFile): 4 | generators = "CMakeConfigDeps" 5 | settings = "os", "compiler", "build_type", "arch" 6 | 7 | def requirements(self): 8 | self.requires("cpp-httplib/0.27.0") 9 | self.requires("stb/cci.20230920") 10 | self.requires("cityhash/1.0.1") 11 | self.requires("gtest/1.17.0") 12 | self.requires("taskflow/3.10.0") 13 | self.requires("vulkan-headers/1.4.313.0") 14 | self.requires("vulkan-loader/1.4.313.0") 15 | self.requires("vulkan-memory-allocator/3.3.0") 16 | self.requires("spirv-cross/1.4.313.0") 17 | if self.settings.os == "Windows": 18 | self.requires("directx-headers/1.610.2") 19 | 20 | # private repo 21 | self.requires("glfw/3.4-exp") 22 | self.requires("libclang/21.1.7-exp") 23 | self.requires("qt/6.10.1-exp") 24 | self.requires("debugbreak/1.0-exp") 25 | self.requires("rapidjson/cci.20250205-exp") 26 | self.requires("assimp/6.0.2-exp") 27 | self.requires("clipp/1.2.3-exp") 28 | self.requires("dxc/1.8.2505.1-exp") 29 | self.requires("vulkan-validationlayers/1.4.313.0-exp") 30 | if self.settings.os == "Macos": 31 | self.requires("molten-vk/1.4.1-exp") 32 | -------------------------------------------------------------------------------- /Engine/Source/Render/Include/Render/RenderModule.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/8/4. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | namespace Render { 16 | struct RenderModuleInitParams { 17 | RHI::RHIType rhiType; 18 | }; 19 | 20 | class RENDER_API RenderModule final : public Core::Module { 21 | public: 22 | RenderModule(); 23 | ~RenderModule() override; 24 | 25 | void OnLoad() override; 26 | void OnUnload() override; 27 | Core::ModuleType Type() const override; 28 | 29 | void Initialize(const RenderModuleInitParams& inParams); 30 | void DeInitialize(); 31 | RHI::Device* GetDevice() const; 32 | Render::RenderThread& GetRenderThread() const; 33 | Scene* NewScene() const; 34 | ViewState* NewViewState() const; 35 | View CreateView() const; 36 | StandardRenderer CreateStandardRenderer(const StandardRenderer::Params& inParams) const; 37 | 38 | private: 39 | bool initialized; 40 | RHI::Instance* rhiInstance; 41 | Common::UniquePtr rhiDevice; 42 | }; 43 | } 44 | -------------------------------------------------------------------------------- /Engine/Source/RHI-DirectX12/Src/Gpu.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 13/1/2022. 3 | // 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | namespace RHI::DirectX12 { 10 | DX12Gpu::DX12Gpu(DX12Instance& inInstance, ComPtr&& inNativeAdapter) 11 | : instance(inInstance) 12 | , nativeAdapter(inNativeAdapter) 13 | { 14 | } 15 | 16 | DX12Gpu::~DX12Gpu() = default; 17 | 18 | GpuProperty DX12Gpu::GetProperty() 19 | { 20 | DXGI_ADAPTER_DESC1 desc; 21 | Assert(SUCCEEDED(nativeAdapter->GetDesc1(&desc))); 22 | 23 | GpuProperty property {}; 24 | property.vendorId = desc.VendorId; 25 | property.deviceId = desc.DeviceId; 26 | property.type = desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE ? GpuType::software : GpuType::hardware; 27 | return property; 28 | } 29 | 30 | DX12Instance& DX12Gpu::GetInstance() const 31 | { 32 | return instance; 33 | } 34 | 35 | IDXGIAdapter1* DX12Gpu::GetNative() const 36 | { 37 | return nativeAdapter.Get(); 38 | } 39 | 40 | Common::UniquePtr DX12Gpu::RequestDevice(const DeviceCreateInfo& inCreateInfo) 41 | { 42 | return Common::UniquePtr(new DX12Device(*this, inCreateInfo)); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Vulkan/Include/RHI/Vulkan/Texture.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Zach Lee on 2022/3/7. 3 | // 4 | 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | namespace RHI::Vulkan { 16 | class VulkanDevice; 17 | 18 | class VulkanTexture final : public Texture { 19 | public: 20 | NonCopyable(VulkanTexture) 21 | 22 | VulkanTexture(VulkanDevice& inDevice, const TextureCreateInfo& inCreateInfo, VkImage inNativeImage); 23 | VulkanTexture(VulkanDevice& inDevice, const TextureCreateInfo& inCreateInfo); 24 | ~VulkanTexture() override; 25 | 26 | Common::UniquePtr CreateTextureView(const TextureViewCreateInfo& inCreateInfo) override; 27 | 28 | VkImage GetNative() const; 29 | VkImageSubresourceRange GetNativeSubResourceFullRange() const; 30 | 31 | private: 32 | void CreateNativeImage(const TextureCreateInfo& inCreateInfo); 33 | void GetAspect(const TextureCreateInfo& inCreateInfo); 34 | void TransitionToInitState(const TextureCreateInfo& inCreateInfo); 35 | 36 | VulkanDevice& device; 37 | VkImage nativeImage; 38 | VmaAllocation nativeAllocation; 39 | VkImageAspectFlags nativeAspect; 40 | bool ownMemory; 41 | }; 42 | } -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/debugbreak/conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | from conan.tools.build import can_run 3 | from conan.tools.files import apply_conandata_patches, get, copy 4 | import os 5 | 6 | required_conan_version = ">=2.0.9" 7 | 8 | class DebugBreakConan(ConanFile): 9 | name = "debugbreak" 10 | description = "debugbreak" 11 | license = "https://github.com/scottt/debugbreak?tab=BSD-2-Clause-1-ov-file" 12 | url = "https://github.com/conan-io/conan-center-index" 13 | homepage = "https://github.com/scottt/debugbreak" 14 | topics = ("utils", "debug") 15 | package_type = "header-library" 16 | 17 | def layout(self): 18 | self.folders.source = "src" 19 | self.folders.build = "build" 20 | self.folders.generators = "build/generators" 21 | 22 | def source(self): 23 | get(self, **self.conan_data["sources"][self.version], strip_root=True) 24 | apply_conandata_patches(self) 25 | 26 | def package(self): 27 | copy(self, "*.h", self.source_folder, os.path.join(self.package_folder, "include")) 28 | 29 | def package_info(self): 30 | self.cpp_info.includedirs = ["include"] 31 | 32 | def test(self): 33 | if can_run(self): 34 | bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") 35 | self.run(bin_path, env="conanrun") 36 | -------------------------------------------------------------------------------- /Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/Synchronous.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2022/5/15. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | using namespace Microsoft::WRL; 13 | 14 | #include 15 | #include 16 | 17 | namespace RHI::DirectX12 { 18 | class DX12Device; 19 | 20 | class DX12Fence final : public Fence { 21 | public: 22 | NonCopyable(DX12Fence) 23 | explicit DX12Fence(DX12Device& inDevice, bool inInitAsSignaled); 24 | ~DX12Fence() override; 25 | 26 | bool IsSignaled() override; 27 | void Reset() override; 28 | void Wait() override; 29 | 30 | ID3D12Fence* GetNative() const; 31 | 32 | private: 33 | void CreateNativeFence(DX12Device& inDevice, bool inInitAsSignaled); 34 | void CreateNativeFenceEvent(); 35 | 36 | ComPtr nativeFence; 37 | HANDLE nativeFenceEvent; 38 | }; 39 | 40 | class DX12Semaphore final : public Semaphore { 41 | public: 42 | NonCopyable(DX12Semaphore) 43 | explicit DX12Semaphore(DX12Device& inDevice); 44 | 45 | ID3D12Fence* GetNative() const; 46 | 47 | private: 48 | void CreateNativeFence(DX12Device& inDevice); 49 | 50 | ComPtr dx12Fence; 51 | }; 52 | } 53 | -------------------------------------------------------------------------------- /Engine/Source/Render/Src/View.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/1/8. 3 | // 4 | 5 | #include 6 | 7 | namespace Render { 8 | ViewData::ViewData() 9 | : viewMatrix(Common::FMat4x4Consts::identity) 10 | , projectionMatrix(Common::FMat4x4Consts::identity) 11 | { 12 | } 13 | 14 | ViewUniform::ViewUniform(const ViewData& inViewData, const ViewData& inPrevViewData) 15 | : origin(inViewData.origin) 16 | , worldToViewMatrix(inViewData.viewMatrix) 17 | , viewToWorldMatrix(worldToViewMatrix.Inverse()) 18 | , viewToClipMatrix(inViewData.projectionMatrix) 19 | , clipToViewMatrix(viewToClipMatrix.Inverse()) 20 | , worldToClipMatrix(viewToClipMatrix * worldToViewMatrix) 21 | , clipToWorldMatrix(worldToClipMatrix.Inverse()) 22 | , prevOrigin(inViewData.origin) 23 | , prevWorldToViewMatrix(inPrevViewData.viewMatrix) 24 | , prevViewToWorldMatrix(prevWorldToViewMatrix.Inverse()) 25 | , prevViewToClipMatrix(inPrevViewData.projectionMatrix) 26 | , prevClipToViewMatrix(prevViewToClipMatrix.Inverse()) 27 | , prevWorldToClipMatrix(prevViewToClipMatrix * prevWorldToViewMatrix) 28 | , prevClipToWorldMatrix(prevWorldToClipMatrix.Inverse()) 29 | { 30 | } 31 | 32 | ViewState::ViewState() = default; 33 | 34 | View::View() 35 | : state(nullptr) 36 | { 37 | } 38 | } -------------------------------------------------------------------------------- /CMake/Common.cmake: -------------------------------------------------------------------------------- 1 | include(ExternalProject) 2 | include(GenerateExportHeader) 3 | 4 | option(USE_UNITY_BUILD "Use unity build" ON) 5 | option(EXPORT_COMPILE_COMMANDS "Whether to export all compile commands" OFF) 6 | 7 | set(CMAKE_CXX_STANDARD 20) 8 | set(CMAKE_UNITY_BUILD ${USE_UNITY_BUILD}) 9 | set(CMAKE_EXPORT_COMPILE_COMMANDS ${EXPORT_COMPILE_COMMANDS}) 10 | 11 | get_cmake_property(generator_is_multi_config GENERATOR_IS_MULTI_CONFIG) 12 | if (${CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT}) 13 | # TODO support multi config generator for CMAKE_INSTALL_PREFIX 14 | set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/Install CACHE PATH "" FORCE) 15 | endif() 16 | 17 | add_definitions(-DBUILD_CONFIG_DEBUG=$,$>,1,0>) 18 | 19 | add_definitions(-DPLATFORM_WINDOWS=$,1,0>) 20 | add_definitions(-DPLATFORM_LINUX=$,1,0>) 21 | add_definitions(-DPLATFORM_MACOS=$,1,0>) 22 | 23 | add_definitions(-DCOMPILER_MSVC=$,1,0>) 24 | add_definitions(-DCOMPILER_APPLE_CLANG=$,1,0>) 25 | add_definitions(-DCOMPILER_GCC=$,1,0>) 26 | 27 | if (${MSVC}) 28 | add_compile_options(/bigobj /MD) 29 | add_definitions(-D_SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS=1) 30 | add_definitions(-DWIN32_LEAN_AND_MEAN) 31 | add_definitions(-DNOMINMAX=1) 32 | endif () 33 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Src/GameThread.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Kindem on 2025/3/1. 3 | // 4 | 5 | #include 6 | 7 | namespace Runtime { 8 | GameThread& GameThread::Get() 9 | { 10 | static GameThread instance; 11 | return instance; 12 | } 13 | 14 | GameThread::GameThread() = default; 15 | 16 | GameThread::~GameThread() 17 | { 18 | Flush(); 19 | } 20 | 21 | void GameThread::Flush() 22 | { 23 | std::queue> tasksToExecute; 24 | { 25 | std::unique_lock lock(mutex); 26 | tasksToExecute.swap(tasks); 27 | } 28 | 29 | while (!tasksToExecute.empty()) { 30 | tasksToExecute.front()(); 31 | tasksToExecute.pop(); 32 | } 33 | } 34 | 35 | GameWorkerThreads& GameWorkerThreads::Get() 36 | { 37 | static GameWorkerThreads instance; 38 | return instance; 39 | } 40 | 41 | 42 | GameWorkerThreads::GameWorkerThreads() = default; 43 | 44 | GameWorkerThreads::~GameWorkerThreads() = default; 45 | 46 | void GameWorkerThreads::Start() 47 | { 48 | Assert(threads == nullptr); 49 | threads = Common::MakeUnique("GameWorkers", 8); 50 | } 51 | 52 | void GameWorkerThreads::Stop() 53 | { 54 | Assert(threads != nullptr); 55 | threads = nullptr; 56 | } 57 | } // namespace Runtime 58 | -------------------------------------------------------------------------------- /Engine/Source/RHI-DirectX12/Include/RHI/DirectX12/BindGroupLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 6/3/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include 10 | 11 | namespace RHI::DirectX12 { 12 | class DX12Device; 13 | 14 | struct RootParameterKeyInfo { 15 | BindingType bindingType; 16 | uint8_t layoutIndex; 17 | HlslBinding binding; 18 | 19 | RootParameterKeyInfo(BindingType inBindingType, uint8_t inLayoutIndex, HlslBinding inBinding); 20 | }; 21 | 22 | class DX12BindGroupLayout final : public BindGroupLayout { 23 | public: 24 | NonCopyable(DX12BindGroupLayout) 25 | explicit DX12BindGroupLayout(const BindGroupLayoutCreateInfo& inCreateInfo); 26 | ~DX12BindGroupLayout() override; 27 | 28 | uint8_t GetLayoutIndex() const; 29 | [[nodiscard]] const std::vector& GetRootParameterKeyInfos() const; 30 | [[nodiscard]] const std::vector& GetNativeRootParameters() const; 31 | 32 | private: 33 | void CreateNativeRootParameters(const BindGroupLayoutCreateInfo& inCreateInfo); 34 | 35 | uint8_t layoutIndex; 36 | std::vector rootParameterKeyInfos; 37 | std::vector nativeRootParameters; 38 | std::vector nativeDescriptorRanges; 39 | }; 40 | } 41 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/clipp/conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | from conan.tools.build import can_run 3 | from conan.tools.files import get, apply_conandata_patches, copy, export_conandata_patches 4 | import os 5 | 6 | required_conan_version = ">=2.0.9" 7 | 8 | class ClippConan(ConanFile): 9 | name = "clipp" 10 | description = "clipp" 11 | license = "https://github.com/muellan/clipp?tab=MIT-1-ov-file" 12 | url = "https://github.com/conan-io/conan-center-index" 13 | homepage = "https://github.com/muellan/clipp" 14 | topics = ("utils", "cli") 15 | package_type = "header-library" 16 | 17 | def export_sources(self): 18 | export_conandata_patches(self) 19 | 20 | def layout(self): 21 | self.folders.source = "src" 22 | self.folders.build = "build" 23 | self.folders.generators = "build/generators" 24 | 25 | def source(self): 26 | get(self, **self.conan_data["sources"][self.version], strip_root=True) 27 | apply_conandata_patches(self) 28 | 29 | def package(self): 30 | copy(self, "*.h", os.path.join(self.source_folder, "include"), os.path.join(self.package_folder, "include")) 31 | 32 | def package_info(self): 33 | self.cpp_info.includedirs = ["include"] 34 | 35 | def test(self): 36 | if can_run(self): 37 | bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") 38 | self.run(bin_path, env="conanrun") 39 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/vulkan-validationlayers/test_package/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(test_package LANGUAGES CXX) 3 | 4 | find_package(VulkanValidationLayers REQUIRED) 5 | 6 | add_executable(${PROJECT_NAME} test_package.cpp) 7 | 8 | if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") 9 | add_custom_command( 10 | TARGET ${PROJECT_NAME} 11 | POST_BUILD 12 | COMMAND ${CMAKE_COMMAND} -E copy_if_different ${VulkanValidationLayers_INCLUDE_DIR}/../bin/VkLayer_khronos_validation.dll $/VkLayer_khronos_validation.dll 13 | COMMAND ${CMAKE_COMMAND} -E copy_if_different ${VulkanValidationLayers_INCLUDE_DIR}/../bin/VkLayer_khronos_validation.json $/VkLayer_khronos_validation.json 14 | ) 15 | elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") 16 | add_custom_command( 17 | TARGET ${PROJECT_NAME} 18 | POST_BUILD 19 | COMMAND ${CMAKE_COMMAND} -E copy_if_different ${VulkanValidationLayers_INCLUDE_DIR}/../lib/libVkLayer_khronos_validation.dylib $/VkLayer_khronos_validation.dylib 20 | COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${VulkanValidationLayers_INCLUDE_DIR}/../share/vulkan $/vulkan 21 | ) 22 | else () 23 | message(FATAL_ERROR "os ${CMAKE_SYSTEM_NAME} not supported yet in test package") 24 | endif () 25 | 26 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Include/Runtime/Asset/Mesh.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/3/21. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace Runtime { 14 | struct RUNTIME_API EClass() StaticMeshVertices { 15 | EClassBody(MeshVerticesData) 16 | 17 | EProperty() uint32_t vertexCount; 18 | EProperty() uint32_t indexCount; 19 | EProperty() std::vector positions; 20 | EProperty() std::vector tangents; 21 | EProperty() std::vector uv0; 22 | // optional 23 | EProperty() std::vector uv1; 24 | EProperty() std::vector colors; 25 | }; 26 | 27 | struct RUNTIME_API EClass() StaticMeshLOD { 28 | EClassBody(MeshLOD) 29 | 30 | EProperty() StaticMeshVertices vertices; 31 | // TODO distance field data ? 32 | // TODO voxel data ? 33 | }; 34 | 35 | class RUNTIME_API EClass() StaticMesh final : public Asset { 36 | EPolyClassBody(StaticMesh) 37 | 38 | public: 39 | explicit StaticMesh(Core::Uri inUri); 40 | ~StaticMesh() override; 41 | 42 | private: 43 | EProperty() AssetPtr material; 44 | EProperty() std::vector lodVec; 45 | }; 46 | } 47 | -------------------------------------------------------------------------------- /Editor/Web/public/vite.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Engine/Source/Mirror/Test/RegistryTest.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2024/9/4. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | EProperty(testKey=v0) extern int v0; 10 | 11 | EFunc() int F0(const int a, const int b); 12 | EFunc() int& F1(); 13 | EFunc() void F2(int& outValue); 14 | EFunc() int F3(int&& inValue); 15 | EFunc() int F4(int inValue); 16 | EFunc() float F4(int inValue, float inRet); 17 | 18 | struct EClass(testKey=C0) C0 { 19 | EClassBody(C0) 20 | 21 | EFunc(testKey=F0) static int& F0(); 22 | EFunc(testKey=F1) static int F1(int inValue); 23 | EFunc(testKey=F1) static int F1(int inValue0, int inValue1); 24 | EFunc(testKey=F2) int F2(int inValue); 25 | EFunc(testKey=F2) int F2(int inValue0, int inValue1); 26 | 27 | EProperty(testKey=v0) static int v0; 28 | }; 29 | 30 | class EClass() C1 { 31 | public: 32 | EClassBody(C1) 33 | 34 | explicit C1(const int inV0); 35 | 36 | EFunc() int GetV0() const; 37 | EFunc() void SetV0(const int inV0); 38 | 39 | private: 40 | EProperty() int v0; 41 | }; 42 | 43 | struct EClass() C2 { 44 | EClassBody(C2) 45 | 46 | C2(const int inA, const int inB); 47 | 48 | EProperty() int a; 49 | EProperty() int b; 50 | }; 51 | 52 | enum class EEnum() E0 { 53 | a, 54 | b, 55 | c, 56 | max 57 | }; 58 | 59 | struct EClass() C3 : C2 { 60 | EClassBody(C3) 61 | 62 | C3(const int inA, const int inB, const int inC); 63 | 64 | EProperty() int c; 65 | }; 66 | -------------------------------------------------------------------------------- /Engine/Source/RHI/Include/RHI/PipelineLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 19/2/2022. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | namespace RHI { 12 | class BindGroupLayout; 13 | 14 | struct PipelineConstantLayout { 15 | ShaderStageFlags stageFlags; 16 | uint32_t offset; 17 | uint32_t size; 18 | 19 | PipelineConstantLayout(); 20 | PipelineConstantLayout(ShaderStageFlags inStageFlags, uint32_t inOffset, uint32_t inSize); 21 | PipelineConstantLayout& SetStageFlags(ShaderStageFlags inStageFlags); 22 | PipelineConstantLayout& SetOffset(uint32_t inOffset); 23 | PipelineConstantLayout& SetSize(uint32_t inSize); 24 | }; 25 | 26 | struct PipelineLayoutCreateInfo { 27 | std::vector bindGroupLayouts; 28 | std::vector pipelineConstantLayouts; 29 | std::string debugName; 30 | 31 | PipelineLayoutCreateInfo(); 32 | PipelineLayoutCreateInfo& AddBindGroupLayout(const BindGroupLayout* inLayout); 33 | PipelineLayoutCreateInfo& AddPipelineConstantLayout(const PipelineConstantLayout& inLayout); 34 | }; 35 | 36 | class PipelineLayout { 37 | public: 38 | NonCopyable(PipelineLayout) 39 | virtual ~PipelineLayout(); 40 | 41 | protected: 42 | explicit PipelineLayout(const PipelineLayoutCreateInfo& createInfo); 43 | }; 44 | } 45 | -------------------------------------------------------------------------------- /Engine/Source/Common/Include/Common/DynamicLibrary.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 28/12/2021. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include 10 | 11 | #if PLATFORM_WINDOWS 12 | #include 13 | #define DynamicLibHandle HINSTANCE 14 | #else 15 | #define DynamicLibHandle void* 16 | #endif 17 | 18 | namespace Common { 19 | class DynamicLibrary { 20 | public: 21 | DynamicLibrary(); 22 | explicit DynamicLibrary(std::string inFullPath); 23 | ~DynamicLibrary(); 24 | 25 | DynamicLibrary(DynamicLibrary&& inOther) noexcept; 26 | DynamicLibrary& operator=(DynamicLibrary&& inOther) noexcept; 27 | 28 | bool IsValid() const; 29 | bool IsLoaded() const; 30 | void Load(); 31 | void Unload(); 32 | void* GetSymbol(const std::string& name) const; 33 | DynamicLibHandle GetHandle() const; 34 | 35 | private: 36 | bool loaded; 37 | std::string fullPath; 38 | DynamicLibHandle handle; 39 | }; 40 | 41 | class DynamicLibraryFinder { 42 | public: 43 | static DynamicLibrary Find(const std::string& simpleName, const std::string& searchDirectory = ""); 44 | 45 | private: 46 | static std::string GetPlatformDynLibFullPath(const std::string& simpleName, const std::string& searchDirectory); 47 | static void RepairLibPrefix(std::string& name); 48 | static void RepairExtension(std::string& name); 49 | }; 50 | } 51 | -------------------------------------------------------------------------------- /Engine/Source/Runtime/Include/Runtime/World.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2024/10/31. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | namespace Runtime { 16 | enum class PlayStatus : uint8_t { 17 | stopped, 18 | playing, 19 | paused, 20 | max 21 | }; 22 | 23 | class RUNTIME_API World { 24 | public: 25 | NonCopyable(World) 26 | NonMovable(World) 27 | ~World(); 28 | 29 | World(std::string inName, Client* inClient, PlayType inPlayType); 30 | void SetSystemGraph(const SystemGraph& inSystemGraph); 31 | PlayStatus PlayStatus() const; 32 | bool Stopped() const; 33 | bool Playing() const; 34 | bool Paused() const; 35 | void Play(); 36 | void Resume(); 37 | void Pause(); 38 | void Stop(); 39 | void LoadFrom(AssetPtr inLevel); 40 | void SaveTo(AssetPtr inLevel); 41 | 42 | private: 43 | friend class Engine; 44 | 45 | void Tick(float inDeltaTimeSeconds); 46 | 47 | std::string name; 48 | Runtime::PlayStatus playStatus; 49 | SystemSetupContext systemSetupContext; 50 | ECRegistry ecRegistry; 51 | SystemGraph systemGraph; 52 | std::optional executor; 53 | }; 54 | } 55 | 56 | -------------------------------------------------------------------------------- /Engine/Source/Core/Test/CmdlineTest.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2023/7/25. 3 | // 4 | 5 | #include 6 | 7 | #include 8 | 9 | Core::CmdlineArgValue arg0("a", "-a", false, "arg0"); 10 | Core::CmdlineArgValue arg1("b", "-b", 0, "arg1"); 11 | Core::CmdlineArgValue arg2("c", "-c", "", "arg2"); 12 | 13 | bool arg3 = false; 14 | uint32_t arg4 = 0; 15 | std::string arg5; 16 | Core::CmdlineArgRef arg3Ref("d", "-d", arg3, "arg3"); 17 | Core::CmdlineArgRef arg4Ref("e", "-e", arg4, "arg4"); 18 | Core::CmdlineArgRef arg5Ref("f", "-f", arg5, "arg5"); 19 | 20 | TEST(CmdlineTest, BasicTest) 21 | { 22 | std::vector args = { 23 | const_cast("TestApplication"), 24 | const_cast("-a"), 25 | const_cast("-b"), 26 | const_cast("1"), 27 | const_cast("-c"), 28 | const_cast("hello"), 29 | const_cast("-d"), 30 | const_cast("-e"), 31 | const_cast("2"), 32 | const_cast("-f"), 33 | const_cast("world"), 34 | }; 35 | 36 | const auto [result, errorInfo] = Core::Cli::Get().Parse(static_cast(args.size()), args.data(), true); 37 | ASSERT_TRUE(result); 38 | ASSERT_TRUE(arg0.GetValue()); 39 | ASSERT_EQ(arg1.GetValue(), 1); 40 | ASSERT_EQ(arg2.GetValue(), "hello"); 41 | ASSERT_TRUE(arg3); 42 | ASSERT_EQ(arg4, 2); 43 | ASSERT_EQ(arg5, "world"); 44 | } 45 | -------------------------------------------------------------------------------- /Engine/Source/RHI/Src/BindGroupLayout.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 19/2/2022. 3 | // 4 | 5 | #include 6 | 7 | namespace RHI { 8 | HlslBinding::HlslBinding(const HlslBindingRangeType inRangeType, const uint8_t inIndex) 9 | : rangeType(inRangeType) 10 | , index(inIndex) 11 | { 12 | } 13 | 14 | GlslBinding::GlslBinding(const uint8_t inIndex) 15 | : index(inIndex) 16 | { 17 | } 18 | 19 | ResourceBinding::ResourceBinding(const BindingType inType, const std::variant& inPlatformBinding) 20 | : type(inType) 21 | , platformBinding(inPlatformBinding) 22 | { 23 | } 24 | 25 | BindGroupLayoutEntry::BindGroupLayoutEntry(const ResourceBinding& inBinding, const ShaderStageFlags inShaderVisibility) 26 | : binding(inBinding) 27 | , shaderVisibility(inShaderVisibility) 28 | { 29 | } 30 | 31 | BindGroupLayoutCreateInfo::BindGroupLayoutCreateInfo(const uint8_t inLayoutIndex, std::string inDebugName) 32 | : layoutIndex(inLayoutIndex) 33 | , debugName(std::move(inDebugName)) 34 | { 35 | } 36 | 37 | BindGroupLayoutCreateInfo& BindGroupLayoutCreateInfo::AddEntry(const BindGroupLayoutEntry& inEntry) 38 | { 39 | entries.emplace_back(inEntry); 40 | return *this; 41 | } 42 | 43 | BindGroupLayout::BindGroupLayout(const BindGroupLayoutCreateInfo&) {} 44 | 45 | BindGroupLayout::~BindGroupLayout() = default; 46 | } 47 | -------------------------------------------------------------------------------- /ThirdParty/ConanRecipes/rapidjson/conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | from conan.tools.build import can_run 3 | from conan.tools.scm import Git 4 | from conan.tools.files import apply_conandata_patches, get, copy 5 | import os 6 | 7 | required_conan_version = ">=2.0.9" 8 | 9 | class RapidJsonConan(ConanFile): 10 | name = "rapidjson" 11 | description = "rapidjson" 12 | license = "https://github.com/Tencent/rapidjson?tab=License-1-ov-file" 13 | url = "https://github.com/conan-io/conan-center-index" 14 | homepage = "https://github.com/Tencent/rapidjson" 15 | topics = ("utils", "json") 16 | package_type = "header-library" 17 | 18 | def layout(self): 19 | self.folders.source = "src" 20 | self.folders.build = "build" 21 | self.folders.generators = "build/generators" 22 | 23 | def source(self): 24 | git = Git(self) 25 | git.clone("https://github.com/Tencent/rapidjson.git", target=".") 26 | git.checkout(self.conan_data["sources"][self.version]["commit"]) 27 | apply_conandata_patches(self) 28 | 29 | def package(self): 30 | copy(self, "*", os.path.join(self.source_folder, "include"), os.path.join(self.package_folder, "include")) 31 | 32 | def package_info(self): 33 | self.cpp_info.includedirs = ["include"] 34 | 35 | def test(self): 36 | if can_run(self): 37 | bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") 38 | self.run(bin_path, env="conanrun") 39 | -------------------------------------------------------------------------------- /Engine/Source/RHI-Vulkan/Src/BufferView.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by swtpotato on 2022/8/2. 3 | // 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | namespace RHI::Vulkan { 11 | static bool IsIndexBuffer(const BufferUsageFlags bufferUsages) 12 | { 13 | return (bufferUsages & BufferUsageBits::index) != 0; 14 | } 15 | } 16 | 17 | namespace RHI::Vulkan { 18 | VulkanBufferView::VulkanBufferView(VulkanBuffer& inBuffer, const BufferViewCreateInfo& inCreateInfo) 19 | : BufferView(inCreateInfo) 20 | , buffer(inBuffer) 21 | { 22 | InitializeBufferAttrib(inCreateInfo); 23 | } 24 | 25 | VulkanBufferView::~VulkanBufferView() = default; 26 | 27 | void VulkanBufferView::InitializeBufferAttrib(const BufferViewCreateInfo& inCreateInfo) 28 | { 29 | offset = inCreateInfo.offset; 30 | size = inCreateInfo.size; 31 | if (IsIndexBuffer(buffer.GetUsages())) { 32 | indexFormat = std::get(inCreateInfo.extend).format; 33 | } 34 | } 35 | 36 | size_t VulkanBufferView::GetBufferSize() const 37 | { 38 | return size; 39 | } 40 | 41 | size_t VulkanBufferView::GetOffset() const 42 | { 43 | return offset; 44 | } 45 | 46 | IndexFormat VulkanBufferView::GetIndexFormat() const 47 | { 48 | return indexFormat; 49 | } 50 | 51 | VulkanBuffer& VulkanBufferView::GetBuffer() const 52 | { 53 | return buffer; 54 | } 55 | } -------------------------------------------------------------------------------- /Engine/Source/RHI/Include/RHI/Buffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2022/1/23. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | namespace RHI { 12 | struct BufferViewCreateInfo; 13 | class BufferView; 14 | 15 | struct BufferCreateInfo { 16 | uint32_t size; 17 | BufferUsageFlags usages; 18 | BufferState initialState; 19 | std::string debugName; 20 | 21 | BufferCreateInfo(); 22 | BufferCreateInfo(uint32_t inSize, BufferUsageFlags inUsages, BufferState inInitialState, std::string inDebugName = ""); 23 | 24 | BufferCreateInfo& SetSize(uint32_t inSize); 25 | BufferCreateInfo& SetUsages(BufferUsageFlags inUsages); 26 | BufferCreateInfo& SetInitialState(BufferState inState); 27 | BufferCreateInfo& SetDebugName(std::string inDebugName); 28 | 29 | uint64_t Hash() const; 30 | 31 | bool operator==(const BufferCreateInfo& rhs) const; 32 | }; 33 | 34 | class Buffer { 35 | public: 36 | NonCopyable(Buffer) 37 | virtual ~Buffer(); 38 | 39 | const BufferCreateInfo& GetCreateInfo() const; 40 | virtual void* Map(MapMode mapMode, size_t offset, size_t length) = 0; 41 | virtual void UnMap() = 0; 42 | virtual Common::UniquePtr CreateBufferView(const BufferViewCreateInfo& createInfo) = 0; 43 | 44 | protected: 45 | explicit Buffer(const BufferCreateInfo& inCreateInfo); 46 | 47 | BufferCreateInfo createInfo; 48 | }; 49 | } 50 | -------------------------------------------------------------------------------- /Engine/Source/Render/Include/Render/View.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by johnk on 2025/1/8. 3 | // 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | namespace Render { 12 | struct ViewData { 13 | ViewData(); 14 | 15 | Common::FVec3 origin; 16 | Common::URect viewport; 17 | Common::FMat4x4 viewMatrix; 18 | Common::FMat4x4 projectionMatrix; 19 | }; 20 | 21 | struct ALIGN_AS_GPU ViewUniform { 22 | ViewUniform(const ViewData& inViewData, const ViewData& inPrevViewData); 23 | 24 | Common::FVec3 origin; 25 | Common::FMat4x4 worldToViewMatrix; 26 | Common::FMat4x4 viewToWorldMatrix; 27 | Common::FMat4x4 viewToClipMatrix; 28 | Common::FMat4x4 clipToViewMatrix; 29 | Common::FMat4x4 worldToClipMatrix; 30 | Common::FMat4x4 clipToWorldMatrix; 31 | Common::FVec3 prevOrigin; 32 | Common::FMat4x4 prevWorldToViewMatrix; 33 | Common::FMat4x4 prevViewToWorldMatrix; 34 | Common::FMat4x4 prevViewToClipMatrix; 35 | Common::FMat4x4 prevClipToViewMatrix; 36 | Common::FMat4x4 prevWorldToClipMatrix; 37 | Common::FMat4x4 prevClipToWorldMatrix; 38 | }; 39 | 40 | struct ViewState { 41 | ViewState(); 42 | 43 | ViewData prevData; 44 | // TODO frame number ... 45 | // TODO temporal history ... 46 | }; 47 | 48 | struct View { 49 | View(); 50 | 51 | ViewData data; 52 | ViewState* state; 53 | }; 54 | } 55 | --------------------------------------------------------------------------------