diff --git a/.clang-format b/.clang-format index ec20f655..08fae016 100644 --- a/.clang-format +++ b/.clang-format @@ -120,7 +120,7 @@ PenaltyBreakTemplateDeclaration: 100 PenaltyReturnTypeOnItsOwnLine: 300 PointerAlignment: Left ReflowComments: true -SortIncludes: true +SortIncludes: false SortUsingDeclarations: true SpaceAfterCStyleCast: true SpaceAfterLogicalNot: false diff --git a/.github/workflows/Engine-CI.yml b/.github/workflows/Engine-CI.yml index 0951a413..1c44a190 100644 --- a/.github/workflows/Engine-CI.yml +++ b/.github/workflows/Engine-CI.yml @@ -24,3 +24,9 @@ jobs: uses: ./.github/workflows/macOS-build.yml with: targetFramework: net8.0 + + linux: + needs: clang-format + uses: ./.github/workflows/linux-build.yml + with: + targetFramework: net8.0 diff --git a/.github/workflows/job-cmakebuild-linux.yml b/.github/workflows/job-cmakebuild-linux.yml new file mode 100644 index 00000000..bd100c79 --- /dev/null +++ b/.github/workflows/job-cmakebuild-linux.yml @@ -0,0 +1,49 @@ +name: ZEngine Cmake Linux Workflow + +on: + workflow_call: + inputs: + configuration: + type: string + default: 'Debug' + targetFramework: + type: string + default: 'net8.0' + +jobs: + Linux-Build: + name: cmake-build-linux-${{ inputs.configuration }} + runs-on: ubuntu-24.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Download the Microsoft repository GPG keys + run: wget -q https://packages.microsoft.com/config/ubuntu/24.04/packages-microsoft-prod.deb + + - name: Register the Microsoft repository GPG keys + run: sudo dpkg -i packages-microsoft-prod.deb + + - name: Update the list of packages after we added packages.microsoft.com + run: sudo apt-get update + + - name: Install development library + run: sudo apt-get install libasound2-dev libgl1-mesa-dev libpulse-dev libdbus-1-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxrandr-dev libxss-dev libxt-dev libxxf86vm-dev cmake apt-transport-https software-properties-common gcc g++ powershell clang-format glslang-tools libwayland-dev libxkbcommon-dev + + - name: CMake Build + run: .\Scripts\BuildEngine.ps1 -Configurations ${{inputs.configuration}} + shell: pwsh + + - name: Publish Build Artifacts + uses: actions/upload-artifact@v4 + with: + name: Build-linux-${{inputs.configuration}} + path: | + Panzerfaust/bin/${{inputs.configuration}}/publish/ + Result.Linux.x64.${{inputs.configuration}}/__externals/Vulkan-Loader/loader/ + Result.Linux.x64.${{inputs.configuration}}/ZEngine/tests/ + Panzerfaust/bin/${{inputs.configuration}}/${{inputs.targetFramework}}/**/Microsoft.CodeAnalysis.CSharp.resources.dll + !Panzerfaust/bin/${{inputs.configuration}}/${{inputs.targetFramework}}/**/Microsoft.CodeAnalysis.CSharp.Scripting.resources.dll + !Panzerfaust/bin/${{inputs.configuration}}/${{inputs.targetFramework}}/**/Microsoft.CodeAnalysis.resources.dll + !Panzerfaust/bin/${{inputs.configuration}}/${{inputs.targetFramework}}/**/Microsoft.CodeAnalysis.Scripting.resources.dll diff --git a/.github/workflows/job-deploy-linux.yml b/.github/workflows/job-deploy-linux.yml new file mode 100644 index 00000000..c19c4b5f --- /dev/null +++ b/.github/workflows/job-deploy-linux.yml @@ -0,0 +1,29 @@ +# Deploy for linux +# +name: linux Deploy Workflow + +on: + workflow_call: + inputs: + targetFramework: + type: string + required: true + configuration: + type: string + default: 'Release' + +jobs: + deploy: + name: deploy-linux-${{ inputs.configuration }} + runs-on: ubuntu-24.04 + steps: + - uses: actions/download-artifact@v4 + with: + path: Result.Darwin.x64.${{ inputs.configuration }} + name: Build-linux-Release + + - name: Publish Artifacts + uses: actions/upload-artifact@v4 + with: + name: linux-${{ inputs.configuration }} + path: Panzerfaust/bin/${{ inputs.configuration }}/${{inputs.targetFramework}}/publish/ diff --git a/.github/workflows/job-test-linux.yml b/.github/workflows/job-test-linux.yml new file mode 100644 index 00000000..edfbcd2b --- /dev/null +++ b/.github/workflows/job-test-linux.yml @@ -0,0 +1,30 @@ +# Run tests for linux +# +name: linux Test Workflow + +on: + workflow_call: + inputs: + configuration: + type: string + default: 'Debug' + +jobs: + test: + name: test-linux-${{ inputs.configuration }} + runs-on: ubuntu-24.04 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Download Artifacts + uses: actions/download-artifact@v4 + with: + name: Build-linux-${{ inputs.configuration }} + + - name: Update access permission of ZEngineTests + run: chmod +x ./Result.Linux.x64.${{ inputs.configuration }}/ZEngine/tests/ZEngineTests + + - name: Run Tests + run: .\Scripts\RunTests.ps1 -Configurations ${{ inputs.configuration }} + shell: pwsh diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 927ddaa3..19a41b53 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -1,59 +1,37 @@ -# @JeanPhilippeKernel : Disabled because we only support Windows as platform for now +# @JeanPhilippeKernel # name: ZEngine Linux Build on: - push: - branches: [ master ] - pull_request: - branches: [ master ] + workflow_call: + inputs: + targetFramework: + required: true + type: string jobs: - Linux-Build: - runs-on: ubuntu-latest + cmake-build: strategy: matrix: - buildConfiguration: [Debug, Release] - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - -# - name: Checkout submodules -# run: git submodule update --init --recursive - -# - name: Install development library -# run: sudo apt-get install libasound2-dev libgl1-mesa-dev libpulse-dev libdbus-1-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxrandr-dev libxss-dev libxt-dev libxxf86vm-dev - -# - name: Install CMake -# uses: jwlawson/actions-setup-cmake@v1.9 -# with: -# cmake-version: '3.20.x' - -# - name: Install pre-requisite packages. -# run: sudo apt-get install -y wget apt-transport-https software-properties-common - -# - name: Download the Microsoft repository GPG keys -# run: wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb - -# - name: Register the Microsoft repository GPG keys -# run: sudo dpkg -i packages-microsoft-prod.deb - -# - name: Update the list of packages after we added packages.microsoft.com -# run: sudo apt-get update - -# - name: Install PowerShell -# run: sudo apt-get install -y powershell - -# - name: Add GCC Toolchain repository -# run: sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - -# - name: Install GCC compiler -# run: sudo apt install -y gcc-11 - -# - name: Install G++ compiler -# run: sudo apt install -y g++-11 + buildConfiguration: [Debug, Release] + uses: ./.github/workflows/job-cmakebuild-linux.yml + with: + configuration: ${{matrix.buildConfiguration}} + targetframework: ${{inputs.targetFramework}} + + test: + needs: cmake-build + strategy: + matrix: + testConfiguration: [Debug, Release] + uses: ./.github/workflows/job-test-linux.yml + with: + configuration: ${{matrix.testConfiguration}} + + deploy: + needs: test + uses: ./.github/workflows/job-deploy-linux.yml + with: + configuration: Release + targetframework: ${{inputs.targetFramework}} -# - name: CMake Build -# run: .\Scripts\BuildEngine.ps1 -Configurations ${{matrix.buildConfiguration}} -# shell: pwsh diff --git a/CMakeLists.txt b/CMakeLists.txt index 2da817d2..8b667852 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required (VERSION 3.17 FATAL_ERROR) +set (CMAKE_CXX_STANDARD_REQUIRED ON) +set (CMAKE_CXX_STANDARD 20) +set (CMAKE_CXX_EXTENSIONS OFF) + project (RendererEngine VERSION 1.0 DESCRIPTION "Renderer Engine is an open-source 2D - 3D rendering engine written in C/C++" @@ -42,30 +46,10 @@ endif() # Externals dependencies # if (NOT LAUNCHER_ONLY) - add_subdirectory (${EXTERNAL_DIR}/fmt) - add_subdirectory (${EXTERNAL_DIR}/imgui) - add_subdirectory (${EXTERNAL_DIR}/glfw) - add_subdirectory (${EXTERNAL_DIR}/spdlog) - add_subdirectory (${EXTERNAL_DIR}/glm) - add_subdirectory (${EXTERNAL_DIR}/entt) - add_subdirectory (${EXTERNAL_DIR}/assimp) - add_subdirectory (${EXTERNAL_DIR}/stduuid) - add_subdirectory (${EXTERNAL_DIR}/yaml-cpp) - add_subdirectory (${EXTERNAL_DIR}/SPIRV-headers) - add_subdirectory (${EXTERNAL_DIR}/SPIRV-Tools) - add_subdirectory (${EXTERNAL_DIR}/glslang) - add_subdirectory (${EXTERNAL_DIR}/SPIRV-Cross) - add_subdirectory (${EXTERNAL_DIR}/gtest) - add_subdirectory (${EXTERNAL_DIR}/VulkanMemoryAllocator) - add_subdirectory (${EXTERNAL_DIR}/tlsf) - add_subdirectory (${EXTERNAL_DIR}/rapidhash) - add_subdirectory (${EXTERNAL_DIR}/CLI11) - - set (CMAKE_PREFIX_PATH - ${CMAKE_PREFIX_PATH} - ${EXTERNAL_DIR}/Vulkan-Headers/build/install/share/cmake - ) - add_subdirectory (${EXTERNAL_DIR}/Vulkan-Loader) + + ## Setup Dependencies + + include(${EXTERNAL_DIR}/externals.cmake) # Core engine lib is here # diff --git a/Scripts/BuildEngine.ps1 b/Scripts/BuildEngine.ps1 index 0e24eefb..45793744 100644 --- a/Scripts/BuildEngine.ps1 +++ b/Scripts/BuildEngine.ps1 @@ -87,21 +87,7 @@ if(-Not $LauncherOnly) { $RepoRoot = [IO.Path]::Combine($PSScriptRoot, "..") Write-Host "Ensuring submodules are initialized and updated..." & git -C $RepoRoot submodule update --init --recursive - - Write-Host "Configuring Vulkan-Header submodule..." - - $ExternalVulkanHeadersDir = Join-Path -Path $RepoRoot -ChildPath "__externals/Vulkan-Headers" - $ExternalVulkanHeadersOutputDir = Join-Path -Path $ExternalVulkanHeadersDir -ChildPath "build" - $ExternalVulkanHeadersInstallDir = Join-Path -Path $ExternalVulkanHeadersOutputDir -ChildPath "install" - - if(-Not (Test-Path -Path $ExternalVulkanHeadersInstallDir)) { - & $cMakeProgram -S $ExternalVulkanHeadersDir -B $ExternalVulkanHeadersOutputDir - & $cMakeProgram --install $ExternalVulkanHeadersOutputDir --prefix $ExternalVulkanHeadersInstallDir - } -} else { - Write-Host "Skipping submodules initialization..." -} - +} function Build([string]$configuration, [int]$VsVersion , [bool]$runBuild) { @@ -113,7 +99,6 @@ function Build([string]$configuration, [int]$VsVersion , [bool]$runBuild) { # Check the system name if ($IsLinux) { $systemName = "Linux" - $cMakeGenerator } elseif ($IsMacOS) { $systemName = "Darwin" @@ -131,7 +116,6 @@ function Build([string]$configuration, [int]$VsVersion , [bool]$runBuild) { [string]$BuildDirectoryName = "Result." + $systemName + "." + $architecture + "." + $BuildDirectoryNameExtension [string]$buildDirectoryPath = [IO.Path]::Combine($RepoRoot, $BuildDirectoryName) [string]$cMakeCacheVariableOverride = "" - [string]$cMakeGenerator = "" # Create build directory if (-Not (Test-Path $buildDirectoryPath)) { @@ -139,20 +123,19 @@ function Build([string]$configuration, [int]$VsVersion , [bool]$runBuild) { } # Define CMake Generator arguments - $cMakeOptions = " -DCMAKE_SYSTEM_NAME=$systemName", " -DCMAKE_BUILD_TYPE=$configuration" + $cMakeOptions = " -DCMAKE_SYSTEM_NAME=$systemName", " -DCMAKE_BUILD_TYPE=$configuration", " -DBUILD_SHARED_LIBS=OFF" $submoduleCMakeOptions = @{ 'ENTT' = @("-DENTT_INCLUDE_HEADERS=ON") - 'SPDLOG' = @("-DSPDLOG_BUILD_SHARED=OFF", "-DBUILD_STATIC_LIBS=ON", "-DSPDLOG_FMT_EXTERNAL=ON", "-DSPDLOG_FMT_EXTERNAL_HO=OFF"); - 'GLFW ' = @("-DGLFW_BUILD_DOCS=OFF", "-DGLFW_BUILD_EXAMPLES=OFF", "-DGLFW_INSTALL=OFF"); + 'SPDLOG' = @("-DSPDLOG_BUILD_SHARED=OFF", "-DSPDLOG_FMT_EXTERNAL=ON", "-DSPDLOG_FMT_EXTERNAL_HO=OFF"); + 'GLFW ' = @("-DGLFW_BUILD_DOCS=OFF", "-DGLFW_INSTALL=OFF", "-DGLFW_BUILD_WAYLAND=OFF"); 'ASSIMP' = @("-DASSIMP_BUILD_TESTS=OFF", "-DASSIMP_INSTALL=OFF", "-DASSIMP_BUILD_SAMPLES=OFF", "-DASSIMP_BUILD_ASSIMP_TOOLS=OFF", "-DASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT=OFF", "-DASSIMP_BUILD_OBJ_IMPORTER=ON", "-DASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT=OFF", "-DASSIMP_BUILD_OBJ_EXPORTER=ON"); 'STDUUID' = @("-DUUID_BUILD_TESTS=OFF", "-DUUID_USING_CXX20_SPAN=ON", "-DUUID_SYSTEM_GENERATOR=OFF"); 'YAMLCPP' = @("-DYAML_CPP_BUILD_TOOLS=OFF", "-DYAML_CPP_BUILD_TESTS=OFF", "-DYAML_CPP_FORMAT_SOURCE=OFF", "-DYAML_BUILD_SHARED_LIBS=OFF"); 'FRAMEWORK' = @("-DBUILD_FRAMEWORK=ON"); 'VULKAN_LOADER' = @("-DVULKAN_HEADERS_INSTALL_DIR=$ExternalVulkanHeadersInstallDir", "-DUSE_MASM=OFF", "-DUSE_GAS=OFF") - 'SPIRV_TOOLS' = @("-DSPIRV_SKIP_EXECUTABLES=ON", "-DSPIRV_SKIP_TESTS=ON") + 'SPIRV_TOOLS' = @("-DSPIRV_SKIP_EXECUTABLES=ON", "-DSPIRV_SKIP_TESTS=ON", "-DSPIRV_WERROR=OFF") 'SPIRV_CROSS' = @("-DSPIRV_CROSS_ENABLE_TESTS=OFF") 'LAUNCHER_ONLY' = @("-DLAUNCHER_ONLY=ON") - 'GLM' = @("-DCMAKE_POLICY_VERSION_MINIMUM=3.5") } $cMakeCacheVariableOverride = $cMakeOptions -join ' ' @@ -162,7 +145,7 @@ function Build([string]$configuration, [int]$VsVersion , [bool]$runBuild) { "Windows" { switch ($VsVersion) { 2022 { - $cMakeGenerator = "-G `"Visual Studio 17 2022`" -A $architecture" + $cMakeGenerator = "`"Visual Studio 17 2022`" -A $architecture" } Default { throw 'This version of Visual Studio is not supported' @@ -171,14 +154,10 @@ function Build([string]$configuration, [int]$VsVersion , [bool]$runBuild) { $cMakeCacheVariableOverride += ' -DCMAKE_CONFIGURATION_TYPES=Debug;Release ' } "Linux" { - $cMakeGenerator = "-G `"Unix Makefiles`"" - - # Set Linux build compiler - $env:CC = '/usr/bin/gcc-11' - $env:CXX = '/usr/bin/g++-11' + $cMakeGenerator = "Ninja" } "Darwin" { - $cMakeGenerator = "-G `"Xcode`"" + $cMakeGenerator = "Xcode" $cMakeCacheVariableOverride += ' ' + $submoduleCMakeOptions.FRAMEWORK -join ' ' } Default { @@ -201,7 +180,7 @@ function Build([string]$configuration, [int]$VsVersion , [bool]$runBuild) { $cMakeCacheVariableOverride += ' ' + $submoduleCMakeOptions.GLM -join ' ' } - $cMakeArguments = " -S $repositoryRootPath -B $buildDirectoryPath $cMakeGenerator $cMakeCacheVariableOverride" + $cMakeArguments = " -S $repositoryRootPath -B $buildDirectoryPath -G $cMakeGenerator $cMakeCacheVariableOverride" # CMake Generation process Write-Host $cMakeArguments diff --git a/Scripts/PostBuild.ps1 b/Scripts/PostBuild.ps1 index 0b23bb2d..35968ee7 100644 --- a/Scripts/PostBuild.ps1 +++ b/Scripts/PostBuild.ps1 @@ -28,7 +28,7 @@ param ( [string[]] $SystemName = 'Windows', [Parameter(HelpMessage="Architecture type to build, default to x64")] - [ValidateSet('win-x64', 'arm64', 'osx-x64', 'osx-arm64')] + [ValidateSet('win-x64', 'arm64', 'osx-x64', 'osx-arm64', 'linux-x64')] [string[]] $Architectures = 'win-x64', [Parameter(HelpMessage="Configuration type to build, default to Debug")] @@ -43,11 +43,7 @@ $ErrorActionPreference = "Stop" $TargetFramework = 'net8.0' [string]$RepoRoot = [IO.Path]::Combine($PSScriptRoot, "..") -[string]$OuputBuildDirectory = If($IsWindows) { - [IO.Path]::Combine($RepoRoot, "Result.Windows.x64.MultiConfig") -} Else { - [IO.Path]::Combine($RepoRoot, "Result.$SystemName.x64.$Configurations") -} +[string]$OuputBuildDirectory = [IO.Path]::Combine($RepoRoot, "../builds/RendererEngine") if($LauncherOnly) { Write-Host "Skipping resources copy..." @@ -103,7 +99,7 @@ $ContentsToProcess = @( } } "Linux" { - @{ From = "$OuputBuildDirectory\Tetragrama\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\Editor"} + @{ From = "$OuputBuildDirectory\Tetragrama\"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\Editor"} } Default { throw 'This system is not supported' @@ -133,4 +129,4 @@ foreach ($item in $ContentsToProcess) { [string]$ToDirectory = $content.To Write-Host "Copied $name --> $ToDirectory" } -} \ No newline at end of file +} diff --git a/Scripts/RunTests.ps1 b/Scripts/RunTests.ps1 index 18528e54..a42c77a1 100644 --- a/Scripts/RunTests.ps1 +++ b/Scripts/RunTests.ps1 @@ -67,7 +67,9 @@ function RunTests { "Darwin" { $testExecutablePath = Join-Path $OutputBuildDirectory -ChildPath "ZEngine/tests/$Configuration/ZEngineTests" } - "Linux" {} + "Linux" { + $testExecutablePath = Join-Path $OutputBuildDirectory -ChildPath "ZEngine/tests/ZEngineTests" + } Default { throw 'This system is not supported' } @@ -79,11 +81,11 @@ function RunTests { & $testExecutablePath } else { - Write-Warning "Test executable does not exist: $testExecutablePath" + Write-Error "Test executable does not exist: $testExecutablePath" } } # Run tests for each configuration foreach ($config in $Configurations) { - RunTests -Configuration $config +RunTests -Configuration $config } diff --git a/Scripts/Shared.ps1 b/Scripts/Shared.ps1 index 4364db64..92849705 100644 --- a/Scripts/Shared.ps1 +++ b/Scripts/Shared.ps1 @@ -185,8 +185,6 @@ function Find-GlslangValidator () { function Find-ClangFormat () { $repoConfiguration = Get-RepositoryConfiguration - $LLVMMinimumVersion = $repoConfiguration.Requirements.LLVM.Version - $LLVMMaximumVersion = $repoConfiguration.Requirements.LLVM.MaximumVersion $candidates = @( 'clang-format' @@ -202,19 +200,16 @@ function Find-ClangFormat () { foreach ($candidate in $candidates) { $clangFormatCommand = Get-Command $candidate -ErrorAction SilentlyContinue if ($clangFormatCommand) { - if ((& $clangFormatCommand --version | Out-String) -match "clang-format version ([\d\.]*)") { - [Version] $clangFormatVersion = $Matches[1] - if ((CompareVersion $clangFormatVersion $LLVMMinimumVersion) -and (CompareVersion $LLVMMaximumVersion $clangFormatVersion)) { return $clangFormatCommand.Source - } - } } } - throw "Failed to find clang-format min $LLVMMinimumVersion max $LLVMMaximumVersion. Tried: " + ($candidates -join ', ') } function Setup-ShaderCCompilerTool () { + if($IsLinux) { + return + } $repoConfiguration = Get-RepositoryConfiguration $repositoryToolPath = $repoConfiguration.Paths.Tools diff --git a/Tetragrama/CMakeLists.txt b/Tetragrama/CMakeLists.txt index e8e64d2b..940aa519 100644 --- a/Tetragrama/CMakeLists.txt +++ b/Tetragrama/CMakeLists.txt @@ -1,14 +1,3 @@ -cmake_minimum_required (VERSION 3.17) - -project (Tetragrama - VERSION 1.0 - DESCRIPTION "Tetragrama, the ZEngine Editor" - LANGUAGES CXX -) - -set (CMAKE_CXX_STANDARD_REQUIRED ON) -set (CMAKE_CXX_STANDARD 20) - file (GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.h) file (GLOB_RECURSE CPP_FILES CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) @@ -31,8 +20,6 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") set_target_properties(${TARGET_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "$(ProjectDir)$(Configuration)") endif () -include(${EXTERNAL_DIR}/externals.cmake) - target_include_directories (${TARGET_NAME} PRIVATE . @@ -62,4 +49,4 @@ target_link_libraries(${TARGET_NAME} PRIVATE imported::External_editorLibs ) -set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME "zEngineEditor") \ No newline at end of file +set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME "zEngineEditor") diff --git a/Tetragrama/Components/HierarchyViewUIComponent.cpp b/Tetragrama/Components/HierarchyViewUIComponent.cpp index b65e40ed..513a4e8a 100644 --- a/Tetragrama/Components/HierarchyViewUIComponent.cpp +++ b/Tetragrama/Components/HierarchyViewUIComponent.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include using namespace ZEngine; using namespace ZEngine::Helpers; diff --git a/Tetragrama/EntryPoint.cpp b/Tetragrama/EntryPoint.cpp index 2f557fea..7b3dc487 100644 --- a/Tetragrama/EntryPoint.cpp +++ b/Tetragrama/EntryPoint.cpp @@ -1,9 +1,8 @@ -#include #include +#include #include #include #include -#include "Editor.h" #ifdef ZENGINE_PLATFORM @@ -24,7 +23,7 @@ int applicationEntryPoint(int argc, char* argv[]) MemoryManager manager = {}; MemoryConfiguration config = {.DefaultSize = ZGiga(2u)}; manager.Initialize(config); - auto arena = &(manager.ArenaAllocator); + auto arena = &(manager.ArenaAllocatorValue); LoggerConfiguration logger_cfg = {}; Logger::Initialize(arena, logger_cfg); diff --git a/ZEngine/CMakeLists.txt b/ZEngine/CMakeLists.txt index 2abca89f..d78021ca 100644 --- a/ZEngine/CMakeLists.txt +++ b/ZEngine/CMakeLists.txt @@ -6,18 +6,5 @@ project (ZEngine LANGUAGES CXX C ) -# Compiler verification in Linux -# -if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - if ((NOT ${CMAKE_CXX_COMPILER_VERSION} MATCHES "11.*.*") AND (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")) - message(FATAL_ERROR "CLANG compiler version should be 11.*.* !") - elseif ((NOT ${CMAKE_CXX_COMPILER_VERSION} MATCHES "11.*.*") AND (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")) - message(FATAL_ERROR "GNU compiler version should be 11.*.* !") - endif () -endif () - -set (CMAKE_CXX_STANDARD_REQUIRED ON) -set (CMAKE_CXX_STANDARD 20) - add_subdirectory (ZEngine) -add_subdirectory (tests) \ No newline at end of file +add_subdirectory (tests) diff --git a/ZEngine/ZEngine/CMakeLists.txt b/ZEngine/ZEngine/CMakeLists.txt index 70dad617..2f8e2d39 100644 --- a/ZEngine/ZEngine/CMakeLists.txt +++ b/ZEngine/ZEngine/CMakeLists.txt @@ -1,5 +1,3 @@ -include(${EXTERNAL_DIR}/externals.cmake) - file (GLOB_RECURSE HEADER_FILES_LIST CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.h) file (GLOB_RECURSE CPP_FILES_LIST CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) file (GLOB_RECURSE RESOURCE_FILES_LIST CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/../Resources/Shaders/*.*) @@ -9,14 +7,7 @@ source_group (TREE ${PROJECT_SOURCE_DIR}/../Resources PREFIX "Resources Files" F # ZEngine source files # -add_library (zEngineLib - STATIC - ${HEADER_FILES_LIST} - ${CPP_FILES_LIST} - ${RESOURCE_FILES_LIST} - ${EXTERNAL_DIR}/ImGuizmo/ImGuizmo.h - ${EXTERNAL_DIR}/ImGuizmo/ImGuizmo.cpp -) +add_library (zEngineLib STATIC ${CPP_FILES_LIST}) target_include_directories (zEngineLib PUBLIC @@ -67,16 +58,9 @@ target_compile_definitions (zEngineLib YAML_CPP_STATIC_DEFINE ) -if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - target_compile_definitions (zEngineLib PUBLIC VK_USE_PLATFORM_WIN32_KHR) -endif() - -if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - target_link_libraries(zEngineLib PRIVATE stdc++fs) -endif () - target_link_libraries (zEngineLib PUBLIC imported::External_libs) if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") target_link_libraries (zEngineLib PUBLIC imported::cppwinrt_headers WindowsApp.lib) -endif() \ No newline at end of file + target_compile_definitions(zEngineLib PUBLIC NOMINMAX) +endif() diff --git a/ZEngine/ZEngine/Core/Memory/MemoryManager.h b/ZEngine/ZEngine/Core/Memory/MemoryManager.h index b49a2bda..78d5bca3 100644 --- a/ZEngine/ZEngine/Core/Memory/MemoryManager.h +++ b/ZEngine/ZEngine/Core/Memory/MemoryManager.h @@ -1,5 +1,5 @@ #pragma once -#include +#include namespace ZEngine::Core::Memory { @@ -12,14 +12,14 @@ namespace ZEngine::Core::Memory { void Initialize(const MemoryConfiguration& config) { - this->ArenaAllocator.Initialize(config.DefaultSize); + this->ArenaAllocatorValue.Initialize(config.DefaultSize); } void Shutdowm() { - ArenaAllocator.Shutdown(); + ArenaAllocatorValue.Shutdown(); } - ArenaAllocator ArenaAllocator = {}; + ArenaAllocator ArenaAllocatorValue = {}; }; -} // namespace ZEngine::Core::Memory \ No newline at end of file +} // namespace ZEngine::Core::Memory diff --git a/ZEngine/ZEngine/Hardwares/VulkanDevice.cpp b/ZEngine/ZEngine/Hardwares/VulkanDevice.cpp index 3421fcc5..13fe676e 100644 --- a/ZEngine/ZEngine/Hardwares/VulkanDevice.cpp +++ b/ZEngine/ZEngine/Hardwares/VulkanDevice.cpp @@ -1,19 +1,21 @@ -#include +#include #include +#include /* * We define those Macros before inclusion of VulkanDevice.h so we can enable impl from VMA header */ #define VMA_IMPLEMENTATION -#define VMA_VULKAN_VERSION 1003000 // Vulkan 1.3 - +// #define VMA_VULKAN_VERSION 1003000 // Vulkan 1.3 #include #include #include #include #include #include +#include #include +#include using namespace std::chrono_literals; using namespace ZEngine::Rendering::Primitives; @@ -371,7 +373,7 @@ namespace ZEngine::Hardwares * Creating VMA Allocators */ VmaAllocatorCreateInfo vma_allocator_create_info = {.physicalDevice = PhysicalDevice, .device = LogicalDevice, .instance = Instance, .vulkanApiVersion = VK_API_VERSION_1_3}; - ZENGINE_VALIDATE_ASSERT(vmaCreateAllocator(&vma_allocator_create_info, &VmaAllocator) == VK_SUCCESS, "Failed to create VMA Allocator") + ZENGINE_VALIDATE_ASSERT(vmaCreateAllocator(&vma_allocator_create_info, &VmaAllocatorValue) == VK_SUCCESS, "Failed to create VMA Allocator") m_buffer_manager.Initialize(this); EnqueuedCommandbuffers.init(Arena, m_buffer_manager.TotalCommandBufferCount, m_buffer_manager.TotalCommandBufferCount); @@ -451,7 +453,7 @@ namespace ZEngine::Hardwares void VulkanDevice::Dispose() { - vmaDestroyAllocator(VmaAllocator); + vmaDestroyAllocator(VmaAllocatorValue); if (__destroyDebugMessengerPtr) { @@ -646,8 +648,9 @@ namespace ZEngine::Hardwares { auto ds = reinterpret_cast(res_handle.Handle); vkFreeDescriptorSets(LogicalDevice, reinterpret_cast(res_handle.Data1), 1, &ds); - break; } + case DeviceResourceType::RESOURCE_COUNT: + break; } DirtyResources.Remove(handle); @@ -667,7 +670,7 @@ namespace ZEngine::Hardwares } BufferView& buffer = DirtyBuffers[handle]; - vmaDestroyBuffer(VmaAllocator, buffer.Handle, buffer.Allocation); + vmaDestroyBuffer(VmaAllocatorValue, buffer.Handle, buffer.Allocation); DirtyBuffers.Remove(handle); } } @@ -688,7 +691,7 @@ namespace ZEngine::Hardwares vkDestroyImageView(LogicalDevice, buffer.ViewHandle, nullptr); vkDestroySampler(LogicalDevice, buffer.Sampler, nullptr); - vmaDestroyImage(VmaAllocator, buffer.Handle, buffer.Allocation); + vmaDestroyImage(VmaAllocatorValue, buffer.Handle, buffer.Allocation); DirtyBufferImages.Remove(handle); } @@ -699,9 +702,9 @@ namespace ZEngine::Hardwares void* mapped_memory; if (data) { - ZENGINE_VALIDATE_ASSERT(vmaMapMemory(VmaAllocator, buffer.Allocation, &mapped_memory) == VK_SUCCESS, "Failed to map memory") + ZENGINE_VALIDATE_ASSERT(vmaMapMemory(VmaAllocatorValue, buffer.Allocation, &mapped_memory) == VK_SUCCESS, "Failed to map memory") ZENGINE_VALIDATE_ASSERT(Helpers::secure_memcpy(mapped_memory, data_size, data, data_size) == Helpers::MEMORY_OP_SUCCESS, "Failed to perform memory copy operation") - vmaUnmapMemory(VmaAllocator, buffer.Allocation); + vmaUnmapMemory(VmaAllocatorValue, buffer.Allocation); } } @@ -718,13 +721,13 @@ namespace ZEngine::Hardwares allocation_create_info.usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE; allocation_create_info.flags = vma_create_flags; - ZENGINE_VALIDATE_ASSERT(vmaCreateBuffer(VmaAllocator, &buffer_create_info, &allocation_create_info, &(buffer_view.Handle), &(buffer_view.Allocation), nullptr) == VK_SUCCESS, "Failed to create buffer"); + ZENGINE_VALIDATE_ASSERT(vmaCreateBuffer(VmaAllocatorValue, &buffer_create_info, &allocation_create_info, &(buffer_view.Handle), &(buffer_view.Allocation), nullptr) == VK_SUCCESS, "Failed to create buffer"); /* * Zeroing the buffer */ VmaAllocationInfo allocation_info = {}; - vmaGetAllocationInfo(VmaAllocator, buffer_view.Allocation, &allocation_info); + vmaGetAllocationInfo(VmaAllocatorValue, buffer_view.Allocation, &allocation_info); Helpers::secure_memset(allocation_info.pMappedData, 0, byte_size, byte_size); // Metadata info @@ -844,7 +847,7 @@ namespace ZEngine::Hardwares allocation_create_info.usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE; allocation_create_info.flags = VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT; - ZENGINE_VALIDATE_ASSERT(vmaCreateImage(VmaAllocator, &image_create_info, &allocation_create_info, &(buffer_image.Handle), &(buffer_image.Allocation), nullptr) == VK_SUCCESS, "Failed to create buffer"); + ZENGINE_VALIDATE_ASSERT(vmaCreateImage(VmaAllocatorValue, &image_create_info, &allocation_create_info, &(buffer_image.Handle), &(buffer_image.Allocation), nullptr) == VK_SUCCESS, "Failed to create buffer"); buffer_image.ViewHandle = CreateImageView(buffer_image.Handle, image_format, image_view_type, image_aspect_flag, layer_count); buffer_image.Sampler = CreateImageSampler(); @@ -1404,7 +1407,7 @@ namespace ZEngine::Hardwares BufferView& buffer = DirtyBuffers[handle]; if (buffer && buffer.FrameIndex == CurrentFrameIndex) { - vmaDestroyBuffer(VmaAllocator, buffer.Handle, buffer.Allocation); + vmaDestroyBuffer(VmaAllocatorValue, buffer.Handle, buffer.Allocation); buffer.Handle = VK_NULL_HANDLE; buffer.Allocation = VK_NULL_HANDLE; DirtyBuffers.Remove(handle); @@ -1430,7 +1433,7 @@ namespace ZEngine::Hardwares { vkDestroyImageView(LogicalDevice, buffer.ViewHandle, nullptr); vkDestroySampler(LogicalDevice, buffer.Sampler, nullptr); - vmaDestroyImage(VmaAllocator, buffer.Handle, buffer.Allocation); + vmaDestroyImage(VmaAllocatorValue, buffer.Handle, buffer.Allocation); buffer.Handle = VK_NULL_HANDLE; buffer.Allocation = VK_NULL_HANDLE; DirtyBufferImages.Remove(handle); @@ -2092,7 +2095,7 @@ namespace ZEngine::Hardwares m_current_offset = 0; m_total_size = size; Buffer = CreateBuffer(); - vmaSetAllocationName(m_device->VmaAllocator, Buffer.Allocation, debug_name); + vmaSetAllocationName(m_device->VmaAllocatorValue, Buffer.Allocation, debug_name); } } @@ -2117,12 +2120,12 @@ namespace ZEngine::Hardwares } VkMemoryPropertyFlags mem_prop_flags; - vmaGetAllocationMemoryProperties(m_device->VmaAllocator, Buffer.Allocation, &mem_prop_flags); + vmaGetAllocationMemoryProperties(m_device->VmaAllocatorValue, Buffer.Allocation, &mem_prop_flags); if (mem_prop_flags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) { VmaAllocationInfo allocation_info = {}; - vmaGetAllocationInfo(m_device->VmaAllocator, Buffer.Allocation, &allocation_info); + vmaGetAllocationInfo(m_device->VmaAllocatorValue, Buffer.Allocation, &allocation_info); if (allocation_info.pMappedData) { auto mapped_buf = reinterpret_cast(allocation_info.pMappedData); @@ -2134,12 +2137,12 @@ namespace ZEngine::Hardwares BufferView staging_buffer = m_device->CreateBuffer(static_cast(byte_size), VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT | VMA_ALLOCATION_CREATE_MAPPED_BIT); VmaAllocationInfo allocation_info = {}; - vmaGetAllocationInfo(m_device->VmaAllocator, staging_buffer.Allocation, &allocation_info); + vmaGetAllocationInfo(m_device->VmaAllocatorValue, staging_buffer.Allocation, &allocation_info); if (allocation_info.pMappedData) { ZENGINE_VALIDATE_ASSERT(Helpers::secure_memset(allocation_info.pMappedData, value, allocation_info.size, byte_size) == Helpers::MEMORY_OP_SUCCESS, "Failed to perform memory copy operation") - ZENGINE_VALIDATE_ASSERT(vmaFlushAllocation(m_device->VmaAllocator, staging_buffer.Allocation, 0, byte_size) == VK_SUCCESS, "Failed to flush allocation") + ZENGINE_VALIDATE_ASSERT(vmaFlushAllocation(m_device->VmaAllocatorValue, staging_buffer.Allocation, 0, byte_size) == VK_SUCCESS, "Failed to flush allocation") m_device->CopyBuffer(staging_buffer, Buffer, byte_size, 0u, offset); } @@ -2163,11 +2166,11 @@ namespace ZEngine::Hardwares } VkMemoryPropertyFlags mem_prop_flags; - vmaGetAllocationMemoryProperties(m_device->VmaAllocator, Buffer.Allocation, &mem_prop_flags); + vmaGetAllocationMemoryProperties(m_device->VmaAllocatorValue, Buffer.Allocation, &mem_prop_flags); if (mem_prop_flags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) { - ZENGINE_VALIDATE_ASSERT(vmaCopyMemoryToAllocation(m_device->VmaAllocator, data, Buffer.Allocation, offset, byte_size) == VK_SUCCESS, "Failed to perform memory copy operation") + ZENGINE_VALIDATE_ASSERT(vmaCopyMemoryToAllocation(m_device->VmaAllocatorValue, data, Buffer.Allocation, offset, byte_size) == VK_SUCCESS, "Failed to perform memory copy operation") VkAccessFlags dst_access_mask = VK_ACCESS_NONE; VkPipelineStageFlags dst_pipeline_stage = VK_PIPELINE_STAGE_TRANSFER_BIT; @@ -2218,7 +2221,7 @@ namespace ZEngine::Hardwares { BufferView staging_buffer = m_device->CreateBuffer(static_cast(byte_size), VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT | VMA_ALLOCATION_CREATE_MAPPED_BIT); - ZENGINE_VALIDATE_ASSERT(vmaCopyMemoryToAllocation(m_device->VmaAllocator, data, staging_buffer.Allocation, offset, byte_size) == VK_SUCCESS, "Failed to perform memory copy operation") + ZENGINE_VALIDATE_ASSERT(vmaCopyMemoryToAllocation(m_device->VmaAllocatorValue, data, staging_buffer.Allocation, offset, byte_size) == VK_SUCCESS, "Failed to perform memory copy operation") m_device->CopyBuffer(staging_buffer, Buffer, byte_size, 0u, offset); diff --git a/ZEngine/ZEngine/Hardwares/VulkanDevice.h b/ZEngine/ZEngine/Hardwares/VulkanDevice.h index 6ef5e527..9336ef38 100644 --- a/ZEngine/ZEngine/Hardwares/VulkanDevice.h +++ b/ZEngine/ZEngine/Hardwares/VulkanDevice.h @@ -6,8 +6,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include @@ -19,6 +19,9 @@ #include #include #include +#include +#include +#include // clang-format on namespace ZEngine::Windows @@ -554,7 +557,7 @@ namespace ZEngine::Hardwares VkPhysicalDeviceFeatures PhysicalDeviceFeature = {}; VkPhysicalDeviceMemoryProperties PhysicalDeviceMemoryProperties = {}; VkSwapchainKHR SwapchainHandle = VK_NULL_HANDLE; - VmaAllocator VmaAllocator = nullptr; + VmaAllocator VmaAllocatorValue = nullptr; Core::Containers::Array DefaultDepthFormats = {}; Rendering::Renderers::RenderPasses::Attachment* SwapchainAttachment = {}; Core::Containers::Array SwapchainImageViews = {}; diff --git a/ZEngine/ZEngine/Rendering/Renderers/GraphicRenderer.cpp b/ZEngine/ZEngine/Rendering/Renderers/GraphicRenderer.cpp index c2e04798..a3fff28d 100644 --- a/ZEngine/ZEngine/Rendering/Renderers/GraphicRenderer.cpp +++ b/ZEngine/ZEngine/Rendering/Renderers/GraphicRenderer.cpp @@ -15,7 +15,7 @@ #define STB_IMAGE_WRITE_IMPLEMENTATION #define STB_IMAGE_RESIZE_IMPLEMENTATION -#include +#include #include using namespace ZEngine::Hardwares; diff --git a/ZEngine/ZEngine/Rendering/Renderers/ImGUIRenderer.cpp b/ZEngine/ZEngine/Rendering/Renderers/ImGUIRenderer.cpp index ad419ab3..ab69c103 100644 --- a/ZEngine/ZEngine/Rendering/Renderers/ImGUIRenderer.cpp +++ b/ZEngine/ZEngine/Rendering/Renderers/ImGUIRenderer.cpp @@ -1,11 +1,13 @@ -#include -#include #include -#include +#include #include #include #include #include +#include +#include +#include +#include using namespace ZEngine::Hardwares; using namespace ZEngine::Rendering; @@ -358,4 +360,4 @@ namespace ZEngine::Rendering::Renderers ImGui::RenderPlatformWindowsDefault(); } } -} // namespace ZEngine::Rendering::Renderers \ No newline at end of file +} // namespace ZEngine::Rendering::Renderers diff --git a/ZEngine/ZEngine/Rendering/Renderers/Pipelines/RendererPipeline.cpp b/ZEngine/ZEngine/Rendering/Renderers/Pipelines/RendererPipeline.cpp index 5314322c..f4ecae51 100644 --- a/ZEngine/ZEngine/Rendering/Renderers/Pipelines/RendererPipeline.cpp +++ b/ZEngine/ZEngine/Rendering/Renderers/Pipelines/RendererPipeline.cpp @@ -1,6 +1,6 @@ -#include #include #include +#include using namespace ZEngine::Helpers; using namespace ZEngine::Core::Containers; @@ -11,7 +11,7 @@ namespace ZEngine::Rendering::Renderers::Pipelines { Device = device; Specification = std::move(spec); - auto shader_handle = Device->CompileShader(Specification.ShaderSpecification); + auto shader_handle = Device->CompileShader(Specification.ShaderSpecificationValue); if (!shader_handle) { ZENGINE_CORE_ERROR("") @@ -193,4 +193,4 @@ namespace ZEngine::Rendering::Renderers::Pipelines Layout = VK_NULL_HANDLE; Handle = VK_NULL_HANDLE; } -} // namespace ZEngine::Rendering::Renderers::Pipelines \ No newline at end of file +} // namespace ZEngine::Rendering::Renderers::Pipelines diff --git a/ZEngine/ZEngine/Rendering/Renderers/RenderPasses/RenderPass.cpp b/ZEngine/ZEngine/Rendering/Renderers/RenderPasses/RenderPass.cpp index 0c6fac33..5d6a953f 100644 --- a/ZEngine/ZEngine/Rendering/Renderers/RenderPasses/RenderPass.cpp +++ b/ZEngine/ZEngine/Rendering/Renderers/RenderPasses/RenderPass.cpp @@ -1,7 +1,7 @@ -#include #include #include #include +#include using namespace ZEngine::Rendering::Buffers; using namespace ZEngine::Rendering::Specifications; @@ -390,13 +390,13 @@ namespace ZEngine::Rendering::Renderers::RenderPasses RenderPassBuilder& RenderPassBuilder::SetShaderOverloadMaxSet(uint32_t count) { - m_spec.PipelineSpecification.ShaderSpecification.OverloadMaxSet = count; + m_spec.PipelineSpecification.ShaderSpecificationValue.OverloadMaxSet = count; return *this; } RenderPassBuilder& RenderPassBuilder::SetOverloadPoolSize(uint32_t count) { - m_spec.PipelineSpecification.ShaderSpecification.OverloadPoolSize = count; + m_spec.PipelineSpecification.ShaderSpecificationValue.OverloadPoolSize = count; return *this; } @@ -450,7 +450,7 @@ namespace ZEngine::Rendering::Renderers::RenderPasses RenderPassBuilder& RenderPassBuilder::UseShader(std::string_view name) { - m_spec.PipelineSpecification.ShaderSpecification.Name = name.data(); + m_spec.PipelineSpecification.ShaderSpecificationValue.Name = name.data(); return *this; } @@ -507,4 +507,4 @@ namespace ZEngine::Rendering::Renderers::RenderPasses std::swap(spec, m_spec); return spec; } -} // namespace ZEngine::Rendering::Renderers::RenderPasses \ No newline at end of file +} // namespace ZEngine::Rendering::Renderers::RenderPasses diff --git a/ZEngine/ZEngine/Rendering/Scenes/GraphicScene.cpp b/ZEngine/ZEngine/Rendering/Scenes/GraphicScene.cpp index 1a151b48..18b08b65 100644 --- a/ZEngine/ZEngine/Rendering/Scenes/GraphicScene.cpp +++ b/ZEngine/ZEngine/Rendering/Scenes/GraphicScene.cpp @@ -1,10 +1,10 @@ -#include -#include -#include +#include #include #include #include +#include #include +#include #define NODE_PARENT_ID -1 #define INVALID_NODE_ID -1 @@ -157,7 +157,7 @@ namespace ZEngine::Rendering::Scenes SceneData->Indices = {0}; SceneData->Materials = {Meshes::MeshMaterial{}}; SceneData->MaterialFiles = {Meshes::MaterialFile{}}; - SceneData->DrawData = { + SceneData->DrawDataValue = { DrawData{.TransformIndex = 0, .VertexOffset = 0, .IndexOffset = 0, .VertexCount = 1, .IndexCount = 1} }; } @@ -169,13 +169,13 @@ namespace ZEngine::Rendering::Scenes if (draw_count) { - SceneData->DrawData.resize(draw_count); + SceneData->DrawDataValue.resize(draw_count); indirect_commmands.resize(draw_count); int i = 0; for (auto& [node, mesh] : SceneData->NodeMeshes) { - DrawData& draw_data = SceneData->DrawData[i]; + DrawData& draw_data = SceneData->DrawDataValue[i]; draw_data.TransformIndex = node; draw_data.MaterialIndex = SceneData->NodeMaterials[node]; draw_data.VertexOffset = SceneData->Meshes[mesh].VertexOffset; @@ -189,13 +189,13 @@ namespace ZEngine::Rendering::Scenes else { // We use the default data - indirect_commmands.resize(SceneData->DrawData.size()); + indirect_commmands.resize(SceneData->DrawDataValue.size()); } - for (uint32_t i = 0; i < SceneData->DrawData.size(); ++i) + for (uint32_t i = 0; i < SceneData->DrawDataValue.size(); ++i) { indirect_commmands[i] = { - .vertexCount = SceneData->DrawData[i].IndexCount, + .vertexCount = SceneData->DrawDataValue[i].IndexCount, .instanceCount = 1, .firstVertex = 0, .firstInstance = i, @@ -644,6 +644,8 @@ namespace ZEngine::Rendering::Scenes SceneData->SpotLights.push_back(spot->GPUPackedData()); } break; + case Lights::LightType::UNDEFINED: + break; } } } diff --git a/ZEngine/ZEngine/Rendering/Scenes/GraphicScene.h b/ZEngine/ZEngine/Rendering/Scenes/GraphicScene.h index 68cc723e..b00bfa86 100644 --- a/ZEngine/ZEngine/Rendering/Scenes/GraphicScene.h +++ b/ZEngine/ZEngine/Rendering/Scenes/GraphicScene.h @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include #include @@ -79,7 +79,7 @@ namespace ZEngine::Rendering::Scenes */ std::vector Vertices = {}; std::vector Indices = {}; - std::vector DrawData = {}; + std::vector DrawDataValue = {}; std::vector Names = {}; std::vector MaterialNames = {}; std::unordered_map NodeMeshes = {}; diff --git a/ZEngine/ZEngine/Rendering/Shaders/Shader.cpp b/ZEngine/ZEngine/Rendering/Shaders/Shader.cpp index a6e1991e..a33db946 100644 --- a/ZEngine/ZEngine/Rendering/Shaders/Shader.cpp +++ b/ZEngine/ZEngine/Rendering/Shaders/Shader.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -99,7 +98,7 @@ namespace ZEngine::Rendering::Shaders LayoutBindingSpecificationMap[set].init(m_device->Arena, 10); } - LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = UB_resource.name, .DescriptorType = DescriptorType::UNIFORM_BUFFER, .Flags = ShaderStageFlags::VERTEX}); + LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = UB_resource.name, .DescriptorTypeValue = DescriptorType::UNIFORM_BUFFER, .Flags = ShaderStageFlags::VERTEX}); } for (const auto& SB_resource : vertex_resources.storage_buffers) @@ -112,7 +111,7 @@ namespace ZEngine::Rendering::Shaders LayoutBindingSpecificationMap[set].init(m_device->Arena, 10); } - LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = SB_resource.name, .DescriptorType = DescriptorType::STORAGE_BUFFER, .Flags = ShaderStageFlags::VERTEX}); + LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = SB_resource.name, .DescriptorTypeValue = DescriptorType::STORAGE_BUFFER, .Flags = ShaderStageFlags::VERTEX}); } for (const auto& pushConstant_resource : vertex_resources.push_constant_buffers) @@ -168,7 +167,7 @@ namespace ZEngine::Rendering::Shaders LayoutBindingSpecificationMap[set].init(m_device->Arena, 10); } - LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = UB_resource.name, .DescriptorType = DescriptorType::UNIFORM_BUFFER, .Flags = ShaderStageFlags::FRAGMENT}); + LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = UB_resource.name, .DescriptorTypeValue = DescriptorType::UNIFORM_BUFFER, .Flags = ShaderStageFlags::FRAGMENT}); } for (const auto& SB_resource : fragment_resources.storage_buffers) @@ -181,7 +180,7 @@ namespace ZEngine::Rendering::Shaders LayoutBindingSpecificationMap[set].init(m_device->Arena, 10); } - LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = SB_resource.name, .DescriptorType = DescriptorType::STORAGE_BUFFER, .Flags = ShaderStageFlags::FRAGMENT}); + LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = SB_resource.name, .DescriptorTypeValue = DescriptorType::STORAGE_BUFFER, .Flags = ShaderStageFlags::FRAGMENT}); } for (const auto& pushConstant_resource : fragment_resources.push_constant_buffers) @@ -226,7 +225,7 @@ namespace ZEngine::Rendering::Shaders LayoutBindingSpecificationMap[set].init(m_device->Arena, 10); } - LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Count = count, .Name = SI_resource.name, .DescriptorType = DescriptorType::COMBINED_IMAGE_SAMPLER, .Flags = ShaderStageFlags::FRAGMENT}); + LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Count = count, .Name = SI_resource.name, .DescriptorTypeValue = DescriptorType::COMBINED_IMAGE_SAMPLER, .Flags = ShaderStageFlags::FRAGMENT}); } } } @@ -281,7 +280,7 @@ namespace ZEngine::Rendering::Shaders layout_binding_collection.init(&LocalArena, 10); for (uint32_t i = 0; i < layout_binding_set.second.size(); ++i) { - layout_binding_collection.push(VkDescriptorSetLayoutBinding{.binding = layout_binding_set.second[i].Binding, .descriptorType = DescriptorTypeMap[static_cast(layout_binding_set.second[i].DescriptorType)], .descriptorCount = layout_binding_set.second[i].Count, .stageFlags = ShaderStageFlagsMap[static_cast(layout_binding_set.second[i].Flags)], .pImmutableSamplers = nullptr}); + layout_binding_collection.push(VkDescriptorSetLayoutBinding{.binding = layout_binding_set.second[i].Binding, .descriptorType = DescriptorTypeMap[static_cast(layout_binding_set.second[i].DescriptorTypeValue)], .descriptorCount = layout_binding_set.second[i].Count, .stageFlags = ShaderStageFlagsMap[static_cast(layout_binding_set.second[i].Flags)], .pImmutableSamplers = nullptr}); } /* * Binding flag extension diff --git a/ZEngine/ZEngine/Rendering/Shaders/ShaderReader.cpp b/ZEngine/ZEngine/Rendering/Shaders/ShaderReader.cpp index e8dfb01e..85ab17a0 100644 --- a/ZEngine/ZEngine/Rendering/Shaders/ShaderReader.cpp +++ b/ZEngine/ZEngine/Rendering/Shaders/ShaderReader.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -19,7 +18,7 @@ namespace ZEngine::Rendering::Shaders std::vector ShaderReader::ReadAsBinary(std::string_view filename) { std::ifstream file_stream = {}; - file_stream.open(filename, std::ifstream::binary | std::ifstream::ate); + file_stream.open(std::string(filename), std::ifstream::binary | std::ifstream::ate); if (!file_stream.is_open()) { ZENGINE_CORE_ERROR("====== Shader file : {} cannot be opened ======", filename.data()) diff --git a/ZEngine/ZEngine/Rendering/Specifications/GraphicRendererPipelineSpecification.h b/ZEngine/ZEngine/Rendering/Specifications/GraphicRendererPipelineSpecification.h index f273378b..6a81d431 100644 --- a/ZEngine/ZEngine/Rendering/Specifications/GraphicRendererPipelineSpecification.h +++ b/ZEngine/ZEngine/Rendering/Specifications/GraphicRendererPipelineSpecification.h @@ -29,10 +29,10 @@ namespace ZEngine::Rendering::Specifications uint32_t DepthCompareOp = VK_COMPARE_OP_LESS_OR_EQUAL; bool EnableStencilTest = false; const char* DebugName = {}; - ShaderSpecification ShaderSpecification = {}; + ShaderSpecification ShaderSpecificationValue = {}; Rendering::Buffers::FramebufferVNext* TargetFrameBuffer = {}; Renderers::RenderPasses::Attachment* Attachment = {}; Core::Containers::Array VertexInputBindingSpecifications = {}; Core::Containers::Array VertexInputAttributeSpecifications = {}; }; -} // namespace ZEngine::Rendering::Specifications \ No newline at end of file +} // namespace ZEngine::Rendering::Specifications diff --git a/ZEngine/ZEngine/Rendering/Specifications/ShaderSpecification.h b/ZEngine/ZEngine/Rendering/Specifications/ShaderSpecification.h index 2717d9b6..12ec27b2 100644 --- a/ZEngine/ZEngine/Rendering/Specifications/ShaderSpecification.h +++ b/ZEngine/ZEngine/Rendering/Specifications/ShaderSpecification.h @@ -39,7 +39,7 @@ namespace ZEngine::Rendering::Specifications uint32_t Binding{0xFFFFFFFF}; uint32_t Count{1}; std::string Name; - DescriptorType DescriptorType; + DescriptorType DescriptorTypeValue; ShaderStageFlags Flags; }; diff --git a/ZEngine/ZEngine/Rendering/Specifications/TextureSpecification.h b/ZEngine/ZEngine/Rendering/Specifications/TextureSpecification.h index 35d64a1f..eb3f857a 100644 --- a/ZEngine/ZEngine/Rendering/Specifications/TextureSpecification.h +++ b/ZEngine/ZEngine/Rendering/Specifications/TextureSpecification.h @@ -34,13 +34,14 @@ namespace ZEngine::Rendering::Specifications { uint32_t Width; uint32_t Height; - ImageViewType ImageViewType = ImageViewType::TYPE_2D; + + ImageViewType ImageViewTypeValue = ImageViewType::TYPE_2D; ImageBufferUsageType BufferUsageType; VkFormat ImageFormat; VkImageUsageFlags ImageUsage; VkImageAspectFlagBits ImageAspectFlag; - uint32_t LayerCount = 1U; - ImageCreateFlag ImageCreateFlag = ImageCreateFlag::NONE; + uint32_t LayerCount = 1U; + ImageCreateFlag ImageCreateFlagValue = ImageCreateFlag::NONE; }; -} // namespace ZEngine::Rendering::Specifications \ No newline at end of file +} // namespace ZEngine::Rendering::Specifications diff --git a/ZEngine/ZEngine/Windows/Inputs/KeyCode.h b/ZEngine/ZEngine/Windows/Inputs/KeyCode.h index 21fbd765..163593ff 100644 --- a/ZEngine/ZEngine/Windows/Inputs/KeyCode.h +++ b/ZEngine/ZEngine/Windows/Inputs/KeyCode.h @@ -1,5 +1,6 @@ #pragma once #include +#include namespace ZEngine::Windows::Inputs { @@ -136,4 +137,9 @@ namespace ZEngine::Windows::Inputs MOUSE_BUTTON_8 = 7 } GlfwKey; + + inline auto format_as(GlfwKey f) + { + return fmt::underlying(f); + } } // namespace ZEngine::Windows::Inputs diff --git a/ZEngine/ZEngine/ZEngineDef.h b/ZEngine/ZEngine/ZEngineDef.h index 7da8597e..2a68bd2a 100644 --- a/ZEngine/ZEngine/ZEngineDef.h +++ b/ZEngine/ZEngine/ZEngineDef.h @@ -12,7 +12,8 @@ #include #define ZENGINE_DEBUG_BREAK() __builtin_trap(); #else -#error "Platform not supported!" +#include +#define ZENGINE_DEBUG_BREAK() raise(SIGTRAP); #endif #ifdef _MSC_VER @@ -96,4 +97,4 @@ #define ASSET_FILE_VERSION MAKE_VERSION(1, 0, 0) #define SCENE_FILE_VERSION MAKE_VERSION(1, 0, 0) -typedef const char* cstring; \ No newline at end of file +typedef const char* cstring; diff --git a/ZEngine/ZEngine/pch.cpp b/ZEngine/ZEngine/pch.cpp deleted file mode 100644 index 8781bfd8..00000000 --- a/ZEngine/ZEngine/pch.cpp +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/ZEngine/ZEngine/pch.h b/ZEngine/ZEngine/pch.h index a4d3f4a2..3716e4cf 100644 --- a/ZEngine/ZEngine/pch.h +++ b/ZEngine/ZEngine/pch.h @@ -1,5 +1,4 @@ #pragma once -#include #include #include #include @@ -9,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -16,4 +16,5 @@ #include #include #include +#include #include diff --git a/ZEngine/tests/CMakeLists.txt b/ZEngine/tests/CMakeLists.txt index a7e8d998..4b25bb7f 100644 --- a/ZEngine/tests/CMakeLists.txt +++ b/ZEngine/tests/CMakeLists.txt @@ -8,6 +8,5 @@ add_executable(ZEngineTests ${TEST_SOURCES}) target_link_libraries(ZEngineTests PRIVATE zEngineLib - GTest::gtest GTest::gtest_main ) diff --git a/ZEngine/tests/Memory/allocator_test.cpp b/ZEngine/tests/Memory/allocator_test.cpp index 424a0c73..05bf42d1 100644 --- a/ZEngine/tests/Memory/allocator_test.cpp +++ b/ZEngine/tests/Memory/allocator_test.cpp @@ -82,14 +82,14 @@ TEST(AllocatorTest, ArenaMemoryManager) void Func() {} }; - int* intPtr = ZPushArray(&(manager.ArenaAllocator), int, 1); - auto structPtr = ZPushStruct(&(manager.ArenaAllocator), Foo); + int* intPtr = ZPushArray(&(manager.ArenaAllocatorValue), int, 1); + auto structPtr = ZPushStruct(&(manager.ArenaAllocatorValue), Foo); *intPtr = 12; structPtr->x = 12; structPtr->y = 798.0f; - char* str = ZPushString(&(manager.ArenaAllocator), 12); + char* str = ZPushString(&(manager.ArenaAllocatorValue), 12); Helpers::secure_memmove(str, 12, "hello", 5); EXPECT_EQ(*intPtr, 12); @@ -121,7 +121,7 @@ TEST(AllocatorTest, ArenaMemoryTemp) { MemoryManager manager{}; manager.Initialize({.DefaultSize = ZKilo(10)}); - auto arena = &(manager.ArenaAllocator); + auto arena = &(manager.ArenaAllocatorValue); { auto fooPtr = ZPushStruct(arena, Foo); fooPtr->x = 10; @@ -142,7 +142,7 @@ TEST(AllocatorTest, ArenaMemoryPool) { MemoryManager manager{}; manager.Initialize({.DefaultSize = ZKilo(10)}); - auto arena = &(manager.ArenaAllocator); + auto arena = &(manager.ArenaAllocatorValue); { PoolAllocator pool; pool.Initialize(arena, sizeof(Foo) * 100, sizeof(Foo)); diff --git a/ZEngine/tests/Memory/handleManager_test.cpp b/ZEngine/tests/Memory/handleManager_test.cpp index 7957ff4d..f6566122 100644 --- a/ZEngine/tests/Memory/handleManager_test.cpp +++ b/ZEngine/tests/Memory/handleManager_test.cpp @@ -10,7 +10,7 @@ class HandleManagerTest : public ::testing::Test void SetUp() override { manager.Initialize({.DefaultSize = ZKilo(10)}); - auto arena = &(manager.ArenaAllocator); + auto arena = &(manager.ArenaAllocatorValue); handle_manager.Initialize(arena, 10); } @@ -114,7 +114,7 @@ TEST_F(HandleManagerTest, ReuseSlot) TEST_F(HandleManagerTest, ConcurrentAccess) { ZEngine::Helpers::HandleManager h_manager; - h_manager.Initialize(&(manager.ArenaAllocator), 40); + h_manager.Initialize(&(manager.ArenaAllocatorValue), 40); const int numThreads = 4; const int numOperationsPerThread = 10; std::vector threads; @@ -145,4 +145,4 @@ TEST_F(HandleManagerTest, ConcurrentAccess) { thread.join(); } -} \ No newline at end of file +} diff --git a/__externals/CLI11 b/__externals/CLI11 index f75fd22b..bb9bd85e 160000 --- a/__externals/CLI11 +++ b/__externals/CLI11 @@ -1 +1 @@ -Subproject commit f75fd22ba323bbb3b6621ed9beaf8f52f24796fd +Subproject commit bb9bd85e3b8129571b084911affc6f0e9ae6be25 diff --git a/__externals/ImGuizmo b/__externals/ImGuizmo index e3174578..664cf2d7 160000 --- a/__externals/ImGuizmo +++ b/__externals/ImGuizmo @@ -1 +1 @@ -Subproject commit e3174578bdc99c715e51c5ad88e7d50b4eeb19b0 +Subproject commit 664cf2d73864a36b2a8b5091d33fc4578c885eca diff --git a/__externals/SPIRV-Cross b/__externals/SPIRV-Cross index 4818f7e7..256192e6 160000 --- a/__externals/SPIRV-Cross +++ b/__externals/SPIRV-Cross @@ -1 +1 @@ -Subproject commit 4818f7e7ef7b7078a3a7a5a52c4a338e0dda22f4 +Subproject commit 256192e6248c8f6234323c998993126e841e1830 diff --git a/__externals/SPIRV-Tools b/__externals/SPIRV-Tools index dda7731e..5e7108e1 160000 --- a/__externals/SPIRV-Tools +++ b/__externals/SPIRV-Tools @@ -1 +1 @@ -Subproject commit dda7731e91c130e64980d987a02f5c75356400cc +Subproject commit 5e7108e11015b1e2c7d944f766524d19fb599b9d diff --git a/__externals/SPIRV-headers b/__externals/SPIRV-headers index 7d500c4d..97e96f9e 160000 --- a/__externals/SPIRV-headers +++ b/__externals/SPIRV-headers @@ -1 +1 @@ -Subproject commit 7d500c4d75ae3fbd37e1d5a20008ca9c8ee3c860 +Subproject commit 97e96f9e9defeb4bba3cfbd034dec516671dd7a3 diff --git a/__externals/Vulkan-Headers b/__externals/Vulkan-Headers index b379292b..89268a6d 160000 --- a/__externals/Vulkan-Headers +++ b/__externals/Vulkan-Headers @@ -1 +1 @@ -Subproject commit b379292b2ab6df5771ba9870d53cf8b2c9295daf +Subproject commit 89268a6d17fc87003b209a1422c17ab288be99a0 diff --git a/__externals/Vulkan-Loader b/__externals/Vulkan-Loader index 40b8e6ee..b54033fd 160000 --- a/__externals/Vulkan-Loader +++ b/__externals/Vulkan-Loader @@ -1 +1 @@ -Subproject commit 40b8e6eeead809a62c708cb48fdd9f8f2eab3f15 +Subproject commit b54033fde026143565519b2d35db206a0059f754 diff --git a/__externals/VulkanMemoryAllocator b/__externals/VulkanMemoryAllocator index 1d8f600f..1076b348 160000 --- a/__externals/VulkanMemoryAllocator +++ b/__externals/VulkanMemoryAllocator @@ -1 +1 @@ -Subproject commit 1d8f600fd424278486eade7ed3e877c99f0846b1 +Subproject commit 1076b348abd17859a116f4b111c43d58a588a086 diff --git a/__externals/assimp b/__externals/assimp index 70f5cca9..92554129 160000 --- a/__externals/assimp +++ b/__externals/assimp @@ -1 +1 @@ -Subproject commit 70f5cca9c3ebd84b89c5775852ac9aa2449f6c5b +Subproject commit 925541290612f42a3b4eb37c9dc1c269ce38de06 diff --git a/__externals/entt b/__externals/entt index 41aab920..6fa66890 160000 --- a/__externals/entt +++ b/__externals/entt @@ -1 +1 @@ -Subproject commit 41aab920b083aa424ac1d27666ce287eeaff6ceb +Subproject commit 6fa668900e0b13432dfb25ce13d9c6663c716b0f diff --git a/__externals/externals.cmake b/__externals/externals.cmake index 35f6d663..a931bf14 100644 --- a/__externals/externals.cmake +++ b/__externals/externals.cmake @@ -1,60 +1,80 @@ # Packages # -set(EXTERNAL_INCLUDE_DIRS - ${EXTERNAL_DIR}/Vulkan-Headers/build/install/include - ${EXTERNAL_DIR}/fmt/include - ${EXTERNAL_DIR}/glm/glm - ${EXTERNAL_DIR}/imgui/src - ${EXTERNAL_DIR}/tlsf/src - ${EXTERNAL_DIR}/rapidhash/src - ${EXTERNAL_DIR}/spdlog/include - ${EXTERNAL_DIR}/glfw/include - ${EXTERNAL_DIR}/entt - ${EXTERNAL_DIR}/assimp/include - ${EXTERNAL_DIR}/stduuid/include - ${EXTERNAL_DIR}/yaml-cpp/include - ${EXTERNAL_DIR}/SPIRV-headers - ${EXTERNAL_DIR}/SPIRV-Tools - ${EXTERNAL_DIR}/glslang - ${EXTERNAL_DIR}/SPIRV-Cross - ${EXTERNAL_DIR}/VulkanMemoryAllocator - ${EXTERNAL_DIR}/nlohmann_json/single_include - ${EXTERNAL_DIR}/CLI11/include -) -if (MSVC) - target_compile_options(assimp PRIVATE /Wv:18) # Fix zip lib compile issue -elseif(APPLE) - target_compile_options(assimp PRIVATE -Wno-shorten-64-to-32 -Wno-unused-but-set-variable -Wno-deprecated-declarations) +add_subdirectory (${EXTERNAL_DIR}/Vulkan-Headers) +add_subdirectory (${EXTERNAL_DIR}/Vulkan-Loader) +add_subdirectory (${EXTERNAL_DIR}/imgui) + +add_library(ImGuizmo) + +target_sources(ImGuizmo PRIVATE + ${EXTERNAL_DIR}/ImGuizmo/ImGuizmo.cpp) + +target_include_directories(ImGuizmo PUBLIC ${EXTERNAL_DIR}) + +if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") + target_compile_definitions (ImGuizmo PUBLIC ENABLE_VULKAN_VALIDATION_LAYER) endif() -if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - target_link_libraries(imgui PUBLIC ${CMAKE_DL_LIBS}) +if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + target_compile_definitions (ImGuizmo PUBLIC VK_USE_PLATFORM_WIN32_KHR) endif() -add_library (imported::External_libs INTERFACE IMPORTED) -add_library(imported::External_editorLibs INTERFACE IMPORTED) +if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + target_link_libraries(ImGuizmo PUBLIC stdc++fs) +endif () +target_link_libraries(ImGuizmo PUBLIC imgui) -target_link_libraries(imported::External_editorLibs INTERFACE - CLI11::CLI11 +add_subdirectory (${EXTERNAL_DIR}/assimp) +add_subdirectory (${EXTERNAL_DIR}/fmt) +add_subdirectory (${EXTERNAL_DIR}/glfw) +add_subdirectory (${EXTERNAL_DIR}/spdlog) +add_subdirectory (${EXTERNAL_DIR}/glm) +add_subdirectory (${EXTERNAL_DIR}/entt) +add_subdirectory (${EXTERNAL_DIR}/stduuid) +add_subdirectory (${EXTERNAL_DIR}/yaml-cpp) +add_subdirectory (${EXTERNAL_DIR}/SPIRV-headers) +add_subdirectory (${EXTERNAL_DIR}/SPIRV-Tools) +add_subdirectory (${EXTERNAL_DIR}/glslang) +add_subdirectory (${EXTERNAL_DIR}/SPIRV-Cross) +add_subdirectory (${EXTERNAL_DIR}/gtest) +add_subdirectory (${EXTERNAL_DIR}/VulkanMemoryAllocator) +add_subdirectory (${EXTERNAL_DIR}/tlsf) +add_subdirectory (${EXTERNAL_DIR}/rapidhash) +add_subdirectory (${EXTERNAL_DIR}/CLI11) +add_subdirectory (${EXTERNAL_DIR}/nlohmann_json) + +add_library (ZEngineLibs INTERFACE) +add_library(TetragramaLibs INTERFACE) + +target_include_directories(ZEngineLibs INTERFACE ${EXTERNAL_DIR}) + +target_link_libraries(TetragramaLibs INTERFACE + CLI11::CLI11 + nlohmann_json::nlohmann_json ) -target_link_libraries(imported::External_libs INTERFACE - vulkan - fmt - glm - imgui - spdlog - glfw - EnTT - assimp - stduuid - yaml-cpp - spirv-cross-reflect spirv-cross-glsl - GPUOpen::VulkanMemoryAllocator - glslang SPIRV - SPIRV-Tools - tlsf - rapidhash +target_link_libraries(ZEngineLibs INTERFACE + fmt::fmt + glm::glm + ImGuizmo + spdlog + glfw + EnTT + assimp + stduuid + yaml-cpp::yaml-cpp + spirv-cross-reflect + spirv-cross-glsl + GPUOpen::VulkanMemoryAllocator + glslang + SPIRV-Tools + tlsf + rapidhash ) + +target_compile_definitions(ZEngineLibs INTERFACE GLM_ENABLE_EXPERIMENTAL) + +add_library(imported::External_libs ALIAS ZEngineLibs) +add_library(imported::External_editorLibs ALIAS TetragramaLibs) diff --git a/__externals/fmt b/__externals/fmt index e41ac1f8..93f03953 160000 --- a/__externals/fmt +++ b/__externals/fmt @@ -1 +1 @@ -Subproject commit e41ac1f875b7a1c419beaf7ddf431a01fb530a92 +Subproject commit 93f03953af6b0268e1a29bb5b23d50f72b87a151 diff --git a/__externals/glfw b/__externals/glfw index fb0f2f92..ac107684 160000 --- a/__externals/glfw +++ b/__externals/glfw @@ -1 +1 @@ -Subproject commit fb0f2f92a38c1d6a776ffeb253329f8d1c65694c +Subproject commit ac10768495837eb98da27d01fe706073d6d251c2 diff --git a/__externals/glm b/__externals/glm index 84f2045a..2d4c4b4d 160000 --- a/__externals/glm +++ b/__externals/glm @@ -1 +1 @@ -Subproject commit 84f2045a79a4aa2454801a98e2de0401bd9c8aee +Subproject commit 2d4c4b4dd31fde06cfffad7915c2b3006402322f diff --git a/__externals/glslang b/__externals/glslang index 32257786..be4ee7d0 160000 --- a/__externals/glslang +++ b/__externals/glslang @@ -1 +1 @@ -Subproject commit 3225778615fd9d7e23fd11b71a05097d59ba0247 +Subproject commit be4ee7d0e3bfd151bfda7b3a8e03f8c49c55ed7b diff --git a/__externals/gtest b/__externals/gtest index b10fad38..373af2e3 160000 --- a/__externals/gtest +++ b/__externals/gtest @@ -1 +1 @@ -Subproject commit b10fad38c4026a29ea6561ab15fc4818170d1c10 +Subproject commit 373af2e3df71599b87a40ce0e37164523849166b diff --git a/__externals/imgui/CMakeLists.txt b/__externals/imgui/CMakeLists.txt index 4b1e0f25..caababe8 100644 --- a/__externals/imgui/CMakeLists.txt +++ b/__externals/imgui/CMakeLists.txt @@ -14,16 +14,20 @@ list (APPEND IMGUI_SOURCE # Source files # -add_library (imgui STATIC ${IMGUI_SOURCE}) +add_library (imgui STATIC) + +target_sources(imgui PRIVATE ${IMGUI_SOURCE}) # include directories # target_include_directories (imgui PUBLIC ./src - ./src/backends - ${EXTERNAL_DIR}/glfw/include - PRIVATE - ${EXTERNAL_DIR}/Vulkan-Headers/build/install/include ) +target_link_libraries(imgui PUBLIC + glfw + Vulkan::Headers + Vulkan::Loader) + +target_compile_definitions(imgui PUBLIC GLFW_INCLUDE_VULKAN IMGUI_DEFINE_MATH_OPERATORS) diff --git a/__externals/imgui/src b/__externals/imgui/src index c191faf0..1d8e48c1 160000 --- a/__externals/imgui/src +++ b/__externals/imgui/src @@ -1 +1 @@ -Subproject commit c191faf0ba478e9c58a69c63306986a21ebfb6e4 +Subproject commit 1d8e48c161370c37628c4f37f3f87cb19fbcb723 diff --git a/__externals/nlohmann_json b/__externals/nlohmann_json index 0457de21..f0aa4546 160000 --- a/__externals/nlohmann_json +++ b/__externals/nlohmann_json @@ -1 +1 @@ -Subproject commit 0457de21cffb298c22b629e538036bfeb96130b7 +Subproject commit f0aa454655640033858232a95a8edad0740734bf diff --git a/__externals/rapidhash/src b/__externals/rapidhash/src index c1f35e3a..bc4b4baa 160000 --- a/__externals/rapidhash/src +++ b/__externals/rapidhash/src @@ -1 +1 @@ -Subproject commit c1f35e3a44010bf90a9008013d8ab7c7b9aaae2c +Subproject commit bc4b4baa48a15ff52ff4725e1ccdcda62815221c diff --git a/__externals/spdlog b/__externals/spdlog index 6491abb5..9ecdf5c8 160000 --- a/__externals/spdlog +++ b/__externals/spdlog @@ -1 +1 @@ -Subproject commit 6491abb519a6a15792c1c6717270ce6c9ba4d72e +Subproject commit 9ecdf5c8a1a3ace5673f9fd1857da1b6375b5114 diff --git a/__externals/stb b/__externals/stb index 8e51be04..f58f558c 160000 --- a/__externals/stb +++ b/__externals/stb @@ -1 +1 @@ -Subproject commit 8e51be04dc7dcee462e1f09e410faceab52cc6d2 +Subproject commit f58f558c120e9b32c217290b80bad1a0729fbb2c diff --git a/__externals/stduuid b/__externals/stduuid index 5c538cca..3afe7193 160000 --- a/__externals/stduuid +++ b/__externals/stduuid @@ -1 +1 @@ -Subproject commit 5c538cca02932aa0266659661d5b4726f3a317c7 +Subproject commit 3afe7193facd5d674de709fccc44d5055e144d7a diff --git a/__externals/yaml-cpp b/__externals/yaml-cpp index c73ee347..2f86d137 160000 --- a/__externals/yaml-cpp +++ b/__externals/yaml-cpp @@ -1 +1 @@ -Subproject commit c73ee34704c512ebe915b283645aefa9f424a22f +Subproject commit 2f86d13775d119edbb69af52e5f566fd65c6953b