From 6e38bf2c249ebcd6b6d96bb81c64a3ede2c0c8ab Mon Sep 17 00:00:00 2001 From: emerycp Date: Tue, 1 Aug 2023 11:57:26 -0400 Subject: [PATCH 01/14] NK92 - Search crawling Do a Log for now. --- Nuake/src/Core/FileSystem.cpp | 10 ++++++++++ Nuake/src/Core/FileSystem.h | 1 + Nuake/src/Core/String.cpp | 13 +++++++++++++ Nuake/src/Core/String.h | 1 + 4 files changed, 25 insertions(+) diff --git a/Nuake/src/Core/FileSystem.cpp b/Nuake/src/Core/FileSystem.cpp index c2ed7bac..9dcab855 100644 --- a/Nuake/src/Core/FileSystem.cpp +++ b/Nuake/src/Core/FileSystem.cpp @@ -228,5 +228,15 @@ namespace Nuake const auto& split = String::Split(path, '\\'); return String::Split(split[split.size() - 1], '.')[0]; } + + void FileSystem::SearchFilesWithKeyword(const std::string& keyword, const std::string& directory) { + const std::string& sanitizedKeyword = String::Sanitize(keyword); + for (const auto& entry : std::filesystem::recursive_directory_iterator(directory)) { + if (entry.is_regular_file() && entry.path().filename().string().find(sanitizedKeyword) != std::string::npos) { + std::cout << entry.path() << std::endl; + } + } + } + } diff --git a/Nuake/src/Core/FileSystem.h b/Nuake/src/Core/FileSystem.h index f337058f..5a7ea8f4 100644 --- a/Nuake/src/Core/FileSystem.h +++ b/Nuake/src/Core/FileSystem.h @@ -34,6 +34,7 @@ namespace Nuake static Ref GetFileTree(); static Ref GetFile(const std::string& path); static std::string GetFileNameFromPath(const std::string& path); + static void FileSystem::SearchFilesWithKeyword(const std::string& keyword, const std::string& directory); static void ScanDirectory(Ref directory); static void GetDirectories(); diff --git a/Nuake/src/Core/String.cpp b/Nuake/src/Core/String.cpp index 7c4ccc5a..cd68caf7 100644 --- a/Nuake/src/Core/String.cpp +++ b/Nuake/src/Core/String.cpp @@ -1,5 +1,6 @@ #include "String.h" #include +#include #include namespace Nuake @@ -36,6 +37,18 @@ namespace Nuake return result; } + std::string String::Sanitize(const std::string& keyword) { + std::string sanitizedKeyword = keyword; + + // Remove spaces, underscores, and hyphens using regex + sanitizedKeyword = std::regex_replace(sanitizedKeyword, std::regex("[ _-]+"), ""); + + // Convert to lowercase + std::transform(sanitizedKeyword.begin(), sanitizedKeyword.end(), sanitizedKeyword.begin(), ::tolower); + + return sanitizedKeyword; + } + std::vector String::Split(const std::string& string, char delimiter) { std::vector result; diff --git a/Nuake/src/Core/String.h b/Nuake/src/Core/String.h index be3f6aa7..c3b55e17 100644 --- a/Nuake/src/Core/String.h +++ b/Nuake/src/Core/String.h @@ -15,6 +15,7 @@ namespace Nuake static bool EndsWith(const std::string& string, const std::string& end); static bool IsDigit(const char& character); static std::string RemoveWhiteSpace(const std::string& string); + static std::string Sanitize(const std::string& keyword); static std::vector Split(const std::string& string, char delimiter); static float ToFloat(const std::string& string); From ff82a185871fe84b1ba4de37d1f7d1c79c18ff93 Mon Sep 17 00:00:00 2001 From: emerycp Date: Tue, 1 Aug 2023 14:28:17 -0400 Subject: [PATCH 02/14] NK-92 - Update file system --- Editor/src/Windows/FileSystemUI.cpp | 16 ++++++++++++++++ Editor/src/Windows/FileSystemUI.h | 1 + Nuake/src/Core/FileSystem.cpp | 25 ++++++++++++++----------- Nuake/src/Core/FileSystem.h | 3 ++- 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/Editor/src/Windows/FileSystemUI.cpp b/Editor/src/Windows/FileSystemUI.cpp index 2e10a976..68ae7a99 100644 --- a/Editor/src/Windows/FileSystemUI.cpp +++ b/Editor/src/Windows/FileSystemUI.cpp @@ -583,6 +583,22 @@ namespace Nuake const uint32_t numButtonAfterPathBrowser = 2; ImGui::SameLine(); + char buffer[256]; + memset(buffer, 0, sizeof(buffer)); + std::strncpy(buffer, m_searchKeyWord.c_str(), sizeof(buffer)); + + if (ImGui::InputTextWithHint("##Search", "Asset search & filter ..", buffer, sizeof(buffer))) + { + m_searchKeyWord = std::string(buffer); + FileSystem::FilteredDirectories = FileSystem::SearchFilesWithKeyword(m_searchKeyWord, FileSystem::RootDirectory->fullPath); + RefreshFileBrowser(); + + // TODO: Fix when creating a new file + } + + + ImGui::SameLine(); + ImGui::PushStyleColor(ImGuiCol_ChildBg, colors[ImGuiCol_TitleBgCollapsed]); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0)); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(4, 4)); diff --git a/Editor/src/Windows/FileSystemUI.h b/Editor/src/Windows/FileSystemUI.h index 9090aa85..514748fa 100644 --- a/Editor/src/Windows/FileSystemUI.h +++ b/Editor/src/Windows/FileSystemUI.h @@ -12,6 +12,7 @@ namespace Nuake { public: static Ref m_CurrentDirectory; bool m_hasClickedOnFile; + std::string m_searchKeyWord; FileSystemUI(EditorInterface* editor) { diff --git a/Nuake/src/Core/FileSystem.cpp b/Nuake/src/Core/FileSystem.cpp index 9dcab855..cd362270 100644 --- a/Nuake/src/Core/FileSystem.cpp +++ b/Nuake/src/Core/FileSystem.cpp @@ -57,6 +57,7 @@ namespace Nuake std::string FileSystem::Root = ""; Ref FileSystem::RootDirectory; + std::vector FileSystem::FilteredDirectories; void FileSystem::ScanDirectory(Ref directory) { @@ -75,15 +76,15 @@ namespace Nuake } else if (entry.is_regular_file()) { - std::string absolutePath = entry.path().string(); - std::string name = entry.path().filename().string(); - std::string extension = entry.path().extension().string(); - Ref newFile = CreateRef(directory, absolutePath, name, extension); - //newFile->Type = entry.path().extension().string(); - //newFile->name = entry.path().filename().string(); - //newFile->Parent = directory; - //newFile->fullPath = entry.path().string(); - directory->Files.push_back(newFile); + std::filesystem::path currentPath = entry.path(); + if (FilteredDirectories.empty() || std::find(FilteredDirectories.begin(), FilteredDirectories.end(), currentPath) != FilteredDirectories.end()) + { + std::string absolutePath = currentPath.string(); + std::string name = currentPath.filename().string(); + std::string extension = currentPath.extension().string(); + Ref newFile = CreateRef(directory, absolutePath, name, extension); + directory->Files.push_back(newFile); + } } } } @@ -229,13 +230,15 @@ namespace Nuake return String::Split(split[split.size() - 1], '.')[0]; } - void FileSystem::SearchFilesWithKeyword(const std::string& keyword, const std::string& directory) { + std::vector FileSystem::SearchFilesWithKeyword(const std::string& keyword, const std::string& directory) { + std::vector result; const std::string& sanitizedKeyword = String::Sanitize(keyword); for (const auto& entry : std::filesystem::recursive_directory_iterator(directory)) { if (entry.is_regular_file() && entry.path().filename().string().find(sanitizedKeyword) != std::string::npos) { - std::cout << entry.path() << std::endl; + result.push_back(entry.path()); } } + return result; } diff --git a/Nuake/src/Core/FileSystem.h b/Nuake/src/Core/FileSystem.h index 5a7ea8f4..f9771bbf 100644 --- a/Nuake/src/Core/FileSystem.h +++ b/Nuake/src/Core/FileSystem.h @@ -25,6 +25,7 @@ namespace Nuake static std::string Root; static Ref RootDirectory; + static std::vector FilteredDirectories; static void SetRootDirectory(const std::string path); @@ -34,7 +35,7 @@ namespace Nuake static Ref GetFileTree(); static Ref GetFile(const std::string& path); static std::string GetFileNameFromPath(const std::string& path); - static void FileSystem::SearchFilesWithKeyword(const std::string& keyword, const std::string& directory); + static std::vector FileSystem::SearchFilesWithKeyword(const std::string& keyword, const std::string& directory); static void ScanDirectory(Ref directory); static void GetDirectories(); From f54d64c6dd766989b6a1ca3021a28b857719761c Mon Sep 17 00:00:00 2001 From: Antoine Pilote Date: Tue, 1 Aug 2023 15:15:27 -0400 Subject: [PATCH 03/14] Added sprite component --- Editor/src/ComponentsPanel/SpritePanel.h | 73 +++++++++++++++++++ Editor/src/Windows/EditorSelectionPanel.cpp | 9 +-- Editor/src/Windows/EditorSelectionPanel.h | 4 +- Editor/src/Windows/FileSystemUI.cpp | 18 ++++- .../src/Scene/Components/SpriteComponent.cpp | 53 ++++++++++++++ Nuake/src/Scene/Components/SpriteComponent.h | 24 ++++++ Nuake/src/Scene/Entities/Entity.cpp | 29 +++++--- 7 files changed, 188 insertions(+), 22 deletions(-) create mode 100644 Editor/src/ComponentsPanel/SpritePanel.h create mode 100644 Nuake/src/Scene/Components/SpriteComponent.cpp create mode 100644 Nuake/src/Scene/Components/SpriteComponent.h diff --git a/Editor/src/ComponentsPanel/SpritePanel.h b/Editor/src/ComponentsPanel/SpritePanel.h new file mode 100644 index 00000000..5db42544 --- /dev/null +++ b/Editor/src/ComponentsPanel/SpritePanel.h @@ -0,0 +1,73 @@ +#pragma once +#include "ComponentPanel.h" + +#include +#include +#include +#include + + +class SpritePanel : ComponentPanel +{ +public: + SpritePanel() = default; + ~SpritePanel() = default; + + void Draw(Nuake::Entity entity) override + { + if (!entity.HasComponent()) + { + return; + } + + auto& component = entity.GetComponent(); + BeginComponentTable(SPRITE, Nuake::SpriteComponent); + { + { + ImGui::Text("Sprite"); + ImGui::TableNextColumn(); + + std::string path = component.SpritePath; + ImGui::Button(path.empty() ? "Drag image" : component.SpritePath.c_str(), ImVec2(ImGui::GetContentRegionAvail().x, 0)); + if (ImGui::BeginDragDropTarget()) + { + if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("_Image")) + { + char* file = (char*)payload->Data; + + std::string fullPath = std::string(file, 512); + path = Nuake::FileSystem::AbsoluteToRelative(std::move(fullPath)); + component.SpritePath = path; + + component.LoadSprite(); + } + ImGui::EndDragDropTarget(); + } + + ImGui::TableNextColumn(); + ComponentTableReset(component.LockYRotation, false); + } + ImGui::TableNextColumn(); + { + ImGui::Text("Billboard"); + ImGui::TableNextColumn(); + + ImGui::Checkbox("##billboard", &component.Billboard); + ImGui::TableNextColumn(); + + ComponentTableReset(component.Billboard, false); + } + ImGui::TableNextColumn(); + { + ImGui::Text("Lock Y rotation"); + ImGui::TableNextColumn(); + + ImGui::Checkbox("##lockYRotation", &component.LockYRotation); + ImGui::TableNextColumn(); + + ComponentTableReset(component.LockYRotation, false); + } + } + EndComponentTable(); + } +}; \ No newline at end of file diff --git a/Editor/src/Windows/EditorSelectionPanel.cpp b/Editor/src/Windows/EditorSelectionPanel.cpp index b278e5cc..5822096c 100644 --- a/Editor/src/Windows/EditorSelectionPanel.cpp +++ b/Editor/src/Windows/EditorSelectionPanel.cpp @@ -14,13 +14,6 @@ EditorSelectionPanel::EditorSelectionPanel() { - mTransformPanel = TransformPanel(); - mLightPanel = LightPanel(); - mScriptPanel = ScriptPanel(); - mQuakeMapPanel = QuakeMapPanel(); - mCameraPanel = CameraPanel(); - mRigidbodyPanel = RigidbodyPanel(); - mBoxColliderPanel = BoxColliderPanel(); } void EditorSelectionPanel::ResolveFile(Ref file) @@ -100,6 +93,7 @@ void EditorSelectionPanel::DrawEntity(Nuake::Entity entity) mTransformPanel.Draw(entity); mLightPanel.Draw(entity); mScriptPanel.Draw(entity); + mSpritePanel.Draw(entity); mMeshPanel.Draw(entity); mQuakeMapPanel.Draw(entity); mCameraPanel.Draw(entity); @@ -129,6 +123,7 @@ void EditorSelectionPanel::DrawAddComponentMenu(Nuake::Entity entity) MenuItemComponent("Camera", Nuake::CameraComponent) MenuItemComponent("Light", Nuake::LightComponent) MenuItemComponent("Model", Nuake::ModelComponent) + MenuItemComponent("Sprite", Nuake::SpriteComponent) ImGui::Separator(); MenuItemComponent("Character Controller", Nuake::CharacterControllerComponent) MenuItemComponent("Rigid body", Nuake::RigidBodyComponent) diff --git a/Editor/src/Windows/EditorSelectionPanel.h b/Editor/src/Windows/EditorSelectionPanel.h index 88b2cd7b..847406ad 100644 --- a/Editor/src/Windows/EditorSelectionPanel.h +++ b/Editor/src/Windows/EditorSelectionPanel.h @@ -18,6 +18,8 @@ #include "../ComponentsPanel/SphereColliderPanel.h" #include "../ComponentsPanel/MeshColliderPanel.h" #include "../ComponentsPanel/CharacterControllerPanel.h" +#include "../ComponentsPanel/SpritePanel.h" + class EditorSelectionPanel { private: @@ -33,7 +35,7 @@ private: MeshColliderPanel mMeshColliderPanel; CapsuleColliderPanel mCapsuleColliderPanel; CylinderColliderPanel mCylinderColliderPanel; - + SpritePanel mSpritePanel; CharacterControllerPanel mCharacterControllerPanel; Ref currentFile; diff --git a/Editor/src/Windows/FileSystemUI.cpp b/Editor/src/Windows/FileSystemUI.cpp index 2e10a976..c1af61eb 100644 --- a/Editor/src/Windows/FileSystemUI.cpp +++ b/Editor/src/Windows/FileSystemUI.cpp @@ -211,28 +211,42 @@ namespace Nuake { Editor->Selection = EditorSelection(file); } + } - if (ImGui::BeginDragDropSource()) + if (ImGui::BeginDragDropSource()) { char pathBuffer[256]; std::strncpy(pathBuffer, file->GetAbsolutePath().c_str(), sizeof(pathBuffer)); std::string dragType; if (fileExtension == ".wren") + { dragType = "_Script"; + } else if (fileExtension == ".map") + { dragType = "_Map"; + } else if (fileExtension == ".obj" || fileExtension == ".mdl" || fileExtension == ".gltf" || fileExtension == ".md3" || fileExtension == ".fbx") + { dragType = "_Model"; + } else if (fileExtension == ".interface") + { dragType = "_Interface"; + } else if (fileExtension == ".prefab") + { dragType = "_Prefab"; + } + else if (fileExtension == ".png" || fileExtension == ".jpg") + { + dragType = "_Image"; + } ImGui::SetDragDropPayload(dragType.c_str(), (void*)(pathBuffer), sizeof(pathBuffer)); ImGui::Text(file->GetName().c_str()); ImGui::EndDragDropSource(); } - } const std::string hoverMenuId = std::string("item_hover_menu") + std::to_string(drawId); if (ImGui::IsItemHovered() && ImGui::IsMouseReleased(1)) diff --git a/Nuake/src/Scene/Components/SpriteComponent.cpp b/Nuake/src/Scene/Components/SpriteComponent.cpp new file mode 100644 index 00000000..414d99d3 --- /dev/null +++ b/Nuake/src/Scene/Components/SpriteComponent.cpp @@ -0,0 +1,53 @@ +#include "SpriteComponent.h" + +#include "src/Rendering/Textures/TextureManager.h" + +namespace Nuake +{ + SpriteComponent::SpriteComponent() : + Billboard(false), + LockYRotation(false), + SpritePath("") + { + + } + + bool SpriteComponent::LoadSprite() + { + const auto texture = TextureManager::Get()->GetTexture(SpritePath); + Sprite = texture; + return true; + } + + json SpriteComponent::Serialize() + { + BEGIN_SERIALIZE(); + SERIALIZE_VAL(Billboard) + SERIALIZE_VAL(LockYRotation) + SERIALIZE_VAL(SpritePath) + END_SERIALIZE(); + } + + bool SpriteComponent::Deserialize(const std::string& str) + { + BEGIN_DESERIALIZE(); + + if (j.contains("Billboard")) + { + Billboard = j["Billboard"]; + } + + if (j.contains("LockYRotation")) + { + LockYRotation = j["LockYRotation"]; + } + + if (j.contains("SpritePath")) + { + SpritePath = j["SpritePath"]; + LoadSprite(); + } + + return true; + } +} \ No newline at end of file diff --git a/Nuake/src/Scene/Components/SpriteComponent.h b/Nuake/src/Scene/Components/SpriteComponent.h new file mode 100644 index 00000000..97761f76 --- /dev/null +++ b/Nuake/src/Scene/Components/SpriteComponent.h @@ -0,0 +1,24 @@ +#pragma once +#include "src/Core/Core.h" +#include "src/Resource/Serializable.h" +#include "src/Rendering/Textures/Texture.h" + +namespace Nuake +{ + class SpriteComponent + { + public: + bool Billboard; + bool LockYRotation; + std::string SpritePath; + Ref Sprite; + + SpriteComponent(); + + public: + bool LoadSprite(); + + json Serialize(); + bool Deserialize(const std::string& str); + }; +} diff --git a/Nuake/src/Scene/Entities/Entity.cpp b/Nuake/src/Scene/Entities/Entity.cpp index 30c9583a..87dbca05 100644 --- a/Nuake/src/Scene/Entities/Entity.cpp +++ b/Nuake/src/Scene/Entities/Entity.cpp @@ -1,19 +1,21 @@ -#include "../Components/ParentComponent.h" #include "Entity.h" -#include "../Components/NameComponent.h" -#include "../Components/TransformComponent.h" -#include "../Components/CameraComponent.h" -#include "../Components/QuakeMap.h" -#include "../Components/LightComponent.h" -#include "../Components/QuakeMap.h" -#include "../Components/WrenScriptComponent.h" -#include "../Components/CharacterControllerComponent.h" -#include "../Components/RigidbodyComponent.h" -#include "src/Scene/Components/BSPBrushComponent.h" +#include "src/Scene/Components/ParentComponent.h" +#include "src/Scene/Components/NameComponent.h" +#include "src/Scene/Components/TransformComponent.h" +#include "src/Scene/Components/CameraComponent.h" +#include "src/Scene/Components/QuakeMap.h" +#include "src/Scene/Components/LightComponent.h" +#include "src/Scene/Components/QuakeMap.h" +#include "src/Scene/Components/WrenScriptComponent.h" +#include "src/Scene/Components/CharacterControllerComponent.h" +#include "src/Scene/Components/RigidbodyComponent.h" +#include "src/Scene/Components/BSPBrushComponent.h" #include "src/Scene/Components/Components.h" -#include +#include "src/Scene/Components/BoxCollider.h" #include "src/Scene/Components/CapsuleColliderComponent.h" +#include "src/Scene/Components/SpriteComponent.h" + namespace Nuake { @@ -37,6 +39,8 @@ namespace Nuake SERIALIZE_OBJECT_REF_LBL("VisibilityComponent", GetComponent()) if (HasComponent()) SERIALIZE_OBJECT_REF_LBL("CameraComponent", GetComponent()) + if (HasComponent()) + SERIALIZE_OBJECT_REF_LBL("SpriteComponent", GetComponent()) if (HasComponent()) SERIALIZE_OBJECT_REF_LBL("QuakeMapComponent", GetComponent()) if (HasComponent()) @@ -78,6 +82,7 @@ namespace Nuake } DESERIALIZE_COMPONENT(NameComponent) DESERIALIZE_COMPONENT(ParentComponent) + DESERIALIZE_COMPONENT(SpriteComponent) DESERIALIZE_COMPONENT(CameraComponent) DESERIALIZE_COMPONENT(QuakeMapComponent) DESERIALIZE_COMPONENT(LightComponent) From f7398d0224e829df8fdd7a1be54a3f2476ab50b8 Mon Sep 17 00:00:00 2001 From: Antoine Pilote Date: Tue, 1 Aug 2023 15:15:36 -0400 Subject: [PATCH 04/14] Code cleanup --- Nuake/src/Core/Physics/DynamicWorld.cpp | 2 +- Nuake/src/Rendering/Shaders/Shader.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Nuake/src/Core/Physics/DynamicWorld.cpp b/Nuake/src/Core/Physics/DynamicWorld.cpp index 2db145bc..e3cce79f 100644 --- a/Nuake/src/Core/Physics/DynamicWorld.cpp +++ b/Nuake/src/Core/Physics/DynamicWorld.cpp @@ -331,7 +331,7 @@ namespace Nuake { // Create jolt ray const auto& fromJolt = JPH::Vec3(from.x, from.y, from.z); - const auto& toJolt = JPH::Vec3(to.x, to.y, to.z); + const auto& toJolt = JPH::Vec3(to.x , to.y, to.z); JPH::RayCast ray { fromJolt, toJolt - fromJolt }; JPH::AllHitCollisionCollector collector; _JoltPhysicsSystem->GetBroadPhaseQuery().CastRay(ray, collector); diff --git a/Nuake/src/Rendering/Shaders/Shader.cpp b/Nuake/src/Rendering/Shaders/Shader.cpp index 895eb8c5..17a7fa2d 100644 --- a/Nuake/src/Rendering/Shaders/Shader.cpp +++ b/Nuake/src/Rendering/Shaders/Shader.cpp @@ -26,6 +26,8 @@ namespace Nuake Source = newSource; ProgramId = newProgramId; + + return true; } // Bind the shader From fe9f69143982b787a1abfe18497d531f800e0d5e Mon Sep 17 00:00:00 2001 From: Antoine Pilote Date: Tue, 1 Aug 2023 15:15:53 -0400 Subject: [PATCH 05/14] Added billboard calculation --- Nuake/src/Rendering/Renderer.cpp | 40 +++++++++--------------- Nuake/src/Rendering/Renderer.h | 1 + Nuake/src/Rendering/SceneRenderer.cpp | 45 ++++++++++++++++++++++++--- 3 files changed, 55 insertions(+), 31 deletions(-) diff --git a/Nuake/src/Rendering/Renderer.cpp b/Nuake/src/Rendering/Renderer.cpp index 25f86f4f..92c61628 100644 --- a/Nuake/src/Rendering/Renderer.cpp +++ b/Nuake/src/Rendering/Renderer.cpp @@ -22,6 +22,7 @@ namespace Nuake unsigned int depthFBO; Ref Renderer::CubeMesh; + Ref Renderer::QuadMesh; Shader* Renderer::m_Shader; Shader* Renderer::m_SkyboxShader; @@ -62,13 +63,14 @@ namespace Nuake 4, 5, 0, 0, 5, 1 }; - float QuadVertices[] = { - -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, - 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, - -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, - 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, - -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, - 1.0f, 1.0f, 0.0f, 1.0f, 1.0f + std::vector QuadVertices + { + { Vector3(-1.0f, -1.0f, 0.0f), Vector2(0, 0), Vector3(0, 0, -1) }, + { Vector3(1.0f, 1.0f, 0.0f), Vector2(1.0f, 1.0f), Vector3(0, 0, -1) }, + { Vector3(-1.0f, 1.0f, 0.0f), Vector2(0.0f, 1.0f), Vector3(0, 0, -1) }, + { Vector3(1.0f, -1.0f, 0.0f), Vector2(1.0f, 0.0f), Vector3(0, 0, -1) }, + { Vector3(-1.0f, -1.0f, 0.0f), Vector2(0.0f, 0.0f), Vector3(0, 0, -1) }, + { Vector3(1.0f, 1.0f, 0.0f), Vector2(1.0f, 1.0f), Vector3(0, 0, -1) } }; @@ -84,24 +86,10 @@ namespace Nuake CubeMesh = CreateRef(); CubeMesh->AddSurface(CubeVertices, CubeIndices); CubeMesh->SetMaterial(material); - // Cube buffer - //CubeVertexArray = new VertexArray(); - //CubeVertexArray->Bind(); - //CubeVertexBuffer = new VertexBuffer(CubeVertices, sizeof(CubeVertices)); - // - VertexBufferLayout vblayout = VertexBufferLayout(); - vblayout.Push(3); - //CubeVertexArray->AddBuffer(*CubeVertexBuffer, vblayout); - // Quad buffer - QuadVertexArray = new VertexArray(); - QuadVertexArray->Bind(); - QuadVertexBuffer = new VertexBuffer(QuadVertices, sizeof(QuadVertices)); - - vblayout = VertexBufferLayout(); - vblayout.Push(3); - vblayout.Push(2); - QuadVertexArray->AddBuffer(*QuadVertexBuffer, vblayout); + QuadMesh = CreateRef(); + QuadMesh->AddSurface(QuadVertices, { 0, 1, 2, 3, 4, 5 }); + QuadMesh->SetMaterial(material); } void Renderer::LoadShaders() @@ -221,7 +209,7 @@ namespace Nuake m_DebugShader->SetUniformMat4f("u_Model", transform.GetGlobalTransform()); m_DebugShader->SetUniform4f("u_Color", color.r, color.g, color.b, color.a); - CubeVertexArray->Bind(); + CubeMesh->Bind(); RenderCommand::DrawArrays(0, 36); } @@ -233,7 +221,7 @@ namespace Nuake void Renderer::DrawQuad(Matrix4 transform) { - QuadVertexArray->Bind(); + QuadMesh->Bind(); RenderCommand::DrawArrays(0, 6); } } diff --git a/Nuake/src/Rendering/Renderer.h b/Nuake/src/Rendering/Renderer.h index 847e3b86..2cde2df3 100644 --- a/Nuake/src/Rendering/Renderer.h +++ b/Nuake/src/Rendering/Renderer.h @@ -51,6 +51,7 @@ namespace Nuake static Ref m_LightsUniformBuffer; static Ref CubeMesh; + static Ref QuadMesh; static void Init(); static void LoadShaders(); diff --git a/Nuake/src/Rendering/SceneRenderer.cpp b/Nuake/src/Rendering/SceneRenderer.cpp index 486beb1f..05f0b606 100644 --- a/Nuake/src/Rendering/SceneRenderer.cpp +++ b/Nuake/src/Rendering/SceneRenderer.cpp @@ -1,7 +1,9 @@ #include "SceneRenderer.h" #include "src/Rendering/Shaders/ShaderManager.h" -#include +#include "src/Scene/Components/BSPBrushComponent.h" +#include "src/Scene/Components/SpriteComponent.h" + #include namespace Nuake @@ -208,16 +210,18 @@ namespace Nuake mGBuffer->Bind(); mGBuffer->Clear(); { + // Init RenderCommand::Enable(RendererEnum::FACE_CULL); Shader* gBufferShader = ShaderManager::GetShader("resources/Shaders/gbuffer.shader"); gBufferShader->Bind(); gBufferShader->SetUniformMat4f("u_Projection", mProjection); gBufferShader->SetUniformMat4f("u_View", mView); - auto view = scene.m_Registry.view(); + // Models + auto view = scene.m_Registry.view(); for (auto e : view) { - auto [transform, mesh, parent, visibility] = view.get(e); + auto [transform, mesh, visibility] = view.get(e); if (mesh.ModelResource && visibility.Visible) { @@ -232,10 +236,11 @@ namespace Nuake RenderCommand::Disable(RendererEnum::FACE_CULL); Renderer::Flush(gBufferShader, false); - auto quakeView = scene.m_Registry.view(); + // Quake BSPs + auto quakeView = scene.m_Registry.view(); for (auto e : quakeView) { - auto [transform, model, parent, visibility] = quakeView.get(e); + auto [transform, model, visibility] = quakeView.get(e); if (model.IsTransparent || !visibility.Visible) continue; @@ -246,6 +251,36 @@ namespace Nuake } } Renderer::Flush(gBufferShader, false); + + // Sprites + auto spriteView = scene.m_Registry.view(); + for (auto e : spriteView) + { + auto [transform, sprite, visibility] = spriteView.get(e); + + if (!visibility.Visible) + continue; + + auto finalQuadTransform = transform.GetGlobalTransform(); + if (sprite.Billboard) + { + Matrix4 finalMatrix; + finalQuadTransform = glm::inverse(mView); + + if (sprite.LockYRotation) + { + finalQuadTransform[1] = Vector4(0, 1, 0, 0); + finalQuadTransform[2] = Vector4(finalQuadTransform[2][0], 0, finalQuadTransform[2][2], 0); + finalQuadTransform = finalQuadTransform; + //finalQuadTransform[1] = Vector4(0, 1, 0, 1); + } + + finalQuadTransform[3] = Vector4(transform.GetGlobalPosition(), 1.0f); + } + + Renderer::SubmitMesh(Renderer::QuadMesh, finalQuadTransform, (uint32_t)e); + } + Renderer::Flush(gBufferShader, false); } } From b114d27ce2b562c70492a95be69e04efb522d637 Mon Sep 17 00:00:00 2001 From: emerycp Date: Tue, 1 Aug 2023 17:16:48 -0400 Subject: [PATCH 06/14] NK-92 - Fix when creating a new file --- Editor/src/Windows/FileSystemUI.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Editor/src/Windows/FileSystemUI.cpp b/Editor/src/Windows/FileSystemUI.cpp index 68ae7a99..0c213fcc 100644 --- a/Editor/src/Windows/FileSystemUI.cpp +++ b/Editor/src/Windows/FileSystemUI.cpp @@ -593,7 +593,10 @@ namespace Nuake FileSystem::FilteredDirectories = FileSystem::SearchFilesWithKeyword(m_searchKeyWord, FileSystem::RootDirectory->fullPath); RefreshFileBrowser(); - // TODO: Fix when creating a new file + if(m_searchKeyWord.empty()) + { + FileSystem::FilteredDirectories.clear(); + } } From 3ee0413e8ad55612f58c4c9bf0f8e3f821326c1c Mon Sep 17 00:00:00 2001 From: Antoine Pilote Date: Tue, 1 Aug 2023 18:49:38 -0400 Subject: [PATCH 07/14] Added alpha scisorring --- Editor/resources/Shaders/gbuffer.shader | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Editor/resources/Shaders/gbuffer.shader b/Editor/resources/Shaders/gbuffer.shader index 9d7aa722..6b0a7aa7 100644 --- a/Editor/resources/Shaders/gbuffer.shader +++ b/Editor/resources/Shaders/gbuffer.shader @@ -23,7 +23,6 @@ void main() //T = normalize(T - dot(T, N) * N); //vec3 B = cross(N, T); - vec3 T = normalize((u_Model * vec4(Tangent, 0.0f)).xyz); vec3 N = normalize((u_Model * vec4(Normal, 0.0f)).xyz); vec3 B = normalize((u_Model * vec4(Bitangent, 0.0f)).xyz); @@ -83,10 +82,17 @@ void main() // Albedo gAlbedo = vec4(m_AlbedoColor, 1.0); if (u_HasAlbedo == 1) - gAlbedo.rgb = texture(m_Albedo, UV).rgb; + { + vec4 albedoSample = texture(m_Albedo, UV); + gAlbedo.rgb = albedoSample.rgb * m_AlbedoColor.rgb; + gAlbedo.a = albedoSample.a; + + if (albedoSample.a < 0.1f) + { + discard; + } + } - gAlbedo.rgb = texture(m_Albedo, UV).rgb * m_AlbedoColor.rgb; - // Material float finalMetalness = u_MetalnessValue; if (u_HasMetalness == 1) From b69d71d0ebb9261f00b75c747a0b9dd9848afd5e Mon Sep 17 00:00:00 2001 From: Antoine Pilote Date: Tue, 1 Aug 2023 18:49:51 -0400 Subject: [PATCH 08/14] Removed unused code --- Nuake/src/Rendering/Renderer.h | 2 +- Nuake/src/Rendering/Textures/MaterialManager.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Nuake/src/Rendering/Renderer.h b/Nuake/src/Rendering/Renderer.h index 2cde2df3..76c86b28 100644 --- a/Nuake/src/Rendering/Renderer.h +++ b/Nuake/src/Rendering/Renderer.h @@ -33,6 +33,7 @@ namespace Nuake { private: static RenderList m_RenderList; + public: static VertexArray* QuadVertexArray; static VertexBuffer* QuadVertexBuffer; @@ -66,7 +67,6 @@ namespace Nuake // Lights static std::vector m_Lights; - static void RegisterLight(TransformComponent transform, LightComponent light); static void RegisterDeferredLight(TransformComponent transform, LightComponent light); // Debug diff --git a/Nuake/src/Rendering/Textures/MaterialManager.h b/Nuake/src/Rendering/Textures/MaterialManager.h index 525493fa..1495512d 100644 --- a/Nuake/src/Rendering/Textures/MaterialManager.h +++ b/Nuake/src/Rendering/Textures/MaterialManager.h @@ -29,7 +29,6 @@ namespace Nuake void LoadMaterials(); - void RegisterMaterial(Ref material); Ref LoadMaterial(std::string path); From e5603c51119d0022fb055c42a248057b62400377 Mon Sep 17 00:00:00 2001 From: Antoine Pilote Date: Tue, 1 Aug 2023 18:50:04 -0400 Subject: [PATCH 09/14] Added sprite mesh --- Nuake/src/Rendering/SceneRenderer.cpp | 13 +++++++----- .../src/Scene/Components/SpriteComponent.cpp | 21 +++++++++++++++++-- Nuake/src/Scene/Components/SpriteComponent.h | 3 ++- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/Nuake/src/Rendering/SceneRenderer.cpp b/Nuake/src/Rendering/SceneRenderer.cpp index 05f0b606..17468d53 100644 --- a/Nuake/src/Rendering/SceneRenderer.cpp +++ b/Nuake/src/Rendering/SceneRenderer.cpp @@ -258,27 +258,30 @@ namespace Nuake { auto [transform, sprite, visibility] = spriteView.get(e); - if (!visibility.Visible) + if (!visibility.Visible || !sprite.SpriteMesh) continue; - auto finalQuadTransform = transform.GetGlobalTransform(); + auto& finalQuadTransform = transform.GetGlobalTransform(); if (sprite.Billboard) { - Matrix4 finalMatrix; finalQuadTransform = glm::inverse(mView); if (sprite.LockYRotation) { + // This locks the pitch rotation on the billboard, useful for trees, lamps, etc. finalQuadTransform[1] = Vector4(0, 1, 0, 0); finalQuadTransform[2] = Vector4(finalQuadTransform[2][0], 0, finalQuadTransform[2][2], 0); finalQuadTransform = finalQuadTransform; - //finalQuadTransform[1] = Vector4(0, 1, 0, 1); } + // Translation finalQuadTransform[3] = Vector4(transform.GetGlobalPosition(), 1.0f); + + // Scale + finalQuadTransform = glm::scale(finalQuadTransform, transform.GetGlobalScale()); } - Renderer::SubmitMesh(Renderer::QuadMesh, finalQuadTransform, (uint32_t)e); + Renderer::SubmitMesh(sprite.SpriteMesh, finalQuadTransform, (uint32_t)e); } Renderer::Flush(gBufferShader, false); } diff --git a/Nuake/src/Scene/Components/SpriteComponent.cpp b/Nuake/src/Scene/Components/SpriteComponent.cpp index 414d99d3..db0fdad0 100644 --- a/Nuake/src/Scene/Components/SpriteComponent.cpp +++ b/Nuake/src/Scene/Components/SpriteComponent.cpp @@ -1,6 +1,9 @@ #include "SpriteComponent.h" +#include "src/Core/FileSystem.h" #include "src/Rendering/Textures/TextureManager.h" +#include "src/Rendering/Textures/MaterialManager.h" +#include "src/Rendering/Vertex.h" namespace Nuake { @@ -14,8 +17,22 @@ namespace Nuake bool SpriteComponent::LoadSprite() { - const auto texture = TextureManager::Get()->GetTexture(SpritePath); - Sprite = texture; + std::vector quadVertices = + { + { Vector3(-1.0f, -1.0f, 0.0f), Vector2(0, 0), Vector3(0, 0, -1) }, + { Vector3(1.0f, 1.0f, 0.0f), Vector2(1.0f, 1.0f), Vector3(0, 0, -1) }, + { Vector3(-1.0f, 1.0f, 0.0f), Vector2(0.0f, 1.0f), Vector3(0, 0, -1) }, + { Vector3(1.0f, -1.0f, 0.0f), Vector2(1.0f, 0.0f), Vector3(0, 0, -1) }, + { Vector3(-1.0f, -1.0f, 0.0f), Vector2(0.0f, 0.0f), Vector3(0, 0, -1) }, + { Vector3(1.0f, 1.0f, 0.0f), Vector2(1.0f, 1.0f), Vector3(0, 0, -1) } + }; + + SpriteMesh = CreateRef(); + SpriteMesh->AddSurface(quadVertices, { 0, 1, 2, 3, 4, 5 }); + + auto& material = MaterialManager::Get()->GetMaterial(FileSystem::Root + SpritePath); + SpriteMesh->SetMaterial(material); + return true; } diff --git a/Nuake/src/Scene/Components/SpriteComponent.h b/Nuake/src/Scene/Components/SpriteComponent.h index 97761f76..465abd3e 100644 --- a/Nuake/src/Scene/Components/SpriteComponent.h +++ b/Nuake/src/Scene/Components/SpriteComponent.h @@ -2,6 +2,7 @@ #include "src/Core/Core.h" #include "src/Resource/Serializable.h" #include "src/Rendering/Textures/Texture.h" +#include "src/Rendering/Mesh/Mesh.h" namespace Nuake { @@ -11,7 +12,7 @@ namespace Nuake bool Billboard; bool LockYRotation; std::string SpritePath; - Ref Sprite; + Ref SpriteMesh; SpriteComponent(); From 9159c6236bcf21addfb32f21ac21c60545f15048 Mon Sep 17 00:00:00 2001 From: emerycp Date: Tue, 1 Aug 2023 19:39:38 -0400 Subject: [PATCH 10/14] NK-92 - Search Bar In Filebrowser --- Editor/src/Windows/FileSystemUI.cpp | 79 +++++++++++++++-------------- Nuake/src/Core/FileSystem.cpp | 27 ++-------- Nuake/src/Core/FileSystem.h | 2 - Nuake/src/Window.cpp | 4 +- 4 files changed, 49 insertions(+), 63 deletions(-) diff --git a/Editor/src/Windows/FileSystemUI.cpp b/Editor/src/Windows/FileSystemUI.cpp index 0c213fcc..1bce4aa3 100644 --- a/Editor/src/Windows/FileSystemUI.cpp +++ b/Editor/src/Windows/FileSystemUI.cpp @@ -384,6 +384,7 @@ namespace Nuake ImGui::Text(file->GetName().c_str()); ImGui::PopFont(); + } bool Splitter(bool split_vertically, float thickness, float* size1, float* size2, float min_size1, float min_size2, float splitter_long_axis_size = -1.0f) @@ -532,8 +533,6 @@ namespace Nuake ImGui::EndChild(); ImGui::SameLine(); - avail = ImGui::GetContentRegionAvail(); - std::vector> paths = std::vector>(); Ref currentParent = m_CurrentDirectory; @@ -581,31 +580,13 @@ namespace Nuake } const uint32_t numButtonAfterPathBrowser = 2; - ImGui::SameLine(); - - char buffer[256]; - memset(buffer, 0, sizeof(buffer)); - std::strncpy(buffer, m_searchKeyWord.c_str(), sizeof(buffer)); - - if (ImGui::InputTextWithHint("##Search", "Asset search & filter ..", buffer, sizeof(buffer))) - { - m_searchKeyWord = std::string(buffer); - FileSystem::FilteredDirectories = FileSystem::SearchFilesWithKeyword(m_searchKeyWord, FileSystem::RootDirectory->fullPath); - RefreshFileBrowser(); - - if(m_searchKeyWord.empty()) - { - FileSystem::FilteredDirectories.clear(); - } - } - - + const uint32_t searchBarSize = 6; ImGui::SameLine(); ImGui::PushStyleColor(ImGuiCol_ChildBg, colors[ImGuiCol_TitleBgCollapsed]); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0)); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(4, 4)); - ImGui::BeginChild("pathBrowser", ImVec2(ImGui::GetContentRegionAvail().x - (numButtonAfterPathBrowser * buttonWidth) - 4.0, 24)); + ImGui::BeginChild("pathBrowser", ImVec2((ImGui::GetContentRegionAvail().x - (numButtonAfterPathBrowser * buttonWidth * searchBarSize)) - 4.0, 24)); for (int i = paths.size() - 1; i > 0; i--) { if (i != paths.size()) @@ -629,13 +610,30 @@ namespace Nuake ImGui::SameLine(); ImGui::Text("/"); } - + ImGui::EndChild(); ImGui::PopStyleVar(); - ImGui::PopStyleVar(); ImGui::PopStyleColor(); + + ImGui::SameLine(); + + ImGui::BeginChild("searchBar", ImVec2(ImGui::GetContentRegionAvail().x - (numButtonAfterPathBrowser * buttonWidth), 24)); + char buffer[256]; + memset(buffer, 0, sizeof(buffer)); + std::strncpy(buffer, m_searchKeyWord.c_str(), sizeof(buffer)); + if (ImGui::InputTextEx("##Search", "Asset search & filter ..", buffer, sizeof(buffer), ImVec2(ImGui::GetContentRegionAvail().x, 24), ImGuiInputTextFlags_EscapeClearsAll)) + { + m_searchKeyWord = std::string(buffer); + // FileSystem::FilteredFiles = FileSystem::SearchFilesWithKeyword(m_searchKeyWord, FileSystem::RootDirectory->fullPath); + // if(m_searchKeyWord.empty()) + // { + // FileSystem::FilteredFiles.clear(); + // } + //RefreshFileBrowser(); + } + ImGui::EndChild(); ImGui::SameLine(); @@ -652,8 +650,9 @@ namespace Nuake } ImGui::PopStyleColor(); // Button color + + ImGui::SameLine(); } - ImGui::EndChild(); ImDrawList* drawList = ImGui::GetWindowDrawList(); @@ -687,13 +686,16 @@ namespace Nuake { for (Ref& d : m_CurrentDirectory->Directories) { - if (i + 1 % amount != 0) - ImGui::TableNextColumn(); - else - ImGui::TableNextRow(); + if(String::Sanitize(d->name).find(String::Sanitize(m_searchKeyWord)) != std::string::npos) + { + if (i + 1 % amount != 0) + ImGui::TableNextColumn(); + else + ImGui::TableNextRow(); - DrawDirectory(d, i); - i++; + DrawDirectory(d, i); + i++; + } } } @@ -701,13 +703,16 @@ namespace Nuake { for (auto f : m_CurrentDirectory->Files) { - if (i - 1 % amount != 0 || i == 1) - ImGui::TableNextColumn(); - else - ImGui::TableNextRow(); + if(String::Sanitize(f->GetName()).find(String::Sanitize(m_searchKeyWord)) != std::string::npos) + { + if (i - 1 % amount != 0 || i == 1) + ImGui::TableNextColumn(); + else + ImGui::TableNextRow(); - DrawFile(f, i); - i++; + DrawFile(f, i); + i++; + } } } diff --git a/Nuake/src/Core/FileSystem.cpp b/Nuake/src/Core/FileSystem.cpp index cd362270..0298be94 100644 --- a/Nuake/src/Core/FileSystem.cpp +++ b/Nuake/src/Core/FileSystem.cpp @@ -57,7 +57,6 @@ namespace Nuake std::string FileSystem::Root = ""; Ref FileSystem::RootDirectory; - std::vector FileSystem::FilteredDirectories; void FileSystem::ScanDirectory(Ref directory) { @@ -71,20 +70,16 @@ namespace Nuake newDir->Parent = directory; ScanDirectory(newDir); - directory->Directories.push_back(newDir); } else if (entry.is_regular_file()) { std::filesystem::path currentPath = entry.path(); - if (FilteredDirectories.empty() || std::find(FilteredDirectories.begin(), FilteredDirectories.end(), currentPath) != FilteredDirectories.end()) - { - std::string absolutePath = currentPath.string(); - std::string name = currentPath.filename().string(); - std::string extension = currentPath.extension().string(); - Ref newFile = CreateRef(directory, absolutePath, name, extension); - directory->Files.push_back(newFile); - } + std::string absolutePath = currentPath.string(); + std::string name = currentPath.filename().string(); + std::string extension = currentPath.extension().string(); + Ref newFile = CreateRef(directory, absolutePath, name, extension); + directory->Files.push_back(newFile); } } } @@ -229,17 +224,5 @@ namespace Nuake const auto& split = String::Split(path, '\\'); return String::Split(split[split.size() - 1], '.')[0]; } - - std::vector FileSystem::SearchFilesWithKeyword(const std::string& keyword, const std::string& directory) { - std::vector result; - const std::string& sanitizedKeyword = String::Sanitize(keyword); - for (const auto& entry : std::filesystem::recursive_directory_iterator(directory)) { - if (entry.is_regular_file() && entry.path().filename().string().find(sanitizedKeyword) != std::string::npos) { - result.push_back(entry.path()); - } - } - return result; - } - } diff --git a/Nuake/src/Core/FileSystem.h b/Nuake/src/Core/FileSystem.h index f9771bbf..f337058f 100644 --- a/Nuake/src/Core/FileSystem.h +++ b/Nuake/src/Core/FileSystem.h @@ -25,7 +25,6 @@ namespace Nuake static std::string Root; static Ref RootDirectory; - static std::vector FilteredDirectories; static void SetRootDirectory(const std::string path); @@ -35,7 +34,6 @@ namespace Nuake static Ref GetFileTree(); static Ref GetFile(const std::string& path); static std::string GetFileNameFromPath(const std::string& path); - static std::vector FileSystem::SearchFilesWithKeyword(const std::string& keyword, const std::string& directory); static void ScanDirectory(Ref directory); static void GetDirectories(); diff --git a/Nuake/src/Window.cpp b/Nuake/src/Window.cpp index abfcf8a3..97f38215 100644 --- a/Nuake/src/Window.cpp +++ b/Nuake/src/Window.cpp @@ -67,7 +67,7 @@ namespace Nuake SetWindowIcon("resources/Images/nuake-logo.png"); glfwMakeContextCurrent(m_Window); - //SetVSync(true) + SetVSync(true); Logger::Log("Driver detected " + std::string(((char*)glGetString(GL_VERSION))), "renderer"); @@ -248,7 +248,7 @@ namespace Nuake void Window::SetVSync(bool enabled) { - glfwSwapInterval(enabled ? 0 : 1); + glfwSwapInterval(enabled ? 1: 0); } void Window::SetDecorated(bool enabled) From 17a6ded94a6725a0d812b704c4eabe6a9f084e03 Mon Sep 17 00:00:00 2001 From: emerycp Date: Tue, 1 Aug 2023 19:42:19 -0400 Subject: [PATCH 11/14] NK-92 Removed Forgotten Comments --- Editor/src/Windows/FileSystemUI.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Editor/src/Windows/FileSystemUI.cpp b/Editor/src/Windows/FileSystemUI.cpp index 1bce4aa3..6093e641 100644 --- a/Editor/src/Windows/FileSystemUI.cpp +++ b/Editor/src/Windows/FileSystemUI.cpp @@ -626,12 +626,6 @@ namespace Nuake if (ImGui::InputTextEx("##Search", "Asset search & filter ..", buffer, sizeof(buffer), ImVec2(ImGui::GetContentRegionAvail().x, 24), ImGuiInputTextFlags_EscapeClearsAll)) { m_searchKeyWord = std::string(buffer); - // FileSystem::FilteredFiles = FileSystem::SearchFilesWithKeyword(m_searchKeyWord, FileSystem::RootDirectory->fullPath); - // if(m_searchKeyWord.empty()) - // { - // FileSystem::FilteredFiles.clear(); - // } - //RefreshFileBrowser(); } ImGui::EndChild(); From 276fc764b27af2aa036a1194b9f7b4f21f0f8b26 Mon Sep 17 00:00:00 2001 From: emerycp Date: Wed, 2 Aug 2023 08:40:16 -0400 Subject: [PATCH 12/14] NK-92 PR Comments --- Editor/src/Windows/FileSystemUI.cpp | 2 -- Nuake/src/Core/String.cpp | 3 ++- Nuake/src/Window.cpp | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Editor/src/Windows/FileSystemUI.cpp b/Editor/src/Windows/FileSystemUI.cpp index 6093e641..713d3a83 100644 --- a/Editor/src/Windows/FileSystemUI.cpp +++ b/Editor/src/Windows/FileSystemUI.cpp @@ -384,7 +384,6 @@ namespace Nuake ImGui::Text(file->GetName().c_str()); ImGui::PopFont(); - } bool Splitter(bool split_vertically, float thickness, float* size1, float* size2, float min_size1, float min_size2, float splitter_long_axis_size = -1.0f) @@ -610,7 +609,6 @@ namespace Nuake ImGui::SameLine(); ImGui::Text("/"); } - ImGui::EndChild(); ImGui::PopStyleVar(); diff --git a/Nuake/src/Core/String.cpp b/Nuake/src/Core/String.cpp index cd68caf7..db6be8a3 100644 --- a/Nuake/src/Core/String.cpp +++ b/Nuake/src/Core/String.cpp @@ -37,7 +37,8 @@ namespace Nuake return result; } - std::string String::Sanitize(const std::string& keyword) { + std::string String::Sanitize(const std::string& keyword) + { std::string sanitizedKeyword = keyword; // Remove spaces, underscores, and hyphens using regex diff --git a/Nuake/src/Window.cpp b/Nuake/src/Window.cpp index 97f38215..5bc39d31 100644 --- a/Nuake/src/Window.cpp +++ b/Nuake/src/Window.cpp @@ -248,7 +248,7 @@ namespace Nuake void Window::SetVSync(bool enabled) { - glfwSwapInterval(enabled ? 1: 0); + glfwSwapInterval(enabled ? 1 : 0); } void Window::SetDecorated(bool enabled) From 220948fe92a53f3fdad26282af88244f88b45058 Mon Sep 17 00:00:00 2001 From: Antoine Pilote Date: Wed, 2 Aug 2023 11:59:42 -0400 Subject: [PATCH 13/14] Update Nuake/src/Core/Physics/DynamicWorld.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: émeryc --- Nuake/src/Core/Physics/DynamicWorld.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nuake/src/Core/Physics/DynamicWorld.cpp b/Nuake/src/Core/Physics/DynamicWorld.cpp index e3cce79f..2db145bc 100644 --- a/Nuake/src/Core/Physics/DynamicWorld.cpp +++ b/Nuake/src/Core/Physics/DynamicWorld.cpp @@ -331,7 +331,7 @@ namespace Nuake { // Create jolt ray const auto& fromJolt = JPH::Vec3(from.x, from.y, from.z); - const auto& toJolt = JPH::Vec3(to.x , to.y, to.z); + const auto& toJolt = JPH::Vec3(to.x, to.y, to.z); JPH::RayCast ray { fromJolt, toJolt - fromJolt }; JPH::AllHitCollisionCollector collector; _JoltPhysicsSystem->GetBroadPhaseQuery().CastRay(ray, collector); From fadb79eb81f33626419b67e00cc0874a4fa2a4d3 Mon Sep 17 00:00:00 2001 From: Antoine Pilote Date: Wed, 2 Aug 2023 16:01:07 +0000 Subject: [PATCH 14/14] Indentention --- Editor/src/Windows/EditorSelectionPanel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Editor/src/Windows/EditorSelectionPanel.cpp b/Editor/src/Windows/EditorSelectionPanel.cpp index 5822096c..a5674899 100644 --- a/Editor/src/Windows/EditorSelectionPanel.cpp +++ b/Editor/src/Windows/EditorSelectionPanel.cpp @@ -93,7 +93,7 @@ void EditorSelectionPanel::DrawEntity(Nuake::Entity entity) mTransformPanel.Draw(entity); mLightPanel.Draw(entity); mScriptPanel.Draw(entity); - mSpritePanel.Draw(entity); + mSpritePanel.Draw(entity); mMeshPanel.Draw(entity); mQuakeMapPanel.Draw(entity); mCameraPanel.Draw(entity);