diff --git a/Premake/ProjectUtil.lua b/Premake/ProjectUtil.lua index b0fb68e1..c1681723 100644 --- a/Premake/ProjectUtil.lua +++ b/Premake/ProjectUtil.lua @@ -9,7 +9,7 @@ if ProjectTemplate == nil then _G[internalName] = { } if cppVersion == nil or cppVersion == "" then - cppVersion = "C++17" + cppVersion = "C++20" else local version = tonumber(cppVersion) @@ -32,7 +32,7 @@ if ProjectTemplate == nil then end if not cppVersion:find("^C++") then - cppVersion = "C++17" + cppVersion = "C++20" end end diff --git a/Source/Game/Game/Animation/AnimationSystem.cpp b/Source/Game/Game/Animation/AnimationSystem.cpp index e91c5a90..eb2822bc 100644 --- a/Source/Game/Game/Animation/AnimationSystem.cpp +++ b/Source/Game/Game/Animation/AnimationSystem.cpp @@ -10,7 +10,7 @@ AutoCVar_Int CVAR_AnimationSystemEnabled(CVarCategory::Client | CVarCategory::Rendering, "animationEnabled", "Enables the Animation System", 0, CVarFlags::EditCheckbox); AutoCVar_Float CVAR_AnimationSystemTimeScale(CVarCategory::Client | CVarCategory::Rendering, "animationTimeScale", "Controls the global speed of all animations", 1.0f); -AutoCVar_Int CVAR_AnimationSystemThrottle(CVarCategory::Client | CVarCategory::Rendering, "animationThrottle", "Sets the number of dirty instances that can be updated every frame", 64); +AutoCVar_Int CVAR_AnimationSystemThrottle(CVarCategory::Client | CVarCategory::Rendering, "animationThrottle", "Sets the number of dirty instances that can be updated every frame", 1024); namespace Animation { @@ -664,22 +664,22 @@ namespace Animation { const AnimationSkeletonBone& bone = skeleton.bones[boneIndex]; AnimationBoneInstance& boneInstance = instance.bones[boneIndex]; - + HandleBoneAnimation(skeleton, instance, bone, boneInstance, adjustedDeltaTime); - + if (!bone.info.flags.Transformed) continue; - + const mat4x4& originalMatrix = _storage.boneMatrices[instance.boneMatrixOffset + boneIndex]; mat4x4 boneMatrix = GetBoneMatrix(skeleton, instance, bone, boneInstance); - + // Apply parent's transformation if (bone.info.parentBoneID != -1) { const mat4x4& parentBoneMatrix = _storage.boneMatrices[instance.boneMatrixOffset + bone.info.parentBoneID]; boneMatrix = mul(boneMatrix, parentBoneMatrix); } - + bool isDirty = originalMatrix != boneMatrix; if (isDirty) { diff --git a/Source/Game/Game/Animation/AnimationSystem.h b/Source/Game/Game/Animation/AnimationSystem.h index fec16643..467e5f06 100644 --- a/Source/Game/Game/Animation/AnimationSystem.h +++ b/Source/Game/Game/Animation/AnimationSystem.h @@ -679,7 +679,7 @@ namespace Animation FlyMountSelfFall = 649, Count }; - static constexpr char* AnimationNames[(i32)Type::Count] = + static const char* AnimationNames[(i32)Type::Count] = { "Stand", "Death", @@ -1429,7 +1429,7 @@ namespace Animation face_beard_00_M_JNT = 192, Count }; - static char* BoneNames[(i16)Bone::Count] = { }; + static const char* BoneNames[(i16)Bone::Count] = { }; enum class BlendOverride { diff --git a/Source/Game/Game/ECS/Components/Model.h b/Source/Game/Game/ECS/Components/Model.h index fd8b8a35..0c686f88 100644 --- a/Source/Game/Game/ECS/Components/Model.h +++ b/Source/Game/Game/ECS/Components/Model.h @@ -2,12 +2,14 @@ #include #include +#include + namespace ECS::Components { struct Model { public: - u32 modelID; + u32 modelID = std::numeric_limits().max(); u32 instanceID = std::numeric_limits().max(); }; } diff --git a/Source/Game/Game/ECS/Components/Name.h b/Source/Game/Game/ECS/Components/Name.h index 7777af21..a8dcd21e 100644 --- a/Source/Game/Game/ECS/Components/Name.h +++ b/Source/Game/Game/ECS/Components/Name.h @@ -2,6 +2,8 @@ #include #include +#include + namespace ECS::Components { struct Name @@ -9,7 +11,7 @@ namespace ECS::Components public: std::string name; std::string fullName; - u32 nameHash; + u32 nameHash = std::numeric_limits().max(); }; } diff --git a/Source/Game/Game/ECS/Systems/CharacterController.cpp b/Source/Game/Game/ECS/Systems/CharacterController.cpp index 0a5b8c8c..e3c6caf0 100644 --- a/Source/Game/Game/ECS/Systems/CharacterController.cpp +++ b/Source/Game/Game/ECS/Systems/CharacterController.cpp @@ -523,17 +523,6 @@ namespace ECS::Systems quat rotation = glm::quat(glm::vec3(0.0f, glm::radians(characterSingleton.waistRotationSettings.x), 0.0f)); animationSystem->SetBoneRotation(instanceID, Animation::Bone::Waist, rotation); } - - //if (characterSingleton.currentOrientation != characterSingleton.targetOrientation) - //{ - // characterSingleton.timeSinceLastOrientationChange += deltaTime; - // characterSingleton.timeSinceLastOrientationChange = glm::clamp(characterSingleton.timeSinceLastOrientationChange, 0.0f, characterSingleton.timetoChangeOrientation); - // - // f32 progress = characterSingleton.timeSinceLastOrientationChange / characterSingleton.timetoChangeOrientation; - // characterSingleton.currentOrientation = glm::mix(characterSingleton.currentOrientation, characterSingleton.targetOrientation, progress); - // - // transformSystem.SetLocalRotation(characterSingleton.modelEntity, glm::quat(glm::vec3(0.0f, glm::radians(characterSingleton.currentOrientation), 0.0f))); - //} } void CharacterController::ReInitCharacterModel(entt::registry& registry) diff --git a/Source/Game/Game/ECS/Util/Transforms.h b/Source/Game/Game/ECS/Util/Transforms.h index 4018d294..72caa704 100644 --- a/Source/Game/Game/ECS/Util/Transforms.h +++ b/Source/Game/Game/ECS/Util/Transforms.h @@ -288,7 +288,7 @@ namespace ECS::Components } private: - mat4a matrix; + mat4a matrix = mat4a(1.0f); Transform* transform{}; entt::entity ownerEntity; diff --git a/Source/Game/Game/Editor/AssetBrowser.cpp b/Source/Game/Game/Editor/AssetBrowser.cpp index 233cacce..94437885 100644 --- a/Source/Game/Game/Editor/AssetBrowser.cpp +++ b/Source/Game/Game/Editor/AssetBrowser.cpp @@ -233,7 +233,7 @@ namespace Editor tSystem.SetLocalTransform(entity, cameraTransform.GetWorldPosition(), quat(1.0f, 0.0f, 0.0f, 0.0f), vec3(1.0f, 1.0f, 1.0f)); std::string relativePath = fs::relative(item, _modelTopPath).string(); - std::replace(relativePath.begin(), relativePath.end(), L'\\', L'/'); + std::replace(relativePath.begin(), relativePath.end(), '\\', '/'); u32 modelPathHash = StringUtils::fnv1a_32(relativePath.c_str(), relativePath.length()); _gameRenderer->GetModelLoader()->LoadModelForEntity(entity, modelPathHash); @@ -475,12 +475,12 @@ namespace Editor if (search.size() > _searchedString.size() && !_searchedFiles.empty()) { - const auto temp = _searchedFiles; + const std::vector& temp = _searchedFiles; _searchedFiles.clear(); _searchedFiles.reserve(temp.size()); _searchedString = search; - for (auto& file : temp) + for (const fs::path& file : temp) { if (StringUtils::SearchString(file.filename().string(), _searchedString, true)) { diff --git a/Source/Game/Game/Editor/AssetBrowser.h b/Source/Game/Game/Editor/AssetBrowser.h index d2d3debc..46c52450 100644 --- a/Source/Game/Game/Editor/AssetBrowser.h +++ b/Source/Game/Game/Editor/AssetBrowser.h @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include diff --git a/Source/Game/Game/Editor/EditorHandler.cpp b/Source/Game/Game/Editor/EditorHandler.cpp index 20481e47..7160f0c8 100644 --- a/Source/Game/Game/Editor/EditorHandler.cpp +++ b/Source/Game/Game/Editor/EditorHandler.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include diff --git a/Source/Game/Game/Editor/SkyboxSelector.cpp b/Source/Game/Game/Editor/SkyboxSelector.cpp index 881fb6fe..ff70c9e6 100644 --- a/Source/Game/Game/Editor/SkyboxSelector.cpp +++ b/Source/Game/Game/Editor/SkyboxSelector.cpp @@ -217,7 +217,7 @@ namespace Editor if (ImGui::BeginPopupEx(popupContextID, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings)) { const fs::path& skyboxPath = data.skyboxPaths[popupSkyboxID]; - std::string& skyboxName = skyboxPath.stem().string(); + std::string skyboxName = skyboxPath.stem().string(); ImGui::Text("Actions for %s", skyboxName.c_str()); ImGui::Separator(); diff --git a/Source/Game/Game/Rendering/CulledRenderer.h b/Source/Game/Game/Rendering/CulledRenderer.h index a3945340..d4821c73 100644 --- a/Source/Game/Game/Rendering/CulledRenderer.h +++ b/Source/Game/Game/Rendering/CulledRenderer.h @@ -7,6 +7,7 @@ #include #include +#include #include #include #include diff --git a/Source/Game/Game/Rendering/GameRenderer.cpp b/Source/Game/Game/Rendering/GameRenderer.cpp index 6828e9c8..c3b3df1a 100644 --- a/Source/Game/Game/Rendering/GameRenderer.cpp +++ b/Source/Game/Game/Rendering/GameRenderer.cpp @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include #include diff --git a/Source/Game/Game/Rendering/Liquid/LiquidRenderer.cpp b/Source/Game/Game/Rendering/Liquid/LiquidRenderer.cpp index d23244a5..c7d7e12f 100644 --- a/Source/Game/Game/Rendering/Liquid/LiquidRenderer.cpp +++ b/Source/Game/Game/Rendering/Liquid/LiquidRenderer.cpp @@ -129,7 +129,7 @@ void LiquidRenderer::Load(LoadDesc& desc) drawCallData.textureCount = 1; drawCallData.hasDepth = 0; drawCallData.liquidType = 0; - drawCallData.uvAnim = hvec2(0, 0); + drawCallData.uvAnim = hvec2(0.0f, 0.0f); // Load textures if they exist entt::registry* registry = ServiceLocator::GetEnttRegistries()->gameRegistry; @@ -182,7 +182,7 @@ void LiquidRenderer::Load(LoadDesc& desc) drawCallData.textureStartIndex = textureStartIndex; drawCallData.textureCount = textureCount; drawCallData.liquidType = liquidType.soundBank; // This is a workaround for now, but we don't want to rely on soundbank for knowing if this is liquid, lava or slime in the future - drawCallData.uvAnim = hvec2(0, 0); // TODO: Load this from Vertex format data + drawCallData.uvAnim = hvec2(0.0f, 0.0f); // TODO: Load this from Vertex format data } vec3 min = vec3(100000, 100000, 100000); diff --git a/Source/Game/Game/Rendering/Model/ModelLoader.cpp b/Source/Game/Game/Rendering/Model/ModelLoader.cpp index 9a5f5294..2f29f7ee 100644 --- a/Source/Game/Game/Rendering/Model/ModelLoader.cpp +++ b/Source/Game/Game/Rendering/Model/ModelLoader.cpp @@ -12,23 +12,22 @@ #include "Game/Util/JoltStream.h" #include "Game/Util/ServiceLocator.h" +#include #include #include -#include #include #include #include - #include #include #include -#include #include #include +#include #include namespace fs = std::filesystem; @@ -670,7 +669,7 @@ bool ModelLoader::LoadRequest(const LoadRequestInternal& request) // Generate Jolt Shape { // Disabled on purpose for now - i32 physicsEnabled = *CVarSystem::Get()->GetIntCVar(CVarCategory::Client | CVarCategory::Physics, "enabled"); + i32 physicsEnabled = *CVarSystem::Get()->GetIntCVar(CVarCategory::Client | CVarCategory::Physics, "enabled"_h); u32 numPhysicsBytes = static_cast(model->physicsData.size()); if (physicsEnabled && numPhysicsBytes > 0) diff --git a/Source/Game/Game/Rendering/Model/ModelRenderer.cpp b/Source/Game/Game/Rendering/Model/ModelRenderer.cpp index 5133ba4d..e8d247e8 100644 --- a/Source/Game/Game/Rendering/Model/ModelRenderer.cpp +++ b/Source/Game/Game/Rendering/Model/ModelRenderer.cpp @@ -1265,7 +1265,7 @@ u32 ModelRenderer::AddInstance(entt::entity entityID, u32 modelID, const mat4x4& if (manifest.isAnimated) { - i32* animationSystemEnabled = CVarSystem::Get()->GetIntCVar(CVarCategory::Client | CVarCategory::Rendering, "animationSystemEnabled"_h); + i32* animationSystemEnabled = CVarSystem::Get()->GetIntCVar(CVarCategory::Client | CVarCategory::Rendering, "animationEnabled"_h); if (animationSystemEnabled && *animationSystemEnabled == 1) { u32 animatedVertexOffset = _animatedVerticesIndex.fetch_add(manifest.numVertices); @@ -1426,7 +1426,7 @@ void ModelRenderer::ModifyInstance(entt::entity entityID, u32 instanceID, u32 mo if (manifest.isAnimated) { - i32* animationSystemEnabled = CVarSystem::Get()->GetIntCVar(CVarCategory::Client | CVarCategory::Rendering, "animationSystemEnabled"_h); + i32* animationSystemEnabled = CVarSystem::Get()->GetIntCVar(CVarCategory::Client | CVarCategory::Rendering, "animationEnabled"_h); if (animationSystemEnabled && *animationSystemEnabled == 1) { u32 animatedVertexOffset = _animatedVerticesIndex.fetch_add(manifest.numVertices); diff --git a/Source/Game/Game/Scripting/LuaStateCtx.cpp b/Source/Game/Game/Scripting/LuaStateCtx.cpp index ecbc9968..dbb5a896 100644 --- a/Source/Game/Game/Scripting/LuaStateCtx.cpp +++ b/Source/Game/Game/Scripting/LuaStateCtx.cpp @@ -479,7 +479,7 @@ namespace Scripting } else if (any.type() == typeid(LuaTable)) { - auto& val = std::any_cast(any); + auto& val = std::any_cast(any); SetLuaTable(key.c_str(), val, recursiveCounter + 1); } else if (any.type() == typeid(LuaTable&)) diff --git a/Source/ShaderCookerStandalone/ShaderCookerStandalone.lua b/Source/ShaderCookerStandalone/ShaderCookerStandalone.lua index 1bddad82..0a5eb660 100644 --- a/Source/ShaderCookerStandalone/ShaderCookerStandalone.lua +++ b/Source/ShaderCookerStandalone/ShaderCookerStandalone.lua @@ -1,5 +1,5 @@ local dependencies = { "base", "shadercooker" } -local defines = { } +local defines = { "_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS", "_SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS" } ProjectTemplate("ShaderCookerStandalone", "ConsoleApp", ".", Game.binDir, dependencies, defines) local dxCompilerLibPath = BuildSettings:Get("DXCompiler Dynamic Lib Path") diff --git a/Source/ShaderCookerStandalone/main.cpp b/Source/ShaderCookerStandalone/main.cpp index 8a6e0b77..b9cafe20 100644 --- a/Source/ShaderCookerStandalone/main.cpp +++ b/Source/ShaderCookerStandalone/main.cpp @@ -30,13 +30,15 @@ i32 main(int argc, char* argv[]) const bool debugSkipCache = false; if (!debugSkipCache) { + std::string shaderCachePathStr = shaderCachePath.string(); + if (shaderCache.Load(shaderCachePath)) { - DebugHandler::Print("Loaded shadercache from: {0}", shaderCachePath.string().c_str()); + DebugHandler::Print("Loaded shadercache from: {0}", shaderCachePathStr); } else { - DebugHandler::Print("Creating shadercache at: {0}", shaderCachePath.string().c_str()); + DebugHandler::Print("Creating shadercache at: {0}", shaderCachePathStr); } } else @@ -90,7 +92,7 @@ i32 main(int argc, char* argv[]) } else { - DebugHandler::PrintError("{0} shaders failed to compile.", numFailedShaders); + DebugHandler::PrintError("Failed to compile {0} shaders", numFailedShaders); } std::chrono::system_clock::time_point endTime = std::chrono::system_clock::now(); diff --git a/Source/Shaders/Shaders.lua b/Source/Shaders/Shaders.lua index 3843fb92..34b062df 100644 --- a/Source/Shaders/Shaders.lua +++ b/Source/Shaders/Shaders.lua @@ -1,7 +1,7 @@ local dependencies = { } local defines = { } ProjectTemplate("Shaders", "Utility", nil, Game.binDir, dependencies, defines) -dependson ("ShaderCookerStandalone") +dependson { "ShaderCookerStandalone" } local rootDir = path.getabsolute("Shaders/", Game.projectsDir) local sourceDir = path.getabsolute("Shaders/", rootDir) diff --git a/Submodules/Engine b/Submodules/Engine index 9cab1eaa..eeac0872 160000 --- a/Submodules/Engine +++ b/Submodules/Engine @@ -1 +1 @@ -Subproject commit 9cab1eaaff73c2fe159da573e992e846c529bf25 +Subproject commit eeac087200d5b855251ddf41f0f21d012b0f0073