From db0ec4094846b56ce825cb8f266022c262646298 Mon Sep 17 00:00:00 2001 From: Antoine Pilote Date: Wed, 4 Sep 2024 00:30:35 -0400 Subject: [PATCH] Moved project out of engine.h --- Nuake/Engine.cpp | 5 ++- Nuake/Engine.h | 5 ++- Nuake/src/Core/OS.cpp | 4 +- Nuake/src/FileSystem/FileSystem.cpp | 1 + Nuake/src/Physics/DynamicWorld.cpp | 8 +--- Nuake/src/Physics/DynamicWorld.h | 2 - Nuake/src/Physics/GhostObject.cpp | 46 --------------------- Nuake/src/Physics/GhostObject.h | 29 ------------- Nuake/src/Physics/PhysicsManager.cpp | 5 --- Nuake/src/Physics/PhysicsManager.h | 1 - Nuake/src/Rendering/SceneRenderer.cpp | 5 ++- Nuake/src/Resource/FGD/FGDFile.cpp | 1 + Nuake/src/Scene/Components/TriggerZone.h | 26 ++++-------- Nuake/src/Scene/EditorCamera.cpp | 1 + Nuake/src/Scene/Systems/QuakeMapBuilder.cpp | 11 +++-- Nuake/src/Scripting/Modules/SceneModule.h | 4 +- Nuake/src/UI/ImUI.cpp | 4 +- Nuake/src/Window.cpp | 6 +-- 18 files changed, 41 insertions(+), 123 deletions(-) delete mode 100644 Nuake/src/Physics/GhostObject.cpp delete mode 100644 Nuake/src/Physics/GhostObject.h diff --git a/Nuake/Engine.cpp b/Nuake/Engine.cpp index 805198a3..cb59907d 100644 --- a/Nuake/Engine.cpp +++ b/Nuake/Engine.cpp @@ -1,6 +1,8 @@ #include "Engine.h" + +#include "src/Scene/Scene.h" +#include "src/Resource/Project.h" #include "src/Physics/PhysicsManager.h" -#include #include "src/AI/NavManager.h" #include "src/Audio/AudioManager.h" @@ -13,6 +15,7 @@ #include "src/Threading/JobSystem.h" #include "src/Modules/Modules.h" +#include #include #include #include diff --git a/Nuake/Engine.h b/Nuake/Engine.h index cd095941..3fc3e760 100644 --- a/Nuake/Engine.h +++ b/Nuake/Engine.h @@ -2,12 +2,13 @@ #include "src/Core/Core.h" #include "src/Core/Logger.h" #include "src/Window.h" -#include "src/Scene/Scene.h" -#include "src/Resource/Project.h" // Welcome to the Nuake source code. namespace Nuake { + class Project; + class Scene; + enum GameState { Playing, diff --git a/Nuake/src/Core/OS.cpp b/Nuake/src/Core/OS.cpp index 733a3bb3..03a91b2f 100644 --- a/Nuake/src/Core/OS.cpp +++ b/Nuake/src/Core/OS.cpp @@ -1,7 +1,9 @@ #include "OS.h" -#include "src/Window.h" #include "Engine.h" +#include "src/Resource/Project.h" +#include "src/Window.h" +#include "src/Core/String.h" #ifdef NK_WIN #define GLFW_EXPOSE_NATIVE_WIN32 diff --git a/Nuake/src/FileSystem/FileSystem.cpp b/Nuake/src/FileSystem/FileSystem.cpp index 993afc51..1220067a 100644 --- a/Nuake/src/FileSystem/FileSystem.cpp +++ b/Nuake/src/FileSystem/FileSystem.cpp @@ -2,6 +2,7 @@ #include "Engine.h" #include "src/Core/OS.h" +#include "src/Core/String.h" #include "Directory.h" #include "File.h" diff --git a/Nuake/src/Physics/DynamicWorld.cpp b/Nuake/src/Physics/DynamicWorld.cpp index ddb53392..bc92c39c 100644 --- a/Nuake/src/Physics/DynamicWorld.cpp +++ b/Nuake/src/Physics/DynamicWorld.cpp @@ -4,7 +4,8 @@ #include "src/Core/Core.h" #include "src/Core/Logger.h" #include "src/Core/Maths.h" -#include +#include "src/Resource/Project.h" +#include "src/Physics/PhysicsShapes.h" #include "src/Scene/Components/TransformComponent.h" #include "src/Scene/Components/CharacterControllerComponent.h" @@ -417,11 +418,6 @@ namespace Nuake } } - void DynamicWorld::AddGhostbody(Ref gb) - { - - } - void DynamicWorld::AddCharacterController(Ref cc) { JPH::Ref settings = new JPH::CharacterVirtualSettings(); diff --git a/Nuake/src/Physics/DynamicWorld.h b/Nuake/src/Physics/DynamicWorld.h index 9ab03032..0b6f06d8 100644 --- a/Nuake/src/Physics/DynamicWorld.h +++ b/Nuake/src/Physics/DynamicWorld.h @@ -7,7 +7,6 @@ #include #include "RaycastResult.h" -#include #include "CharacterController.h" #include "CollisionData.h" @@ -72,7 +71,6 @@ namespace Nuake void SetGravity(const Vector3& g); void AddRigidbody(Ref rb); - void AddGhostbody(Ref gb); void AddCharacterController(Ref cc); bool IsCharacterGrounded(const Entity& entity); Vector3 GetCharacterGroundVelocity(const Entity& entity); diff --git a/Nuake/src/Physics/GhostObject.cpp b/Nuake/src/Physics/GhostObject.cpp deleted file mode 100644 index 73dcb821..00000000 --- a/Nuake/src/Physics/GhostObject.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include "GhostObject.h" - -#include "src/Physics/PhysicsManager.h" - -namespace Nuake -{ - GhostObject::GhostObject(Vector3 position, Ref shape) - { - m_OverlappingEntities = std::vector(); - } - - int GhostObject::OverlappingCount() - { - return 0; - } - - void GhostObject::ClearOverlappingList() - { - m_OverlappingEntities.clear(); - } - - void GhostObject::SetEntityID(Entity ent) - { - } - - void GhostObject::ScanOverlap() - { - ClearOverlappingList(); - - for (int i = 0; i < OverlappingCount(); i++) - { - int index =0; - if (index == -1) - continue; - - Entity handle = Engine::GetCurrentScene()->GetEntity(index); - m_OverlappingEntities.push_back(handle); - } - } - - std::vector GhostObject::GetOverlappingEntities() - { - return m_OverlappingEntities; - } - -} diff --git a/Nuake/src/Physics/GhostObject.h b/Nuake/src/Physics/GhostObject.h deleted file mode 100644 index fd01ffc8..00000000 --- a/Nuake/src/Physics/GhostObject.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once -#include "src/Core/Core.h" -#include "src/Core/Maths.h" -#include "PhysicsShapes.h" - -#include -#include - - - -namespace Nuake -{ - class GhostObject { - private: - std::vector m_OverlappingEntities; - - public: - GhostObject(Vector3 position, Ref shape); - - int OverlappingCount(); - void ClearOverlappingList(); - void ScanOverlap(); - - void SetEntityID(Entity ent); - - std::vector GetOverlappingEntities(); - - }; -} diff --git a/Nuake/src/Physics/PhysicsManager.cpp b/Nuake/src/Physics/PhysicsManager.cpp index db271d68..87a41da0 100644 --- a/Nuake/src/Physics/PhysicsManager.cpp +++ b/Nuake/src/Physics/PhysicsManager.cpp @@ -17,11 +17,6 @@ namespace Nuake m_World->AddRigidbody(rb); } - void PhysicsManager::RegisterGhostBody(Ref rb) - { - m_World->AddGhostbody(rb); - } - void PhysicsManager::RegisterCharacterController(Ref cc) { m_World->AddCharacterController(cc); diff --git a/Nuake/src/Physics/PhysicsManager.h b/Nuake/src/Physics/PhysicsManager.h index 901a6b86..37745732 100644 --- a/Nuake/src/Physics/PhysicsManager.h +++ b/Nuake/src/Physics/PhysicsManager.h @@ -56,7 +56,6 @@ namespace Nuake const std::vector GetCollisions(); void RegisterBody(Ref rb); - void RegisterGhostBody(Ref rb); void RegisterCharacterController(Ref c); void SetBodyTransform(const Entity& entity, const Vector3& position, const Quat& rotation); diff --git a/Nuake/src/Rendering/SceneRenderer.cpp b/Nuake/src/Rendering/SceneRenderer.cpp index f3ab0b02..2f75d23a 100644 --- a/Nuake/src/Rendering/SceneRenderer.cpp +++ b/Nuake/src/Rendering/SceneRenderer.cpp @@ -1,14 +1,15 @@ #include "SceneRenderer.h" -#include "src/Rendering/Shaders/ShaderManager.h" +#include "src/Rendering/Shaders/ShaderManager.h" +#include "src/Resource/Project.h" #include "src/Scene/Components/BSPBrushComponent.h" #include "src/Scene/Components/ModelComponent.h" #include "src/Scene/Components/ParentComponent.h" #include "src/Scene/Components/ParticleEmitterComponent.h" #include "src/Scene/Components/SpriteComponent.h" +#include #include -#include #include #include diff --git a/Nuake/src/Resource/FGD/FGDFile.cpp b/Nuake/src/Resource/FGD/FGDFile.cpp index 2b49a989..94afaa3e 100644 --- a/Nuake/src/Resource/FGD/FGDFile.cpp +++ b/Nuake/src/Resource/FGD/FGDFile.cpp @@ -2,6 +2,7 @@ #include #include "src/FileSystem/FileSystem.h" #include "Engine.h" +#include "src/Resource/Project.h" namespace Nuake { FGDFile::FGDFile(const std::string path) diff --git a/Nuake/src/Scene/Components/TriggerZone.h b/Nuake/src/Scene/Components/TriggerZone.h index f2d27cf8..8c07debb 100644 --- a/Nuake/src/Scene/Components/TriggerZone.h +++ b/Nuake/src/Scene/Components/TriggerZone.h @@ -1,11 +1,12 @@ #pragma once -#include "src/Physics/GhostObject.h" + #include -namespace Nuake { - class TriggerZone { +namespace Nuake +{ + class TriggerZone + { public: - Ref m_GhostObject; std::string target = ""; std::vector Targets; @@ -16,23 +17,10 @@ namespace Nuake { Targets = std::vector(); } - int GetOverLappingCount() + std::vector GetTargets() { - if (!Enabled) return 0; - - return m_GhostObject->OverlappingCount(); - } - - std::vector GetTargets() { return Targets; } - - std::vector GetOverlappingBodies() - { - if (!Enabled) - return std::vector(); - - return m_GhostObject->GetOverlappingEntities(); - } + }; } diff --git a/Nuake/src/Scene/EditorCamera.cpp b/Nuake/src/Scene/EditorCamera.cpp index 09658010..c5b2b844 100644 --- a/Nuake/src/Scene/EditorCamera.cpp +++ b/Nuake/src/Scene/EditorCamera.cpp @@ -6,6 +6,7 @@ #include "src/Core/Logger.h" #include #include +#include "src/Resource/Project.h" namespace Nuake { diff --git a/Nuake/src/Scene/Systems/QuakeMapBuilder.cpp b/Nuake/src/Scene/Systems/QuakeMapBuilder.cpp index 914b207c..1d49ac55 100644 --- a/Nuake/src/Scene/Systems/QuakeMapBuilder.cpp +++ b/Nuake/src/Scene/Systems/QuakeMapBuilder.cpp @@ -1,5 +1,8 @@ #include "QuakeMapBuilder.h" +#include "Engine.h" +#include "src/Resource/Project.h" + #include "src/Rendering/Mesh/Mesh.h" #include "src/FileSystem/FileSystem.h" #include "src/Core/String.h" @@ -24,12 +27,14 @@ extern "C" { #include "src/Scene/Components/WrenScriptComponent.h" #include "src/Scene/Components/PrefabComponent.h" #include "src/Scene/Components/ModelComponent.h" - -#include -#include #include #include #include +#include + +#include +#include + namespace Nuake { struct ProcessedMesh diff --git a/Nuake/src/Scripting/Modules/SceneModule.h b/Nuake/src/Scripting/Modules/SceneModule.h index 3504ebfa..a96a35df 100644 --- a/Nuake/src/Scripting/Modules/SceneModule.h +++ b/Nuake/src/Scripting/Modules/SceneModule.h @@ -423,7 +423,7 @@ namespace Nuake TriggerZone trigger = ent.GetComponent(); - int count = trigger.GetOverLappingCount(); + int count = 0; wrenSetSlotDouble(vm, 0, count); } @@ -435,7 +435,7 @@ namespace Nuake TriggerZone trigger = ent.GetComponent(); - std::vector entities = trigger.GetOverlappingBodies(); + std::vector entities = {}; wrenEnsureSlots(vm, static_cast(entities.size())); diff --git a/Nuake/src/UI/ImUI.cpp b/Nuake/src/UI/ImUI.cpp index 2c018043..23792414 100644 --- a/Nuake/src/UI/ImUI.cpp +++ b/Nuake/src/UI/ImUI.cpp @@ -1,6 +1,8 @@ #include "ImUI.h" +#include "Engine.h" +#include "src/Resource/Project.h" + #include -#include namespace Nuake { diff --git a/Nuake/src/Window.cpp b/Nuake/src/Window.cpp index 5035ae4a..de4fe39c 100644 --- a/Nuake/src/Window.cpp +++ b/Nuake/src/Window.cpp @@ -1,10 +1,8 @@ #include "Window.h" -#include -#include - #include "Engine.h" +#include "src/Resource/Project.h" #include "src/Core/Maths.h" #include "src/Rendering/Renderer.h" #include "src/Rendering/Buffers/Framebuffer.h" @@ -12,6 +10,8 @@ #include "src/Resource/StaticResources.h" +#include +#include #include #include #include