From 1fcc5bfd3c2c1b43bd172df1e7bb525ba287c305 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:34:38 +0000 Subject: [PATCH 001/125] Update Scene Writer --- .../ERS_SceneWriter/ERS_SceneWriter.cpp | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/Source/Core/Writers/ERS_SceneWriter/ERS_SceneWriter.cpp b/Source/Core/Writers/ERS_SceneWriter/ERS_SceneWriter.cpp index 601f31bce4..8edd8fa4d3 100644 --- a/Source/Core/Writers/ERS_SceneWriter/ERS_SceneWriter.cpp +++ b/Source/Core/Writers/ERS_SceneWriter/ERS_SceneWriter.cpp @@ -50,7 +50,7 @@ std::string SceneWriter::ProcessScene(ERS_STRUCT_Scene* InputScene) { // Write Metadata Output << YAML::Key << "SceneName" << YAML::Value << InputScene->SceneName; - Output << YAML::Key << "SceneFormatVersion" << YAML::Value << InputScene->SceneFormatVersion; + Output << YAML::Key << "SceneFormatVersion" << YAML::Value << 2; Output << YAML::Key << "ActiveCameraIndex" << YAML::Value << InputScene->ActiveSceneCameraIndex; @@ -236,27 +236,34 @@ std::string SceneWriter::ProcessScene(ERS_STRUCT_Scene* InputScene) { //---- Write Scene Cameras ----// for (int i = 0; (long)i < (long)InputScene->SceneCameras.size(); i++) { + ERS_STRUCT_SceneCamera* SceneCamera = InputScene->SceneCameras[i].get(); + + Output << YAML::Key << AssetIndex; Output << YAML::BeginMap; - Output << YAML::Key << "AssetName" << YAML::Value << InputScene->SceneCameras[i]->UserDefinedName_; + Output << YAML::Key << "AssetName" << YAML::Value << SceneCamera->UserDefinedName_; Output << YAML::Key << "AssetType" << YAML::Value << "SceneCamera"; + Output << YAML::Key << "PosX" << YAML::Value << SceneCamera->Pos_[0]; + Output << YAML::Key << "PosY" << YAML::Value << SceneCamera->Pos_[1]; + Output << YAML::Key << "PosZ" << YAML::Value << SceneCamera->Pos_[2]; + Output << YAML::Key << "RotX" << YAML::Value << SceneCamera->Rot_[0]; + Output << YAML::Key << "RotY" << YAML::Value << SceneCamera->Rot_[1]; + Output << YAML::Key << "RotZ" << YAML::Value << SceneCamera->Rot_[2]; - Output << YAML::Key << "PosX" << YAML::Value << InputScene->SceneCameras[i]->Pos_[0]; - Output << YAML::Key << "PosY" << YAML::Value << InputScene->SceneCameras[i]->Pos_[1]; - Output << YAML::Key << "PosZ" << YAML::Value << InputScene->SceneCameras[i]->Pos_[2]; - - Output << YAML::Key << "RotX" << YAML::Value << InputScene->SceneCameras[i]->Rot_[0]; - Output << YAML::Key << "RotY" << YAML::Value << InputScene->SceneCameras[i]->Rot_[1]; - Output << YAML::Key << "RotZ" << YAML::Value << InputScene->SceneCameras[i]->Rot_[2]; - + Output << YAML::Key << "NearClip" << YAML::Value << SceneCamera->NearClip_; + Output << YAML::Key << "FarClip" << YAML::Value << SceneCamera->FarClip_; + Output << YAML::Key << "FOV" << YAML::Value << SceneCamera->FOV_; + Output << YAML::Key << "EnforceAspectRatio" << YAML::Value << SceneCamera->EnforceAspectRatio_; + Output << YAML::Key << "AspectRatio" << YAML::Value << SceneCamera->AspectRatio_; + Output << YAML::Key << "StreamingPriority" << YAML::Value << SceneCamera->StreamingPriority_; Output<SceneCameras[i]->AttachedScriptIndexes_.size(); x++) { - Output<SceneCameras[i]->AttachedScriptIndexes_[x]; + for (unsigned long x = 0; x < SceneCamera->AttachedScriptIndexes_.size(); x++) { + Output<AttachedScriptIndexes_[x]; } Output< Date: Fri, 12 Aug 2022 21:36:03 +0000 Subject: [PATCH 002/125] Update Scene Loader --- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp | 0 .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.h | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp create mode 100644 Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.h diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.h new file mode 100644 index 0000000000..e69de29bb2 From 36d4a8b3e66e988a8af0cb27c1fabbf4cc7d9048 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:36:36 +0000 Subject: [PATCH 003/125] Update Scene Loader --- .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 0 Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp create mode 100644 Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h new file mode 100644 index 0000000000..e69de29bb2 From f662c334bfeeb64871bd50a32bcab843ba9d4d2d Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:36:48 +0000 Subject: [PATCH 004/125] Update Scene Loader --- .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp | 0 Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp create mode 100644 Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h new file mode 100644 index 0000000000..e69de29bb2 From ab24175bb15a4e110e31a6aa7b0ef24993c72fef Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:37:02 +0000 Subject: [PATCH 005/125] Update Scene Loader --- .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp | 0 Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp create mode 100644 Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h new file mode 100644 index 0000000000..e69de29bb2 From e37e839af835c7ff4f45429928fad2b771dfe670 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:43:59 +0000 Subject: [PATCH 006/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderManager.h | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.h index e69de29bb2..f2677dae36 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.h @@ -0,0 +1,32 @@ +//======================================================================// +// This file is part of the BrainGenix-ERS Environment Rendering System // +//======================================================================// + +#pragma once + +// Standard Libraries (BG convention: use <> instead of "") +#include +#include + +// Third-Party Libraries (BG convention: use <> instead of "") +#include + +// Internal Libraries (BG convention: use <> instead of "") +#include + +#include +#include +#include + + +/** + * @brief Attempts to decode the scene data passed in. Will check against known format versions and decode if it's a known format. + * + * @param SceneData YAML::Node containing the scene data. + * @param Scene Pointer to the scene to be updated. + * @param SystemUtils Pointer to the systemutils struct. + * @param LogEnable Enable or disable information log messages. + * @return true Loading completed without errors. + * @return false Loading failed. + */ +bool ERS_FUNCTION_DecodeScene(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, bool LogEnable = true); \ No newline at end of file From 6bb831ba19669b9bff882756f179a5ca4e14777c Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:44:19 +0000 Subject: [PATCH 007/125] Update Scene Loader --- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.h index f2677dae36..6e3a4ee464 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.h @@ -13,6 +13,7 @@ // Internal Libraries (BG convention: use <> instead of "") #include +#include #include #include From ffc69dbcdd462011433e4d12ae5eefa6984efd80 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:44:55 +0000 Subject: [PATCH 008/125] Update Scene Loader --- Source/Core/Loader/ERS_SceneLoader/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/CMakeLists.txt b/Source/Core/Loader/ERS_SceneLoader/CMakeLists.txt index c0e4acc623..6be1d16e09 100644 --- a/Source/Core/Loader/ERS_SceneLoader/CMakeLists.txt +++ b/Source/Core/Loader/ERS_SceneLoader/CMakeLists.txt @@ -8,9 +8,17 @@ add_library(ERS_SceneLoader # Add Source Files (.cpp) "ERS_SceneLoader.cpp" + "ERS_FUNCTION_SceneDecoderManager.cpp" + "ERS_FUNCTION_SceneDecoderV1.cpp" + "ERS_FUNCTION_SceneDecoderV2.cpp" + "ERS_FUNCTION_SceneDecoderV3.cpp" # Add Header Files (.h) "ERS_SceneLoader.h" + "ERS_FUNCTION_SceneDecoderManager.h" + "ERS_FUNCTION_SceneDecoderV1.h" + "ERS_FUNCTION_SceneDecoderV2.h" + "ERS_FUNCTION_SceneDecoderV3.h" ${BACKWARD_ENABLE} ) From cd01ba029f4550e56ccb56f359177a25d6fb1253 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:45:11 +0000 Subject: [PATCH 009/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV1.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h index e69de29bb2..f198cce768 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h @@ -0,0 +1,16 @@ +//======================================================================// +// This file is part of the BrainGenix-ERS Environment Rendering System // +//======================================================================// + +#pragma once + +// Standard Libraries (BG convention: use <> instead of "") +#include +#include + +// Third-Party Libraries (BG convention: use <> instead of "") +#include + +// Internal Libraries (BG convention: use <> instead of "") +#include +#include \ No newline at end of file From 6e69380e4bc500d10eb50db3653331e9bb13b968 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:45:20 +0000 Subject: [PATCH 010/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV2.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h index e69de29bb2..f198cce768 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h @@ -0,0 +1,16 @@ +//======================================================================// +// This file is part of the BrainGenix-ERS Environment Rendering System // +//======================================================================// + +#pragma once + +// Standard Libraries (BG convention: use <> instead of "") +#include +#include + +// Third-Party Libraries (BG convention: use <> instead of "") +#include + +// Internal Libraries (BG convention: use <> instead of "") +#include +#include \ No newline at end of file From a7cbc393f812d6ef55abb89dbc13920e40bb2cb1 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:45:25 +0000 Subject: [PATCH 011/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV3.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h index e69de29bb2..f198cce768 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h @@ -0,0 +1,16 @@ +//======================================================================// +// This file is part of the BrainGenix-ERS Environment Rendering System // +//======================================================================// + +#pragma once + +// Standard Libraries (BG convention: use <> instead of "") +#include +#include + +// Third-Party Libraries (BG convention: use <> instead of "") +#include + +// Internal Libraries (BG convention: use <> instead of "") +#include +#include \ No newline at end of file From 009fe02811408105e40f5c48d207c61aa2389a8b Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:45:59 +0000 Subject: [PATCH 012/125] Update Scene Loader --- .../ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp index e69de29bb2..187f84cb5f 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp @@ -0,0 +1,5 @@ +//======================================================================// +// This file is part of the BrainGenix-ERS Environment Rendering System // +//======================================================================// + +#include \ No newline at end of file From aa6368bf0a1f7e50a20f31322ca5cd30eb94f070 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:46:12 +0000 Subject: [PATCH 013/125] Update Scene Loader --- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index e69de29bb2..795ed2d237 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -0,0 +1,5 @@ +//======================================================================// +// This file is part of the BrainGenix-ERS Environment Rendering System // +//======================================================================// + +#include \ No newline at end of file From 1bf664acea1a2fcd38cebfa774420bbbe25a149d Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:46:18 +0000 Subject: [PATCH 014/125] Update Scene Loader --- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp index e69de29bb2..0d2750ae3d 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp @@ -0,0 +1,5 @@ +//======================================================================// +// This file is part of the BrainGenix-ERS Environment Rendering System // +//======================================================================// + +#include \ No newline at end of file From f3ca7509ae76392e84cb8a58a95d277c79c39383 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:46:23 +0000 Subject: [PATCH 015/125] Update Scene Loader --- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp index e69de29bb2..caf87d5ca9 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp @@ -0,0 +1,5 @@ +//======================================================================// +// This file is part of the BrainGenix-ERS Environment Rendering System // +//======================================================================// + +#include \ No newline at end of file From c04ff1d0c17c0ba158dec5c3abe95276100af8ca Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:47:04 +0000 Subject: [PATCH 016/125] Update Scene Loader --- .../ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp index 187f84cb5f..c4c778b01b 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp @@ -2,4 +2,11 @@ // This file is part of the BrainGenix-ERS Environment Rendering System // //======================================================================// -#include \ No newline at end of file +#include + + +bool ERS_FUNCTION_DecodeScene(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, bool LogEnable) { + + + +} \ No newline at end of file From 31a744171207211387c502c05fecae902c7e869a Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:48:48 +0000 Subject: [PATCH 017/125] Update Scene Loader --- .../ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp index c4c778b01b..5aba654775 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp @@ -5,8 +5,15 @@ #include + + bool ERS_FUNCTION_DecodeScene(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, bool LogEnable) { + SystemUtils->Logger_->Log("Decoding ERS Scene", 5, LogEnable); + // Extract Current Version + int Version; + SystemUtils->Logger_->Log("Identifying Scene Format Version", 4, LogEnable); + if (SceneData["SceneFormatVersion"]) } \ No newline at end of file From 1f482dbdb5afb1125c9df6fcab32a7d4d9f0a716 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:50:30 +0000 Subject: [PATCH 018/125] Update Scene Loader --- .../ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp index 5aba654775..33ae42de9d 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp @@ -12,8 +12,13 @@ bool ERS_FUNCTION_DecodeScene(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS SystemUtils->Logger_->Log("Decoding ERS Scene", 5, LogEnable); // Extract Current Version - int Version; + int Version = 0; SystemUtils->Logger_->Log("Identifying Scene Format Version", 4, LogEnable); - if (SceneData["SceneFormatVersion"]) + if (SceneData["SceneFormatVersion"]) { + Version = SceneData["SceneFormatVersion"].as(); + } else { + SystemUtils->Logger_->Log("Unable To Find Metadata Tag For 'SceneFormatVersion', Unable To Identify Version", 9); + return false; + } } \ No newline at end of file From 1944fceaf4be0a884b32ea0118c4cd030ace9ea0 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:51:24 +0000 Subject: [PATCH 019/125] Update Scene Loader --- .../ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp index 33ae42de9d..e48ef6687b 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp @@ -21,4 +21,13 @@ bool ERS_FUNCTION_DecodeScene(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS return false; } + // Attempt Decoding With Known Decoding Systems + if (Version == 1) { + + } else if (Version == 2) { + + } else if (Version == 3) { + + } + } \ No newline at end of file From 3982e4f2340962deaa7ed87e88afe20904999dd8 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:52:25 +0000 Subject: [PATCH 020/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV1.h | 15 ++++++++++++++- .../ERS_FUNCTION_SceneDecoderV2.h | 16 +++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h index f198cce768..318e257852 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h @@ -13,4 +13,17 @@ // Internal Libraries (BG convention: use <> instead of "") #include -#include \ No newline at end of file +#include + + +/** + * @brief Decodes the specified version of the scene format. + * + * @param SceneData YAML::Node containing the scene data. + * @param Scene Pointer to the scene to be updated. + * @param SystemUtils Pointer to the systemutils struct. + * @param LogEnable Enable or disable information log messages. + * @return true Loading completed without errors. + * @return false Loading failed. + */ +bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, bool LogEnable = true); \ No newline at end of file diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h index f198cce768..f01e31a265 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h @@ -13,4 +13,18 @@ // Internal Libraries (BG convention: use <> instead of "") #include -#include \ No newline at end of file +#include + + + +/** + * @brief Decodes the specified version of the scene format. + * + * @param SceneData YAML::Node containing the scene data. + * @param Scene Pointer to the scene to be updated. + * @param SystemUtils Pointer to the systemutils struct. + * @param LogEnable Enable or disable information log messages. + * @return true Loading completed without errors. + * @return false Loading failed. + */ +bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, bool LogEnable = true); \ No newline at end of file From ab9102102b4986f0a65c66714feba657ef01bd66 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:52:33 +0000 Subject: [PATCH 021/125] Update Scene Loader --- .../ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h index f198cce768..ba3414538c 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h @@ -13,4 +13,17 @@ // Internal Libraries (BG convention: use <> instead of "") #include -#include \ No newline at end of file +#include + + +/** + * @brief Decodes the specified version of the scene format. + * + * @param SceneData YAML::Node containing the scene data. + * @param Scene Pointer to the scene to be updated. + * @param SystemUtils Pointer to the systemutils struct. + * @param LogEnable Enable or disable information log messages. + * @return true Loading completed without errors. + * @return false Loading failed. + */ +bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, bool LogEnable = true); \ No newline at end of file From fe2b7c2971b38ed6a5451d3d6259166a7427a0be Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:53:12 +0000 Subject: [PATCH 022/125] Update Scene Loader --- .../ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp index e48ef6687b..667b3897b8 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp @@ -23,11 +23,11 @@ bool ERS_FUNCTION_DecodeScene(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS // Attempt Decoding With Known Decoding Systems if (Version == 1) { - + return ERS_FUNCTION_DecodeSceneV1(SceneData, Scene, SystemUtils, LogEnable); } else if (Version == 2) { - + return ERS_FUNCTION_DecodeSceneV2(SceneData, Scene, SystemUtils, LogEnable); } else if (Version == 3) { - + return ERS_FUNCTION_DecodeSceneV3(SceneData, Scene, SystemUtils, LogEnable); } } \ No newline at end of file From 627d760cee252465cec1730173c7cfef32f9d959 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:54:47 +0000 Subject: [PATCH 023/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV1.cpp | 271 +++++++++++++++++- .../ERS_SceneLoader/ERS_SceneLoader.cpp | 261 ----------------- 2 files changed, 270 insertions(+), 262 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 795ed2d237..dded953e95 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -2,4 +2,273 @@ // This file is part of the BrainGenix-ERS Environment Rendering System // //======================================================================// -#include \ No newline at end of file +#include + + + + + + + + // // Grab Metadata + // Scene.SceneFormatVersion = RawSceneData["SceneFormatVersion"].as(); + // Scene.SceneName = RawSceneData["SceneName"].as(); + // Scene.ScenePath = AssetID; + + // if (RawSceneData["ActiveCameraIndex"]) { + // Scene.ActiveSceneCameraIndex = RawSceneData["ActiveCameraIndex"].as(); + // } + + // // Log Scene Processing + // SystemUtils_->Logger_->Log(std::string(std::string("Processing Scene: ") + std::string(Scene.SceneName)).c_str(), 3); + + // // Create Vector Of YAML::Nodes + // std::vector SceneItems; + + // // Populate Vector With Elements From SceneData + // YAML::Node SceneDataNode = RawSceneData["SceneData"]; + // for (YAML::const_iterator it=SceneDataNode.begin(); it!=SceneDataNode.end(); ++it) { + // SceneItems.push_back(it->second); + // } + + + // // Iterate Through Vector To Add Each Asset To Loading Queue Of Requested Type + // for (long i = 0; (long)i < (long)SceneDataNode.size(); i++) { + + // // Get Asset Information + // std::string AssetName = SceneDataNode[i]["AssetName"].as(); + // std::string AssetType = SceneDataNode[i]["AssetType"].as(); + + // // If type Is Model + // if (AssetType == std::string("Model")) { + + // long AssetID = SceneDataNode[i]["AssetID"].as(); + + // // Get Asset LocRotScale + // float PosX = SceneDataNode[i]["AssetPositionX"].as(); + // float PosY = SceneDataNode[i]["AssetPositionY"].as(); + // float PosZ = SceneDataNode[i]["AssetPositionZ"].as(); + + // float RotX = SceneDataNode[i]["AssetRotationX"].as(); + // float RotY = SceneDataNode[i]["AssetRotationY"].as(); + // float RotZ = SceneDataNode[i]["AssetRotationZ"].as(); + + // float ScaleX = SceneDataNode[i]["AssetScaleX"].as(); + // float ScaleY = SceneDataNode[i]["AssetScaleY"].as(); + // float ScaleZ = SceneDataNode[i]["AssetScaleZ"].as(); + + // //Load Model + // Scene.Models.push_back(std::make_shared()); + // int CurrentSize = Scene.Models.size(); + // ModelLoader_->AddModelToLoadingQueue(AssetID, Scene.Models[CurrentSize-1]); + + // // Add Instance To Models Vector + // Scene.Models[CurrentSize-1]->IsTemplateModel = false; + // Scene.Models[CurrentSize-1]->SetLocRotScale(glm::vec3(PosX, PosY, PosZ), glm::vec3(RotX, RotY, RotZ), glm::vec3(ScaleX, ScaleY, ScaleZ)); + // Scene.Models[CurrentSize-1]->ApplyTransformations(); + // Scene.Models[CurrentSize-1]->AssetID = AssetID; + // Scene.Models[CurrentSize-1]->Name = AssetName; + + + // // Load Attached Scripts + // if (SceneDataNode[i]["AttachedScripts"]) { + // YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + // for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + // Scene.Models[CurrentSize-1]->AttachedScriptIndexes_.push_back(it->second.as()); + // } + // } + + + // // Load Shadow Configuration + // if (SceneDataNode[i]["CastDynamicShadows"]) { + // Scene.Models[CurrentSize-1]->CastDynamicShadows_ = SceneDataNode[i]["CastDynamicShadows"].as(); + // } + + // if (SceneDataNode[i]["CastStaticShadows"]) { + // Scene.Models[CurrentSize-1]->CastStaticShadows_ = SceneDataNode[i]["CastStaticShadows"].as(); + // } + + // if (SceneDataNode[i]["ReceiveShadows"]) { + // Scene.Models[CurrentSize-1]->ReceiveShadows_ = SceneDataNode[i]["ReceiveShadows"].as(); + // } + + // if (SceneDataNode[i]["ShaderOverrideIndex"]) { + // Scene.Models[CurrentSize-1]->ShaderOverrideIndex_ = SceneDataNode[i]["ShaderOverrideIndex"].as(); + // } + + + // } else if (AssetType == std::string("DirectionalLight")) { + + // // Setup Model Pointer In Scene To Work On + // Scene.DirectionalLights.push_back(std::make_shared()); + // int LightIndex = Scene.DirectionalLights.size() - 1; + + // Scene.DirectionalLights[LightIndex]->UserDefinedName = AssetName; + + // if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { + // Scene.DirectionalLights[LightIndex]->Color = glm::vec3( + // SceneDataNode[i]["ColorRed"].as(), + // SceneDataNode[i]["ColorGreen"].as(), + // SceneDataNode[i]["ColorBlue"].as() + // ); + // } + + // if (SceneDataNode[i]["Intensity"]) { + // Scene.DirectionalLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); + // } + + // if (SceneDataNode[i]["MaxDistance"]) { + // Scene.DirectionalLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); + // } + + // Scene.DirectionalLights[LightIndex]->Pos = glm::vec3( + // SceneDataNode[i]["PosX"].as(), + // SceneDataNode[i]["PosY"].as(), + // SceneDataNode[i]["PosZ"].as() + // ); + // Scene.DirectionalLights[LightIndex]->Rot = glm::vec3( + // SceneDataNode[i]["RotX"].as(), + // SceneDataNode[i]["RotY"].as(), + // SceneDataNode[i]["RotZ"].as() + // ); + + + // if (SceneDataNode[i]["CastShadows"]) { + // Scene.DirectionalLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); + // } + + // // Load Attached Scripts + // if (SceneDataNode[i]["AttachedScripts"]) { + // YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + // for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + // Scene.DirectionalLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); + // } + // } + + // } else if (AssetType == std::string("PointLight")) { + + // // Setup Model Pointer In Scene To Work On + // Scene.PointLights.push_back(std::make_shared()); + // int LightIndex = Scene.PointLights.size() - 1; + + // Scene.PointLights[LightIndex]->UserDefinedName = AssetName; + // if (SceneDataNode[i]["Intensity"]) { + // Scene.PointLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); + // } + // if (SceneDataNode[i]["MaxDistance"]) { + // Scene.PointLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); + // } + + + // if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { + // Scene.PointLights[LightIndex]->Color = glm::vec3( + // SceneDataNode[i]["ColorRed"].as(), + // SceneDataNode[i]["ColorGreen"].as(), + // SceneDataNode[i]["ColorBlue"].as() + // ); + // } + + // Scene.PointLights[LightIndex]->Pos = glm::vec3( + // SceneDataNode[i]["PosX"].as(), + // SceneDataNode[i]["PosY"].as(), + // SceneDataNode[i]["PosZ"].as() + // ); + + // if (SceneDataNode[i]["CastShadows"]) { + // Scene.PointLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); + // } + + // // Load Attached Scripts + // if (SceneDataNode[i]["AttachedScripts"]) { + // YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + // for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + // Scene.PointLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); + // } + // } + + // } else if (AssetType == std::string("SpotLight")) { + + // // Setup Model Pointer In Scene To Work On + // Scene.SpotLights.push_back(std::make_shared()); + // int LightIndex = Scene.SpotLights.size() - 1; + + // Scene.SpotLights[LightIndex]->UserDefinedName = AssetName; + + // if (SceneDataNode[i]["Intensity"]) { + // Scene.SpotLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); + // } + // if (SceneDataNode[i]["MaxDistance"]) { + // Scene.SpotLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); + // } + // Scene.SpotLights[LightIndex]->CutOff = SceneDataNode[i]["CutOff"].as(); + + // if (SceneDataNode[i]["RollOff"]) { + // Scene.SpotLights[LightIndex]->Rolloff = SceneDataNode[i]["RollOff"].as(); + // } + // if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { + // Scene.SpotLights[LightIndex]->Color = glm::vec3( + // SceneDataNode[i]["ColorRed"].as(), + // SceneDataNode[i]["ColorGreen"].as(), + // SceneDataNode[i]["ColorBlue"].as() + // ); + // } + + + // Scene.SpotLights[LightIndex]->Pos = glm::vec3( + // SceneDataNode[i]["PosX"].as(), + // SceneDataNode[i]["PosY"].as(), + // SceneDataNode[i]["PosZ"].as() + // ); + // Scene.SpotLights[LightIndex]->Rot = glm::vec3( + // SceneDataNode[i]["RotX"].as(), + // SceneDataNode[i]["RotY"].as(), + // SceneDataNode[i]["RotZ"].as() + // ); + + + // if (SceneDataNode[i]["CastShadows"]) { + // Scene.SpotLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); + // } + + // // Load Attached Scripts + // if (SceneDataNode[i]["AttachedScripts"]) { + // YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + // for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + // Scene.SpotLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); + // } + // } + + // } else if (AssetType == std::string("SceneCamera")) { + + // // Setup Model Pointer In Scene To Work On + // Scene.SceneCameras.push_back(std::make_shared()); + // int SceneCameraIndex = Scene.SceneCameras.size() - 1; + + // Scene.SceneCameras[SceneCameraIndex]->UserDefinedName_ = AssetName; + // Scene.SceneCameras[SceneCameraIndex]->Pos_ = glm::vec3( + // SceneDataNode[i]["PosX"].as(), + // SceneDataNode[i]["PosY"].as(), + // SceneDataNode[i]["PosZ"].as() + // ); + // Scene.SceneCameras[SceneCameraIndex]->Rot_ = glm::vec3( + // SceneDataNode[i]["RotX"].as(), + // SceneDataNode[i]["RotY"].as(), + // SceneDataNode[i]["RotZ"].as() + // ); + + // // Load Attached Scripts + // if (SceneDataNode[i]["AttachedScripts"]) { + // YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + // for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + // Scene.SceneCameras[SceneCameraIndex]->AttachedScriptIndexes_.push_back(it->second.as()); + // } + // } + + // } else { + // SystemUtils_->Logger_->Log(std::string("Unsupported/Unknown Asset Type: ") + AssetType, 9); + // } + + // } + + // // Indicate Scene Is Loaded + // Scene.IsSceneLoaded = true; \ No newline at end of file diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_SceneLoader.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_SceneLoader.cpp index f25df516a4..38afc0781d 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_SceneLoader.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_SceneLoader.cpp @@ -43,268 +43,7 @@ ERS_STRUCT_Scene ERS_CLASS_SceneLoader::ProcessScene(YAML::Node RawSceneData, lo // Create Scene Instance ERS_STRUCT_Scene Scene; - // Grab Metadata - Scene.SceneFormatVersion = RawSceneData["SceneFormatVersion"].as(); - Scene.SceneName = RawSceneData["SceneName"].as(); - Scene.ScenePath = AssetID; - if (RawSceneData["ActiveCameraIndex"]) { - Scene.ActiveSceneCameraIndex = RawSceneData["ActiveCameraIndex"].as(); - } - - // Log Scene Processing - SystemUtils_->Logger_->Log(std::string(std::string("Processing Scene: ") + std::string(Scene.SceneName)).c_str(), 3); - - // Create Vector Of YAML::Nodes - std::vector SceneItems; - - // Populate Vector With Elements From SceneData - YAML::Node SceneDataNode = RawSceneData["SceneData"]; - for (YAML::const_iterator it=SceneDataNode.begin(); it!=SceneDataNode.end(); ++it) { - SceneItems.push_back(it->second); - } - - - // Iterate Through Vector To Add Each Asset To Loading Queue Of Requested Type - for (long i = 0; (long)i < (long)SceneDataNode.size(); i++) { - - // Get Asset Information - std::string AssetName = SceneDataNode[i]["AssetName"].as(); - std::string AssetType = SceneDataNode[i]["AssetType"].as(); - - // If type Is Model - if (AssetType == std::string("Model")) { - - long AssetID = SceneDataNode[i]["AssetID"].as(); - - // Get Asset LocRotScale - float PosX = SceneDataNode[i]["AssetPositionX"].as(); - float PosY = SceneDataNode[i]["AssetPositionY"].as(); - float PosZ = SceneDataNode[i]["AssetPositionZ"].as(); - - float RotX = SceneDataNode[i]["AssetRotationX"].as(); - float RotY = SceneDataNode[i]["AssetRotationY"].as(); - float RotZ = SceneDataNode[i]["AssetRotationZ"].as(); - - float ScaleX = SceneDataNode[i]["AssetScaleX"].as(); - float ScaleY = SceneDataNode[i]["AssetScaleY"].as(); - float ScaleZ = SceneDataNode[i]["AssetScaleZ"].as(); - - //Load Model - Scene.Models.push_back(std::make_shared()); - int CurrentSize = Scene.Models.size(); - ModelLoader_->AddModelToLoadingQueue(AssetID, Scene.Models[CurrentSize-1]); - - // Add Instance To Models Vector - Scene.Models[CurrentSize-1]->IsTemplateModel = false; - Scene.Models[CurrentSize-1]->SetLocRotScale(glm::vec3(PosX, PosY, PosZ), glm::vec3(RotX, RotY, RotZ), glm::vec3(ScaleX, ScaleY, ScaleZ)); - Scene.Models[CurrentSize-1]->ApplyTransformations(); - Scene.Models[CurrentSize-1]->AssetID = AssetID; - Scene.Models[CurrentSize-1]->Name = AssetName; - - - // Load Attached Scripts - if (SceneDataNode[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - Scene.Models[CurrentSize-1]->AttachedScriptIndexes_.push_back(it->second.as()); - } - } - - - // Load Shadow Configuration - if (SceneDataNode[i]["CastDynamicShadows"]) { - Scene.Models[CurrentSize-1]->CastDynamicShadows_ = SceneDataNode[i]["CastDynamicShadows"].as(); - } - - if (SceneDataNode[i]["CastStaticShadows"]) { - Scene.Models[CurrentSize-1]->CastStaticShadows_ = SceneDataNode[i]["CastStaticShadows"].as(); - } - - if (SceneDataNode[i]["ReceiveShadows"]) { - Scene.Models[CurrentSize-1]->ReceiveShadows_ = SceneDataNode[i]["ReceiveShadows"].as(); - } - - if (SceneDataNode[i]["ShaderOverrideIndex"]) { - Scene.Models[CurrentSize-1]->ShaderOverrideIndex_ = SceneDataNode[i]["ShaderOverrideIndex"].as(); - } - - - } else if (AssetType == std::string("DirectionalLight")) { - - // Setup Model Pointer In Scene To Work On - Scene.DirectionalLights.push_back(std::make_shared()); - int LightIndex = Scene.DirectionalLights.size() - 1; - - Scene.DirectionalLights[LightIndex]->UserDefinedName = AssetName; - - if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { - Scene.DirectionalLights[LightIndex]->Color = glm::vec3( - SceneDataNode[i]["ColorRed"].as(), - SceneDataNode[i]["ColorGreen"].as(), - SceneDataNode[i]["ColorBlue"].as() - ); - } - - if (SceneDataNode[i]["Intensity"]) { - Scene.DirectionalLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); - } - - if (SceneDataNode[i]["MaxDistance"]) { - Scene.DirectionalLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); - } - - Scene.DirectionalLights[LightIndex]->Pos = glm::vec3( - SceneDataNode[i]["PosX"].as(), - SceneDataNode[i]["PosY"].as(), - SceneDataNode[i]["PosZ"].as() - ); - Scene.DirectionalLights[LightIndex]->Rot = glm::vec3( - SceneDataNode[i]["RotX"].as(), - SceneDataNode[i]["RotY"].as(), - SceneDataNode[i]["RotZ"].as() - ); - - - if (SceneDataNode[i]["CastShadows"]) { - Scene.DirectionalLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); - } - - // Load Attached Scripts - if (SceneDataNode[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - Scene.DirectionalLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - } - } - - } else if (AssetType == std::string("PointLight")) { - - // Setup Model Pointer In Scene To Work On - Scene.PointLights.push_back(std::make_shared()); - int LightIndex = Scene.PointLights.size() - 1; - - Scene.PointLights[LightIndex]->UserDefinedName = AssetName; - if (SceneDataNode[i]["Intensity"]) { - Scene.PointLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); - } - if (SceneDataNode[i]["MaxDistance"]) { - Scene.PointLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); - } - - - if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { - Scene.PointLights[LightIndex]->Color = glm::vec3( - SceneDataNode[i]["ColorRed"].as(), - SceneDataNode[i]["ColorGreen"].as(), - SceneDataNode[i]["ColorBlue"].as() - ); - } - - Scene.PointLights[LightIndex]->Pos = glm::vec3( - SceneDataNode[i]["PosX"].as(), - SceneDataNode[i]["PosY"].as(), - SceneDataNode[i]["PosZ"].as() - ); - - if (SceneDataNode[i]["CastShadows"]) { - Scene.PointLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); - } - - // Load Attached Scripts - if (SceneDataNode[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - Scene.PointLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - } - } - - } else if (AssetType == std::string("SpotLight")) { - - // Setup Model Pointer In Scene To Work On - Scene.SpotLights.push_back(std::make_shared()); - int LightIndex = Scene.SpotLights.size() - 1; - - Scene.SpotLights[LightIndex]->UserDefinedName = AssetName; - - if (SceneDataNode[i]["Intensity"]) { - Scene.SpotLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); - } - if (SceneDataNode[i]["MaxDistance"]) { - Scene.SpotLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); - } - Scene.SpotLights[LightIndex]->CutOff = SceneDataNode[i]["CutOff"].as(); - - if (SceneDataNode[i]["RollOff"]) { - Scene.SpotLights[LightIndex]->Rolloff = SceneDataNode[i]["RollOff"].as(); - } - if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { - Scene.SpotLights[LightIndex]->Color = glm::vec3( - SceneDataNode[i]["ColorRed"].as(), - SceneDataNode[i]["ColorGreen"].as(), - SceneDataNode[i]["ColorBlue"].as() - ); - } - - - Scene.SpotLights[LightIndex]->Pos = glm::vec3( - SceneDataNode[i]["PosX"].as(), - SceneDataNode[i]["PosY"].as(), - SceneDataNode[i]["PosZ"].as() - ); - Scene.SpotLights[LightIndex]->Rot = glm::vec3( - SceneDataNode[i]["RotX"].as(), - SceneDataNode[i]["RotY"].as(), - SceneDataNode[i]["RotZ"].as() - ); - - - if (SceneDataNode[i]["CastShadows"]) { - Scene.SpotLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); - } - - // Load Attached Scripts - if (SceneDataNode[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - Scene.SpotLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - } - } - - } else if (AssetType == std::string("SceneCamera")) { - - // Setup Model Pointer In Scene To Work On - Scene.SceneCameras.push_back(std::make_shared()); - int SceneCameraIndex = Scene.SceneCameras.size() - 1; - - Scene.SceneCameras[SceneCameraIndex]->UserDefinedName_ = AssetName; - Scene.SceneCameras[SceneCameraIndex]->Pos_ = glm::vec3( - SceneDataNode[i]["PosX"].as(), - SceneDataNode[i]["PosY"].as(), - SceneDataNode[i]["PosZ"].as() - ); - Scene.SceneCameras[SceneCameraIndex]->Rot_ = glm::vec3( - SceneDataNode[i]["RotX"].as(), - SceneDataNode[i]["RotY"].as(), - SceneDataNode[i]["RotZ"].as() - ); - - // Load Attached Scripts - if (SceneDataNode[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - Scene.SceneCameras[SceneCameraIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - } - } - - } else { - SystemUtils_->Logger_->Log(std::string("Unsupported/Unknown Asset Type: ") + AssetType, 9); - } - - } - - // Indicate Scene Is Loaded - Scene.IsSceneLoaded = true; // Return Scene return Scene; From 30ae9f584bd6a9d3de7a6ab7e7fa677efcf00bfa Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:56:10 +0000 Subject: [PATCH 024/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV1.cpp | 469 +++++++++--------- 1 file changed, 237 insertions(+), 232 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index dded953e95..9fb091af54 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -6,269 +6,274 @@ +bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, bool LogEnable = true) { + // Grab Metadata + Scene->SceneFormatVersion = RawSceneData["SceneFormatVersion"].as(); + Scene->SceneName = RawSceneData["SceneName"].as(); + Scene->ScenePath = AssetID; + if (RawSceneData["ActiveCameraIndex"]) { + Scene->ActiveSceneCameraIndex = RawSceneData["ActiveCameraIndex"].as(); + } - // // Grab Metadata - // Scene.SceneFormatVersion = RawSceneData["SceneFormatVersion"].as(); - // Scene.SceneName = RawSceneData["SceneName"].as(); - // Scene.ScenePath = AssetID; + // Log Scene Processing + SystemUtils_->Logger_->Log(std::string("Processing Scene: ") + std::string(Scene->SceneName), 3); - // if (RawSceneData["ActiveCameraIndex"]) { - // Scene.ActiveSceneCameraIndex = RawSceneData["ActiveCameraIndex"].as(); - // } + // Create Vector Of YAML::Nodes + std::vector SceneItems; - // // Log Scene Processing - // SystemUtils_->Logger_->Log(std::string(std::string("Processing Scene: ") + std::string(Scene.SceneName)).c_str(), 3); + // Populate Vector With Elements From SceneData + YAML::Node SceneDataNode = RawSceneData["SceneData"]; + for (YAML::const_iterator it=SceneDataNode.begin(); it!=SceneDataNode.end(); ++it) { + SceneItems.push_back(it->second); + } - // // Create Vector Of YAML::Nodes - // std::vector SceneItems; - // // Populate Vector With Elements From SceneData - // YAML::Node SceneDataNode = RawSceneData["SceneData"]; - // for (YAML::const_iterator it=SceneDataNode.begin(); it!=SceneDataNode.end(); ++it) { - // SceneItems.push_back(it->second); - // } + // Iterate Through Vector To Add Each Asset To Loading Queue Of Requested Type + for (long i = 0; (long)i < (long)SceneDataNode.size(); i++) { + // Get Asset Information + std::string AssetName = SceneDataNode[i]["AssetName"].as(); + std::string AssetType = SceneDataNode[i]["AssetType"].as(); - // // Iterate Through Vector To Add Each Asset To Loading Queue Of Requested Type - // for (long i = 0; (long)i < (long)SceneDataNode.size(); i++) { + // If type Is Model + if (AssetType == std::string("Model")) { - // // Get Asset Information - // std::string AssetName = SceneDataNode[i]["AssetName"].as(); - // std::string AssetType = SceneDataNode[i]["AssetType"].as(); + long AssetID = SceneDataNode[i]["AssetID"].as(); - // // If type Is Model - // if (AssetType == std::string("Model")) { + // Get Asset LocRotScale + float PosX = SceneDataNode[i]["AssetPositionX"].as(); + float PosY = SceneDataNode[i]["AssetPositionY"].as(); + float PosZ = SceneDataNode[i]["AssetPositionZ"].as(); - // long AssetID = SceneDataNode[i]["AssetID"].as(); + float RotX = SceneDataNode[i]["AssetRotationX"].as(); + float RotY = SceneDataNode[i]["AssetRotationY"].as(); + float RotZ = SceneDataNode[i]["AssetRotationZ"].as(); - // // Get Asset LocRotScale - // float PosX = SceneDataNode[i]["AssetPositionX"].as(); - // float PosY = SceneDataNode[i]["AssetPositionY"].as(); - // float PosZ = SceneDataNode[i]["AssetPositionZ"].as(); + float ScaleX = SceneDataNode[i]["AssetScaleX"].as(); + float ScaleY = SceneDataNode[i]["AssetScaleY"].as(); + float ScaleZ = SceneDataNode[i]["AssetScaleZ"].as(); - // float RotX = SceneDataNode[i]["AssetRotationX"].as(); - // float RotY = SceneDataNode[i]["AssetRotationY"].as(); - // float RotZ = SceneDataNode[i]["AssetRotationZ"].as(); + //Load Model + Scene->Models.push_back(std::make_shared()); + int CurrentSize = Scene->Models.size(); + ModelLoader_->AddModelToLoadingQueue(AssetID, Scene->Models[CurrentSize-1]); - // float ScaleX = SceneDataNode[i]["AssetScaleX"].as(); - // float ScaleY = SceneDataNode[i]["AssetScaleY"].as(); - // float ScaleZ = SceneDataNode[i]["AssetScaleZ"].as(); + // Add Instance To Models Vector + Scene->Models[CurrentSize-1]->IsTemplateModel = false; + Scene->Models[CurrentSize-1]->SetLocRotScale(glm::vec3(PosX, PosY, PosZ), glm::vec3(RotX, RotY, RotZ), glm::vec3(ScaleX, ScaleY, ScaleZ)); + Scene->Models[CurrentSize-1]->ApplyTransformations(); + Scene->Models[CurrentSize-1]->AssetID = AssetID; + Scene->Models[CurrentSize-1]->Name = AssetName; - // //Load Model - // Scene.Models.push_back(std::make_shared()); - // int CurrentSize = Scene.Models.size(); - // ModelLoader_->AddModelToLoadingQueue(AssetID, Scene.Models[CurrentSize-1]); - // // Add Instance To Models Vector - // Scene.Models[CurrentSize-1]->IsTemplateModel = false; - // Scene.Models[CurrentSize-1]->SetLocRotScale(glm::vec3(PosX, PosY, PosZ), glm::vec3(RotX, RotY, RotZ), glm::vec3(ScaleX, ScaleY, ScaleZ)); - // Scene.Models[CurrentSize-1]->ApplyTransformations(); - // Scene.Models[CurrentSize-1]->AssetID = AssetID; - // Scene.Models[CurrentSize-1]->Name = AssetName; + // Load Attached Scripts + if (SceneDataNode[i]["AttachedScripts"]) { + YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + Scene->Models[CurrentSize-1]->AttachedScriptIndexes_.push_back(it->second.as()); + } + } - // // Load Attached Scripts - // if (SceneDataNode[i]["AttachedScripts"]) { - // YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - // for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - // Scene.Models[CurrentSize-1]->AttachedScriptIndexes_.push_back(it->second.as()); - // } - // } + // Load Shadow Configuration + if (SceneDataNode[i]["CastDynamicShadows"]) { + Scene->Models[CurrentSize-1]->CastDynamicShadows_ = SceneDataNode[i]["CastDynamicShadows"].as(); + } + if (SceneDataNode[i]["CastStaticShadows"]) { + Scene->Models[CurrentSize-1]->CastStaticShadows_ = SceneDataNode[i]["CastStaticShadows"].as(); + } - // // Load Shadow Configuration - // if (SceneDataNode[i]["CastDynamicShadows"]) { - // Scene.Models[CurrentSize-1]->CastDynamicShadows_ = SceneDataNode[i]["CastDynamicShadows"].as(); - // } + if (SceneDataNode[i]["ReceiveShadows"]) { + Scene->Models[CurrentSize-1]->ReceiveShadows_ = SceneDataNode[i]["ReceiveShadows"].as(); + } - // if (SceneDataNode[i]["CastStaticShadows"]) { - // Scene.Models[CurrentSize-1]->CastStaticShadows_ = SceneDataNode[i]["CastStaticShadows"].as(); - // } + if (SceneDataNode[i]["ShaderOverrideIndex"]) { + Scene->Models[CurrentSize-1]->ShaderOverrideIndex_ = SceneDataNode[i]["ShaderOverrideIndex"].as(); + } - // if (SceneDataNode[i]["ReceiveShadows"]) { - // Scene.Models[CurrentSize-1]->ReceiveShadows_ = SceneDataNode[i]["ReceiveShadows"].as(); - // } - // if (SceneDataNode[i]["ShaderOverrideIndex"]) { - // Scene.Models[CurrentSize-1]->ShaderOverrideIndex_ = SceneDataNode[i]["ShaderOverrideIndex"].as(); - // } + } else if (AssetType == std::string("DirectionalLight")) { + // Setup Model Pointer In Scene To Work On + Scene->DirectionalLights.push_back(std::make_shared()); + int LightIndex = Scene->DirectionalLights.size() - 1; - // } else if (AssetType == std::string("DirectionalLight")) { + Scene->DirectionalLights[LightIndex]->UserDefinedName = AssetName; - // // Setup Model Pointer In Scene To Work On - // Scene.DirectionalLights.push_back(std::make_shared()); - // int LightIndex = Scene.DirectionalLights.size() - 1; + if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { + Scene->DirectionalLights[LightIndex]->Color = glm::vec3( + SceneDataNode[i]["ColorRed"].as(), + SceneDataNode[i]["ColorGreen"].as(), + SceneDataNode[i]["ColorBlue"].as() + ); + } - // Scene.DirectionalLights[LightIndex]->UserDefinedName = AssetName; + if (SceneDataNode[i]["Intensity"]) { + Scene->DirectionalLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); + } - // if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { - // Scene.DirectionalLights[LightIndex]->Color = glm::vec3( - // SceneDataNode[i]["ColorRed"].as(), - // SceneDataNode[i]["ColorGreen"].as(), - // SceneDataNode[i]["ColorBlue"].as() - // ); - // } + if (SceneDataNode[i]["MaxDistance"]) { + Scene->DirectionalLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); + } - // if (SceneDataNode[i]["Intensity"]) { - // Scene.DirectionalLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); - // } + Scene->DirectionalLights[LightIndex]->Pos = glm::vec3( + SceneDataNode[i]["PosX"].as(), + SceneDataNode[i]["PosY"].as(), + SceneDataNode[i]["PosZ"].as() + ); + Scene->DirectionalLights[LightIndex]->Rot = glm::vec3( + SceneDataNode[i]["RotX"].as(), + SceneDataNode[i]["RotY"].as(), + SceneDataNode[i]["RotZ"].as() + ); + + + if (SceneDataNode[i]["CastShadows"]) { + Scene->DirectionalLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); + } + + // Load Attached Scripts + if (SceneDataNode[i]["AttachedScripts"]) { + YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + Scene->DirectionalLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); + } + } + + } else if (AssetType == std::string("PointLight")) { + + // Setup Model Pointer In Scene To Work On + Scene->PointLights.push_back(std::make_shared()); + int LightIndex = Scene->PointLights.size() - 1; + + Scene->PointLights[LightIndex]->UserDefinedName = AssetName; + if (SceneDataNode[i]["Intensity"]) { + Scene->PointLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); + } + if (SceneDataNode[i]["MaxDistance"]) { + Scene->PointLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); + } - // if (SceneDataNode[i]["MaxDistance"]) { - // Scene.DirectionalLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); - // } + + if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { + Scene->PointLights[LightIndex]->Color = glm::vec3( + SceneDataNode[i]["ColorRed"].as(), + SceneDataNode[i]["ColorGreen"].as(), + SceneDataNode[i]["ColorBlue"].as() + ); + } + + Scene->PointLights[LightIndex]->Pos = glm::vec3( + SceneDataNode[i]["PosX"].as(), + SceneDataNode[i]["PosY"].as(), + SceneDataNode[i]["PosZ"].as() + ); + + if (SceneDataNode[i]["CastShadows"]) { + Scene->PointLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); + } + + // Load Attached Scripts + if (SceneDataNode[i]["AttachedScripts"]) { + YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + Scene->PointLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); + } + } + + } else if (AssetType == std::string("SpotLight")) { + + // Setup Model Pointer In Scene To Work On + Scene->SpotLights.push_back(std::make_shared()); + int LightIndex = Scene->SpotLights.size() - 1; + + Scene->SpotLights[LightIndex]->UserDefinedName = AssetName; + + if (SceneDataNode[i]["Intensity"]) { + Scene->SpotLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); + } + if (SceneDataNode[i]["MaxDistance"]) { + Scene->SpotLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); + } + Scene->SpotLights[LightIndex]->CutOff = SceneDataNode[i]["CutOff"].as(); + + if (SceneDataNode[i]["RollOff"]) { + Scene->SpotLights[LightIndex]->Rolloff = SceneDataNode[i]["RollOff"].as(); + } + if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { + Scene->SpotLights[LightIndex]->Color = glm::vec3( + SceneDataNode[i]["ColorRed"].as(), + SceneDataNode[i]["ColorGreen"].as(), + SceneDataNode[i]["ColorBlue"].as() + ); + } + + + Scene->SpotLights[LightIndex]->Pos = glm::vec3( + SceneDataNode[i]["PosX"].as(), + SceneDataNode[i]["PosY"].as(), + SceneDataNode[i]["PosZ"].as() + ); + Scene->SpotLights[LightIndex]->Rot = glm::vec3( + SceneDataNode[i]["RotX"].as(), + SceneDataNode[i]["RotY"].as(), + SceneDataNode[i]["RotZ"].as() + ); + + + if (SceneDataNode[i]["CastShadows"]) { + Scene->SpotLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); + } + + // Load Attached Scripts + if (SceneDataNode[i]["AttachedScripts"]) { + YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + Scene->SpotLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); + } + } + + } else if (AssetType == std::string("SceneCamera")) { + + // Setup Model Pointer In Scene To Work On + Scene->SceneCameras.push_back(std::make_shared()); + int SceneCameraIndex = Scene->SceneCameras.size() - 1; + + Scene->SceneCameras[SceneCameraIndex]->UserDefinedName_ = AssetName; + Scene->SceneCameras[SceneCameraIndex]->Pos_ = glm::vec3( + SceneDataNode[i]["PosX"].as(), + SceneDataNode[i]["PosY"].as(), + SceneDataNode[i]["PosZ"].as() + ); + Scene->SceneCameras[SceneCameraIndex]->Rot_ = glm::vec3( + SceneDataNode[i]["RotX"].as(), + SceneDataNode[i]["RotY"].as(), + SceneDataNode[i]["RotZ"].as() + ); + + // Load Attached Scripts + if (SceneDataNode[i]["AttachedScripts"]) { + YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + Scene->SceneCameras[SceneCameraIndex]->AttachedScriptIndexes_.push_back(it->second.as()); + } + } + + } else { + SystemUtils_->Logger_->Log(std::string("Unsupported/Unknown Asset Type: ") + AssetType, 9); + } + + } + + // Indicate Scene Is Loaded + Scene->IsSceneLoaded = true; + + + +} - // Scene.DirectionalLights[LightIndex]->Pos = glm::vec3( - // SceneDataNode[i]["PosX"].as(), - // SceneDataNode[i]["PosY"].as(), - // SceneDataNode[i]["PosZ"].as() - // ); - // Scene.DirectionalLights[LightIndex]->Rot = glm::vec3( - // SceneDataNode[i]["RotX"].as(), - // SceneDataNode[i]["RotY"].as(), - // SceneDataNode[i]["RotZ"].as() - // ); - - - // if (SceneDataNode[i]["CastShadows"]) { - // Scene.DirectionalLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); - // } - - // // Load Attached Scripts - // if (SceneDataNode[i]["AttachedScripts"]) { - // YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - // for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - // Scene.DirectionalLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - // } - // } - - // } else if (AssetType == std::string("PointLight")) { - - // // Setup Model Pointer In Scene To Work On - // Scene.PointLights.push_back(std::make_shared()); - // int LightIndex = Scene.PointLights.size() - 1; - - // Scene.PointLights[LightIndex]->UserDefinedName = AssetName; - // if (SceneDataNode[i]["Intensity"]) { - // Scene.PointLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); - // } - // if (SceneDataNode[i]["MaxDistance"]) { - // Scene.PointLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); - // } - - // if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { - // Scene.PointLights[LightIndex]->Color = glm::vec3( - // SceneDataNode[i]["ColorRed"].as(), - // SceneDataNode[i]["ColorGreen"].as(), - // SceneDataNode[i]["ColorBlue"].as() - // ); - // } - - // Scene.PointLights[LightIndex]->Pos = glm::vec3( - // SceneDataNode[i]["PosX"].as(), - // SceneDataNode[i]["PosY"].as(), - // SceneDataNode[i]["PosZ"].as() - // ); - - // if (SceneDataNode[i]["CastShadows"]) { - // Scene.PointLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); - // } - - // // Load Attached Scripts - // if (SceneDataNode[i]["AttachedScripts"]) { - // YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - // for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - // Scene.PointLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - // } - // } - - // } else if (AssetType == std::string("SpotLight")) { - - // // Setup Model Pointer In Scene To Work On - // Scene.SpotLights.push_back(std::make_shared()); - // int LightIndex = Scene.SpotLights.size() - 1; - - // Scene.SpotLights[LightIndex]->UserDefinedName = AssetName; - - // if (SceneDataNode[i]["Intensity"]) { - // Scene.SpotLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); - // } - // if (SceneDataNode[i]["MaxDistance"]) { - // Scene.SpotLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); - // } - // Scene.SpotLights[LightIndex]->CutOff = SceneDataNode[i]["CutOff"].as(); - - // if (SceneDataNode[i]["RollOff"]) { - // Scene.SpotLights[LightIndex]->Rolloff = SceneDataNode[i]["RollOff"].as(); - // } - // if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { - // Scene.SpotLights[LightIndex]->Color = glm::vec3( - // SceneDataNode[i]["ColorRed"].as(), - // SceneDataNode[i]["ColorGreen"].as(), - // SceneDataNode[i]["ColorBlue"].as() - // ); - // } - - - // Scene.SpotLights[LightIndex]->Pos = glm::vec3( - // SceneDataNode[i]["PosX"].as(), - // SceneDataNode[i]["PosY"].as(), - // SceneDataNode[i]["PosZ"].as() - // ); - // Scene.SpotLights[LightIndex]->Rot = glm::vec3( - // SceneDataNode[i]["RotX"].as(), - // SceneDataNode[i]["RotY"].as(), - // SceneDataNode[i]["RotZ"].as() - // ); - - - // if (SceneDataNode[i]["CastShadows"]) { - // Scene.SpotLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); - // } - - // // Load Attached Scripts - // if (SceneDataNode[i]["AttachedScripts"]) { - // YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - // for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - // Scene.SpotLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - // } - // } - - // } else if (AssetType == std::string("SceneCamera")) { - - // // Setup Model Pointer In Scene To Work On - // Scene.SceneCameras.push_back(std::make_shared()); - // int SceneCameraIndex = Scene.SceneCameras.size() - 1; - - // Scene.SceneCameras[SceneCameraIndex]->UserDefinedName_ = AssetName; - // Scene.SceneCameras[SceneCameraIndex]->Pos_ = glm::vec3( - // SceneDataNode[i]["PosX"].as(), - // SceneDataNode[i]["PosY"].as(), - // SceneDataNode[i]["PosZ"].as() - // ); - // Scene.SceneCameras[SceneCameraIndex]->Rot_ = glm::vec3( - // SceneDataNode[i]["RotX"].as(), - // SceneDataNode[i]["RotY"].as(), - // SceneDataNode[i]["RotZ"].as() - // ); - - // // Load Attached Scripts - // if (SceneDataNode[i]["AttachedScripts"]) { - // YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - // for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - // Scene.SceneCameras[SceneCameraIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - // } - // } - - // } else { - // SystemUtils_->Logger_->Log(std::string("Unsupported/Unknown Asset Type: ") + AssetType, 9); - // } - - // } - - // // Indicate Scene Is Loaded - // Scene.IsSceneLoaded = true; \ No newline at end of file From b275633092aa14e48ee7380de8586e4836f1e2eb Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:57:18 +0000 Subject: [PATCH 025/125] Update Scene Loader --- .../ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 13 ++++++------- .../Core/Loader/ERS_SceneLoader/ERS_SceneLoader.cpp | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 9fb091af54..d6fc031ac3 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -10,22 +10,21 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E // Grab Metadata - Scene->SceneFormatVersion = RawSceneData["SceneFormatVersion"].as(); - Scene->SceneName = RawSceneData["SceneName"].as(); - Scene->ScenePath = AssetID; + Scene->SceneFormatVersion = SceneData["SceneFormatVersion"].as(); + Scene->SceneName = SceneData["SceneName"].as(); - if (RawSceneData["ActiveCameraIndex"]) { - Scene->ActiveSceneCameraIndex = RawSceneData["ActiveCameraIndex"].as(); + if (SceneData["ActiveCameraIndex"]) { + Scene->ActiveSceneCameraIndex = SceneData["ActiveCameraIndex"].as(); } // Log Scene Processing - SystemUtils_->Logger_->Log(std::string("Processing Scene: ") + std::string(Scene->SceneName), 3); + SystemUtils->Logger_->Log(std::string("Processing Scene: ") + std::string(Scene->SceneName), 3); // Create Vector Of YAML::Nodes std::vector SceneItems; // Populate Vector With Elements From SceneData - YAML::Node SceneDataNode = RawSceneData["SceneData"]; + YAML::Node SceneDataNode = SceneData["SceneData"]; for (YAML::const_iterator it=SceneDataNode.begin(); it!=SceneDataNode.end(); ++it) { SceneItems.push_back(it->second); } diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_SceneLoader.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_SceneLoader.cpp index 38afc0781d..5295f6bbd9 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_SceneLoader.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_SceneLoader.cpp @@ -42,7 +42,7 @@ ERS_STRUCT_Scene ERS_CLASS_SceneLoader::ProcessScene(YAML::Node RawSceneData, lo // Create Scene Instance ERS_STRUCT_Scene Scene; - + Scene.ScenePath = AssetID; // Return Scene From 964ef4b3d4d6065a795e145a569df0bea06a546b Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:58:57 +0000 Subject: [PATCH 026/125] Update Scene Loader --- .../ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.h | 2 +- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 6 +++--- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.h index 6e3a4ee464..2b79449e6b 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.h @@ -30,4 +30,4 @@ * @return true Loading completed without errors. * @return false Loading failed. */ -bool ERS_FUNCTION_DecodeScene(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, bool LogEnable = true); \ No newline at end of file +bool ERS_FUNCTION_DecodeScene(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable = true); \ No newline at end of file diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index d6fc031ac3..2c5b81c15b 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -6,7 +6,7 @@ -bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, bool LogEnable = true) { +bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable = true) { // Grab Metadata @@ -58,7 +58,7 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E //Load Model Scene->Models.push_back(std::make_shared()); int CurrentSize = Scene->Models.size(); - ModelLoader_->AddModelToLoadingQueue(AssetID, Scene->Models[CurrentSize-1]); + ModelLoader->AddModelToLoadingQueue(AssetID, Scene->Models[CurrentSize-1]); // Add Instance To Models Vector Scene->Models[CurrentSize-1]->IsTemplateModel = false; @@ -263,7 +263,7 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E } } else { - SystemUtils_->Logger_->Log(std::string("Unsupported/Unknown Asset Type: ") + AssetType, 9); + SystemUtils->Logger_->Log(std::string("Unsupported/Unknown Asset Type: ") + AssetType, 9); } } diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h index 318e257852..8a3a36b780 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h @@ -26,4 +26,4 @@ * @return true Loading completed without errors. * @return false Loading failed. */ -bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, bool LogEnable = true); \ No newline at end of file +bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable = true); \ No newline at end of file From 30e74981e69c20e430a3bb7f7f3b0f80bc4d0cf4 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:59:17 +0000 Subject: [PATCH 027/125] Update Scene Loader --- .../ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp | 8 ++++---- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h | 2 +- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp index 667b3897b8..ec41625da9 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp @@ -7,7 +7,7 @@ -bool ERS_FUNCTION_DecodeScene(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, bool LogEnable) { +bool ERS_FUNCTION_DecodeScene(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable) { SystemUtils->Logger_->Log("Decoding ERS Scene", 5, LogEnable); @@ -23,11 +23,11 @@ bool ERS_FUNCTION_DecodeScene(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS // Attempt Decoding With Known Decoding Systems if (Version == 1) { - return ERS_FUNCTION_DecodeSceneV1(SceneData, Scene, SystemUtils, LogEnable); + return ERS_FUNCTION_DecodeSceneV1(SceneData, Scene, SystemUtils, ModelLoader, LogEnable); } else if (Version == 2) { - return ERS_FUNCTION_DecodeSceneV2(SceneData, Scene, SystemUtils, LogEnable); + return ERS_FUNCTION_DecodeSceneV2(SceneData, Scene, SystemUtils, ModelLoader, LogEnable); } else if (Version == 3) { - return ERS_FUNCTION_DecodeSceneV3(SceneData, Scene, SystemUtils, LogEnable); + return ERS_FUNCTION_DecodeSceneV3(SceneData, Scene, SystemUtils, ModelLoader, LogEnable); } } \ No newline at end of file diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h index f01e31a265..99a152c579 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h @@ -27,4 +27,4 @@ * @return true Loading completed without errors. * @return false Loading failed. */ -bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, bool LogEnable = true); \ No newline at end of file +bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable = true); \ No newline at end of file diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h index ba3414538c..852d16b6de 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h @@ -26,4 +26,4 @@ * @return true Loading completed without errors. * @return false Loading failed. */ -bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, bool LogEnable = true); \ No newline at end of file +bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable = true); \ No newline at end of file From 7b40c683a03d34da1f417233bc8034182da98a59 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 21:59:42 +0000 Subject: [PATCH 028/125] Update Scene Loader --- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.h | 2 ++ .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h | 2 ++ .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h | 1 + .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h | 2 ++ 4 files changed, 7 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.h index 2b79449e6b..6ffc668bd4 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.h @@ -15,6 +15,8 @@ #include #include +#include + #include #include #include diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h index 8a3a36b780..dd5678de33 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h @@ -15,6 +15,8 @@ #include #include +#include + /** * @brief Decodes the specified version of the scene format. diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h index 99a152c579..f26d029965 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h @@ -15,6 +15,7 @@ #include #include +#include /** diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h index 852d16b6de..aaa06bbed4 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h @@ -15,6 +15,8 @@ #include #include +#include + /** * @brief Decodes the specified version of the scene format. From e23407a6020975c14b238e226c08fe5685d68957 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:01:37 +0000 Subject: [PATCH 029/125] Update Scene Loader --- Source/Core/Loader/ERS_SceneLoader/ERS_SceneLoader.cpp | 1 + Source/Core/Loader/ERS_SceneLoader/ERS_SceneLoader.h | 2 ++ Source/Core/Structures/ERS_STRUCT_Camera/ERS_STRUCT_Camera.h | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_SceneLoader.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_SceneLoader.cpp index 5295f6bbd9..fba227282e 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_SceneLoader.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_SceneLoader.cpp @@ -44,6 +44,7 @@ ERS_STRUCT_Scene ERS_CLASS_SceneLoader::ProcessScene(YAML::Node RawSceneData, lo ERS_STRUCT_Scene Scene; Scene.ScenePath = AssetID; + ERS_FUNCT // Return Scene return Scene; diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_SceneLoader.h b/Source/Core/Loader/ERS_SceneLoader/ERS_SceneLoader.h index bdb0f4b4f7..74f1f26752 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_SceneLoader.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_SceneLoader.h @@ -14,6 +14,8 @@ #include #include +#include + #include #include #include diff --git a/Source/Core/Structures/ERS_STRUCT_Camera/ERS_STRUCT_Camera.h b/Source/Core/Structures/ERS_STRUCT_Camera/ERS_STRUCT_Camera.h index 4a08384ef4..b939eab00c 100644 --- a/Source/Core/Structures/ERS_STRUCT_Camera/ERS_STRUCT_Camera.h +++ b/Source/Core/Structures/ERS_STRUCT_Camera/ERS_STRUCT_Camera.h @@ -247,7 +247,7 @@ struct ERS_STRUCT_Camera { // Asset Streaming Settings - int StreamingPriority_ = 1; /**< Higher this is, the more the system will try and load assets for this camera. Should be in range (1-10)*/ + int StreamingPriority_ = 1; /**< Higher this is, the more the system will try and load assets for this camera. Should be in range (1-10)*/ }; From 8e1ab5fda3fa870e79a6c1d8082dea618209e4d3 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:01:46 +0000 Subject: [PATCH 030/125] Update Scene Loader --- .../ERS_STRUCT_Camera/ERS_STRUCT_Camera.h | 86 ------------------- 1 file changed, 86 deletions(-) diff --git a/Source/Core/Structures/ERS_STRUCT_Camera/ERS_STRUCT_Camera.h b/Source/Core/Structures/ERS_STRUCT_Camera/ERS_STRUCT_Camera.h index b939eab00c..85d8174289 100644 --- a/Source/Core/Structures/ERS_STRUCT_Camera/ERS_STRUCT_Camera.h +++ b/Source/Core/Structures/ERS_STRUCT_Camera/ERS_STRUCT_Camera.h @@ -252,89 +252,3 @@ struct ERS_STRUCT_Camera { }; - - - - - - - -// struct ERS_STRUCT_Camera { -// private: -// void Rotate(float angle, const glm::vec3 &axis); - -// glm::mat4 PerspectiveMatrix_; -// glm::mat4 ViewMatrix_; - -// float AspectRatio_; -// float NearClip_; -// float FarClip_; - -// public: - -// // Asset Streaming Config -// int Priority_ = 1; // Higher this is, the more the system will try and load assets for this camera. Should be in range (1-10) - -// float FOV_; -// float zoom; -// float zoomDelta = glm::radians(1.0f); - - - -// glm::vec3 Position_; - -// glm::quat orientation; // store rotation and orientation data - -// glm::vec3 mousePosition; // use to calculate the yaw and pitch rotation. -// float mouseSenstivitiy = 0.0009f; // slow down the rate in which the camera rotate - -// // play around with those two values until you get a roll speed that you like. -// const float ROLL_ANGLE = 0.009f; // we're using this because roll depends on the mouse scroll. -// float rollDamp = 0.95f; // we're using this because roll depends on the mouse scroll. - -// float damp = 0.8f; // a value to damp the camera rotational speed - -// // the angles to rotate the camera by. -// float Yaw_ = 0.0f; // rotate about the y axis -// float Pitch_ = 0.0f; // rotate about the x axis -// float Roll_ = 0.0f; // rotate about the z axis -// float twoPI = glm::two_pi(); // check radian bound - -// float MovementSpeed_ = 0.2f; // the linear travel speed of the camera - - -// glm::vec3 xAxis = glm::vec3(1.0f, 0.0f, 0.0f); -// glm::vec3 yAxis = glm::vec3(0.0f, 1.0f, 0.0f); -// glm::vec3 zAxis = glm::vec3(0.0f, 0.0f, 1.0f); - - -// //ERS_STRUCT_Camera() = delete; - -// ///The vertical Field of View. In radians -// ///The width of the display window -// ///The height of the display window -// ///The near-clipping plane -// ///The far-clipping plane -// ///The Position_ of the camera -// ERS_STRUCT_Camera(float fov, int width, int height, float near, float far); -// ERS_STRUCT_Camera(float fov, int width, int height, float near, float far, glm::vec3 Position); -// ERS_STRUCT_Camera(glm::vec3 Position = glm::vec3(0.0f, 0.0f, 0.0f)); - - -// // Done -// void ProcessKeyboard(CameraMovement Direction, float DeltaTime); -// void ProcessMouseMovement(float XOffset, float YOffset); // control pitch and yaw -// void ProcessMouseScroll(float YOffset); // control Roll_ -// void SetRotation(glm::vec3 Rotation); -// void SetAspectRatio(float AspectRatio); -// void Update(); - -// // Todo -// void Zoom(ZoomState z); - - -// void SetMousePosition(float x, float y); -// void GetMatrices(glm::mat4& perspective, glm::mat4& view); -// //void GetDirectionVectors(glm::vec3 &Front, glm::vec3 &Right, glm::vec3 &Up); - -// }; From 04ce6840116d88f81de43aa820f3f96cc0664d17 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:06:31 +0000 Subject: [PATCH 031/125] Update Scene Loader --- Source/Core/Loader/ERS_SceneLoader/ERS_SceneLoader.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_SceneLoader.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_SceneLoader.cpp index fba227282e..827519b528 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_SceneLoader.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_SceneLoader.cpp @@ -44,7 +44,8 @@ ERS_STRUCT_Scene ERS_CLASS_SceneLoader::ProcessScene(YAML::Node RawSceneData, lo ERS_STRUCT_Scene Scene; Scene.ScenePath = AssetID; - ERS_FUNCT + // Decode + ERS_FUNCTION_DecodeScene(RawSceneData, &Scene, SystemUtils_, ModelLoader_); // Return Scene return Scene; From 04ab211e9aca6a0d0492555945f7903b842c8025 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:09:21 +0000 Subject: [PATCH 032/125] Update Scene Loader --- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 2c5b81c15b..dd19ba3f31 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -20,10 +20,8 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E // Log Scene Processing SystemUtils->Logger_->Log(std::string("Processing Scene: ") + std::string(Scene->SceneName), 3); - // Create Vector Of YAML::Nodes + // Create List Of Scene Items std::vector SceneItems; - - // Populate Vector With Elements From SceneData YAML::Node SceneDataNode = SceneData["SceneData"]; for (YAML::const_iterator it=SceneDataNode.begin(); it!=SceneDataNode.end(); ++it) { SceneItems.push_back(it->second); From 59c77d69f7820098f3fee65c278b38b392b10bfe Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:09:52 +0000 Subject: [PATCH 033/125] Update Scene Loader --- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index dd19ba3f31..8505810384 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -268,8 +268,7 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E // Indicate Scene Is Loaded Scene->IsSceneLoaded = true; - - + return true; } From 1ef17b0b9b31e55bd3b14e39be83ae076fb87ee2 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:10:17 +0000 Subject: [PATCH 034/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV2.cpp | 279 +++++++++++++++++- 1 file changed, 278 insertions(+), 1 deletion(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp index 0d2750ae3d..2e7a577c09 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp @@ -2,4 +2,281 @@ // This file is part of the BrainGenix-ERS Environment Rendering System // //======================================================================// -#include \ No newline at end of file +#include + + +//======================================================================// +// This file is part of the BrainGenix-ERS Environment Rendering System // +//======================================================================// + +#include + + + +bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable = true) { + + + // Grab Metadata + Scene->SceneFormatVersion = SceneData["SceneFormatVersion"].as(); + Scene->SceneName = SceneData["SceneName"].as(); + + if (SceneData["ActiveCameraIndex"]) { + Scene->ActiveSceneCameraIndex = SceneData["ActiveCameraIndex"].as(); + } + + // Log Scene Processing + SystemUtils->Logger_->Log(std::string("Processing Scene: ") + std::string(Scene->SceneName), 3); + + // Create List Of Scene Items + std::vector SceneItems; + YAML::Node SceneDataNode = SceneData["SceneData"]; + for (YAML::const_iterator it=SceneDataNode.begin(); it!=SceneDataNode.end(); ++it) { + SceneItems.push_back(it->second); + } + + + // Iterate Through Vector To Add Each Asset To Loading Queue Of Requested Type + for (long i = 0; (long)i < (long)SceneDataNode.size(); i++) { + + // Get Asset Information + std::string AssetName = SceneDataNode[i]["AssetName"].as(); + std::string AssetType = SceneDataNode[i]["AssetType"].as(); + + // If type Is Model + if (AssetType == std::string("Model")) { + + long AssetID = SceneDataNode[i]["AssetID"].as(); + + // Get Asset LocRotScale + float PosX = SceneDataNode[i]["AssetPositionX"].as(); + float PosY = SceneDataNode[i]["AssetPositionY"].as(); + float PosZ = SceneDataNode[i]["AssetPositionZ"].as(); + + float RotX = SceneDataNode[i]["AssetRotationX"].as(); + float RotY = SceneDataNode[i]["AssetRotationY"].as(); + float RotZ = SceneDataNode[i]["AssetRotationZ"].as(); + + float ScaleX = SceneDataNode[i]["AssetScaleX"].as(); + float ScaleY = SceneDataNode[i]["AssetScaleY"].as(); + float ScaleZ = SceneDataNode[i]["AssetScaleZ"].as(); + + //Load Model + Scene->Models.push_back(std::make_shared()); + int CurrentSize = Scene->Models.size(); + ModelLoader->AddModelToLoadingQueue(AssetID, Scene->Models[CurrentSize-1]); + + // Add Instance To Models Vector + Scene->Models[CurrentSize-1]->IsTemplateModel = false; + Scene->Models[CurrentSize-1]->SetLocRotScale(glm::vec3(PosX, PosY, PosZ), glm::vec3(RotX, RotY, RotZ), glm::vec3(ScaleX, ScaleY, ScaleZ)); + Scene->Models[CurrentSize-1]->ApplyTransformations(); + Scene->Models[CurrentSize-1]->AssetID = AssetID; + Scene->Models[CurrentSize-1]->Name = AssetName; + + + // Load Attached Scripts + if (SceneDataNode[i]["AttachedScripts"]) { + YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + Scene->Models[CurrentSize-1]->AttachedScriptIndexes_.push_back(it->second.as()); + } + } + + + // Load Shadow Configuration + if (SceneDataNode[i]["CastDynamicShadows"]) { + Scene->Models[CurrentSize-1]->CastDynamicShadows_ = SceneDataNode[i]["CastDynamicShadows"].as(); + } + + if (SceneDataNode[i]["CastStaticShadows"]) { + Scene->Models[CurrentSize-1]->CastStaticShadows_ = SceneDataNode[i]["CastStaticShadows"].as(); + } + + if (SceneDataNode[i]["ReceiveShadows"]) { + Scene->Models[CurrentSize-1]->ReceiveShadows_ = SceneDataNode[i]["ReceiveShadows"].as(); + } + + if (SceneDataNode[i]["ShaderOverrideIndex"]) { + Scene->Models[CurrentSize-1]->ShaderOverrideIndex_ = SceneDataNode[i]["ShaderOverrideIndex"].as(); + } + + + } else if (AssetType == std::string("DirectionalLight")) { + + // Setup Model Pointer In Scene To Work On + Scene->DirectionalLights.push_back(std::make_shared()); + int LightIndex = Scene->DirectionalLights.size() - 1; + + Scene->DirectionalLights[LightIndex]->UserDefinedName = AssetName; + + if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { + Scene->DirectionalLights[LightIndex]->Color = glm::vec3( + SceneDataNode[i]["ColorRed"].as(), + SceneDataNode[i]["ColorGreen"].as(), + SceneDataNode[i]["ColorBlue"].as() + ); + } + + if (SceneDataNode[i]["Intensity"]) { + Scene->DirectionalLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); + } + + if (SceneDataNode[i]["MaxDistance"]) { + Scene->DirectionalLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); + } + + Scene->DirectionalLights[LightIndex]->Pos = glm::vec3( + SceneDataNode[i]["PosX"].as(), + SceneDataNode[i]["PosY"].as(), + SceneDataNode[i]["PosZ"].as() + ); + Scene->DirectionalLights[LightIndex]->Rot = glm::vec3( + SceneDataNode[i]["RotX"].as(), + SceneDataNode[i]["RotY"].as(), + SceneDataNode[i]["RotZ"].as() + ); + + + if (SceneDataNode[i]["CastShadows"]) { + Scene->DirectionalLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); + } + + // Load Attached Scripts + if (SceneDataNode[i]["AttachedScripts"]) { + YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + Scene->DirectionalLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); + } + } + + } else if (AssetType == std::string("PointLight")) { + + // Setup Model Pointer In Scene To Work On + Scene->PointLights.push_back(std::make_shared()); + int LightIndex = Scene->PointLights.size() - 1; + + Scene->PointLights[LightIndex]->UserDefinedName = AssetName; + if (SceneDataNode[i]["Intensity"]) { + Scene->PointLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); + } + if (SceneDataNode[i]["MaxDistance"]) { + Scene->PointLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); + } + + + if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { + Scene->PointLights[LightIndex]->Color = glm::vec3( + SceneDataNode[i]["ColorRed"].as(), + SceneDataNode[i]["ColorGreen"].as(), + SceneDataNode[i]["ColorBlue"].as() + ); + } + + Scene->PointLights[LightIndex]->Pos = glm::vec3( + SceneDataNode[i]["PosX"].as(), + SceneDataNode[i]["PosY"].as(), + SceneDataNode[i]["PosZ"].as() + ); + + if (SceneDataNode[i]["CastShadows"]) { + Scene->PointLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); + } + + // Load Attached Scripts + if (SceneDataNode[i]["AttachedScripts"]) { + YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + Scene->PointLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); + } + } + + } else if (AssetType == std::string("SpotLight")) { + + // Setup Model Pointer In Scene To Work On + Scene->SpotLights.push_back(std::make_shared()); + int LightIndex = Scene->SpotLights.size() - 1; + + Scene->SpotLights[LightIndex]->UserDefinedName = AssetName; + + if (SceneDataNode[i]["Intensity"]) { + Scene->SpotLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); + } + if (SceneDataNode[i]["MaxDistance"]) { + Scene->SpotLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); + } + Scene->SpotLights[LightIndex]->CutOff = SceneDataNode[i]["CutOff"].as(); + + if (SceneDataNode[i]["RollOff"]) { + Scene->SpotLights[LightIndex]->Rolloff = SceneDataNode[i]["RollOff"].as(); + } + if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { + Scene->SpotLights[LightIndex]->Color = glm::vec3( + SceneDataNode[i]["ColorRed"].as(), + SceneDataNode[i]["ColorGreen"].as(), + SceneDataNode[i]["ColorBlue"].as() + ); + } + + + Scene->SpotLights[LightIndex]->Pos = glm::vec3( + SceneDataNode[i]["PosX"].as(), + SceneDataNode[i]["PosY"].as(), + SceneDataNode[i]["PosZ"].as() + ); + Scene->SpotLights[LightIndex]->Rot = glm::vec3( + SceneDataNode[i]["RotX"].as(), + SceneDataNode[i]["RotY"].as(), + SceneDataNode[i]["RotZ"].as() + ); + + + if (SceneDataNode[i]["CastShadows"]) { + Scene->SpotLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); + } + + // Load Attached Scripts + if (SceneDataNode[i]["AttachedScripts"]) { + YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + Scene->SpotLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); + } + } + + } else if (AssetType == std::string("SceneCamera")) { + + // Setup Model Pointer In Scene To Work On + Scene->SceneCameras.push_back(std::make_shared()); + int SceneCameraIndex = Scene->SceneCameras.size() - 1; + + Scene->SceneCameras[SceneCameraIndex]->UserDefinedName_ = AssetName; + Scene->SceneCameras[SceneCameraIndex]->Pos_ = glm::vec3( + SceneDataNode[i]["PosX"].as(), + SceneDataNode[i]["PosY"].as(), + SceneDataNode[i]["PosZ"].as() + ); + Scene->SceneCameras[SceneCameraIndex]->Rot_ = glm::vec3( + SceneDataNode[i]["RotX"].as(), + SceneDataNode[i]["RotY"].as(), + SceneDataNode[i]["RotZ"].as() + ); + + // Load Attached Scripts + if (SceneDataNode[i]["AttachedScripts"]) { + YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + Scene->SceneCameras[SceneCameraIndex]->AttachedScriptIndexes_.push_back(it->second.as()); + } + } + + } else { + SystemUtils->Logger_->Log(std::string("Unsupported/Unknown Asset Type: ") + AssetType, 9); + } + + } + + // Indicate Scene Is Loaded + Scene->IsSceneLoaded = true; + return true; + +} + + From d47b7e58e1a7d1c5fee51c2ed4e4d6fa5804a845 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:13:04 +0000 Subject: [PATCH 035/125] Update Scene Loader --- .../ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp index 2e7a577c09..69fe0eb091 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp @@ -259,6 +259,14 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E SceneDataNode[i]["RotZ"].as() ); + Scene->SceneCameras[SceneCameraIndex]->NearClip_ = SceneDataNode[i]["NearClip"].as(); + Scene->SceneCameras[SceneCameraIndex]->FarClip_ = SceneDataNode[i]["FarClip"].as(); + Scene->SceneCameras[SceneCameraIndex]->FOV_ = SceneDataNode[i]["FOV"].as(); + Scene->SceneCameras[SceneCameraIndex]->EnforceAspectRatio_ = SceneDataNode[i]["EnforceAspectRatio"].as(); + Scene->SceneCameras[SceneCameraIndex]->AspectRatio_ = SceneDataNode[i]["AspectRatio"].as(); + Scene->SceneCameras[SceneCameraIndex]->StreamingPriority_ = SceneDataNode[i]["StreamingPriority"].as(); + + // Load Attached Scripts if (SceneDataNode[i]["AttachedScripts"]) { YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; From 36500c66956ddf4cc7290475fab41471be4dcf44 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:16:20 +0000 Subject: [PATCH 036/125] Update Scene Loader --- .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp index 69fe0eb091..863af824f7 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp @@ -13,7 +13,7 @@ -bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable = true) { +bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable = true) { // Grab Metadata From b82da32a91f21329df47b8c8066c557b455ad319 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:16:30 +0000 Subject: [PATCH 037/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV3.cpp | 279 +++++++++++++++++- 1 file changed, 278 insertions(+), 1 deletion(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp index caf87d5ca9..8ddaed0beb 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp @@ -2,4 +2,281 @@ // This file is part of the BrainGenix-ERS Environment Rendering System // //======================================================================// -#include \ No newline at end of file +#include + + +bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable = true) { + + + // Grab Metadata + Scene->SceneFormatVersion = SceneData["SceneFormatVersion"].as(); + Scene->SceneName = SceneData["SceneName"].as(); + + if (SceneData["ActiveCameraIndex"]) { + Scene->ActiveSceneCameraIndex = SceneData["ActiveCameraIndex"].as(); + } + + // Log Scene Processing + SystemUtils->Logger_->Log(std::string("Processing Scene: ") + std::string(Scene->SceneName), 3); + + // Create List Of Scene Items + std::vector SceneItems; + YAML::Node SceneDataNode = SceneData["SceneData"]; + for (YAML::const_iterator it=SceneDataNode.begin(); it!=SceneDataNode.end(); ++it) { + SceneItems.push_back(it->second); + } + + + // Iterate Through Vector To Add Each Asset To Loading Queue Of Requested Type + for (long i = 0; (long)i < (long)SceneDataNode.size(); i++) { + + // Get Asset Information + std::string AssetName = SceneDataNode[i]["AssetName"].as(); + std::string AssetType = SceneDataNode[i]["AssetType"].as(); + + // If type Is Model + if (AssetType == std::string("Model")) { + + long AssetID = SceneDataNode[i]["AssetID"].as(); + + // Get Asset LocRotScale + float PosX = SceneDataNode[i]["AssetPositionX"].as(); + float PosY = SceneDataNode[i]["AssetPositionY"].as(); + float PosZ = SceneDataNode[i]["AssetPositionZ"].as(); + + float RotX = SceneDataNode[i]["AssetRotationX"].as(); + float RotY = SceneDataNode[i]["AssetRotationY"].as(); + float RotZ = SceneDataNode[i]["AssetRotationZ"].as(); + + float ScaleX = SceneDataNode[i]["AssetScaleX"].as(); + float ScaleY = SceneDataNode[i]["AssetScaleY"].as(); + float ScaleZ = SceneDataNode[i]["AssetScaleZ"].as(); + + //Load Model + Scene->Models.push_back(std::make_shared()); + int CurrentSize = Scene->Models.size(); + ModelLoader->AddModelToLoadingQueue(AssetID, Scene->Models[CurrentSize-1]); + + // Add Instance To Models Vector + Scene->Models[CurrentSize-1]->IsTemplateModel = false; + Scene->Models[CurrentSize-1]->SetLocRotScale(glm::vec3(PosX, PosY, PosZ), glm::vec3(RotX, RotY, RotZ), glm::vec3(ScaleX, ScaleY, ScaleZ)); + Scene->Models[CurrentSize-1]->ApplyTransformations(); + Scene->Models[CurrentSize-1]->AssetID = AssetID; + Scene->Models[CurrentSize-1]->Name = AssetName; + + + // Load Attached Scripts + if (SceneDataNode[i]["AttachedScripts"]) { + YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + Scene->Models[CurrentSize-1]->AttachedScriptIndexes_.push_back(it->second.as()); + } + } + + + // Load Shadow Configuration + if (SceneDataNode[i]["CastDynamicShadows"]) { + Scene->Models[CurrentSize-1]->CastDynamicShadows_ = SceneDataNode[i]["CastDynamicShadows"].as(); + } + + if (SceneDataNode[i]["CastStaticShadows"]) { + Scene->Models[CurrentSize-1]->CastStaticShadows_ = SceneDataNode[i]["CastStaticShadows"].as(); + } + + if (SceneDataNode[i]["ReceiveShadows"]) { + Scene->Models[CurrentSize-1]->ReceiveShadows_ = SceneDataNode[i]["ReceiveShadows"].as(); + } + + if (SceneDataNode[i]["ShaderOverrideIndex"]) { + Scene->Models[CurrentSize-1]->ShaderOverrideIndex_ = SceneDataNode[i]["ShaderOverrideIndex"].as(); + } + + + } else if (AssetType == std::string("DirectionalLight")) { + + // Setup Model Pointer In Scene To Work On + Scene->DirectionalLights.push_back(std::make_shared()); + int LightIndex = Scene->DirectionalLights.size() - 1; + + Scene->DirectionalLights[LightIndex]->UserDefinedName = AssetName; + + if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { + Scene->DirectionalLights[LightIndex]->Color = glm::vec3( + SceneDataNode[i]["ColorRed"].as(), + SceneDataNode[i]["ColorGreen"].as(), + SceneDataNode[i]["ColorBlue"].as() + ); + } + + if (SceneDataNode[i]["Intensity"]) { + Scene->DirectionalLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); + } + + if (SceneDataNode[i]["MaxDistance"]) { + Scene->DirectionalLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); + } + + Scene->DirectionalLights[LightIndex]->Pos = glm::vec3( + SceneDataNode[i]["PosX"].as(), + SceneDataNode[i]["PosY"].as(), + SceneDataNode[i]["PosZ"].as() + ); + Scene->DirectionalLights[LightIndex]->Rot = glm::vec3( + SceneDataNode[i]["RotX"].as(), + SceneDataNode[i]["RotY"].as(), + SceneDataNode[i]["RotZ"].as() + ); + + + if (SceneDataNode[i]["CastShadows"]) { + Scene->DirectionalLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); + } + + // Load Attached Scripts + if (SceneDataNode[i]["AttachedScripts"]) { + YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + Scene->DirectionalLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); + } + } + + } else if (AssetType == std::string("PointLight")) { + + // Setup Model Pointer In Scene To Work On + Scene->PointLights.push_back(std::make_shared()); + int LightIndex = Scene->PointLights.size() - 1; + + Scene->PointLights[LightIndex]->UserDefinedName = AssetName; + if (SceneDataNode[i]["Intensity"]) { + Scene->PointLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); + } + if (SceneDataNode[i]["MaxDistance"]) { + Scene->PointLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); + } + + + if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { + Scene->PointLights[LightIndex]->Color = glm::vec3( + SceneDataNode[i]["ColorRed"].as(), + SceneDataNode[i]["ColorGreen"].as(), + SceneDataNode[i]["ColorBlue"].as() + ); + } + + Scene->PointLights[LightIndex]->Pos = glm::vec3( + SceneDataNode[i]["PosX"].as(), + SceneDataNode[i]["PosY"].as(), + SceneDataNode[i]["PosZ"].as() + ); + + if (SceneDataNode[i]["CastShadows"]) { + Scene->PointLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); + } + + // Load Attached Scripts + if (SceneDataNode[i]["AttachedScripts"]) { + YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + Scene->PointLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); + } + } + + } else if (AssetType == std::string("SpotLight")) { + + // Setup Model Pointer In Scene To Work On + Scene->SpotLights.push_back(std::make_shared()); + int LightIndex = Scene->SpotLights.size() - 1; + + Scene->SpotLights[LightIndex]->UserDefinedName = AssetName; + + if (SceneDataNode[i]["Intensity"]) { + Scene->SpotLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); + } + if (SceneDataNode[i]["MaxDistance"]) { + Scene->SpotLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); + } + Scene->SpotLights[LightIndex]->CutOff = SceneDataNode[i]["CutOff"].as(); + + if (SceneDataNode[i]["RollOff"]) { + Scene->SpotLights[LightIndex]->Rolloff = SceneDataNode[i]["RollOff"].as(); + } + if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { + Scene->SpotLights[LightIndex]->Color = glm::vec3( + SceneDataNode[i]["ColorRed"].as(), + SceneDataNode[i]["ColorGreen"].as(), + SceneDataNode[i]["ColorBlue"].as() + ); + } + + + Scene->SpotLights[LightIndex]->Pos = glm::vec3( + SceneDataNode[i]["PosX"].as(), + SceneDataNode[i]["PosY"].as(), + SceneDataNode[i]["PosZ"].as() + ); + Scene->SpotLights[LightIndex]->Rot = glm::vec3( + SceneDataNode[i]["RotX"].as(), + SceneDataNode[i]["RotY"].as(), + SceneDataNode[i]["RotZ"].as() + ); + + + if (SceneDataNode[i]["CastShadows"]) { + Scene->SpotLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); + } + + // Load Attached Scripts + if (SceneDataNode[i]["AttachedScripts"]) { + YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + Scene->SpotLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); + } + } + + } else if (AssetType == std::string("SceneCamera")) { + + // Setup Model Pointer In Scene To Work On + Scene->SceneCameras.push_back(std::make_shared()); + int SceneCameraIndex = Scene->SceneCameras.size() - 1; + + Scene->SceneCameras[SceneCameraIndex]->UserDefinedName_ = AssetName; + Scene->SceneCameras[SceneCameraIndex]->Pos_ = glm::vec3( + SceneDataNode[i]["PosX"].as(), + SceneDataNode[i]["PosY"].as(), + SceneDataNode[i]["PosZ"].as() + ); + Scene->SceneCameras[SceneCameraIndex]->Rot_ = glm::vec3( + SceneDataNode[i]["RotX"].as(), + SceneDataNode[i]["RotY"].as(), + SceneDataNode[i]["RotZ"].as() + ); + + Scene->SceneCameras[SceneCameraIndex]->NearClip_ = SceneDataNode[i]["NearClip"].as(); + Scene->SceneCameras[SceneCameraIndex]->FarClip_ = SceneDataNode[i]["FarClip"].as(); + Scene->SceneCameras[SceneCameraIndex]->FOV_ = SceneDataNode[i]["FOV"].as(); + Scene->SceneCameras[SceneCameraIndex]->EnforceAspectRatio_ = SceneDataNode[i]["EnforceAspectRatio"].as(); + Scene->SceneCameras[SceneCameraIndex]->AspectRatio_ = SceneDataNode[i]["AspectRatio"].as(); + Scene->SceneCameras[SceneCameraIndex]->StreamingPriority_ = SceneDataNode[i]["StreamingPriority"].as(); + + + // Load Attached Scripts + if (SceneDataNode[i]["AttachedScripts"]) { + YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + Scene->SceneCameras[SceneCameraIndex]->AttachedScriptIndexes_.push_back(it->second.as()); + } + } + + } else { + SystemUtils->Logger_->Log(std::string("Unsupported/Unknown Asset Type: ") + AssetType, 9); + } + + } + + // Indicate Scene Is Loaded + Scene->IsSceneLoaded = true; + return true; + +} + + From b7ea144332c68b6db7471f05e0a13584ca0763ba Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:16:39 +0000 Subject: [PATCH 038/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV3.cpp | 506 +++++++++--------- 1 file changed, 253 insertions(+), 253 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp index 8ddaed0beb..04d6b20522 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp @@ -8,274 +8,274 @@ bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable = true) { - // Grab Metadata - Scene->SceneFormatVersion = SceneData["SceneFormatVersion"].as(); - Scene->SceneName = SceneData["SceneName"].as(); + // // Grab Metadata + // Scene->SceneFormatVersion = SceneData["SceneFormatVersion"].as(); + // Scene->SceneName = SceneData["SceneName"].as(); - if (SceneData["ActiveCameraIndex"]) { - Scene->ActiveSceneCameraIndex = SceneData["ActiveCameraIndex"].as(); - } + // if (SceneData["ActiveCameraIndex"]) { + // Scene->ActiveSceneCameraIndex = SceneData["ActiveCameraIndex"].as(); + // } - // Log Scene Processing - SystemUtils->Logger_->Log(std::string("Processing Scene: ") + std::string(Scene->SceneName), 3); - - // Create List Of Scene Items - std::vector SceneItems; - YAML::Node SceneDataNode = SceneData["SceneData"]; - for (YAML::const_iterator it=SceneDataNode.begin(); it!=SceneDataNode.end(); ++it) { - SceneItems.push_back(it->second); - } + // // Log Scene Processing + // SystemUtils->Logger_->Log(std::string("Processing Scene: ") + std::string(Scene->SceneName), 3); + + // // Create List Of Scene Items + // std::vector SceneItems; + // YAML::Node SceneDataNode = SceneData["SceneData"]; + // for (YAML::const_iterator it=SceneDataNode.begin(); it!=SceneDataNode.end(); ++it) { + // SceneItems.push_back(it->second); + // } - // Iterate Through Vector To Add Each Asset To Loading Queue Of Requested Type - for (long i = 0; (long)i < (long)SceneDataNode.size(); i++) { + // // Iterate Through Vector To Add Each Asset To Loading Queue Of Requested Type + // for (long i = 0; (long)i < (long)SceneDataNode.size(); i++) { - // Get Asset Information - std::string AssetName = SceneDataNode[i]["AssetName"].as(); - std::string AssetType = SceneDataNode[i]["AssetType"].as(); + // // Get Asset Information + // std::string AssetName = SceneDataNode[i]["AssetName"].as(); + // std::string AssetType = SceneDataNode[i]["AssetType"].as(); - // If type Is Model - if (AssetType == std::string("Model")) { - - long AssetID = SceneDataNode[i]["AssetID"].as(); - - // Get Asset LocRotScale - float PosX = SceneDataNode[i]["AssetPositionX"].as(); - float PosY = SceneDataNode[i]["AssetPositionY"].as(); - float PosZ = SceneDataNode[i]["AssetPositionZ"].as(); - - float RotX = SceneDataNode[i]["AssetRotationX"].as(); - float RotY = SceneDataNode[i]["AssetRotationY"].as(); - float RotZ = SceneDataNode[i]["AssetRotationZ"].as(); - - float ScaleX = SceneDataNode[i]["AssetScaleX"].as(); - float ScaleY = SceneDataNode[i]["AssetScaleY"].as(); - float ScaleZ = SceneDataNode[i]["AssetScaleZ"].as(); - - //Load Model - Scene->Models.push_back(std::make_shared()); - int CurrentSize = Scene->Models.size(); - ModelLoader->AddModelToLoadingQueue(AssetID, Scene->Models[CurrentSize-1]); - - // Add Instance To Models Vector - Scene->Models[CurrentSize-1]->IsTemplateModel = false; - Scene->Models[CurrentSize-1]->SetLocRotScale(glm::vec3(PosX, PosY, PosZ), glm::vec3(RotX, RotY, RotZ), glm::vec3(ScaleX, ScaleY, ScaleZ)); - Scene->Models[CurrentSize-1]->ApplyTransformations(); - Scene->Models[CurrentSize-1]->AssetID = AssetID; - Scene->Models[CurrentSize-1]->Name = AssetName; - - - // Load Attached Scripts - if (SceneDataNode[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - Scene->Models[CurrentSize-1]->AttachedScriptIndexes_.push_back(it->second.as()); - } - } - - - // Load Shadow Configuration - if (SceneDataNode[i]["CastDynamicShadows"]) { - Scene->Models[CurrentSize-1]->CastDynamicShadows_ = SceneDataNode[i]["CastDynamicShadows"].as(); - } - - if (SceneDataNode[i]["CastStaticShadows"]) { - Scene->Models[CurrentSize-1]->CastStaticShadows_ = SceneDataNode[i]["CastStaticShadows"].as(); - } - - if (SceneDataNode[i]["ReceiveShadows"]) { - Scene->Models[CurrentSize-1]->ReceiveShadows_ = SceneDataNode[i]["ReceiveShadows"].as(); - } - - if (SceneDataNode[i]["ShaderOverrideIndex"]) { - Scene->Models[CurrentSize-1]->ShaderOverrideIndex_ = SceneDataNode[i]["ShaderOverrideIndex"].as(); - } - - - } else if (AssetType == std::string("DirectionalLight")) { - - // Setup Model Pointer In Scene To Work On - Scene->DirectionalLights.push_back(std::make_shared()); - int LightIndex = Scene->DirectionalLights.size() - 1; - - Scene->DirectionalLights[LightIndex]->UserDefinedName = AssetName; - - if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { - Scene->DirectionalLights[LightIndex]->Color = glm::vec3( - SceneDataNode[i]["ColorRed"].as(), - SceneDataNode[i]["ColorGreen"].as(), - SceneDataNode[i]["ColorBlue"].as() - ); - } - - if (SceneDataNode[i]["Intensity"]) { - Scene->DirectionalLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); - } + // // If type Is Model + // if (AssetType == std::string("Model")) { + + // long AssetID = SceneDataNode[i]["AssetID"].as(); + + // // Get Asset LocRotScale + // float PosX = SceneDataNode[i]["AssetPositionX"].as(); + // float PosY = SceneDataNode[i]["AssetPositionY"].as(); + // float PosZ = SceneDataNode[i]["AssetPositionZ"].as(); + + // float RotX = SceneDataNode[i]["AssetRotationX"].as(); + // float RotY = SceneDataNode[i]["AssetRotationY"].as(); + // float RotZ = SceneDataNode[i]["AssetRotationZ"].as(); + + // float ScaleX = SceneDataNode[i]["AssetScaleX"].as(); + // float ScaleY = SceneDataNode[i]["AssetScaleY"].as(); + // float ScaleZ = SceneDataNode[i]["AssetScaleZ"].as(); + + // //Load Model + // Scene->Models.push_back(std::make_shared()); + // int CurrentSize = Scene->Models.size(); + // ModelLoader->AddModelToLoadingQueue(AssetID, Scene->Models[CurrentSize-1]); + + // // Add Instance To Models Vector + // Scene->Models[CurrentSize-1]->IsTemplateModel = false; + // Scene->Models[CurrentSize-1]->SetLocRotScale(glm::vec3(PosX, PosY, PosZ), glm::vec3(RotX, RotY, RotZ), glm::vec3(ScaleX, ScaleY, ScaleZ)); + // Scene->Models[CurrentSize-1]->ApplyTransformations(); + // Scene->Models[CurrentSize-1]->AssetID = AssetID; + // Scene->Models[CurrentSize-1]->Name = AssetName; + + + // // Load Attached Scripts + // if (SceneDataNode[i]["AttachedScripts"]) { + // YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + // for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + // Scene->Models[CurrentSize-1]->AttachedScriptIndexes_.push_back(it->second.as()); + // } + // } + + + // // Load Shadow Configuration + // if (SceneDataNode[i]["CastDynamicShadows"]) { + // Scene->Models[CurrentSize-1]->CastDynamicShadows_ = SceneDataNode[i]["CastDynamicShadows"].as(); + // } + + // if (SceneDataNode[i]["CastStaticShadows"]) { + // Scene->Models[CurrentSize-1]->CastStaticShadows_ = SceneDataNode[i]["CastStaticShadows"].as(); + // } + + // if (SceneDataNode[i]["ReceiveShadows"]) { + // Scene->Models[CurrentSize-1]->ReceiveShadows_ = SceneDataNode[i]["ReceiveShadows"].as(); + // } + + // if (SceneDataNode[i]["ShaderOverrideIndex"]) { + // Scene->Models[CurrentSize-1]->ShaderOverrideIndex_ = SceneDataNode[i]["ShaderOverrideIndex"].as(); + // } + + + // } else if (AssetType == std::string("DirectionalLight")) { + + // // Setup Model Pointer In Scene To Work On + // Scene->DirectionalLights.push_back(std::make_shared()); + // int LightIndex = Scene->DirectionalLights.size() - 1; + + // Scene->DirectionalLights[LightIndex]->UserDefinedName = AssetName; + + // if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { + // Scene->DirectionalLights[LightIndex]->Color = glm::vec3( + // SceneDataNode[i]["ColorRed"].as(), + // SceneDataNode[i]["ColorGreen"].as(), + // SceneDataNode[i]["ColorBlue"].as() + // ); + // } + + // if (SceneDataNode[i]["Intensity"]) { + // Scene->DirectionalLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); + // } - if (SceneDataNode[i]["MaxDistance"]) { - Scene->DirectionalLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); - } + // if (SceneDataNode[i]["MaxDistance"]) { + // Scene->DirectionalLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); + // } - Scene->DirectionalLights[LightIndex]->Pos = glm::vec3( - SceneDataNode[i]["PosX"].as(), - SceneDataNode[i]["PosY"].as(), - SceneDataNode[i]["PosZ"].as() - ); - Scene->DirectionalLights[LightIndex]->Rot = glm::vec3( - SceneDataNode[i]["RotX"].as(), - SceneDataNode[i]["RotY"].as(), - SceneDataNode[i]["RotZ"].as() - ); - - - if (SceneDataNode[i]["CastShadows"]) { - Scene->DirectionalLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); - } - - // Load Attached Scripts - if (SceneDataNode[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - Scene->DirectionalLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - } - } - - } else if (AssetType == std::string("PointLight")) { - - // Setup Model Pointer In Scene To Work On - Scene->PointLights.push_back(std::make_shared()); - int LightIndex = Scene->PointLights.size() - 1; - - Scene->PointLights[LightIndex]->UserDefinedName = AssetName; - if (SceneDataNode[i]["Intensity"]) { - Scene->PointLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); - } - if (SceneDataNode[i]["MaxDistance"]) { - Scene->PointLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); - } + // Scene->DirectionalLights[LightIndex]->Pos = glm::vec3( + // SceneDataNode[i]["PosX"].as(), + // SceneDataNode[i]["PosY"].as(), + // SceneDataNode[i]["PosZ"].as() + // ); + // Scene->DirectionalLights[LightIndex]->Rot = glm::vec3( + // SceneDataNode[i]["RotX"].as(), + // SceneDataNode[i]["RotY"].as(), + // SceneDataNode[i]["RotZ"].as() + // ); + + + // if (SceneDataNode[i]["CastShadows"]) { + // Scene->DirectionalLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); + // } + + // // Load Attached Scripts + // if (SceneDataNode[i]["AttachedScripts"]) { + // YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + // for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + // Scene->DirectionalLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); + // } + // } + + // } else if (AssetType == std::string("PointLight")) { + + // // Setup Model Pointer In Scene To Work On + // Scene->PointLights.push_back(std::make_shared()); + // int LightIndex = Scene->PointLights.size() - 1; + + // Scene->PointLights[LightIndex]->UserDefinedName = AssetName; + // if (SceneDataNode[i]["Intensity"]) { + // Scene->PointLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); + // } + // if (SceneDataNode[i]["MaxDistance"]) { + // Scene->PointLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); + // } - if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { - Scene->PointLights[LightIndex]->Color = glm::vec3( - SceneDataNode[i]["ColorRed"].as(), - SceneDataNode[i]["ColorGreen"].as(), - SceneDataNode[i]["ColorBlue"].as() - ); - } - - Scene->PointLights[LightIndex]->Pos = glm::vec3( - SceneDataNode[i]["PosX"].as(), - SceneDataNode[i]["PosY"].as(), - SceneDataNode[i]["PosZ"].as() - ); - - if (SceneDataNode[i]["CastShadows"]) { - Scene->PointLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); - } - - // Load Attached Scripts - if (SceneDataNode[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - Scene->PointLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - } - } - - } else if (AssetType == std::string("SpotLight")) { - - // Setup Model Pointer In Scene To Work On - Scene->SpotLights.push_back(std::make_shared()); - int LightIndex = Scene->SpotLights.size() - 1; - - Scene->SpotLights[LightIndex]->UserDefinedName = AssetName; - - if (SceneDataNode[i]["Intensity"]) { - Scene->SpotLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); - } - if (SceneDataNode[i]["MaxDistance"]) { - Scene->SpotLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); - } - Scene->SpotLights[LightIndex]->CutOff = SceneDataNode[i]["CutOff"].as(); - - if (SceneDataNode[i]["RollOff"]) { - Scene->SpotLights[LightIndex]->Rolloff = SceneDataNode[i]["RollOff"].as(); - } - if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { - Scene->SpotLights[LightIndex]->Color = glm::vec3( - SceneDataNode[i]["ColorRed"].as(), - SceneDataNode[i]["ColorGreen"].as(), - SceneDataNode[i]["ColorBlue"].as() - ); - } - - - Scene->SpotLights[LightIndex]->Pos = glm::vec3( - SceneDataNode[i]["PosX"].as(), - SceneDataNode[i]["PosY"].as(), - SceneDataNode[i]["PosZ"].as() - ); - Scene->SpotLights[LightIndex]->Rot = glm::vec3( - SceneDataNode[i]["RotX"].as(), - SceneDataNode[i]["RotY"].as(), - SceneDataNode[i]["RotZ"].as() - ); - - - if (SceneDataNode[i]["CastShadows"]) { - Scene->SpotLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); - } - - // Load Attached Scripts - if (SceneDataNode[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - Scene->SpotLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - } - } - - } else if (AssetType == std::string("SceneCamera")) { - - // Setup Model Pointer In Scene To Work On - Scene->SceneCameras.push_back(std::make_shared()); - int SceneCameraIndex = Scene->SceneCameras.size() - 1; - - Scene->SceneCameras[SceneCameraIndex]->UserDefinedName_ = AssetName; - Scene->SceneCameras[SceneCameraIndex]->Pos_ = glm::vec3( - SceneDataNode[i]["PosX"].as(), - SceneDataNode[i]["PosY"].as(), - SceneDataNode[i]["PosZ"].as() - ); - Scene->SceneCameras[SceneCameraIndex]->Rot_ = glm::vec3( - SceneDataNode[i]["RotX"].as(), - SceneDataNode[i]["RotY"].as(), - SceneDataNode[i]["RotZ"].as() - ); - - Scene->SceneCameras[SceneCameraIndex]->NearClip_ = SceneDataNode[i]["NearClip"].as(); - Scene->SceneCameras[SceneCameraIndex]->FarClip_ = SceneDataNode[i]["FarClip"].as(); - Scene->SceneCameras[SceneCameraIndex]->FOV_ = SceneDataNode[i]["FOV"].as(); - Scene->SceneCameras[SceneCameraIndex]->EnforceAspectRatio_ = SceneDataNode[i]["EnforceAspectRatio"].as(); - Scene->SceneCameras[SceneCameraIndex]->AspectRatio_ = SceneDataNode[i]["AspectRatio"].as(); - Scene->SceneCameras[SceneCameraIndex]->StreamingPriority_ = SceneDataNode[i]["StreamingPriority"].as(); + // if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { + // Scene->PointLights[LightIndex]->Color = glm::vec3( + // SceneDataNode[i]["ColorRed"].as(), + // SceneDataNode[i]["ColorGreen"].as(), + // SceneDataNode[i]["ColorBlue"].as() + // ); + // } + + // Scene->PointLights[LightIndex]->Pos = glm::vec3( + // SceneDataNode[i]["PosX"].as(), + // SceneDataNode[i]["PosY"].as(), + // SceneDataNode[i]["PosZ"].as() + // ); + + // if (SceneDataNode[i]["CastShadows"]) { + // Scene->PointLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); + // } + + // // Load Attached Scripts + // if (SceneDataNode[i]["AttachedScripts"]) { + // YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + // for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + // Scene->PointLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); + // } + // } + + // } else if (AssetType == std::string("SpotLight")) { + + // // Setup Model Pointer In Scene To Work On + // Scene->SpotLights.push_back(std::make_shared()); + // int LightIndex = Scene->SpotLights.size() - 1; + + // Scene->SpotLights[LightIndex]->UserDefinedName = AssetName; + + // if (SceneDataNode[i]["Intensity"]) { + // Scene->SpotLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); + // } + // if (SceneDataNode[i]["MaxDistance"]) { + // Scene->SpotLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); + // } + // Scene->SpotLights[LightIndex]->CutOff = SceneDataNode[i]["CutOff"].as(); + + // if (SceneDataNode[i]["RollOff"]) { + // Scene->SpotLights[LightIndex]->Rolloff = SceneDataNode[i]["RollOff"].as(); + // } + // if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { + // Scene->SpotLights[LightIndex]->Color = glm::vec3( + // SceneDataNode[i]["ColorRed"].as(), + // SceneDataNode[i]["ColorGreen"].as(), + // SceneDataNode[i]["ColorBlue"].as() + // ); + // } + + + // Scene->SpotLights[LightIndex]->Pos = glm::vec3( + // SceneDataNode[i]["PosX"].as(), + // SceneDataNode[i]["PosY"].as(), + // SceneDataNode[i]["PosZ"].as() + // ); + // Scene->SpotLights[LightIndex]->Rot = glm::vec3( + // SceneDataNode[i]["RotX"].as(), + // SceneDataNode[i]["RotY"].as(), + // SceneDataNode[i]["RotZ"].as() + // ); + + + // if (SceneDataNode[i]["CastShadows"]) { + // Scene->SpotLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); + // } + + // // Load Attached Scripts + // if (SceneDataNode[i]["AttachedScripts"]) { + // YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + // for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + // Scene->SpotLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); + // } + // } + + // } else if (AssetType == std::string("SceneCamera")) { + + // // Setup Model Pointer In Scene To Work On + // Scene->SceneCameras.push_back(std::make_shared()); + // int SceneCameraIndex = Scene->SceneCameras.size() - 1; + + // Scene->SceneCameras[SceneCameraIndex]->UserDefinedName_ = AssetName; + // Scene->SceneCameras[SceneCameraIndex]->Pos_ = glm::vec3( + // SceneDataNode[i]["PosX"].as(), + // SceneDataNode[i]["PosY"].as(), + // SceneDataNode[i]["PosZ"].as() + // ); + // Scene->SceneCameras[SceneCameraIndex]->Rot_ = glm::vec3( + // SceneDataNode[i]["RotX"].as(), + // SceneDataNode[i]["RotY"].as(), + // SceneDataNode[i]["RotZ"].as() + // ); + + // Scene->SceneCameras[SceneCameraIndex]->NearClip_ = SceneDataNode[i]["NearClip"].as(); + // Scene->SceneCameras[SceneCameraIndex]->FarClip_ = SceneDataNode[i]["FarClip"].as(); + // Scene->SceneCameras[SceneCameraIndex]->FOV_ = SceneDataNode[i]["FOV"].as(); + // Scene->SceneCameras[SceneCameraIndex]->EnforceAspectRatio_ = SceneDataNode[i]["EnforceAspectRatio"].as(); + // Scene->SceneCameras[SceneCameraIndex]->AspectRatio_ = SceneDataNode[i]["AspectRatio"].as(); + // Scene->SceneCameras[SceneCameraIndex]->StreamingPriority_ = SceneDataNode[i]["StreamingPriority"].as(); - // Load Attached Scripts - if (SceneDataNode[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - Scene->SceneCameras[SceneCameraIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - } - } + // // Load Attached Scripts + // if (SceneDataNode[i]["AttachedScripts"]) { + // YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + // for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + // Scene->SceneCameras[SceneCameraIndex]->AttachedScriptIndexes_.push_back(it->second.as()); + // } + // } - } else { - SystemUtils->Logger_->Log(std::string("Unsupported/Unknown Asset Type: ") + AssetType, 9); - } + // } else { + // SystemUtils->Logger_->Log(std::string("Unsupported/Unknown Asset Type: ") + AssetType, 9); + // } - } + // } - // Indicate Scene Is Loaded - Scene->IsSceneLoaded = true; - return true; + // // Indicate Scene Is Loaded + // Scene->IsSceneLoaded = true; + // return true; } From 5e232410921e91aa3ecdf1d46aca5aa54b65353d Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:18:29 +0000 Subject: [PATCH 039/125] Update Scene Loader --- .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 2 +- .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp | 2 +- .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 8505810384..a0bb950022 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -6,7 +6,7 @@ -bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable = true) { +bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable) { // Grab Metadata diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp index 863af824f7..4d4727b797 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp @@ -13,7 +13,7 @@ -bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable = true) { +bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable) { // Grab Metadata diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp index 04d6b20522..903bdc6e1d 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp @@ -5,7 +5,7 @@ #include -bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable = true) { +bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable) { // // Grab Metadata From 09038ca39a2e2cf30e8b0676b36f43a096d746ea Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:19:20 +0000 Subject: [PATCH 040/125] Update Scene Loader --- .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index a0bb950022..3e1800093b 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -18,7 +18,7 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E } // Log Scene Processing - SystemUtils->Logger_->Log(std::string("Processing Scene: ") + std::string(Scene->SceneName), 3); + SystemUtils->Logger_->Log(std::string("Processing Scene: ") + std::string(Scene->SceneName), 3, LogEnable); // Create List Of Scene Items std::vector SceneItems; From 79ab3db8c230ea20eb2d195e8a69e249dbb77840 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:21:51 +0000 Subject: [PATCH 041/125] Update Scene Loader --- .../ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp index ec41625da9..b593005e2a 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp @@ -23,11 +23,17 @@ bool ERS_FUNCTION_DecodeScene(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS // Attempt Decoding With Known Decoding Systems if (Version == 1) { + SystemUtils->Logger_->Log("Detected Scene Format To Be Version 1, Starting Decoding Process", 4, LogEnable); return ERS_FUNCTION_DecodeSceneV1(SceneData, Scene, SystemUtils, ModelLoader, LogEnable); } else if (Version == 2) { + SystemUtils->Logger_->Log("Detected Scene Format To Be Version 2, Starting Decoding Process", 4, LogEnable); return ERS_FUNCTION_DecodeSceneV2(SceneData, Scene, SystemUtils, ModelLoader, LogEnable); } else if (Version == 3) { + SystemUtils->Logger_->Log("Detected Scene Format To Be Version 3, Starting Decoding Process", 4, LogEnable); return ERS_FUNCTION_DecodeSceneV3(SceneData, Scene, SystemUtils, ModelLoader, LogEnable); + } else { + SystemUtils->Logger_->Log("Scene Format Has Unknown Version, Aborting Load", 8); + return false; } } \ No newline at end of file From 4da680372c611f340e5b0bab93dc844927e8025a Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:22:59 +0000 Subject: [PATCH 042/125] Update Scene Loader --- .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp index 4d4727b797..4fd3ff0f2b 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp @@ -25,7 +25,7 @@ bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E } // Log Scene Processing - SystemUtils->Logger_->Log(std::string("Processing Scene: ") + std::string(Scene->SceneName), 3); + SystemUtils->Logger_->Log(std::string("Processing Scene: ") + std::string(Scene->SceneName), 3, LogEnable); // Create List Of Scene Items std::vector SceneItems; From dd234d20b20157d7a47b240611dcc5f14455c2de Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:23:09 +0000 Subject: [PATCH 043/125] Update Scene Loader --- .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp index 903bdc6e1d..32a433b1bb 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp @@ -17,7 +17,7 @@ bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E // } // // Log Scene Processing - // SystemUtils->Logger_->Log(std::string("Processing Scene: ") + std::string(Scene->SceneName), 3); + // SystemUtils->Logger_->Log(std::string("Processing Scene: ") + std::string(Scene->SceneName), 3, LogEnable); // // Create List Of Scene Items // std::vector SceneItems; From 1ac861f16518d10e519e7f9ef732df8c8571b36e Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:28:01 +0000 Subject: [PATCH 044/125] Update Scene Loader --- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp index 4fd3ff0f2b..27bc74937c 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp @@ -262,9 +262,9 @@ bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E Scene->SceneCameras[SceneCameraIndex]->NearClip_ = SceneDataNode[i]["NearClip"].as(); Scene->SceneCameras[SceneCameraIndex]->FarClip_ = SceneDataNode[i]["FarClip"].as(); Scene->SceneCameras[SceneCameraIndex]->FOV_ = SceneDataNode[i]["FOV"].as(); - Scene->SceneCameras[SceneCameraIndex]->EnforceAspectRatio_ = SceneDataNode[i]["EnforceAspectRatio"].as(); + Scene->SceneCameras[SceneCameraIndex]->EnforceAspectRatio_ = SceneDataNode[i]["EnforceAspectRatio"].as(); Scene->SceneCameras[SceneCameraIndex]->AspectRatio_ = SceneDataNode[i]["AspectRatio"].as(); - Scene->SceneCameras[SceneCameraIndex]->StreamingPriority_ = SceneDataNode[i]["StreamingPriority"].as(); + Scene->SceneCameras[SceneCameraIndex]->StreamingPriority_ = SceneDataNode[i]["StreamingPriority"].as(); // Load Attached Scripts From 3af586f613f5c6f3ee61bf2cb3ff89bd2d42703f Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:29:18 +0000 Subject: [PATCH 045/125] Update Scene Loader --- .../ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp | 5 +++++ .../ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h | 14 ++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp create mode 100644 Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp new file mode 100644 index 0000000000..caf87d5ca9 --- /dev/null +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -0,0 +1,5 @@ +//======================================================================// +// This file is part of the BrainGenix-ERS Environment Rendering System // +//======================================================================// + +#include \ No newline at end of file diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h new file mode 100644 index 0000000000..6e8501bdf4 --- /dev/null +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h @@ -0,0 +1,14 @@ +//======================================================================// +// This file is part of the BrainGenix-ERS Environment Rendering System // +//======================================================================// + +#pragma once + +// Standard Libraries (BG convention: use <> instead of "") +#include +#include + +// Third-Party Libraries (BG convention: use <> instead of "") +#include + +// Internal Libraries (BG convention: use <> instead of "") \ No newline at end of file From 24022c95d1f894db2c3e79761bd1278b5a0892b0 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:29:38 +0000 Subject: [PATCH 046/125] Update Scene Loader --- Source/Core/Loader/ERS_SceneLoader/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/CMakeLists.txt b/Source/Core/Loader/ERS_SceneLoader/CMakeLists.txt index 6be1d16e09..16fd395363 100644 --- a/Source/Core/Loader/ERS_SceneLoader/CMakeLists.txt +++ b/Source/Core/Loader/ERS_SceneLoader/CMakeLists.txt @@ -8,6 +8,7 @@ add_library(ERS_SceneLoader # Add Source Files (.cpp) "ERS_SceneLoader.cpp" + "ERS_FUNCTION_YAMLHelpers.cpp" "ERS_FUNCTION_SceneDecoderManager.cpp" "ERS_FUNCTION_SceneDecoderV1.cpp" "ERS_FUNCTION_SceneDecoderV2.cpp" @@ -15,6 +16,7 @@ add_library(ERS_SceneLoader # Add Header Files (.h) "ERS_SceneLoader.h" + "ERS_FUNCTION_YAMLHelpers.h" "ERS_FUNCTION_SceneDecoderManager.h" "ERS_FUNCTION_SceneDecoderV1.h" "ERS_FUNCTION_SceneDecoderV2.h" From 39ba7bc5784fd8f8e63722f666336de3e9c3a101 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:29:57 +0000 Subject: [PATCH 047/125] Update Scene Loader --- Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp index caf87d5ca9..ce7ecef160 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -2,4 +2,4 @@ // This file is part of the BrainGenix-ERS Environment Rendering System // //======================================================================// -#include \ No newline at end of file +#include \ No newline at end of file From 97ec3c5ab8bf941bc98fbf137027b1ccde8d67b8 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:33:47 +0000 Subject: [PATCH 048/125] Update Scene Loader --- .../ERS_FUNCTION_YAMLHelpers.h | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h index 6e8501bdf4..f7b1b6f9e6 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h @@ -11,4 +11,41 @@ // Third-Party Libraries (BG convention: use <> instead of "") #include -// Internal Libraries (BG convention: use <> instead of "") \ No newline at end of file +// Internal Libraries (BG convention: use <> instead of "") + + +/** + * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. + * Returns true on success, false on fail. + * + * @param Data YAML::Node containing the target data + * @param Name Name of the parameter in the yaml node + * @param Target Reference to int to be set to the decoded value + * @return true + * @return false + */ +bool ERS_FUNCTION_GetInt(YAML::Node Data, std::string Name, int &Target); + +/** + * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. + * Returns true on success, false on fail. + * + * @param Data YAML::Node containing the target data + * @param Name Name of the parameter in the yaml node + * @param Target Reference to float to be set to the decoded value + * @return true + * @return false + */ +bool ERS_FUNCTION_GetFloat(YAML::Node Data, std::string Name, float &Target); + +/** + * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. + * Returns true on success, false on fail. + * + * @param Data YAML::Node containing the target data + * @param Name Name of the parameter in the yaml node + * @param Target Reference to bool to be set to the decoded value + * @return true + * @return false + */ +bool ERS_FUNCTION_GetBool(YAML::Node Data, std::string Name, bool &Target); \ No newline at end of file From 4d3e32928560ff37d66f89d8c82333cf5bf75369 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:37:19 +0000 Subject: [PATCH 049/125] Update Scene Loader --- .../ERS_FUNCTION_YAMLHelpers.h | 121 +++++++++++++++++- 1 file changed, 117 insertions(+), 4 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h index f7b1b6f9e6..93d2db8859 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h @@ -11,16 +11,20 @@ // Third-Party Libraries (BG convention: use <> instead of "") #include +#include + // Internal Libraries (BG convention: use <> instead of "") + + /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. * * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node - * @param Target Reference to int to be set to the decoded value + * @param Target Reference to the variable to be set to the decoded value * @return true * @return false */ @@ -32,7 +36,7 @@ bool ERS_FUNCTION_GetInt(YAML::Node Data, std::string Name, int &Target); * * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node - * @param Target Reference to float to be set to the decoded value + * @param Target Reference to the variable to be set to the decoded value * @return true * @return false */ @@ -44,8 +48,117 @@ bool ERS_FUNCTION_GetFloat(YAML::Node Data, std::string Name, float &Target); * * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node - * @param Target Reference to bool to be set to the decoded value + * @param Target Reference to the variable to be set to the decoded value + * @return true + * @return false + */ +bool ERS_FUNCTION_GetBool(YAML::Node Data, std::string Name, bool &Target); + +/** + * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. + * Returns true on success, false on fail. + * + * @param Data YAML::Node containing the target data + * @param Name Name of the parameter in the yaml node + * @param Target Reference to the variable to be set to the decoded value + * @return true + * @return false + */ +bool ERS_FUNCTION_GetLong(YAML::Node Data, std::string Name, long &Target); + + +/** + * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. + * Returns true on success, false on fail. + * + * @param Data YAML::Node containing the target data + * @param Name Name of the parameter in the yaml node + * @param Target Reference to the variable to be set to the decoded value + * @return true + * @return false + */ +bool ERS_FUNCTION_GetDouble(YAML::Node Data, std::string Name, double &Target); + +/** + * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. + * Returns true on success, false on fail. + * + * @param Data YAML::Node containing the target data + * @param Name Name of the parameter in the yaml node + * @param Target Reference to the variable to be set to the decoded value + * @return true + * @return false + */ +bool ERS_FUNCTION_GetUnsignedInt(YAML::Node Data, std::string Name, unsigned int &Target); + +/** + * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. + * Returns true on success, false on fail. + * + * @param Data YAML::Node containing the target data + * @param Name Name of the parameter in the yaml node + * @param Target Reference to the variable to be set to the decoded value + * @return true + * @return false + */ +bool ERS_FUNCTION_GetUnsignedLong(YAML::Node Data, std::string Name, unsigned long &Target); + +/** + * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. + * Returns true on success, false on fail. + * + * @param Data YAML::Node containing the target data + * @param Name Name of the parameter in the yaml node + * @param Target Reference to the variable to be set to the decoded value + * @return true + * @return false + */ +bool ERS_FUNCTION_GetLongLong(YAML::Node Data, std::string Name, long long &Target); + +/** + * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. + * Returns true on success, false on fail. + * + * @param Data YAML::Node containing the target data + * @param Name Name of the parameter in the yaml node + * @param Target Reference to the variable to be set to the decoded value + * @return true + * @return false + */ +bool ERS_FUNCTION_GetUnsignedLongLong(YAML::Node Data, std::string Name, unsigned long long &Target); + +/** + * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. + * Returns true on success, false on fail. + * + * @param Data YAML::Node containing the target data + * @param Name Name of the parameter in the yaml node + * @param Target Reference to the variable to be set to the decoded value + * @return true + * @return false + */ +bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string Name, glm::vec3 &Target); + +/** + * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. + * Returns true on success, false on fail. + * + * @param Data YAML::Node containing the target data + * @param Name Name of the parameter in the yaml node + * @param Target Reference to the variable to be set to the decoded value + * @return true + * @return false + */ +bool ERS_FUNCTION_GetVec4(YAML::Node Data, std::string Name, glm::vec4 &Target); + +/** + * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. + * Returns true on success, false on fail. + * + * @param Data YAML::Node containing the target data + * @param Name Name of the parameter in the yaml node + * @param Target Reference to the variable to be set to the decoded value * @return true * @return false */ -bool ERS_FUNCTION_GetBool(YAML::Node Data, std::string Name, bool &Target); \ No newline at end of file +bool ERS_FUNCTION_GetString(YAML::Node Data, std::string Name, std::string &Target); \ No newline at end of file From 9d6462b85b9d22f620031d0dd05b34e171e15638 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:41:05 +0000 Subject: [PATCH 050/125] Update Scene Loader --- .../ERS_FUNCTION_YAMLHelpers.cpp | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp index ce7ecef160..9b22feb793 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -2,4 +2,36 @@ // This file is part of the BrainGenix-ERS Environment Rendering System // //======================================================================// -#include \ No newline at end of file +#include + + +bool ERS_FUNCTION_GetInt(YAML::Node Data, std::string Name, int &Target) { + try { + Target = Data[Name].as(); + return true; + } catch (YAML::TypedBadConversion) { + return false; + } catch (YAML::KeyNotFound) { + return false; + } +} +bool ERS_FUNCTION_GetFloat(YAML::Node Data, std::string Name, float &Target) { + try { + Target = Data[Name].as(); + return true; + } catch (YAML::TypedBadConversion) { + return false; + } catch (YAML::KeyNotFound) { + return false; + } +} +bool ERS_FUNCTION_GetBool(YAML::Node Data, std::string Name, bool &Target) { + try { + Target = Data[Name].as(); + return true; + } catch (YAML::TypedBadConversion) { + return false; + } catch (YAML::KeyNotFound) { + return false; + } +} \ No newline at end of file From 6c9db641c7f62e2f7f9badc8b62c3ef18b2a22c1 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:41:41 +0000 Subject: [PATCH 051/125] Update Scene Loader --- .../ERS_FUNCTION_YAMLHelpers.cpp | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp index 9b22feb793..d801c04da0 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -34,4 +34,24 @@ bool ERS_FUNCTION_GetBool(YAML::Node Data, std::string Name, bool &Target) { } catch (YAML::KeyNotFound) { return false; } +} +bool ERS_FUNCTION_GetLong(YAML::Node Data, std::string Name, long &Target) { + try { + Target = Data[Name].as(); + return true; + } catch (YAML::TypedBadConversion) { + return false; + } catch (YAML::KeyNotFound) { + return false; + } +} +bool ERS_FUNCTION_GetDouble(YAML::Node Data, std::string Name, double &Target) { + try { + Target = Data[Name].as(); + return true; + } catch (YAML::TypedBadConversion) { + return false; + } catch (YAML::KeyNotFound) { + return false; + } } \ No newline at end of file From 4c1dbf72268339850bd7ca99725d24db4eaa1b19 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:43:29 +0000 Subject: [PATCH 052/125] Update Scene Loader --- .../ERS_FUNCTION_YAMLHelpers.cpp | 50 +++++++++++++++++++ .../ERS_FUNCTION_YAMLHelpers.h | 7 +-- 2 files changed, 54 insertions(+), 3 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp index d801c04da0..4ef835500d 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -54,4 +54,54 @@ bool ERS_FUNCTION_GetDouble(YAML::Node Data, std::string Name, double &Target) { } catch (YAML::KeyNotFound) { return false; } +} +bool ERS_FUNCTION_GetUnsignedInt(YAML::Node Data, std::string Name, unsigned int &Target) { + try { + Target = Data[Name].as(); + return true; + } catch (YAML::TypedBadConversion) { + return false; + } catch (YAML::KeyNotFound) { + return false; + } +} +bool ERS_FUNCTION_GetBool(YAML::Node Data, std::string Name, unsigned long &Target) { + try { + Target = Data[Name].as(); + return true; + } catch (YAML::TypedBadConversion) { + return false; + } catch (YAML::KeyNotFound) { + return false; + } +} +bool ERS_FUNCTION_GetLongLong(YAML::Node Data, std::string Name, long long &Target) { + try { + Target = Data[Name].as(); + return true; + } catch (YAML::TypedBadConversion) { + return false; + } catch (YAML::KeyNotFound) { + return false; + } +} +bool ERS_FUNCTION_GetUnsignedLongLong(YAML::Node Data, std::string Name, unsigned long long &Target) { + try { + Target = Data[Name].as(); + return true; + } catch (YAML::TypedBadConversion) { + return false; + } catch (YAML::KeyNotFound) { + return false; + } +} +bool ERS_FUNCTION_GetString(YAML::Node Data, std::string Name, std::string &Target) { + try { + Target = Data[Name].as(); + return true; + } catch (YAML::TypedBadConversion) { + return false; + } catch (YAML::KeyNotFound) { + return false; + } } \ No newline at end of file diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h index 93d2db8859..d8d612b09c 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h @@ -137,7 +137,7 @@ bool ERS_FUNCTION_GetUnsignedLongLong(YAML::Node Data, std::string Name, unsigne * @return true * @return false */ -bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string Name, glm::vec3 &Target); +bool ERS_FUNCTION_GetString(YAML::Node Data, std::string Name, std::string &Target); /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. @@ -149,7 +149,7 @@ bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string Name, glm::vec3 &Target); * @return true * @return false */ -bool ERS_FUNCTION_GetVec4(YAML::Node Data, std::string Name, glm::vec4 &Target); +bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string Name, glm::vec3 &Target); /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. @@ -161,4 +161,5 @@ bool ERS_FUNCTION_GetVec4(YAML::Node Data, std::string Name, glm::vec4 &Target); * @return true * @return false */ -bool ERS_FUNCTION_GetString(YAML::Node Data, std::string Name, std::string &Target); \ No newline at end of file +bool ERS_FUNCTION_GetVec4(YAML::Node Data, std::string Name, glm::vec4 &Target); + From cfccd9c44965aae54d2279ec1eb72f862be0f593 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:44:03 +0000 Subject: [PATCH 053/125] Update Scene Loader --- .../ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp index 4ef835500d..0d55402153 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -4,7 +4,7 @@ #include - +// Standart Type Helper Functions bool ERS_FUNCTION_GetInt(YAML::Node Data, std::string Name, int &Target) { try { Target = Data[Name].as(); @@ -95,6 +95,18 @@ bool ERS_FUNCTION_GetUnsignedLongLong(YAML::Node Data, std::string Name, unsigne return false; } } +bool ERS_FUNCTION_GetString(YAML::Node Data, std::string Name, std::string &Target) { + try { + Target = Data[Name].as(); + return true; + } catch (YAML::TypedBadConversion) { + return false; + } catch (YAML::KeyNotFound) { + return false; + } +} + +// GLM Helper Functions bool ERS_FUNCTION_GetString(YAML::Node Data, std::string Name, std::string &Target) { try { Target = Data[Name].as(); From 9bc42cf5d5ba48609d83250ad762b8921ddccbd1 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:45:07 +0000 Subject: [PATCH 054/125] Update Scene Loader --- .../ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp index 0d55402153..66655fab97 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -107,11 +107,21 @@ bool ERS_FUNCTION_GetString(YAML::Node Data, std::string Name, std::string &Targ } // GLM Helper Functions -bool ERS_FUNCTION_GetString(YAML::Node Data, std::string Name, std::string &Target) { +bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string Name, glm::vec3 &Target) { try { - Target = Data[Name].as(); + Target = Data[Name].as(); return true; - } catch (YAML::TypedBadConversion) { + } catch (YAML::TypedBadConversion) { + return false; + } catch (YAML::KeyNotFound) { + return false; + } +} +bool ERS_FUNCTION_GetVec4(YAML::Node Data, std::string Name, glm::vec4 &Target) { + try { + Target = Data[Name].as(); + return true; + } catch (YAML::TypedBadConversion) { return false; } catch (YAML::KeyNotFound) { return false; From 16d6eed89745db94c0df30f5fd5a2d868cc3b7ad Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:46:38 +0000 Subject: [PATCH 055/125] Update Scene Loader --- .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h | 4 ++++ .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h | 4 ++++ .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h index dd5678de33..dd8de5a9dd 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h @@ -17,6 +17,10 @@ #include +#include + + + /** * @brief Decodes the specified version of the scene format. diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h index f26d029965..e62f833f6a 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h @@ -17,6 +17,10 @@ #include +#include + + + /** * @brief Decodes the specified version of the scene format. diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h index aaa06bbed4..c1db10155c 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h @@ -17,6 +17,10 @@ #include +#include + + + /** * @brief Decodes the specified version of the scene format. From 6e312f92a26108a9e2559aecb470fbd6471b1fae Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:48:51 +0000 Subject: [PATCH 056/125] Update Scene Loader --- .../ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 3e1800093b..7fadda25af 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -10,12 +10,10 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E // Grab Metadata - Scene->SceneFormatVersion = SceneData["SceneFormatVersion"].as(); - Scene->SceneName = SceneData["SceneName"].as(); + Scene->SceneFormatVersion = 1; + ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName); + ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex); - if (SceneData["ActiveCameraIndex"]) { - Scene->ActiveSceneCameraIndex = SceneData["ActiveCameraIndex"].as(); - } // Log Scene Processing SystemUtils->Logger_->Log(std::string("Processing Scene: ") + std::string(Scene->SceneName), 3, LogEnable); From fe1bd6f855d3e7f183e087405b74f7ea3789fb4c Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:49:15 +0000 Subject: [PATCH 057/125] Update Scene Loader --- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 7fadda25af..5691881a1f 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -8,6 +8,7 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable) { + SystemUtils->Logger_->Log(std::string("Processing Scene '") + std::string(Scene->SceneName) + "'", 3, LogEnable); // Grab Metadata Scene->SceneFormatVersion = 1; @@ -15,8 +16,6 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex); - // Log Scene Processing - SystemUtils->Logger_->Log(std::string("Processing Scene: ") + std::string(Scene->SceneName), 3, LogEnable); // Create List Of Scene Items std::vector SceneItems; From 3376d13cca859f02810ec70aefb09a44098ee152 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:50:10 +0000 Subject: [PATCH 058/125] Update Scene Loader --- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 5691881a1f..7a8f41a3ea 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -11,9 +11,9 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E SystemUtils->Logger_->Log(std::string("Processing Scene '") + std::string(Scene->SceneName) + "'", 3, LogEnable); // Grab Metadata - Scene->SceneFormatVersion = 1; - ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName); - ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex); + ERS_FUNCTION_GetLong (SceneData, "SceneFormatVersion", Scene->SceneFormatVersion); + ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName); + ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex); From e54f9f8a218a47529c9a0e48e6ff0ff3d08b3f60 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:50:23 +0000 Subject: [PATCH 059/125] Update Scene Loader --- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 7a8f41a3ea..72df8df86a 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -11,8 +11,8 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E SystemUtils->Logger_->Log(std::string("Processing Scene '") + std::string(Scene->SceneName) + "'", 3, LogEnable); // Grab Metadata - ERS_FUNCTION_GetLong (SceneData, "SceneFormatVersion", Scene->SceneFormatVersion); - ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName); + ERS_FUNCTION_GetLong (SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); + ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName ); ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex); From e1a4d5ead5aaecdb05459da1962147b097f6bdd4 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:50:37 +0000 Subject: [PATCH 060/125] Update Scene Loader --- .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 72df8df86a..432bc81371 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -8,7 +8,7 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable) { - SystemUtils->Logger_->Log(std::string("Processing Scene '") + std::string(Scene->SceneName) + "'", 3, LogEnable); + SystemUtils->Logger_->Log(std::string("Processing Scene '") + Scene->SceneName + "'", 3, LogEnable); // Grab Metadata ERS_FUNCTION_GetLong (SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); From fdb651d5a74bac83c37f6f196835dfa73a026920 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:51:08 +0000 Subject: [PATCH 061/125] Update Scene Loader --- .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 432bc81371..16548d65a3 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -15,8 +15,6 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName ); ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex); - - // Create List Of Scene Items std::vector SceneItems; YAML::Node SceneDataNode = SceneData["SceneData"]; From 78ebf000d30a6b1c993ce6c76c367d62c9150792 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:52:49 +0000 Subject: [PATCH 062/125] Update Scene Loader --- .../ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 16548d65a3..21a177318a 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -27,11 +27,14 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E for (long i = 0; (long)i < (long)SceneDataNode.size(); i++) { // Get Asset Information - std::string AssetName = SceneDataNode[i]["AssetName"].as(); - std::string AssetType = SceneDataNode[i]["AssetType"].as(); + YAML::Node Item = SceneDataNode[i]; + std::string AssetName, AssetType; + ERS_FUNCTION_GetString(Item, "AssetName", AssetName); + ERS_FUNCTION_GetString(Item, "AssetType", AssetType); + // If type Is Model - if (AssetType == std::string("Model")) { + if (AssetType == "Model") { long AssetID = SceneDataNode[i]["AssetID"].as(); From 9aee6dcfb420b32664b980ed0fdad1f28ff2596f Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:55:17 +0000 Subject: [PATCH 063/125] Update Scene Loader --- .../ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp | 13 +++++++++++++ .../ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp index 66655fab97..ae56567372 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -117,6 +117,19 @@ bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string Name, glm::vec3 &Target) return false; } } +bool ERS_FUNCTION_GetVec3FromFloats(YAML::Node Data, std::string NameBase, glm::vec3 &Target) { + try { + float X = Data[NameBase + "X"].as(); + float Y = Data[NameBase + "Y"].as(); + float Z = Data[NameBase + "Z"].as(); + Target = glm::vec3(X,Y,Z); + return true; + } catch (YAML::TypedBadConversion) { + return false; + } catch (YAML::KeyNotFound) { + return false; + } +} bool ERS_FUNCTION_GetVec4(YAML::Node Data, std::string Name, glm::vec4 &Target) { try { Target = Data[Name].as(); diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h index d8d612b09c..8f1c961529 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h @@ -151,6 +151,20 @@ bool ERS_FUNCTION_GetString(YAML::Node Data, std::string Name, std::string &Targ */ bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string Name, glm::vec3 &Target); +/** + * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. + * Returns true on success, false on fail. + * Will append X,Y,Z to get the three components of the vector. + * + * @param Data YAML::Node containing the target data + * @param Name Name of the parameter in the yaml node + * @param Target Reference to the variable to be set to the decoded value + * @return true + * @return false + */ +bool ERS_FUNCTION_GetVec3FromFloats(YAML::Node Data, std::string NameBase, glm::vec3 &Target); + + /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. From 6b52fb5e190b92cc825464077721b600cac689cb Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:55:26 +0000 Subject: [PATCH 064/125] Update Scene Loader --- Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp index ae56567372..05ac0162d8 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -124,7 +124,7 @@ bool ERS_FUNCTION_GetVec3FromFloats(YAML::Node Data, std::string NameBase, glm:: float Z = Data[NameBase + "Z"].as(); Target = glm::vec3(X,Y,Z); return true; - } catch (YAML::TypedBadConversion) { + } catch (YAML::TypedBadConversion) { return false; } catch (YAML::KeyNotFound) { return false; From 5e445bd14f39fe53e475e609f07aed90ffa364c6 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:57:50 +0000 Subject: [PATCH 065/125] Update Scene Loader --- .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp index 05ac0162d8..8af1004c08 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -9,9 +9,9 @@ bool ERS_FUNCTION_GetInt(YAML::Node Data, std::string Name, int &Target) { try { Target = Data[Name].as(); return true; - } catch (YAML::TypedBadConversion) { + } catch (YAML::TypedBadConversion&) { return false; - } catch (YAML::KeyNotFound) { + } catch (YAML::KeyNotFound&) { return false; } } From 24d3c4d313afc299a106852a6496521e8a861525 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:58:57 +0000 Subject: [PATCH 066/125] Update Scene Loader --- .../ERS_FUNCTION_YAMLHelpers.cpp | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp index 8af1004c08..2b389188b7 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -19,9 +19,9 @@ bool ERS_FUNCTION_GetFloat(YAML::Node Data, std::string Name, float &Target) { try { Target = Data[Name].as(); return true; - } catch (YAML::TypedBadConversion) { + } catch (YAML::TypedBadConversion&) { return false; - } catch (YAML::KeyNotFound) { + } catch (YAML::KeyNotFound&) { return false; } } @@ -29,9 +29,9 @@ bool ERS_FUNCTION_GetBool(YAML::Node Data, std::string Name, bool &Target) { try { Target = Data[Name].as(); return true; - } catch (YAML::TypedBadConversion) { + } catch (YAML::TypedBadConversion&) { return false; - } catch (YAML::KeyNotFound) { + } catch (YAML::KeyNotFound&) { return false; } } @@ -39,9 +39,9 @@ bool ERS_FUNCTION_GetLong(YAML::Node Data, std::string Name, long &Target) { try { Target = Data[Name].as(); return true; - } catch (YAML::TypedBadConversion) { + } catch (YAML::TypedBadConversion&) { return false; - } catch (YAML::KeyNotFound) { + } catch (YAML::KeyNotFound&) { return false; } } @@ -49,9 +49,9 @@ bool ERS_FUNCTION_GetDouble(YAML::Node Data, std::string Name, double &Target) { try { Target = Data[Name].as(); return true; - } catch (YAML::TypedBadConversion) { + } catch (YAML::TypedBadConversion&) { return false; - } catch (YAML::KeyNotFound) { + } catch (YAML::KeyNotFound&) { return false; } } @@ -59,9 +59,9 @@ bool ERS_FUNCTION_GetUnsignedInt(YAML::Node Data, std::string Name, unsigned int try { Target = Data[Name].as(); return true; - } catch (YAML::TypedBadConversion) { + } catch (YAML::TypedBadConversion&) { return false; - } catch (YAML::KeyNotFound) { + } catch (YAML::KeyNotFound&) { return false; } } @@ -69,9 +69,9 @@ bool ERS_FUNCTION_GetBool(YAML::Node Data, std::string Name, unsigned long &Targ try { Target = Data[Name].as(); return true; - } catch (YAML::TypedBadConversion) { + } catch (YAML::TypedBadConversion&) { return false; - } catch (YAML::KeyNotFound) { + } catch (YAML::KeyNotFound&) { return false; } } @@ -79,9 +79,9 @@ bool ERS_FUNCTION_GetLongLong(YAML::Node Data, std::string Name, long long &Targ try { Target = Data[Name].as(); return true; - } catch (YAML::TypedBadConversion) { + } catch (YAML::TypedBadConversion&) { return false; - } catch (YAML::KeyNotFound) { + } catch (YAML::KeyNotFound&) { return false; } } @@ -89,9 +89,9 @@ bool ERS_FUNCTION_GetUnsignedLongLong(YAML::Node Data, std::string Name, unsigne try { Target = Data[Name].as(); return true; - } catch (YAML::TypedBadConversion) { + } catch (YAML::TypedBadConversion&) { return false; - } catch (YAML::KeyNotFound) { + } catch (YAML::KeyNotFound&) { return false; } } @@ -99,9 +99,9 @@ bool ERS_FUNCTION_GetString(YAML::Node Data, std::string Name, std::string &Targ try { Target = Data[Name].as(); return true; - } catch (YAML::TypedBadConversion) { + } catch (YAML::TypedBadConversion&) { return false; - } catch (YAML::KeyNotFound) { + } catch (YAML::KeyNotFound&) { return false; } } @@ -111,9 +111,9 @@ bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string Name, glm::vec3 &Target) try { Target = Data[Name].as(); return true; - } catch (YAML::TypedBadConversion) { + } catch (YAML::TypedBadConversion&) { return false; - } catch (YAML::KeyNotFound) { + } catch (YAML::KeyNotFound&) { return false; } } @@ -124,9 +124,9 @@ bool ERS_FUNCTION_GetVec3FromFloats(YAML::Node Data, std::string NameBase, glm:: float Z = Data[NameBase + "Z"].as(); Target = glm::vec3(X,Y,Z); return true; - } catch (YAML::TypedBadConversion) { + } catch (YAML::TypedBadConversion&) { return false; - } catch (YAML::KeyNotFound) { + } catch (YAML::KeyNotFound&) { return false; } } @@ -134,9 +134,9 @@ bool ERS_FUNCTION_GetVec4(YAML::Node Data, std::string Name, glm::vec4 &Target) try { Target = Data[Name].as(); return true; - } catch (YAML::TypedBadConversion) { + } catch (YAML::TypedBadConversion&) { return false; - } catch (YAML::KeyNotFound) { + } catch (YAML::KeyNotFound&) { return false; } } \ No newline at end of file From 9fa5cc423e57c9a3e2e817629168eb900cd3a5d4 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 22:59:48 +0000 Subject: [PATCH 067/125] Update Scene Loader --- .../ERS_FUNCTION_YAMLHelpers.cpp | 20 ++++++------- .../ERS_FUNCTION_YAMLHelpers.h | 28 +------------------ 2 files changed, 11 insertions(+), 37 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp index 2b389188b7..a057b45e47 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -130,13 +130,13 @@ bool ERS_FUNCTION_GetVec3FromFloats(YAML::Node Data, std::string NameBase, glm:: return false; } } -bool ERS_FUNCTION_GetVec4(YAML::Node Data, std::string Name, glm::vec4 &Target) { - try { - Target = Data[Name].as(); - return true; - } catch (YAML::TypedBadConversion&) { - return false; - } catch (YAML::KeyNotFound&) { - return false; - } -} \ No newline at end of file +// bool ERS_FUNCTION_GetVec4(YAML::Node Data, std::string Name, glm::vec4 &Target) { +// try { +// Target = Data[Name].as(); +// return true; +// } catch (YAML::TypedBadConversion&) { +// return false; +// } catch (YAML::KeyNotFound&) { +// return false; +// } +// } \ No newline at end of file diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h index 8f1c961529..a0efdc3066 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h @@ -139,18 +139,6 @@ bool ERS_FUNCTION_GetUnsignedLongLong(YAML::Node Data, std::string Name, unsigne */ bool ERS_FUNCTION_GetString(YAML::Node Data, std::string Name, std::string &Target); -/** - * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. - * Returns true on success, false on fail. - * - * @param Data YAML::Node containing the target data - * @param Name Name of the parameter in the yaml node - * @param Target Reference to the variable to be set to the decoded value - * @return true - * @return false - */ -bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string Name, glm::vec3 &Target); - /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. @@ -162,18 +150,4 @@ bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string Name, glm::vec3 &Target); * @return true * @return false */ -bool ERS_FUNCTION_GetVec3FromFloats(YAML::Node Data, std::string NameBase, glm::vec3 &Target); - - -/** - * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. - * Returns true on success, false on fail. - * - * @param Data YAML::Node containing the target data - * @param Name Name of the parameter in the yaml node - * @param Target Reference to the variable to be set to the decoded value - * @return true - * @return false - */ -bool ERS_FUNCTION_GetVec4(YAML::Node Data, std::string Name, glm::vec4 &Target); - +bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string NameBase, glm::vec3 &Target); From 2851c275f641c54f66a2b7c859774aecb05f7dbf Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 23:00:03 +0000 Subject: [PATCH 068/125] Update Scene Loader --- .../ERS_FUNCTION_YAMLHelpers.cpp | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp index a057b45e47..8a8a877394 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -107,17 +107,7 @@ bool ERS_FUNCTION_GetString(YAML::Node Data, std::string Name, std::string &Targ } // GLM Helper Functions -bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string Name, glm::vec3 &Target) { - try { - Target = Data[Name].as(); - return true; - } catch (YAML::TypedBadConversion&) { - return false; - } catch (YAML::KeyNotFound&) { - return false; - } -} -bool ERS_FUNCTION_GetVec3FromFloats(YAML::Node Data, std::string NameBase, glm::vec3 &Target) { +bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string NameBase, glm::vec3 &Target) { try { float X = Data[NameBase + "X"].as(); float Y = Data[NameBase + "Y"].as(); @@ -130,13 +120,3 @@ bool ERS_FUNCTION_GetVec3FromFloats(YAML::Node Data, std::string NameBase, glm:: return false; } } -// bool ERS_FUNCTION_GetVec4(YAML::Node Data, std::string Name, glm::vec4 &Target) { -// try { -// Target = Data[Name].as(); -// return true; -// } catch (YAML::TypedBadConversion&) { -// return false; -// } catch (YAML::KeyNotFound&) { -// return false; -// } -// } \ No newline at end of file From 9fcd637a6756383e009e88ea61927b823a56c724 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 23:01:58 +0000 Subject: [PATCH 069/125] Update Scene Loader --- .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 21a177318a..a831ad6ba3 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -8,9 +8,9 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable) { - SystemUtils->Logger_->Log(std::string("Processing Scene '") + Scene->SceneName + "'", 3, LogEnable); // Grab Metadata + SystemUtils->Logger_->Log(std::string("Processing Scene '") + Scene->SceneName + "'", 3, LogEnable); ERS_FUNCTION_GetLong (SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName ); ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex); From 40b818568c4c1e975bb7130a5497ecb9e0f7e3fe Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 23:04:20 +0000 Subject: [PATCH 070/125] Update Scene Loader --- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 4 ++++ .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h | 5 +++++ .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h | 5 +++++ .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h | 5 +++++ 4 files changed, 19 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index a831ad6ba3..371001c346 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -36,6 +36,10 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E // If type Is Model if (AssetType == "Model") { + ERS_STRUCT_Model Model; + + ERS_FUNCTION_GetLong(Item, "AssetID", Model->AssetID); + long AssetID = SceneDataNode[i]["AssetID"].as(); // Get Asset LocRotScale diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h index dd8de5a9dd..386a783666 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.h @@ -14,6 +14,11 @@ // Internal Libraries (BG convention: use <> instead of "") #include #include +#include +#include +#include +#include +#include #include diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h index e62f833f6a..c8901ddd19 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.h @@ -14,6 +14,11 @@ // Internal Libraries (BG convention: use <> instead of "") #include #include +#include +#include +#include +#include +#include #include diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h index c1db10155c..8cbef93290 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.h @@ -14,6 +14,11 @@ // Internal Libraries (BG convention: use <> instead of "") #include #include +#include +#include +#include +#include +#include #include From 7da5d0dd0d7cd623f226af6f41520e33d70d4120 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 23:10:54 +0000 Subject: [PATCH 071/125] Update Scene Loader --- .../ERS_ModelLoader/ERS_CLASS_ModelLoader.cpp | 4 ++++ .../ERS_ModelLoader/ERS_CLASS_ModelLoader.h | 1 + .../ERS_FUNCTION_SceneDecoderV1.cpp | 24 ++++--------------- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/Source/Core/Loader/ERS_ModelLoader/ERS_CLASS_ModelLoader.cpp b/Source/Core/Loader/ERS_ModelLoader/ERS_CLASS_ModelLoader.cpp index 20c4d6d235..d3f387b854 100644 --- a/Source/Core/Loader/ERS_ModelLoader/ERS_CLASS_ModelLoader.cpp +++ b/Source/Core/Loader/ERS_ModelLoader/ERS_CLASS_ModelLoader.cpp @@ -132,6 +132,10 @@ void ERS_CLASS_ModelLoader::ProcessNewModels(ERS_STRUCT_Scene* ActiveScene) { } +void ERS_CLASS_ModelLoader::AddModelToLoadingQueue(std::shared_ptr Model) { + AddModelToLoadingQueue(Model->AssetID, Model); +} + void ERS_CLASS_ModelLoader::AddModelToLoadingQueue(long AssetID, std::shared_ptr Model) { // Log Addition diff --git a/Source/Core/Loader/ERS_ModelLoader/ERS_CLASS_ModelLoader.h b/Source/Core/Loader/ERS_ModelLoader/ERS_CLASS_ModelLoader.h index 9689d2afbe..b00d78aa83 100644 --- a/Source/Core/Loader/ERS_ModelLoader/ERS_CLASS_ModelLoader.h +++ b/Source/Core/Loader/ERS_ModelLoader/ERS_CLASS_ModelLoader.h @@ -200,6 +200,7 @@ class ERS_CLASS_ModelLoader { * @param FlipTextures */ void AddModelToLoadingQueue(long AssetID, std::shared_ptr Model); + void AddModelToLoadingQueue(std::shared_ptr Model); diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 371001c346..20ec1965c8 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -38,22 +38,11 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E ERS_STRUCT_Model Model; - ERS_FUNCTION_GetLong(Item, "AssetID", Model->AssetID); - - long AssetID = SceneDataNode[i]["AssetID"].as(); - - // Get Asset LocRotScale - float PosX = SceneDataNode[i]["AssetPositionX"].as(); - float PosY = SceneDataNode[i]["AssetPositionY"].as(); - float PosZ = SceneDataNode[i]["AssetPositionZ"].as(); - - float RotX = SceneDataNode[i]["AssetRotationX"].as(); - float RotY = SceneDataNode[i]["AssetRotationY"].as(); - float RotZ = SceneDataNode[i]["AssetRotationZ"].as(); - - float ScaleX = SceneDataNode[i]["AssetScaleX"].as(); - float ScaleY = SceneDataNode[i]["AssetScaleY"].as(); - float ScaleZ = SceneDataNode[i]["AssetScaleZ"].as(); + ERS_FUNCTION_GetLong (Item, "AssetID", Model.AssetID ); + ERS_FUNCTION_GetVec3 (Item, "AssetPosition", Model.ModelPosition ); + ERS_FUNCTION_GetVec3 (Item, "AssetRotation", Model.ModelRotation ); + ERS_FUNCTION_GetVec3 (Item, "AssetScale", Model.ModelScale ); + //Model.ApplyTransformations(); //Load Model Scene->Models.push_back(std::make_shared()); @@ -62,9 +51,6 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E // Add Instance To Models Vector Scene->Models[CurrentSize-1]->IsTemplateModel = false; - Scene->Models[CurrentSize-1]->SetLocRotScale(glm::vec3(PosX, PosY, PosZ), glm::vec3(RotX, RotY, RotZ), glm::vec3(ScaleX, ScaleY, ScaleZ)); - Scene->Models[CurrentSize-1]->ApplyTransformations(); - Scene->Models[CurrentSize-1]->AssetID = AssetID; Scene->Models[CurrentSize-1]->Name = AssetName; From f9f744f152e63a3610063860b71543c1c6500db5 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 23:15:23 +0000 Subject: [PATCH 072/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV1.cpp | 33 +++++++------------ 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 20ec1965c8..42314a21b4 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -38,16 +38,21 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E ERS_STRUCT_Model Model; - ERS_FUNCTION_GetLong (Item, "AssetID", Model.AssetID ); - ERS_FUNCTION_GetVec3 (Item, "AssetPosition", Model.ModelPosition ); - ERS_FUNCTION_GetVec3 (Item, "AssetRotation", Model.ModelRotation ); - ERS_FUNCTION_GetVec3 (Item, "AssetScale", Model.ModelScale ); + ERS_FUNCTION_GetLong (Item, "AssetID", Model.AssetID ); + ERS_FUNCTION_GetVec3 (Item, "AssetPosition", Model.ModelPosition ); + ERS_FUNCTION_GetVec3 (Item, "AssetRotation", Model.ModelRotation ); + ERS_FUNCTION_GetVec3 (Item, "AssetScale", Model.ModelScale ); + ERS_FUNCTION_GetBool (Item, "CastDynamicShadows", Model.CastDynamicShadows_ ); + ERS_FUNCTION_GetBool (Item, "CastStaticShadows", Model.CastStaticShadows_ ); + ERS_FUNCTION_GetBool (Item, "ReceiveShadows", Model.ReceiveShadows_ ); + ERS_FUNCTION_GetLong (Item, "ShaderOverrideIndex", Model.ShaderOverrideIndex_ ); + //Model.ApplyTransformations(); //Load Model - Scene->Models.push_back(std::make_shared()); + Scene->Models.push_back(std::make_shared(Model)); int CurrentSize = Scene->Models.size(); - ModelLoader->AddModelToLoadingQueue(AssetID, Scene->Models[CurrentSize-1]); + ModelLoader->AddModelToLoadingQueue(Scene->Models[CurrentSize-1]); // Add Instance To Models Vector Scene->Models[CurrentSize-1]->IsTemplateModel = false; @@ -63,22 +68,6 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E } - // Load Shadow Configuration - if (SceneDataNode[i]["CastDynamicShadows"]) { - Scene->Models[CurrentSize-1]->CastDynamicShadows_ = SceneDataNode[i]["CastDynamicShadows"].as(); - } - - if (SceneDataNode[i]["CastStaticShadows"]) { - Scene->Models[CurrentSize-1]->CastStaticShadows_ = SceneDataNode[i]["CastStaticShadows"].as(); - } - - if (SceneDataNode[i]["ReceiveShadows"]) { - Scene->Models[CurrentSize-1]->ReceiveShadows_ = SceneDataNode[i]["ReceiveShadows"].as(); - } - - if (SceneDataNode[i]["ShaderOverrideIndex"]) { - Scene->Models[CurrentSize-1]->ShaderOverrideIndex_ = SceneDataNode[i]["ShaderOverrideIndex"].as(); - } } else if (AssetType == std::string("DirectionalLight")) { From 28bd0dfdee55143086c567249896f2923d8649bc Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 23:17:00 +0000 Subject: [PATCH 073/125] Update Scene Loader --- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 42314a21b4..aa6a70bd1e 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -46,6 +46,8 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E ERS_FUNCTION_GetBool (Item, "CastStaticShadows", Model.CastStaticShadows_ ); ERS_FUNCTION_GetBool (Item, "ReceiveShadows", Model.ReceiveShadows_ ); ERS_FUNCTION_GetLong (Item, "ShaderOverrideIndex", Model.ShaderOverrideIndex_ ); + ERS_FUNCTION_GetString (Item, "AssetName", Model.Name ); + Model.IsTemplateModel = false; //Model.ApplyTransformations(); @@ -54,10 +56,6 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E int CurrentSize = Scene->Models.size(); ModelLoader->AddModelToLoadingQueue(Scene->Models[CurrentSize-1]); - // Add Instance To Models Vector - Scene->Models[CurrentSize-1]->IsTemplateModel = false; - Scene->Models[CurrentSize-1]->Name = AssetName; - // Load Attached Scripts if (SceneDataNode[i]["AttachedScripts"]) { From 5c7232436e09955b8878644b52ce9db7c73b6538 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 23:17:19 +0000 Subject: [PATCH 074/125] Update Scene Loader --- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index aa6a70bd1e..be4bdd673c 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -53,8 +53,7 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E //Load Model Scene->Models.push_back(std::make_shared(Model)); - int CurrentSize = Scene->Models.size(); - ModelLoader->AddModelToLoadingQueue(Scene->Models[CurrentSize-1]); + ModelLoader->AddModelToLoadingQueue(Scene->Models[Scene->Models.size()-1]); // Load Attached Scripts From 73197f370131fb56ff29c5479076d5a2dcdfab4d Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 23:19:13 +0000 Subject: [PATCH 075/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV1.cpp | 18 +++++++------ .../ERS_FUNCTION_YAMLHelpers.h | 25 +++++++++++++++++++ 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index be4bdd673c..b815f4db92 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -49,6 +49,15 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E ERS_FUNCTION_GetString (Item, "AssetName", Model.Name ); Model.IsTemplateModel = false; + // Load Attached Scripts + if (SceneDataNode[i]["AttachedScripts"]) { + YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { + Model.AttachedScriptIndexes_.push_back(it->second.as()); + } + } + + //Model.ApplyTransformations(); //Load Model @@ -56,14 +65,7 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E ModelLoader->AddModelToLoadingQueue(Scene->Models[Scene->Models.size()-1]); - // Load Attached Scripts - if (SceneDataNode[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - Scene->Models[CurrentSize-1]->AttachedScriptIndexes_.push_back(it->second.as()); - } - } - + diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h index a0efdc3066..046e929c3f 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h @@ -151,3 +151,28 @@ bool ERS_FUNCTION_GetString(YAML::Node Data, std::string Name, std::string &Targ * @return false */ bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string NameBase, glm::vec3 &Target); + +/** + * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. + * Returns true on success, false on fail. + * + * @param Data YAML::Node containing the target data + * @param Name Name of the parameter in the yaml node + * @param Target Reference to the variable to be set to the decoded value + * @return true + * @return false + */ +bool ERS_FUNCTION_GetNode(YAML::Node Data, std::string NameBase, YAML::Node &Target); + +/** + * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. + * Returns true on success, false on fail. + * Will append X,Y,Z to get the three components of the vector. + * + * @param Data YAML::Node containing the target data + * @param Name Name of the parameter in the yaml node + * @param Target Reference to the variable to be set to the decoded value + * @return true + * @return false + */ +bool ERS_FUNCTION_GetStringVector(YAML::Node Data, std::string NameBase, std::vector &Target); \ No newline at end of file From 536b4ea9aec780af4bfae510e404c791e4536dc2 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 23:19:40 +0000 Subject: [PATCH 076/125] Update Scene Loader --- .../Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h index 046e929c3f..79cd49712a 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h @@ -150,7 +150,10 @@ bool ERS_FUNCTION_GetString(YAML::Node Data, std::string Name, std::string &Targ * @return true * @return false */ -bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string NameBase, glm::vec3 &Target); +bool ERS_FUNCTION_GetStringVector(YAML::Node Data, std::string NameBase, std::vector &Target); + + + /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. @@ -164,6 +167,9 @@ bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string NameBase, glm::vec3 &Targ */ bool ERS_FUNCTION_GetNode(YAML::Node Data, std::string NameBase, YAML::Node &Target); + + + /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. @@ -175,4 +181,4 @@ bool ERS_FUNCTION_GetNode(YAML::Node Data, std::string NameBase, YAML::Node &Tar * @return true * @return false */ -bool ERS_FUNCTION_GetStringVector(YAML::Node Data, std::string NameBase, std::vector &Target); \ No newline at end of file +bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string NameBase, glm::vec3 &Target); \ No newline at end of file From 7dfad34975d6ef7c9aeb2dfa0a4dcfa7198958ed Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 23:20:47 +0000 Subject: [PATCH 077/125] Update Scene Loader --- .../ERS_FUNCTION_YAMLHelpers.cpp | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp index 8a8a877394..8f46d705ea 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -105,6 +105,29 @@ bool ERS_FUNCTION_GetString(YAML::Node Data, std::string Name, std::string &Targ return false; } } +bool ERS_FUNCTION_GetNode(YAML::Node Data, std::string Name, YAML::Node &Target) { + try { + Target = Data[Name]; + return true; + } catch (YAML::KeyNotFound&) { + return false; + } +} + + +// Vector Helpers +bool ERS_FUNCTION_GetStringVector(YAML::Node Data, std::string Name, std::vector &Target) { + try { + Target = Data[Name].as(); + return true; + } catch (YAML::TypedBadConversion&) { + return false; + } catch (YAML::KeyNotFound&) { + return false; + } +} + + // GLM Helper Functions bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string NameBase, glm::vec3 &Target) { From 200bd42e71c4751767fedcf2fd6757b2ac616be8 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 23:23:11 +0000 Subject: [PATCH 078/125] Update Scene Loader --- .../ERS_FUNCTION_YAMLHelpers.cpp | 5 ++- .../ERS_FUNCTION_YAMLHelpers.h | 31 ++++++++++++++++--- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp index 8f46d705ea..230a1da6ea 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -118,7 +118,10 @@ bool ERS_FUNCTION_GetNode(YAML::Node Data, std::string Name, YAML::Node &Target) // Vector Helpers bool ERS_FUNCTION_GetStringVector(YAML::Node Data, std::string Name, std::vector &Target) { try { - Target = Data[Name].as(); + YAML::Node TargetNode = Data[Name]; + for (YAML::const_iterator it=TargetNode.begin(); it!=TargetNode.end(); ++it) { + Target.push_back(it->second.as()); + } return true; } catch (YAML::TypedBadConversion&) { return false; diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h index 79cd49712a..82603abd12 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h @@ -142,7 +142,6 @@ bool ERS_FUNCTION_GetString(YAML::Node Data, std::string Name, std::string &Targ /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. - * Will append X,Y,Z to get the three components of the vector. * * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node @@ -150,14 +149,14 @@ bool ERS_FUNCTION_GetString(YAML::Node Data, std::string Name, std::string &Targ * @return true * @return false */ -bool ERS_FUNCTION_GetStringVector(YAML::Node Data, std::string NameBase, std::vector &Target); - +bool ERS_FUNCTION_GetNode(YAML::Node Data, std::string NameBase, YAML::Node &Target); /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. + * Will append X,Y,Z to get the three components of the vector. * * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node @@ -165,9 +164,33 @@ bool ERS_FUNCTION_GetStringVector(YAML::Node Data, std::string NameBase, std::ve * @return true * @return false */ -bool ERS_FUNCTION_GetNode(YAML::Node Data, std::string NameBase, YAML::Node &Target); +bool ERS_FUNCTION_GetStringVector(YAML::Node Data, std::string NameBase, std::vector &Target); +/** + * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. + * Returns true on success, false on fail. + * Will append X,Y,Z to get the three components of the vector. + * + * @param Data YAML::Node containing the target data + * @param Name Name of the parameter in the yaml node + * @param Target Reference to the variable to be set to the decoded value + * @return true + * @return false + */ +bool ERS_FUNCTION_GetIntVector(YAML::Node Data, std::string NameBase, std::vector &Target); +/** + * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. + * Returns true on success, false on fail. + * Will append X,Y,Z to get the three components of the vector. + * + * @param Data YAML::Node containing the target data + * @param Name Name of the parameter in the yaml node + * @param Target Reference to the variable to be set to the decoded value + * @return true + * @return false + */ +bool ERS_FUNCTION_GetLongVector(YAML::Node Data, std::string NameBase, std::vector &Target); /** From 5d502ebc319a649fdb334fc082d7fe43c139ba62 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 23:24:06 +0000 Subject: [PATCH 079/125] Update Scene Loader --- .../ERS_FUNCTION_YAMLHelpers.cpp | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp index 230a1da6ea..0b15a1d4fc 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -129,8 +129,32 @@ bool ERS_FUNCTION_GetStringVector(YAML::Node Data, std::string Name, std::vector return false; } } - - +bool ERS_FUNCTION_GetIntVector(YAML::Node Data, std::string Name, std::vector &Target) { + try { + YAML::Node TargetNode = Data[Name]; + for (YAML::const_iterator it=TargetNode.begin(); it!=TargetNode.end(); ++it) { + Target.push_back(it->second.as()); + } + return true; + } catch (YAML::TypedBadConversion&) { + return false; + } catch (YAML::KeyNotFound&) { + return false; + } +} +bool ERS_FUNCTION_GetLongVector(YAML::Node Data, std::string Name, std::vector &Target) { + try { + YAML::Node TargetNode = Data[Name]; + for (YAML::const_iterator it=TargetNode.begin(); it!=TargetNode.end(); ++it) { + Target.push_back(it->second.as()); + } + return true; + } catch (YAML::TypedBadConversion&) { + return false; + } catch (YAML::KeyNotFound&) { + return false; + } +} // GLM Helper Functions bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string NameBase, glm::vec3 &Target) { From 9413ef429dfe26b4b9f91400f40542a741af6439 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 23:24:28 +0000 Subject: [PATCH 080/125] Update Scene Loader --- Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h index 82603abd12..30ebb4f20d 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h @@ -156,7 +156,6 @@ bool ERS_FUNCTION_GetNode(YAML::Node Data, std::string NameBase, YAML::Node &Tar /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. - * Will append X,Y,Z to get the three components of the vector. * * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node @@ -169,7 +168,6 @@ bool ERS_FUNCTION_GetStringVector(YAML::Node Data, std::string NameBase, std::ve /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. - * Will append X,Y,Z to get the three components of the vector. * * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node @@ -182,7 +180,6 @@ bool ERS_FUNCTION_GetIntVector(YAML::Node Data, std::string NameBase, std::vecto /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. - * Will append X,Y,Z to get the three components of the vector. * * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node From 289ea5067b58835db1ea412d4fd2a78514547be7 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 23:26:06 +0000 Subject: [PATCH 081/125] Update Scene Loader --- .../ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp | 12 ++++++++++++ .../ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h | 13 +++++++++++++ 2 files changed, 25 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp index 0b15a1d4fc..313c1bf107 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -155,6 +155,18 @@ bool ERS_FUNCTION_GetLongVector(YAML::Node Data, std::string Name, std::vector &Target) { + try { + YAML::Node TargetNode = Data[Name]; + for (YAML::const_iterator it=TargetNode.begin(); it!=TargetNode.end(); ++it) { + Target.push_back(it->second); + } + return true; + } catch (YAML::KeyNotFound&) { + return false; + } +} + // GLM Helper Functions bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string NameBase, glm::vec3 &Target) { diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h index 30ebb4f20d..c80a4364bd 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h @@ -189,6 +189,19 @@ bool ERS_FUNCTION_GetIntVector(YAML::Node Data, std::string NameBase, std::vecto */ bool ERS_FUNCTION_GetLongVector(YAML::Node Data, std::string NameBase, std::vector &Target); +/** + * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. + * Returns true on success, false on fail. + * + * @param Data YAML::Node containing the target data + * @param Name Name of the parameter in the yaml node + * @param Target Reference to the variable to be set to the decoded value + * @return true + * @return false + */ +bool ERS_FUNCTION_GetNodeVector(YAML::Node Data, std::string NameBase, std::vector &Target); + + /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. From ae9bfb49fa19e60a4d8585bd7139ba62cbfe82f1 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 23:28:16 +0000 Subject: [PATCH 082/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV1.cpp | 163 +++++++++--------- 1 file changed, 79 insertions(+), 84 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index b815f4db92..778a4afe40 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -11,23 +11,18 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E // Grab Metadata SystemUtils->Logger_->Log(std::string("Processing Scene '") + Scene->SceneName + "'", 3, LogEnable); - ERS_FUNCTION_GetLong (SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); - ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName ); - ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex); - - // Create List Of Scene Items std::vector SceneItems; - YAML::Node SceneDataNode = SceneData["SceneData"]; - for (YAML::const_iterator it=SceneDataNode.begin(); it!=SceneDataNode.end(); ++it) { - SceneItems.push_back(it->second); - } + ERS_FUNCTION_GetLong (SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); + ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName ); + ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex); + ERS_FUNCTION_GetNodeVector (SceneData, "SceneData", SceneItems ); // Iterate Through Vector To Add Each Asset To Loading Queue Of Requested Type - for (long i = 0; (long)i < (long)SceneDataNode.size(); i++) { + for (long i = 0; (long)i < (long)SceneItems.size(); i++) { // Get Asset Information - YAML::Node Item = SceneDataNode[i]; + YAML::Node Item = SceneItems[i]; std::string AssetName, AssetType; ERS_FUNCTION_GetString(Item, "AssetName", AssetName); ERS_FUNCTION_GetString(Item, "AssetType", AssetType); @@ -38,20 +33,20 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E ERS_STRUCT_Model Model; - ERS_FUNCTION_GetLong (Item, "AssetID", Model.AssetID ); - ERS_FUNCTION_GetVec3 (Item, "AssetPosition", Model.ModelPosition ); - ERS_FUNCTION_GetVec3 (Item, "AssetRotation", Model.ModelRotation ); - ERS_FUNCTION_GetVec3 (Item, "AssetScale", Model.ModelScale ); - ERS_FUNCTION_GetBool (Item, "CastDynamicShadows", Model.CastDynamicShadows_ ); - ERS_FUNCTION_GetBool (Item, "CastStaticShadows", Model.CastStaticShadows_ ); - ERS_FUNCTION_GetBool (Item, "ReceiveShadows", Model.ReceiveShadows_ ); - ERS_FUNCTION_GetLong (Item, "ShaderOverrideIndex", Model.ShaderOverrideIndex_ ); - ERS_FUNCTION_GetString (Item, "AssetName", Model.Name ); + ERS_FUNCTION_GetLong (Item, "AssetID", Model.AssetID ); + ERS_FUNCTION_GetVec3 (Item, "AssetPosition", Model.ModelPosition ); + ERS_FUNCTION_GetVec3 (Item, "AssetRotation", Model.ModelRotation ); + ERS_FUNCTION_GetVec3 (Item, "AssetScale", Model.ModelScale ); + ERS_FUNCTION_GetBool (Item, "CastDynamicShadows", Model.CastDynamicShadows_ ); + ERS_FUNCTION_GetBool (Item, "CastStaticShadows", Model.CastStaticShadows_ ); + ERS_FUNCTION_GetBool (Item, "ReceiveShadows", Model.ReceiveShadows_ ); + ERS_FUNCTION_GetLong (Item, "ShaderOverrideIndex", Model.ShaderOverrideIndex_ ); + ERS_FUNCTION_GetString (Item, "AssetName", Model.Name ); Model.IsTemplateModel = false; // Load Attached Scripts - if (SceneDataNode[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + if (SceneItems[i]["AttachedScripts"]) { + YAML::Node Scripts = SceneItems[i]["AttachedScripts"]; for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { Model.AttachedScriptIndexes_.push_back(it->second.as()); } @@ -77,41 +72,41 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E Scene->DirectionalLights[LightIndex]->UserDefinedName = AssetName; - if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { + if (SceneItems[i]["ColorRed"] && SceneItems[i]["ColorGreen"] && SceneItems[i]["ColorBlue"]) { Scene->DirectionalLights[LightIndex]->Color = glm::vec3( - SceneDataNode[i]["ColorRed"].as(), - SceneDataNode[i]["ColorGreen"].as(), - SceneDataNode[i]["ColorBlue"].as() + SceneItems[i]["ColorRed"].as(), + SceneItems[i]["ColorGreen"].as(), + SceneItems[i]["ColorBlue"].as() ); } - if (SceneDataNode[i]["Intensity"]) { - Scene->DirectionalLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); + if (SceneItems[i]["Intensity"]) { + Scene->DirectionalLights[LightIndex]->Intensity = SceneItems[i]["Intensity"].as(); } - if (SceneDataNode[i]["MaxDistance"]) { - Scene->DirectionalLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); + if (SceneItems[i]["MaxDistance"]) { + Scene->DirectionalLights[LightIndex]->MaxDistance = SceneItems[i]["MaxDistance"].as(); } Scene->DirectionalLights[LightIndex]->Pos = glm::vec3( - SceneDataNode[i]["PosX"].as(), - SceneDataNode[i]["PosY"].as(), - SceneDataNode[i]["PosZ"].as() + SceneItems[i]["PosX"].as(), + SceneItems[i]["PosY"].as(), + SceneItems[i]["PosZ"].as() ); Scene->DirectionalLights[LightIndex]->Rot = glm::vec3( - SceneDataNode[i]["RotX"].as(), - SceneDataNode[i]["RotY"].as(), - SceneDataNode[i]["RotZ"].as() + SceneItems[i]["RotX"].as(), + SceneItems[i]["RotY"].as(), + SceneItems[i]["RotZ"].as() ); - if (SceneDataNode[i]["CastShadows"]) { - Scene->DirectionalLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); + if (SceneItems[i]["CastShadows"]) { + Scene->DirectionalLights[LightIndex]->CastsShadows_ = SceneItems[i]["CastShadows"].as(); } // Load Attached Scripts - if (SceneDataNode[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + if (SceneItems[i]["AttachedScripts"]) { + YAML::Node Scripts = SceneItems[i]["AttachedScripts"]; for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { Scene->DirectionalLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); } @@ -124,35 +119,35 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E int LightIndex = Scene->PointLights.size() - 1; Scene->PointLights[LightIndex]->UserDefinedName = AssetName; - if (SceneDataNode[i]["Intensity"]) { - Scene->PointLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); + if (SceneItems[i]["Intensity"]) { + Scene->PointLights[LightIndex]->Intensity = SceneItems[i]["Intensity"].as(); } - if (SceneDataNode[i]["MaxDistance"]) { - Scene->PointLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); + if (SceneItems[i]["MaxDistance"]) { + Scene->PointLights[LightIndex]->MaxDistance = SceneItems[i]["MaxDistance"].as(); } - if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { + if (SceneItems[i]["ColorRed"] && SceneItems[i]["ColorGreen"] && SceneItems[i]["ColorBlue"]) { Scene->PointLights[LightIndex]->Color = glm::vec3( - SceneDataNode[i]["ColorRed"].as(), - SceneDataNode[i]["ColorGreen"].as(), - SceneDataNode[i]["ColorBlue"].as() + SceneItems[i]["ColorRed"].as(), + SceneItems[i]["ColorGreen"].as(), + SceneItems[i]["ColorBlue"].as() ); } Scene->PointLights[LightIndex]->Pos = glm::vec3( - SceneDataNode[i]["PosX"].as(), - SceneDataNode[i]["PosY"].as(), - SceneDataNode[i]["PosZ"].as() + SceneItems[i]["PosX"].as(), + SceneItems[i]["PosY"].as(), + SceneItems[i]["PosZ"].as() ); - if (SceneDataNode[i]["CastShadows"]) { - Scene->PointLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); + if (SceneItems[i]["CastShadows"]) { + Scene->PointLights[LightIndex]->CastsShadows_ = SceneItems[i]["CastShadows"].as(); } // Load Attached Scripts - if (SceneDataNode[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + if (SceneItems[i]["AttachedScripts"]) { + YAML::Node Scripts = SceneItems[i]["AttachedScripts"]; for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { Scene->PointLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); } @@ -166,45 +161,45 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E Scene->SpotLights[LightIndex]->UserDefinedName = AssetName; - if (SceneDataNode[i]["Intensity"]) { - Scene->SpotLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); + if (SceneItems[i]["Intensity"]) { + Scene->SpotLights[LightIndex]->Intensity = SceneItems[i]["Intensity"].as(); } - if (SceneDataNode[i]["MaxDistance"]) { - Scene->SpotLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); + if (SceneItems[i]["MaxDistance"]) { + Scene->SpotLights[LightIndex]->MaxDistance = SceneItems[i]["MaxDistance"].as(); } - Scene->SpotLights[LightIndex]->CutOff = SceneDataNode[i]["CutOff"].as(); + Scene->SpotLights[LightIndex]->CutOff = SceneItems[i]["CutOff"].as(); - if (SceneDataNode[i]["RollOff"]) { - Scene->SpotLights[LightIndex]->Rolloff = SceneDataNode[i]["RollOff"].as(); + if (SceneItems[i]["RollOff"]) { + Scene->SpotLights[LightIndex]->Rolloff = SceneItems[i]["RollOff"].as(); } - if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { + if (SceneItems[i]["ColorRed"] && SceneItems[i]["ColorGreen"] && SceneItems[i]["ColorBlue"]) { Scene->SpotLights[LightIndex]->Color = glm::vec3( - SceneDataNode[i]["ColorRed"].as(), - SceneDataNode[i]["ColorGreen"].as(), - SceneDataNode[i]["ColorBlue"].as() + SceneItems[i]["ColorRed"].as(), + SceneItems[i]["ColorGreen"].as(), + SceneItems[i]["ColorBlue"].as() ); } Scene->SpotLights[LightIndex]->Pos = glm::vec3( - SceneDataNode[i]["PosX"].as(), - SceneDataNode[i]["PosY"].as(), - SceneDataNode[i]["PosZ"].as() + SceneItems[i]["PosX"].as(), + SceneItems[i]["PosY"].as(), + SceneItems[i]["PosZ"].as() ); Scene->SpotLights[LightIndex]->Rot = glm::vec3( - SceneDataNode[i]["RotX"].as(), - SceneDataNode[i]["RotY"].as(), - SceneDataNode[i]["RotZ"].as() + SceneItems[i]["RotX"].as(), + SceneItems[i]["RotY"].as(), + SceneItems[i]["RotZ"].as() ); - if (SceneDataNode[i]["CastShadows"]) { - Scene->SpotLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); + if (SceneItems[i]["CastShadows"]) { + Scene->SpotLights[LightIndex]->CastsShadows_ = SceneItems[i]["CastShadows"].as(); } // Load Attached Scripts - if (SceneDataNode[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + if (SceneItems[i]["AttachedScripts"]) { + YAML::Node Scripts = SceneItems[i]["AttachedScripts"]; for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { Scene->SpotLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); } @@ -218,19 +213,19 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E Scene->SceneCameras[SceneCameraIndex]->UserDefinedName_ = AssetName; Scene->SceneCameras[SceneCameraIndex]->Pos_ = glm::vec3( - SceneDataNode[i]["PosX"].as(), - SceneDataNode[i]["PosY"].as(), - SceneDataNode[i]["PosZ"].as() + SceneItems[i]["PosX"].as(), + SceneItems[i]["PosY"].as(), + SceneItems[i]["PosZ"].as() ); Scene->SceneCameras[SceneCameraIndex]->Rot_ = glm::vec3( - SceneDataNode[i]["RotX"].as(), - SceneDataNode[i]["RotY"].as(), - SceneDataNode[i]["RotZ"].as() + SceneItems[i]["RotX"].as(), + SceneItems[i]["RotY"].as(), + SceneItems[i]["RotZ"].as() ); // Load Attached Scripts - if (SceneDataNode[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; + if (SceneItems[i]["AttachedScripts"]) { + YAML::Node Scripts = SceneItems[i]["AttachedScripts"]; for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { Scene->SceneCameras[SceneCameraIndex]->AttachedScriptIndexes_.push_back(it->second.as()); } From 3e668b825ff3098908b38e84b68cfeb71e3a0071 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 23:28:44 +0000 Subject: [PATCH 083/125] Update Scene Loader --- .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 778a4afe40..6d343eb05f 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -42,7 +42,6 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E ERS_FUNCTION_GetBool (Item, "ReceiveShadows", Model.ReceiveShadows_ ); ERS_FUNCTION_GetLong (Item, "ShaderOverrideIndex", Model.ShaderOverrideIndex_ ); ERS_FUNCTION_GetString (Item, "AssetName", Model.Name ); - Model.IsTemplateModel = false; // Load Attached Scripts if (SceneItems[i]["AttachedScripts"]) { From 29f6f7d6321c3c47794495b5418854fed47b2674 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 23:30:21 +0000 Subject: [PATCH 084/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV1.cpp | 37 +++++++------------ 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 6d343eb05f..b805922165 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -13,10 +13,10 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E SystemUtils->Logger_->Log(std::string("Processing Scene '") + Scene->SceneName + "'", 3, LogEnable); std::vector SceneItems; - ERS_FUNCTION_GetLong (SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); - ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName ); - ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex); - ERS_FUNCTION_GetNodeVector (SceneData, "SceneData", SceneItems ); + ERS_FUNCTION_GetLong (SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); + ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName ); + ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex ); + ERS_FUNCTION_GetNodeVector (SceneData, "SceneData", SceneItems ); // Iterate Through Vector To Add Each Asset To Loading Queue Of Requested Type for (long i = 0; (long)i < (long)SceneItems.size(); i++) { @@ -33,26 +33,17 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E ERS_STRUCT_Model Model; - ERS_FUNCTION_GetLong (Item, "AssetID", Model.AssetID ); - ERS_FUNCTION_GetVec3 (Item, "AssetPosition", Model.ModelPosition ); - ERS_FUNCTION_GetVec3 (Item, "AssetRotation", Model.ModelRotation ); - ERS_FUNCTION_GetVec3 (Item, "AssetScale", Model.ModelScale ); - ERS_FUNCTION_GetBool (Item, "CastDynamicShadows", Model.CastDynamicShadows_ ); - ERS_FUNCTION_GetBool (Item, "CastStaticShadows", Model.CastStaticShadows_ ); - ERS_FUNCTION_GetBool (Item, "ReceiveShadows", Model.ReceiveShadows_ ); - ERS_FUNCTION_GetLong (Item, "ShaderOverrideIndex", Model.ShaderOverrideIndex_ ); - ERS_FUNCTION_GetString (Item, "AssetName", Model.Name ); - - // Load Attached Scripts - if (SceneItems[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneItems[i]["AttachedScripts"]; - for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - Model.AttachedScriptIndexes_.push_back(it->second.as()); - } - } - + ERS_FUNCTION_GetLong (Item, "AssetID", Model.AssetID ); + ERS_FUNCTION_GetVec3 (Item, "AssetPosition", Model.ModelPosition ); + ERS_FUNCTION_GetVec3 (Item, "AssetRotation", Model.ModelRotation ); + ERS_FUNCTION_GetVec3 (Item, "AssetScale", Model.ModelScale ); + ERS_FUNCTION_GetBool (Item, "CastDynamicShadows", Model.CastDynamicShadows_ ); + ERS_FUNCTION_GetBool (Item, "CastStaticShadows", Model.CastStaticShadows_ ); + ERS_FUNCTION_GetBool (Item, "ReceiveShadows", Model.ReceiveShadows_ ); + ERS_FUNCTION_GetLong (Item, "ShaderOverrideIndex", Model.ShaderOverrideIndex_ ); + ERS_FUNCTION_GetString (Item, "AssetName", Model.Name ); + ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Model.AttachedScriptIndexes_ ); - //Model.ApplyTransformations(); //Load Model Scene->Models.push_back(std::make_shared(Model)); From 865dc59200bb2a0feb506d7e579e8d5bf65f5bb1 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 23:32:37 +0000 Subject: [PATCH 085/125] Update Scene Loader --- .../ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index b805922165..428f4ac9af 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -28,11 +28,9 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E ERS_FUNCTION_GetString(Item, "AssetType", AssetType); - // If type Is Model if (AssetType == "Model") { ERS_STRUCT_Model Model; - ERS_FUNCTION_GetLong (Item, "AssetID", Model.AssetID ); ERS_FUNCTION_GetVec3 (Item, "AssetPosition", Model.ModelPosition ); ERS_FUNCTION_GetVec3 (Item, "AssetRotation", Model.ModelRotation ); @@ -44,16 +42,9 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E ERS_FUNCTION_GetString (Item, "AssetName", Model.Name ); ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Model.AttachedScriptIndexes_ ); - - //Load Model Scene->Models.push_back(std::make_shared(Model)); ModelLoader->AddModelToLoadingQueue(Scene->Models[Scene->Models.size()-1]); - - - - - } else if (AssetType == std::string("DirectionalLight")) { // Setup Model Pointer In Scene To Work On From f50a67568f7aae457a602552bdc1246e0d0dac73 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 23:55:49 +0000 Subject: [PATCH 086/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV1.cpp | 2 ++ .../ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp | 13 +++++++++++++ .../ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h | 15 ++++++++++++++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 428f4ac9af..b9a17041ea 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -48,6 +48,8 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E } else if (AssetType == std::string("DirectionalLight")) { // Setup Model Pointer In Scene To Work On + ERS_STRUCT_DirectionalLight Light; + ERS_FUNCTION_GetVec3Color (Item, "Color") Scene->DirectionalLights.push_back(std::make_shared()); int LightIndex = Scene->DirectionalLights.size() - 1; diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp index 313c1bf107..f65bf56a09 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -182,3 +182,16 @@ bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string NameBase, glm::vec3 &Targ return false; } } +bool ERS_FUNCTION_GetVec3Color(YAML::Node Data, std::string NameBase, glm::vec3 &Target) { + try { + float X = Data[NameBase + "Red"].as(); + float Y = Data[NameBase + "Green"].as(); + float Z = Data[NameBase + "Blue"].as(); + Target = glm::vec3(X,Y,Z); + return true; + } catch (YAML::TypedBadConversion&) { + return false; + } catch (YAML::KeyNotFound&) { + return false; + } +} diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h index c80a4364bd..3f554a54d2 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h @@ -214,4 +214,17 @@ bool ERS_FUNCTION_GetNodeVector(YAML::Node Data, std::string NameBase, std::vect * @return true * @return false */ -bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string NameBase, glm::vec3 &Target); \ No newline at end of file +bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string NameBase, glm::vec3 &Target); + +/** + * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. + * Returns true on success, false on fail. + * Will append Red,Green,Blue to get the three components of the vector. + * + * @param Data YAML::Node containing the target data + * @param Name Name of the parameter in the yaml node + * @param Target Reference to the variable to be set to the decoded value + * @return true + * @return false + */ +bool ERS_FUNCTION_GetVec3Color(YAML::Node Data, std::string NameBase, glm::vec3 &Target); \ No newline at end of file From 899b7acf6e89c3bfdeb60fdf40f64c582e56ad70 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Fri, 12 Aug 2022 23:59:49 +0000 Subject: [PATCH 087/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV1.cpp | 55 +++---------------- 1 file changed, 9 insertions(+), 46 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index b9a17041ea..80eb5cb89b 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -47,53 +47,16 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E } else if (AssetType == std::string("DirectionalLight")) { - // Setup Model Pointer In Scene To Work On ERS_STRUCT_DirectionalLight Light; - ERS_FUNCTION_GetVec3Color (Item, "Color") - Scene->DirectionalLights.push_back(std::make_shared()); - int LightIndex = Scene->DirectionalLights.size() - 1; - - Scene->DirectionalLights[LightIndex]->UserDefinedName = AssetName; - - if (SceneItems[i]["ColorRed"] && SceneItems[i]["ColorGreen"] && SceneItems[i]["ColorBlue"]) { - Scene->DirectionalLights[LightIndex]->Color = glm::vec3( - SceneItems[i]["ColorRed"].as(), - SceneItems[i]["ColorGreen"].as(), - SceneItems[i]["ColorBlue"].as() - ); - } - - if (SceneItems[i]["Intensity"]) { - Scene->DirectionalLights[LightIndex]->Intensity = SceneItems[i]["Intensity"].as(); - } - - if (SceneItems[i]["MaxDistance"]) { - Scene->DirectionalLights[LightIndex]->MaxDistance = SceneItems[i]["MaxDistance"].as(); - } - - Scene->DirectionalLights[LightIndex]->Pos = glm::vec3( - SceneItems[i]["PosX"].as(), - SceneItems[i]["PosY"].as(), - SceneItems[i]["PosZ"].as() - ); - Scene->DirectionalLights[LightIndex]->Rot = glm::vec3( - SceneItems[i]["RotX"].as(), - SceneItems[i]["RotY"].as(), - SceneItems[i]["RotZ"].as() - ); - - - if (SceneItems[i]["CastShadows"]) { - Scene->DirectionalLights[LightIndex]->CastsShadows_ = SceneItems[i]["CastShadows"].as(); - } - - // Load Attached Scripts - if (SceneItems[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneItems[i]["AttachedScripts"]; - for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - Scene->DirectionalLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - } - } + ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); + ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); + ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); + ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); + ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); + ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); + ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); + ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Scene->DirectionalLights.push_back(std::make_shared(Light)); } else if (AssetType == std::string("PointLight")) { From 2b21104efc158b2d8a81a6d4b9c6ca116b96f17b Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 00:01:28 +0000 Subject: [PATCH 088/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV1.cpp | 47 ++++--------------- 1 file changed, 9 insertions(+), 38 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 80eb5cb89b..1a6526b4d2 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -60,44 +60,15 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E } else if (AssetType == std::string("PointLight")) { - // Setup Model Pointer In Scene To Work On - Scene->PointLights.push_back(std::make_shared()); - int LightIndex = Scene->PointLights.size() - 1; - - Scene->PointLights[LightIndex]->UserDefinedName = AssetName; - if (SceneItems[i]["Intensity"]) { - Scene->PointLights[LightIndex]->Intensity = SceneItems[i]["Intensity"].as(); - } - if (SceneItems[i]["MaxDistance"]) { - Scene->PointLights[LightIndex]->MaxDistance = SceneItems[i]["MaxDistance"].as(); - } - - - if (SceneItems[i]["ColorRed"] && SceneItems[i]["ColorGreen"] && SceneItems[i]["ColorBlue"]) { - Scene->PointLights[LightIndex]->Color = glm::vec3( - SceneItems[i]["ColorRed"].as(), - SceneItems[i]["ColorGreen"].as(), - SceneItems[i]["ColorBlue"].as() - ); - } - - Scene->PointLights[LightIndex]->Pos = glm::vec3( - SceneItems[i]["PosX"].as(), - SceneItems[i]["PosY"].as(), - SceneItems[i]["PosZ"].as() - ); - - if (SceneItems[i]["CastShadows"]) { - Scene->PointLights[LightIndex]->CastsShadows_ = SceneItems[i]["CastShadows"].as(); - } - - // Load Attached Scripts - if (SceneItems[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneItems[i]["AttachedScripts"]; - for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - Scene->PointLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - } - } + ERS_STRUCT_PointLight Light; + ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); + ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); + ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); + ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); + ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); + ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); + ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Scene->PointLights.push_back(std::make_shared(Light)); } else if (AssetType == std::string("SpotLight")) { From d7e9d975e7e513e23c9e1c158ab7a304b486f7ef Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 00:03:37 +0000 Subject: [PATCH 089/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV1.cpp | 61 ++++--------------- 1 file changed, 12 insertions(+), 49 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 1a6526b4d2..85b4343a57 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -72,55 +72,18 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E } else if (AssetType == std::string("SpotLight")) { - // Setup Model Pointer In Scene To Work On - Scene->SpotLights.push_back(std::make_shared()); - int LightIndex = Scene->SpotLights.size() - 1; - - Scene->SpotLights[LightIndex]->UserDefinedName = AssetName; - - if (SceneItems[i]["Intensity"]) { - Scene->SpotLights[LightIndex]->Intensity = SceneItems[i]["Intensity"].as(); - } - if (SceneItems[i]["MaxDistance"]) { - Scene->SpotLights[LightIndex]->MaxDistance = SceneItems[i]["MaxDistance"].as(); - } - Scene->SpotLights[LightIndex]->CutOff = SceneItems[i]["CutOff"].as(); - - if (SceneItems[i]["RollOff"]) { - Scene->SpotLights[LightIndex]->Rolloff = SceneItems[i]["RollOff"].as(); - } - if (SceneItems[i]["ColorRed"] && SceneItems[i]["ColorGreen"] && SceneItems[i]["ColorBlue"]) { - Scene->SpotLights[LightIndex]->Color = glm::vec3( - SceneItems[i]["ColorRed"].as(), - SceneItems[i]["ColorGreen"].as(), - SceneItems[i]["ColorBlue"].as() - ); - } - - - Scene->SpotLights[LightIndex]->Pos = glm::vec3( - SceneItems[i]["PosX"].as(), - SceneItems[i]["PosY"].as(), - SceneItems[i]["PosZ"].as() - ); - Scene->SpotLights[LightIndex]->Rot = glm::vec3( - SceneItems[i]["RotX"].as(), - SceneItems[i]["RotY"].as(), - SceneItems[i]["RotZ"].as() - ); - - - if (SceneItems[i]["CastShadows"]) { - Scene->SpotLights[LightIndex]->CastsShadows_ = SceneItems[i]["CastShadows"].as(); - } - - // Load Attached Scripts - if (SceneItems[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneItems[i]["AttachedScripts"]; - for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - Scene->SpotLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - } - } + ERS_STRUCT_SpotLight Light; + ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); + ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); + ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); + ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); + ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); + ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); + ERS_FUNCTION_GetFloat (Item, "CutOff", Light.CutOff ); + ERS_FUNCTION_GetFloat (Item, "RollOff", Light.Rolloff ); + ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); + ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Scene->SpotLights.push_back(std::make_shared(Light)); } else if (AssetType == std::string("SceneCamera")) { From 1c616cf219273c7273f42eb432963fe75814fc9f Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 00:06:26 +0000 Subject: [PATCH 090/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV1.cpp | 29 ++++--------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 85b4343a57..5d9611a85d 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -87,29 +87,12 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E } else if (AssetType == std::string("SceneCamera")) { - // Setup Model Pointer In Scene To Work On - Scene->SceneCameras.push_back(std::make_shared()); - int SceneCameraIndex = Scene->SceneCameras.size() - 1; - - Scene->SceneCameras[SceneCameraIndex]->UserDefinedName_ = AssetName; - Scene->SceneCameras[SceneCameraIndex]->Pos_ = glm::vec3( - SceneItems[i]["PosX"].as(), - SceneItems[i]["PosY"].as(), - SceneItems[i]["PosZ"].as() - ); - Scene->SceneCameras[SceneCameraIndex]->Rot_ = glm::vec3( - SceneItems[i]["RotX"].as(), - SceneItems[i]["RotY"].as(), - SceneItems[i]["RotZ"].as() - ); - - // Load Attached Scripts - if (SceneItems[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneItems[i]["AttachedScripts"]; - for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - Scene->SceneCameras[SceneCameraIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - } - } + ERS_STRUCT_SceneCamera Camera; + ERS_FUNCTION_GetString (Item, "AssetName", Camera.UserDefinedName_ ); + ERS_FUNCTION_GetVec3 (Item, "Pos", Camera.Pos_, ); + ERS_FUNCTION_GetVec3 (Item, "Rot", Camera.Rot_, ); + ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Camera.AttachedScriptIndexes_ ); + Scene->SceneCameras.push_back(std::make_shared(Camera)); } else { SystemUtils->Logger_->Log(std::string("Unsupported/Unknown Asset Type: ") + AssetType, 9); From 6f5133fb009f60e1fe169a46a9cc9e085097d647 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 00:07:58 +0000 Subject: [PATCH 091/125] Update Scene Loader --- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 5d9611a85d..a5832c5577 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -89,8 +89,8 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E ERS_STRUCT_SceneCamera Camera; ERS_FUNCTION_GetString (Item, "AssetName", Camera.UserDefinedName_ ); - ERS_FUNCTION_GetVec3 (Item, "Pos", Camera.Pos_, ); - ERS_FUNCTION_GetVec3 (Item, "Rot", Camera.Rot_, ); + ERS_FUNCTION_GetVec3 (Item, "Pos", Camera.Pos_ ); + ERS_FUNCTION_GetVec3 (Item, "Rot", Camera.Rot_ ); ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Camera.AttachedScriptIndexes_ ); Scene->SceneCameras.push_back(std::make_shared(Camera)); From 0d1d9d8929450d81d69c345ee1f146e39be7652b Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 00:11:42 +0000 Subject: [PATCH 092/125] Update Scene Loader --- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index a5832c5577..454902793c 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -8,11 +8,10 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable) { + SystemUtils->Logger_->Log(std::string("Processing Scene '") + Scene->SceneName + "'", 3, LogEnable); // Grab Metadata - SystemUtils->Logger_->Log(std::string("Processing Scene '") + Scene->SceneName + "'", 3, LogEnable); std::vector SceneItems; - ERS_FUNCTION_GetLong (SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName ); ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex ); From 3c51b88628df015fc7ae444199112bc8a369a59f Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 00:12:26 +0000 Subject: [PATCH 093/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV1.cpp | 2 +- .../ERS_FUNCTION_SceneDecoderV2.cpp | 301 ++++-------------- 2 files changed, 63 insertions(+), 240 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 454902793c..2e820ba8b4 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -8,7 +8,7 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable) { - SystemUtils->Logger_->Log(std::string("Processing Scene '") + Scene->SceneName + "'", 3, LogEnable); + SystemUtils->Logger_->Log(std::string("Processing Scene '") + Scene->SceneName + "' With Decoder Version 1", 3, LogEnable); // Grab Metadata std::vector SceneItems; diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp index 27bc74937c..9af9d3bc83 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp @@ -15,265 +15,90 @@ bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable) { + SystemUtils->Logger_->Log(std::string("Processing Scene '") + Scene->SceneName + "' With Decoder Version 1", 3, LogEnable); // Grab Metadata - Scene->SceneFormatVersion = SceneData["SceneFormatVersion"].as(); - Scene->SceneName = SceneData["SceneName"].as(); - - if (SceneData["ActiveCameraIndex"]) { - Scene->ActiveSceneCameraIndex = SceneData["ActiveCameraIndex"].as(); - } - - // Log Scene Processing - SystemUtils->Logger_->Log(std::string("Processing Scene: ") + std::string(Scene->SceneName), 3, LogEnable); - - // Create List Of Scene Items std::vector SceneItems; - YAML::Node SceneDataNode = SceneData["SceneData"]; - for (YAML::const_iterator it=SceneDataNode.begin(); it!=SceneDataNode.end(); ++it) { - SceneItems.push_back(it->second); - } - + ERS_FUNCTION_GetLong (SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); + ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName ); + ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex ); + ERS_FUNCTION_GetNodeVector (SceneData, "SceneData", SceneItems ); // Iterate Through Vector To Add Each Asset To Loading Queue Of Requested Type - for (long i = 0; (long)i < (long)SceneDataNode.size(); i++) { + for (long i = 0; (long)i < (long)SceneItems.size(); i++) { // Get Asset Information - std::string AssetName = SceneDataNode[i]["AssetName"].as(); - std::string AssetType = SceneDataNode[i]["AssetType"].as(); - - // If type Is Model - if (AssetType == std::string("Model")) { - - long AssetID = SceneDataNode[i]["AssetID"].as(); - - // Get Asset LocRotScale - float PosX = SceneDataNode[i]["AssetPositionX"].as(); - float PosY = SceneDataNode[i]["AssetPositionY"].as(); - float PosZ = SceneDataNode[i]["AssetPositionZ"].as(); - - float RotX = SceneDataNode[i]["AssetRotationX"].as(); - float RotY = SceneDataNode[i]["AssetRotationY"].as(); - float RotZ = SceneDataNode[i]["AssetRotationZ"].as(); - - float ScaleX = SceneDataNode[i]["AssetScaleX"].as(); - float ScaleY = SceneDataNode[i]["AssetScaleY"].as(); - float ScaleZ = SceneDataNode[i]["AssetScaleZ"].as(); + YAML::Node Item = SceneItems[i]; + std::string AssetName, AssetType; + ERS_FUNCTION_GetString(Item, "AssetName", AssetName); + ERS_FUNCTION_GetString(Item, "AssetType", AssetType); - //Load Model - Scene->Models.push_back(std::make_shared()); - int CurrentSize = Scene->Models.size(); - ModelLoader->AddModelToLoadingQueue(AssetID, Scene->Models[CurrentSize-1]); - // Add Instance To Models Vector - Scene->Models[CurrentSize-1]->IsTemplateModel = false; - Scene->Models[CurrentSize-1]->SetLocRotScale(glm::vec3(PosX, PosY, PosZ), glm::vec3(RotX, RotY, RotZ), glm::vec3(ScaleX, ScaleY, ScaleZ)); - Scene->Models[CurrentSize-1]->ApplyTransformations(); - Scene->Models[CurrentSize-1]->AssetID = AssetID; - Scene->Models[CurrentSize-1]->Name = AssetName; + if (AssetType == "Model") { + ERS_STRUCT_Model Model; + ERS_FUNCTION_GetLong (Item, "AssetID", Model.AssetID ); + ERS_FUNCTION_GetVec3 (Item, "AssetPosition", Model.ModelPosition ); + ERS_FUNCTION_GetVec3 (Item, "AssetRotation", Model.ModelRotation ); + ERS_FUNCTION_GetVec3 (Item, "AssetScale", Model.ModelScale ); + ERS_FUNCTION_GetBool (Item, "CastDynamicShadows", Model.CastDynamicShadows_ ); + ERS_FUNCTION_GetBool (Item, "CastStaticShadows", Model.CastStaticShadows_ ); + ERS_FUNCTION_GetBool (Item, "ReceiveShadows", Model.ReceiveShadows_ ); + ERS_FUNCTION_GetLong (Item, "ShaderOverrideIndex", Model.ShaderOverrideIndex_ ); + ERS_FUNCTION_GetString (Item, "AssetName", Model.Name ); + ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Model.AttachedScriptIndexes_ ); - // Load Attached Scripts - if (SceneDataNode[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - Scene->Models[CurrentSize-1]->AttachedScriptIndexes_.push_back(it->second.as()); - } - } - - - // Load Shadow Configuration - if (SceneDataNode[i]["CastDynamicShadows"]) { - Scene->Models[CurrentSize-1]->CastDynamicShadows_ = SceneDataNode[i]["CastDynamicShadows"].as(); - } - - if (SceneDataNode[i]["CastStaticShadows"]) { - Scene->Models[CurrentSize-1]->CastStaticShadows_ = SceneDataNode[i]["CastStaticShadows"].as(); - } - - if (SceneDataNode[i]["ReceiveShadows"]) { - Scene->Models[CurrentSize-1]->ReceiveShadows_ = SceneDataNode[i]["ReceiveShadows"].as(); - } - - if (SceneDataNode[i]["ShaderOverrideIndex"]) { - Scene->Models[CurrentSize-1]->ShaderOverrideIndex_ = SceneDataNode[i]["ShaderOverrideIndex"].as(); - } - + Scene->Models.push_back(std::make_shared(Model)); + ModelLoader->AddModelToLoadingQueue(Scene->Models[Scene->Models.size()-1]); } else if (AssetType == std::string("DirectionalLight")) { - // Setup Model Pointer In Scene To Work On - Scene->DirectionalLights.push_back(std::make_shared()); - int LightIndex = Scene->DirectionalLights.size() - 1; - - Scene->DirectionalLights[LightIndex]->UserDefinedName = AssetName; - - if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { - Scene->DirectionalLights[LightIndex]->Color = glm::vec3( - SceneDataNode[i]["ColorRed"].as(), - SceneDataNode[i]["ColorGreen"].as(), - SceneDataNode[i]["ColorBlue"].as() - ); - } - - if (SceneDataNode[i]["Intensity"]) { - Scene->DirectionalLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); - } - - if (SceneDataNode[i]["MaxDistance"]) { - Scene->DirectionalLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); - } - - Scene->DirectionalLights[LightIndex]->Pos = glm::vec3( - SceneDataNode[i]["PosX"].as(), - SceneDataNode[i]["PosY"].as(), - SceneDataNode[i]["PosZ"].as() - ); - Scene->DirectionalLights[LightIndex]->Rot = glm::vec3( - SceneDataNode[i]["RotX"].as(), - SceneDataNode[i]["RotY"].as(), - SceneDataNode[i]["RotZ"].as() - ); - - - if (SceneDataNode[i]["CastShadows"]) { - Scene->DirectionalLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); - } - - // Load Attached Scripts - if (SceneDataNode[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - Scene->DirectionalLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - } - } + ERS_STRUCT_DirectionalLight Light; + ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); + ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); + ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); + ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); + ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); + ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); + ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); + ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Scene->DirectionalLights.push_back(std::make_shared(Light)); } else if (AssetType == std::string("PointLight")) { - // Setup Model Pointer In Scene To Work On - Scene->PointLights.push_back(std::make_shared()); - int LightIndex = Scene->PointLights.size() - 1; - - Scene->PointLights[LightIndex]->UserDefinedName = AssetName; - if (SceneDataNode[i]["Intensity"]) { - Scene->PointLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); - } - if (SceneDataNode[i]["MaxDistance"]) { - Scene->PointLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); - } - - - if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { - Scene->PointLights[LightIndex]->Color = glm::vec3( - SceneDataNode[i]["ColorRed"].as(), - SceneDataNode[i]["ColorGreen"].as(), - SceneDataNode[i]["ColorBlue"].as() - ); - } - - Scene->PointLights[LightIndex]->Pos = glm::vec3( - SceneDataNode[i]["PosX"].as(), - SceneDataNode[i]["PosY"].as(), - SceneDataNode[i]["PosZ"].as() - ); - - if (SceneDataNode[i]["CastShadows"]) { - Scene->PointLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); - } - - // Load Attached Scripts - if (SceneDataNode[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - Scene->PointLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - } - } + ERS_STRUCT_PointLight Light; + ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); + ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); + ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); + ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); + ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); + ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); + ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Scene->PointLights.push_back(std::make_shared(Light)); } else if (AssetType == std::string("SpotLight")) { - // Setup Model Pointer In Scene To Work On - Scene->SpotLights.push_back(std::make_shared()); - int LightIndex = Scene->SpotLights.size() - 1; - - Scene->SpotLights[LightIndex]->UserDefinedName = AssetName; - - if (SceneDataNode[i]["Intensity"]) { - Scene->SpotLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); - } - if (SceneDataNode[i]["MaxDistance"]) { - Scene->SpotLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); - } - Scene->SpotLights[LightIndex]->CutOff = SceneDataNode[i]["CutOff"].as(); - - if (SceneDataNode[i]["RollOff"]) { - Scene->SpotLights[LightIndex]->Rolloff = SceneDataNode[i]["RollOff"].as(); - } - if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { - Scene->SpotLights[LightIndex]->Color = glm::vec3( - SceneDataNode[i]["ColorRed"].as(), - SceneDataNode[i]["ColorGreen"].as(), - SceneDataNode[i]["ColorBlue"].as() - ); - } - - - Scene->SpotLights[LightIndex]->Pos = glm::vec3( - SceneDataNode[i]["PosX"].as(), - SceneDataNode[i]["PosY"].as(), - SceneDataNode[i]["PosZ"].as() - ); - Scene->SpotLights[LightIndex]->Rot = glm::vec3( - SceneDataNode[i]["RotX"].as(), - SceneDataNode[i]["RotY"].as(), - SceneDataNode[i]["RotZ"].as() - ); - - - if (SceneDataNode[i]["CastShadows"]) { - Scene->SpotLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); - } - - // Load Attached Scripts - if (SceneDataNode[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - Scene->SpotLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - } - } + ERS_STRUCT_SpotLight Light; + ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); + ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); + ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); + ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); + ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); + ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); + ERS_FUNCTION_GetFloat (Item, "CutOff", Light.CutOff ); + ERS_FUNCTION_GetFloat (Item, "RollOff", Light.Rolloff ); + ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); + ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Scene->SpotLights.push_back(std::make_shared(Light)); } else if (AssetType == std::string("SceneCamera")) { - // Setup Model Pointer In Scene To Work On - Scene->SceneCameras.push_back(std::make_shared()); - int SceneCameraIndex = Scene->SceneCameras.size() - 1; - - Scene->SceneCameras[SceneCameraIndex]->UserDefinedName_ = AssetName; - Scene->SceneCameras[SceneCameraIndex]->Pos_ = glm::vec3( - SceneDataNode[i]["PosX"].as(), - SceneDataNode[i]["PosY"].as(), - SceneDataNode[i]["PosZ"].as() - ); - Scene->SceneCameras[SceneCameraIndex]->Rot_ = glm::vec3( - SceneDataNode[i]["RotX"].as(), - SceneDataNode[i]["RotY"].as(), - SceneDataNode[i]["RotZ"].as() - ); - - Scene->SceneCameras[SceneCameraIndex]->NearClip_ = SceneDataNode[i]["NearClip"].as(); - Scene->SceneCameras[SceneCameraIndex]->FarClip_ = SceneDataNode[i]["FarClip"].as(); - Scene->SceneCameras[SceneCameraIndex]->FOV_ = SceneDataNode[i]["FOV"].as(); - Scene->SceneCameras[SceneCameraIndex]->EnforceAspectRatio_ = SceneDataNode[i]["EnforceAspectRatio"].as(); - Scene->SceneCameras[SceneCameraIndex]->AspectRatio_ = SceneDataNode[i]["AspectRatio"].as(); - Scene->SceneCameras[SceneCameraIndex]->StreamingPriority_ = SceneDataNode[i]["StreamingPriority"].as(); - - - // Load Attached Scripts - if (SceneDataNode[i]["AttachedScripts"]) { - YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - Scene->SceneCameras[SceneCameraIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - } - } + ERS_STRUCT_SceneCamera Camera; + ERS_FUNCTION_GetString (Item, "AssetName", Camera.UserDefinedName_ ); + ERS_FUNCTION_GetVec3 (Item, "Pos", Camera.Pos_ ); + ERS_FUNCTION_GetVec3 (Item, "Rot", Camera.Rot_ ); + ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Camera.AttachedScriptIndexes_ ); + Scene->SceneCameras.push_back(std::make_shared(Camera)); } else { SystemUtils->Logger_->Log(std::string("Unsupported/Unknown Asset Type: ") + AssetType, 9); @@ -285,6 +110,4 @@ bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E Scene->IsSceneLoaded = true; return true; -} - - +} \ No newline at end of file From 83ff0df759219bcb4f4944e1e3b179db99fd1e51 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 00:12:35 +0000 Subject: [PATCH 094/125] Update Scene Loader --- .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp index 9af9d3bc83..df56bf0e0a 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp @@ -15,7 +15,7 @@ bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable) { - SystemUtils->Logger_->Log(std::string("Processing Scene '") + Scene->SceneName + "' With Decoder Version 1", 3, LogEnable); + SystemUtils->Logger_->Log(std::string("Processing Scene '") + Scene->SceneName + "' With Decoder Version 2", 3, LogEnable); // Grab Metadata std::vector SceneItems; From ac58fababef0aea74a9e7e47c8c1b9f34ace1a7c Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 00:15:02 +0000 Subject: [PATCH 095/125] Update Scene Loader --- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp index df56bf0e0a..6b64b5960d 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp @@ -98,6 +98,12 @@ bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E ERS_FUNCTION_GetVec3 (Item, "Pos", Camera.Pos_ ); ERS_FUNCTION_GetVec3 (Item, "Rot", Camera.Rot_ ); ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Camera.AttachedScriptIndexes_ ); + ERS_FUNCTION_GetFloat (Item, "NearClip", Camera.NearClip_ ); + ERS_FUNCTION_GetFloat (Item, "FarClip", Camera.FarClip_ ); + ERS_FUNCTION_GetFloat (Item, "FOV", Camera.FOV_ ); + ERS_FUNCTION_GetBool (Item, "EnforceAspectRatio", Camera.EnforceAspectRatio_ ); + ERS_FUNCTION_GetFloat (Item, "AspectRatio", Camera.AspectRatio_ ); + ERS_FUNCTION_GetInt (Item, "StreamingPriority", Camera.StreamingPriority_ ); Scene->SceneCameras.push_back(std::make_shared(Camera)); } else { From 421767a49ebd9005d173f635f3ab306d49476782 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 00:15:13 +0000 Subject: [PATCH 096/125] Update Scene Loader --- .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp index 6b64b5960d..2209fc21f1 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp @@ -97,13 +97,13 @@ bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E ERS_FUNCTION_GetString (Item, "AssetName", Camera.UserDefinedName_ ); ERS_FUNCTION_GetVec3 (Item, "Pos", Camera.Pos_ ); ERS_FUNCTION_GetVec3 (Item, "Rot", Camera.Rot_ ); - ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Camera.AttachedScriptIndexes_ ); ERS_FUNCTION_GetFloat (Item, "NearClip", Camera.NearClip_ ); ERS_FUNCTION_GetFloat (Item, "FarClip", Camera.FarClip_ ); ERS_FUNCTION_GetFloat (Item, "FOV", Camera.FOV_ ); ERS_FUNCTION_GetBool (Item, "EnforceAspectRatio", Camera.EnforceAspectRatio_ ); ERS_FUNCTION_GetFloat (Item, "AspectRatio", Camera.AspectRatio_ ); ERS_FUNCTION_GetInt (Item, "StreamingPriority", Camera.StreamingPriority_ ); + ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Camera.AttachedScriptIndexes_ ); Scene->SceneCameras.push_back(std::make_shared(Camera)); } else { From c1e6df99a4a8b7072360ff3e70e82a7f28a3222a Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 00:16:58 +0000 Subject: [PATCH 097/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV3.cpp | 269 ------------------ 1 file changed, 269 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp index 32a433b1bb..a70f460879 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp @@ -8,275 +8,6 @@ bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable) { - // // Grab Metadata - // Scene->SceneFormatVersion = SceneData["SceneFormatVersion"].as(); - // Scene->SceneName = SceneData["SceneName"].as(); - - // if (SceneData["ActiveCameraIndex"]) { - // Scene->ActiveSceneCameraIndex = SceneData["ActiveCameraIndex"].as(); - // } - - // // Log Scene Processing - // SystemUtils->Logger_->Log(std::string("Processing Scene: ") + std::string(Scene->SceneName), 3, LogEnable); - - // // Create List Of Scene Items - // std::vector SceneItems; - // YAML::Node SceneDataNode = SceneData["SceneData"]; - // for (YAML::const_iterator it=SceneDataNode.begin(); it!=SceneDataNode.end(); ++it) { - // SceneItems.push_back(it->second); - // } - - - // // Iterate Through Vector To Add Each Asset To Loading Queue Of Requested Type - // for (long i = 0; (long)i < (long)SceneDataNode.size(); i++) { - - // // Get Asset Information - // std::string AssetName = SceneDataNode[i]["AssetName"].as(); - // std::string AssetType = SceneDataNode[i]["AssetType"].as(); - - // // If type Is Model - // if (AssetType == std::string("Model")) { - - // long AssetID = SceneDataNode[i]["AssetID"].as(); - - // // Get Asset LocRotScale - // float PosX = SceneDataNode[i]["AssetPositionX"].as(); - // float PosY = SceneDataNode[i]["AssetPositionY"].as(); - // float PosZ = SceneDataNode[i]["AssetPositionZ"].as(); - - // float RotX = SceneDataNode[i]["AssetRotationX"].as(); - // float RotY = SceneDataNode[i]["AssetRotationY"].as(); - // float RotZ = SceneDataNode[i]["AssetRotationZ"].as(); - - // float ScaleX = SceneDataNode[i]["AssetScaleX"].as(); - // float ScaleY = SceneDataNode[i]["AssetScaleY"].as(); - // float ScaleZ = SceneDataNode[i]["AssetScaleZ"].as(); - - // //Load Model - // Scene->Models.push_back(std::make_shared()); - // int CurrentSize = Scene->Models.size(); - // ModelLoader->AddModelToLoadingQueue(AssetID, Scene->Models[CurrentSize-1]); - - // // Add Instance To Models Vector - // Scene->Models[CurrentSize-1]->IsTemplateModel = false; - // Scene->Models[CurrentSize-1]->SetLocRotScale(glm::vec3(PosX, PosY, PosZ), glm::vec3(RotX, RotY, RotZ), glm::vec3(ScaleX, ScaleY, ScaleZ)); - // Scene->Models[CurrentSize-1]->ApplyTransformations(); - // Scene->Models[CurrentSize-1]->AssetID = AssetID; - // Scene->Models[CurrentSize-1]->Name = AssetName; - - - // // Load Attached Scripts - // if (SceneDataNode[i]["AttachedScripts"]) { - // YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - // for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - // Scene->Models[CurrentSize-1]->AttachedScriptIndexes_.push_back(it->second.as()); - // } - // } - - - // // Load Shadow Configuration - // if (SceneDataNode[i]["CastDynamicShadows"]) { - // Scene->Models[CurrentSize-1]->CastDynamicShadows_ = SceneDataNode[i]["CastDynamicShadows"].as(); - // } - - // if (SceneDataNode[i]["CastStaticShadows"]) { - // Scene->Models[CurrentSize-1]->CastStaticShadows_ = SceneDataNode[i]["CastStaticShadows"].as(); - // } - - // if (SceneDataNode[i]["ReceiveShadows"]) { - // Scene->Models[CurrentSize-1]->ReceiveShadows_ = SceneDataNode[i]["ReceiveShadows"].as(); - // } - - // if (SceneDataNode[i]["ShaderOverrideIndex"]) { - // Scene->Models[CurrentSize-1]->ShaderOverrideIndex_ = SceneDataNode[i]["ShaderOverrideIndex"].as(); - // } - - - // } else if (AssetType == std::string("DirectionalLight")) { - - // // Setup Model Pointer In Scene To Work On - // Scene->DirectionalLights.push_back(std::make_shared()); - // int LightIndex = Scene->DirectionalLights.size() - 1; - - // Scene->DirectionalLights[LightIndex]->UserDefinedName = AssetName; - - // if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { - // Scene->DirectionalLights[LightIndex]->Color = glm::vec3( - // SceneDataNode[i]["ColorRed"].as(), - // SceneDataNode[i]["ColorGreen"].as(), - // SceneDataNode[i]["ColorBlue"].as() - // ); - // } - - // if (SceneDataNode[i]["Intensity"]) { - // Scene->DirectionalLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); - // } - - // if (SceneDataNode[i]["MaxDistance"]) { - // Scene->DirectionalLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); - // } - - // Scene->DirectionalLights[LightIndex]->Pos = glm::vec3( - // SceneDataNode[i]["PosX"].as(), - // SceneDataNode[i]["PosY"].as(), - // SceneDataNode[i]["PosZ"].as() - // ); - // Scene->DirectionalLights[LightIndex]->Rot = glm::vec3( - // SceneDataNode[i]["RotX"].as(), - // SceneDataNode[i]["RotY"].as(), - // SceneDataNode[i]["RotZ"].as() - // ); - - - // if (SceneDataNode[i]["CastShadows"]) { - // Scene->DirectionalLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); - // } - - // // Load Attached Scripts - // if (SceneDataNode[i]["AttachedScripts"]) { - // YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - // for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - // Scene->DirectionalLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - // } - // } - - // } else if (AssetType == std::string("PointLight")) { - - // // Setup Model Pointer In Scene To Work On - // Scene->PointLights.push_back(std::make_shared()); - // int LightIndex = Scene->PointLights.size() - 1; - - // Scene->PointLights[LightIndex]->UserDefinedName = AssetName; - // if (SceneDataNode[i]["Intensity"]) { - // Scene->PointLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); - // } - // if (SceneDataNode[i]["MaxDistance"]) { - // Scene->PointLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); - // } - - - // if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { - // Scene->PointLights[LightIndex]->Color = glm::vec3( - // SceneDataNode[i]["ColorRed"].as(), - // SceneDataNode[i]["ColorGreen"].as(), - // SceneDataNode[i]["ColorBlue"].as() - // ); - // } - - // Scene->PointLights[LightIndex]->Pos = glm::vec3( - // SceneDataNode[i]["PosX"].as(), - // SceneDataNode[i]["PosY"].as(), - // SceneDataNode[i]["PosZ"].as() - // ); - - // if (SceneDataNode[i]["CastShadows"]) { - // Scene->PointLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); - // } - - // // Load Attached Scripts - // if (SceneDataNode[i]["AttachedScripts"]) { - // YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - // for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - // Scene->PointLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - // } - // } - - // } else if (AssetType == std::string("SpotLight")) { - - // // Setup Model Pointer In Scene To Work On - // Scene->SpotLights.push_back(std::make_shared()); - // int LightIndex = Scene->SpotLights.size() - 1; - - // Scene->SpotLights[LightIndex]->UserDefinedName = AssetName; - - // if (SceneDataNode[i]["Intensity"]) { - // Scene->SpotLights[LightIndex]->Intensity = SceneDataNode[i]["Intensity"].as(); - // } - // if (SceneDataNode[i]["MaxDistance"]) { - // Scene->SpotLights[LightIndex]->MaxDistance = SceneDataNode[i]["MaxDistance"].as(); - // } - // Scene->SpotLights[LightIndex]->CutOff = SceneDataNode[i]["CutOff"].as(); - - // if (SceneDataNode[i]["RollOff"]) { - // Scene->SpotLights[LightIndex]->Rolloff = SceneDataNode[i]["RollOff"].as(); - // } - // if (SceneDataNode[i]["ColorRed"] && SceneDataNode[i]["ColorGreen"] && SceneDataNode[i]["ColorBlue"]) { - // Scene->SpotLights[LightIndex]->Color = glm::vec3( - // SceneDataNode[i]["ColorRed"].as(), - // SceneDataNode[i]["ColorGreen"].as(), - // SceneDataNode[i]["ColorBlue"].as() - // ); - // } - - - // Scene->SpotLights[LightIndex]->Pos = glm::vec3( - // SceneDataNode[i]["PosX"].as(), - // SceneDataNode[i]["PosY"].as(), - // SceneDataNode[i]["PosZ"].as() - // ); - // Scene->SpotLights[LightIndex]->Rot = glm::vec3( - // SceneDataNode[i]["RotX"].as(), - // SceneDataNode[i]["RotY"].as(), - // SceneDataNode[i]["RotZ"].as() - // ); - - - // if (SceneDataNode[i]["CastShadows"]) { - // Scene->SpotLights[LightIndex]->CastsShadows_ = SceneDataNode[i]["CastShadows"].as(); - // } - - // // Load Attached Scripts - // if (SceneDataNode[i]["AttachedScripts"]) { - // YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - // for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - // Scene->SpotLights[LightIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - // } - // } - - // } else if (AssetType == std::string("SceneCamera")) { - - // // Setup Model Pointer In Scene To Work On - // Scene->SceneCameras.push_back(std::make_shared()); - // int SceneCameraIndex = Scene->SceneCameras.size() - 1; - - // Scene->SceneCameras[SceneCameraIndex]->UserDefinedName_ = AssetName; - // Scene->SceneCameras[SceneCameraIndex]->Pos_ = glm::vec3( - // SceneDataNode[i]["PosX"].as(), - // SceneDataNode[i]["PosY"].as(), - // SceneDataNode[i]["PosZ"].as() - // ); - // Scene->SceneCameras[SceneCameraIndex]->Rot_ = glm::vec3( - // SceneDataNode[i]["RotX"].as(), - // SceneDataNode[i]["RotY"].as(), - // SceneDataNode[i]["RotZ"].as() - // ); - - // Scene->SceneCameras[SceneCameraIndex]->NearClip_ = SceneDataNode[i]["NearClip"].as(); - // Scene->SceneCameras[SceneCameraIndex]->FarClip_ = SceneDataNode[i]["FarClip"].as(); - // Scene->SceneCameras[SceneCameraIndex]->FOV_ = SceneDataNode[i]["FOV"].as(); - // Scene->SceneCameras[SceneCameraIndex]->EnforceAspectRatio_ = SceneDataNode[i]["EnforceAspectRatio"].as(); - // Scene->SceneCameras[SceneCameraIndex]->AspectRatio_ = SceneDataNode[i]["AspectRatio"].as(); - // Scene->SceneCameras[SceneCameraIndex]->StreamingPriority_ = SceneDataNode[i]["StreamingPriority"].as(); - - - // // Load Attached Scripts - // if (SceneDataNode[i]["AttachedScripts"]) { - // YAML::Node Scripts = SceneDataNode[i]["AttachedScripts"]; - // for (YAML::const_iterator it=Scripts.begin(); it!=Scripts.end(); ++it) { - // Scene->SceneCameras[SceneCameraIndex]->AttachedScriptIndexes_.push_back(it->second.as()); - // } - // } - - // } else { - // SystemUtils->Logger_->Log(std::string("Unsupported/Unknown Asset Type: ") + AssetType, 9); - // } - - // } - - // // Indicate Scene Is Loaded - // Scene->IsSceneLoaded = true; - // return true; - } From d035dd6a4d5a1d4b7cd03c9955a980f98fb8f80c Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 00:17:20 +0000 Subject: [PATCH 098/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV3.cpp | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp index a70f460879..4f2525e897 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp @@ -7,7 +7,106 @@ bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable) { + SystemUtils->Logger_->Log(std::string("Processing Scene '") + Scene->SceneName + "' With Decoder Version 3", 3, LogEnable); + // Grab Metadata + std::vector SceneItems; + ERS_FUNCTION_GetLong (SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); + ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName ); + ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex ); + ERS_FUNCTION_GetNodeVector (SceneData, "SceneData", SceneItems ); + + // Iterate Through Vector To Add Each Asset To Loading Queue Of Requested Type + for (long i = 0; (long)i < (long)SceneItems.size(); i++) { + + // Get Asset Information + YAML::Node Item = SceneItems[i]; + std::string AssetName, AssetType; + ERS_FUNCTION_GetString(Item, "AssetName", AssetName); + ERS_FUNCTION_GetString(Item, "AssetType", AssetType); + + + if (AssetType == "Model") { + + ERS_STRUCT_Model Model; + ERS_FUNCTION_GetLong (Item, "AssetID", Model.AssetID ); + ERS_FUNCTION_GetVec3 (Item, "AssetPosition", Model.ModelPosition ); + ERS_FUNCTION_GetVec3 (Item, "AssetRotation", Model.ModelRotation ); + ERS_FUNCTION_GetVec3 (Item, "AssetScale", Model.ModelScale ); + ERS_FUNCTION_GetBool (Item, "CastDynamicShadows", Model.CastDynamicShadows_ ); + ERS_FUNCTION_GetBool (Item, "CastStaticShadows", Model.CastStaticShadows_ ); + ERS_FUNCTION_GetBool (Item, "ReceiveShadows", Model.ReceiveShadows_ ); + ERS_FUNCTION_GetLong (Item, "ShaderOverrideIndex", Model.ShaderOverrideIndex_ ); + ERS_FUNCTION_GetString (Item, "AssetName", Model.Name ); + ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Model.AttachedScriptIndexes_ ); + + Scene->Models.push_back(std::make_shared(Model)); + ModelLoader->AddModelToLoadingQueue(Scene->Models[Scene->Models.size()-1]); + + } else if (AssetType == std::string("DirectionalLight")) { + + ERS_STRUCT_DirectionalLight Light; + ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); + ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); + ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); + ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); + ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); + ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); + ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); + ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Scene->DirectionalLights.push_back(std::make_shared(Light)); + + } else if (AssetType == std::string("PointLight")) { + + ERS_STRUCT_PointLight Light; + ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); + ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); + ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); + ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); + ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); + ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); + ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Scene->PointLights.push_back(std::make_shared(Light)); + + } else if (AssetType == std::string("SpotLight")) { + + ERS_STRUCT_SpotLight Light; + ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); + ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); + ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); + ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); + ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); + ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); + ERS_FUNCTION_GetFloat (Item, "CutOff", Light.CutOff ); + ERS_FUNCTION_GetFloat (Item, "RollOff", Light.Rolloff ); + ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); + ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Scene->SpotLights.push_back(std::make_shared(Light)); + + } else if (AssetType == std::string("SceneCamera")) { + + ERS_STRUCT_SceneCamera Camera; + ERS_FUNCTION_GetString (Item, "AssetName", Camera.UserDefinedName_ ); + ERS_FUNCTION_GetVec3 (Item, "Pos", Camera.Pos_ ); + ERS_FUNCTION_GetVec3 (Item, "Rot", Camera.Rot_ ); + ERS_FUNCTION_GetFloat (Item, "NearClip", Camera.NearClip_ ); + ERS_FUNCTION_GetFloat (Item, "FarClip", Camera.FarClip_ ); + ERS_FUNCTION_GetFloat (Item, "FOV", Camera.FOV_ ); + ERS_FUNCTION_GetBool (Item, "EnforceAspectRatio", Camera.EnforceAspectRatio_ ); + ERS_FUNCTION_GetFloat (Item, "AspectRatio", Camera.AspectRatio_ ); + ERS_FUNCTION_GetInt (Item, "StreamingPriority", Camera.StreamingPriority_ ); + ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Camera.AttachedScriptIndexes_ ); + Scene->SceneCameras.push_back(std::make_shared(Camera)); + + } else { + SystemUtils->Logger_->Log(std::string("Unsupported/Unknown Asset Type: ") + AssetType, 9); + } + + } + + // Indicate Scene Is Loaded + Scene->IsSceneLoaded = true; + return true; } From 7b24e1d01d526fdc46d16fedec93a9f3c65ef8b1 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 00:22:31 +0000 Subject: [PATCH 099/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV3.cpp | 93 ++++++++++--------- 1 file changed, 47 insertions(+), 46 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp index 4f2525e897..2f8d11fde0 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp @@ -10,82 +10,85 @@ bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E SystemUtils->Logger_->Log(std::string("Processing Scene '") + Scene->SceneName + "' With Decoder Version 3", 3, LogEnable); // Grab Metadata - std::vector SceneItems; + std::vector Models, PointLights, SpotLights, DirectionalLights, SceneCameras; ERS_FUNCTION_GetLong (SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName ); ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex ); - ERS_FUNCTION_GetNodeVector (SceneData, "SceneData", SceneItems ); + ERS_FUNCTION_GetNodeVector (SceneData, "Models", Models ); + ERS_FUNCTION_GetNodeVector (SceneData, "PointLights", PointLights ); + ERS_FUNCTION_GetNodeVector (SceneData, "SpotLights", SpotLights ); + ERS_FUNCTION_GetNodeVector (SceneData, "DirectionalLights", DirectionalLights ); + ERS_FUNCTION_GetNodeVector (SceneData, "SceneCameras", SceneCameras ); - // Iterate Through Vector To Add Each Asset To Loading Queue Of Requested Type - for (long i = 0; (long)i < (long)SceneItems.size(); i++) { - // Get Asset Information - YAML::Node Item = SceneItems[i]; - std::string AssetName, AssetType; - ERS_FUNCTION_GetString(Item, "AssetName", AssetName); - ERS_FUNCTION_GetString(Item, "AssetType", AssetType); - - - if (AssetType == "Model") { - - ERS_STRUCT_Model Model; - ERS_FUNCTION_GetLong (Item, "AssetID", Model.AssetID ); - ERS_FUNCTION_GetVec3 (Item, "AssetPosition", Model.ModelPosition ); - ERS_FUNCTION_GetVec3 (Item, "AssetRotation", Model.ModelRotation ); - ERS_FUNCTION_GetVec3 (Item, "AssetScale", Model.ModelScale ); - ERS_FUNCTION_GetBool (Item, "CastDynamicShadows", Model.CastDynamicShadows_ ); - ERS_FUNCTION_GetBool (Item, "CastStaticShadows", Model.CastStaticShadows_ ); - ERS_FUNCTION_GetBool (Item, "ReceiveShadows", Model.ReceiveShadows_ ); - ERS_FUNCTION_GetLong (Item, "ShaderOverrideIndex", Model.ShaderOverrideIndex_ ); - ERS_FUNCTION_GetString (Item, "AssetName", Model.Name ); - ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Model.AttachedScriptIndexes_ ); + for (unsigned int i = 0; i < Models.size(); i++) { - Scene->Models.push_back(std::make_shared(Model)); - ModelLoader->AddModelToLoadingQueue(Scene->Models[Scene->Models.size()-1]); + // Get Asset Information + YAML::Node Item = Models[i]; + ERS_STRUCT_Model Model; + + // Decode + ERS_FUNCTION_GetLong (Item, "AssetID", Model.AssetID ); + ERS_FUNCTION_GetVec3 (Item, "AssetPosition", Model.ModelPosition ); + ERS_FUNCTION_GetVec3 (Item, "AssetRotation", Model.ModelRotation ); + ERS_FUNCTION_GetVec3 (Item, "AssetScale", Model.ModelScale ); + ERS_FUNCTION_GetBool (Item, "CastDynamicShadows", Model.CastDynamicShadows_ ); + ERS_FUNCTION_GetBool (Item, "CastStaticShadows", Model.CastStaticShadows_ ); + ERS_FUNCTION_GetBool (Item, "ReceiveShadows", Model.ReceiveShadows_ ); + ERS_FUNCTION_GetLong (Item, "ShaderOverrideIndex", Model.ShaderOverrideIndex_ ); + ERS_FUNCTION_GetString (Item, "AssetName", Model.Name ); + ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Model.AttachedScriptIndexes_ ); + + Scene->Models.push_back(std::make_shared(Model)); + ModelLoader->AddModelToLoadingQueue(Scene->Models[Scene->Models.size()-1]); - } else if (AssetType == std::string("DirectionalLight")) { + } - ERS_STRUCT_DirectionalLight Light; + for (unsigned int i = 0; i < PointLights.size(); i++) { + ERS_STRUCT_PointLight Light; ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); - ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); - Scene->DirectionalLights.push_back(std::make_shared(Light)); - - } else if (AssetType == std::string("PointLight")) { - - ERS_STRUCT_PointLight Light; + Scene->PointLights.push_back(std::make_shared(Light)); + } + + for (unsigned int i = 0; i < SpotLights.size(); i++) { + ERS_STRUCT_SpotLight Light; ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); + ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); + ERS_FUNCTION_GetFloat (Item, "CutOff", Light.CutOff ); + ERS_FUNCTION_GetFloat (Item, "RollOff", Light.Rolloff ); ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); - Scene->PointLights.push_back(std::make_shared(Light)); + Scene->SpotLights.push_back(std::make_shared(Light)); - } else if (AssetType == std::string("SpotLight")) { + } + + for (unsigned int i = 0; i < DirectionalLights.size(); i++) { - ERS_STRUCT_SpotLight Light; + ERS_STRUCT_DirectionalLight Light; ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); - ERS_FUNCTION_GetFloat (Item, "CutOff", Light.CutOff ); - ERS_FUNCTION_GetFloat (Item, "RollOff", Light.Rolloff ); ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); - Scene->SpotLights.push_back(std::make_shared(Light)); + Scene->DirectionalLights.push_back(std::make_shared(Light)); - } else if (AssetType == std::string("SceneCamera")) { + } - ERS_STRUCT_SceneCamera Camera; + for (unsigned int i = 0; i < SceneCameras.size(); i++) { + ERS_STRUCT_SceneCamera Camera; ERS_FUNCTION_GetString (Item, "AssetName", Camera.UserDefinedName_ ); ERS_FUNCTION_GetVec3 (Item, "Pos", Camera.Pos_ ); ERS_FUNCTION_GetVec3 (Item, "Rot", Camera.Rot_ ); @@ -98,12 +101,10 @@ bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Camera.AttachedScriptIndexes_ ); Scene->SceneCameras.push_back(std::make_shared(Camera)); - } else { - SystemUtils->Logger_->Log(std::string("Unsupported/Unknown Asset Type: ") + AssetType, 9); - } - } + + // Indicate Scene Is Loaded Scene->IsSceneLoaded = true; return true; From 665f1cf1acd45e156182b982770a06c113d2aa56 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 00:23:35 +0000 Subject: [PATCH 100/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV3.cpp | 100 +++++++++--------- 1 file changed, 52 insertions(+), 48 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp index 2f8d11fde0..5f8ac1b13b 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp @@ -23,11 +23,8 @@ bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E for (unsigned int i = 0; i < Models.size(); i++) { - // Get Asset Information YAML::Node Item = Models[i]; ERS_STRUCT_Model Model; - - // Decode ERS_FUNCTION_GetLong (Item, "AssetID", Model.AssetID ); ERS_FUNCTION_GetVec3 (Item, "AssetPosition", Model.ModelPosition ); ERS_FUNCTION_GetVec3 (Item, "AssetRotation", Model.ModelRotation ); @@ -45,61 +42,68 @@ bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E } for (unsigned int i = 0; i < PointLights.size(); i++) { - ERS_STRUCT_PointLight Light; - ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); - ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); - ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); - ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); - ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); - ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); - ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); - Scene->PointLights.push_back(std::make_shared(Light)); + + YAML::Node Item = Models[i]; + ERS_STRUCT_PointLight Light; + ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); + ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); + ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); + ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); + ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); + ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); + ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Scene->PointLights.push_back(std::make_shared(Light)); } for (unsigned int i = 0; i < SpotLights.size(); i++) { - ERS_STRUCT_SpotLight Light; - ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); - ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); - ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); - ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); - ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); - ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); - ERS_FUNCTION_GetFloat (Item, "CutOff", Light.CutOff ); - ERS_FUNCTION_GetFloat (Item, "RollOff", Light.Rolloff ); - ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); - ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); - Scene->SpotLights.push_back(std::make_shared(Light)); + + YAML::Node Item = Models[i]; + ERS_STRUCT_SpotLight Light; + ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); + ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); + ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); + ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); + ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); + ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); + ERS_FUNCTION_GetFloat (Item, "CutOff", Light.CutOff ); + ERS_FUNCTION_GetFloat (Item, "RollOff", Light.Rolloff ); + ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); + ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Scene->SpotLights.push_back(std::make_shared(Light)); } - for (unsigned int i = 0; i < DirectionalLights.size(); i++) { + for (unsigned int i = 0; i < DirectionalLights.size(); i++) { - ERS_STRUCT_DirectionalLight Light; - ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); - ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); - ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); - ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); - ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); - ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); - ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); - ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); - Scene->DirectionalLights.push_back(std::make_shared(Light)); + YAML::Node Item = Models[i]; + ERS_STRUCT_DirectionalLight Light; + ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); + ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); + ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); + ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); + ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); + ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); + ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); + ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Scene->DirectionalLights.push_back(std::make_shared(Light)); } - for (unsigned int i = 0; i < SceneCameras.size(); i++) { - ERS_STRUCT_SceneCamera Camera; - ERS_FUNCTION_GetString (Item, "AssetName", Camera.UserDefinedName_ ); - ERS_FUNCTION_GetVec3 (Item, "Pos", Camera.Pos_ ); - ERS_FUNCTION_GetVec3 (Item, "Rot", Camera.Rot_ ); - ERS_FUNCTION_GetFloat (Item, "NearClip", Camera.NearClip_ ); - ERS_FUNCTION_GetFloat (Item, "FarClip", Camera.FarClip_ ); - ERS_FUNCTION_GetFloat (Item, "FOV", Camera.FOV_ ); - ERS_FUNCTION_GetBool (Item, "EnforceAspectRatio", Camera.EnforceAspectRatio_ ); - ERS_FUNCTION_GetFloat (Item, "AspectRatio", Camera.AspectRatio_ ); - ERS_FUNCTION_GetInt (Item, "StreamingPriority", Camera.StreamingPriority_ ); - ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Camera.AttachedScriptIndexes_ ); - Scene->SceneCameras.push_back(std::make_shared(Camera)); + for (unsigned int i = 0; i < SceneCameras.size(); i++) { + + YAML::Node Item = Models[i]; + ERS_STRUCT_SceneCamera Camera; + ERS_FUNCTION_GetString (Item, "AssetName", Camera.UserDefinedName_ ); + ERS_FUNCTION_GetVec3 (Item, "Pos", Camera.Pos_ ); + ERS_FUNCTION_GetVec3 (Item, "Rot", Camera.Rot_ ); + ERS_FUNCTION_GetFloat (Item, "NearClip", Camera.NearClip_ ); + ERS_FUNCTION_GetFloat (Item, "FarClip", Camera.FarClip_ ); + ERS_FUNCTION_GetFloat (Item, "FOV", Camera.FOV_ ); + ERS_FUNCTION_GetBool (Item, "EnforceAspectRatio", Camera.EnforceAspectRatio_ ); + ERS_FUNCTION_GetFloat (Item, "AspectRatio", Camera.AspectRatio_ ); + ERS_FUNCTION_GetInt (Item, "StreamingPriority", Camera.StreamingPriority_ ); + ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Camera.AttachedScriptIndexes_ ); + Scene->SceneCameras.push_back(std::make_shared(Camera)); } From df98771a67de94ef4cb800544aa4fecbf35405cc Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 00:27:09 +0000 Subject: [PATCH 101/125] Update Scene Loader --- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp index b593005e2a..78529b2248 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderManager.cpp @@ -10,7 +10,7 @@ bool ERS_FUNCTION_DecodeScene(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable) { SystemUtils->Logger_->Log("Decoding ERS Scene", 5, LogEnable); - + // Extract Current Version int Version = 0; SystemUtils->Logger_->Log("Identifying Scene Format Version", 4, LogEnable); From 8e568eb4ed7973ff45f23e981b58d49e6179548b Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 00:28:51 +0000 Subject: [PATCH 102/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV1.cpp | 96 ++++++++++--------- 1 file changed, 49 insertions(+), 47 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 2e820ba8b4..2565381eca 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -8,14 +8,16 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable) { + // Init + bool Success = true; SystemUtils->Logger_->Log(std::string("Processing Scene '") + Scene->SceneName + "' With Decoder Version 1", 3, LogEnable); // Grab Metadata std::vector SceneItems; - ERS_FUNCTION_GetLong (SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); - ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName ); - ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex ); - ERS_FUNCTION_GetNodeVector (SceneData, "SceneData", SceneItems ); + Success &= ERS_FUNCTION_GetLong (SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); + Success &= ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName ); + Success &= ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex ); + Success &= ERS_FUNCTION_GetNodeVector (SceneData, "SceneData", SceneItems ); // Iterate Through Vector To Add Each Asset To Loading Queue Of Requested Type for (long i = 0; (long)i < (long)SceneItems.size(); i++) { @@ -23,23 +25,23 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E // Get Asset Information YAML::Node Item = SceneItems[i]; std::string AssetName, AssetType; - ERS_FUNCTION_GetString(Item, "AssetName", AssetName); - ERS_FUNCTION_GetString(Item, "AssetType", AssetType); + Success &= ERS_FUNCTION_GetString(Item, "AssetName", AssetName); + Success &= ERS_FUNCTION_GetString(Item, "AssetType", AssetType); if (AssetType == "Model") { ERS_STRUCT_Model Model; - ERS_FUNCTION_GetLong (Item, "AssetID", Model.AssetID ); - ERS_FUNCTION_GetVec3 (Item, "AssetPosition", Model.ModelPosition ); - ERS_FUNCTION_GetVec3 (Item, "AssetRotation", Model.ModelRotation ); - ERS_FUNCTION_GetVec3 (Item, "AssetScale", Model.ModelScale ); - ERS_FUNCTION_GetBool (Item, "CastDynamicShadows", Model.CastDynamicShadows_ ); - ERS_FUNCTION_GetBool (Item, "CastStaticShadows", Model.CastStaticShadows_ ); - ERS_FUNCTION_GetBool (Item, "ReceiveShadows", Model.ReceiveShadows_ ); - ERS_FUNCTION_GetLong (Item, "ShaderOverrideIndex", Model.ShaderOverrideIndex_ ); - ERS_FUNCTION_GetString (Item, "AssetName", Model.Name ); - ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Model.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetLong (Item, "AssetID", Model.AssetID ); + Success &= ERS_FUNCTION_GetVec3 (Item, "AssetPosition", Model.ModelPosition ); + Success &= ERS_FUNCTION_GetVec3 (Item, "AssetRotation", Model.ModelRotation ); + Success &= ERS_FUNCTION_GetVec3 (Item, "AssetScale", Model.ModelScale ); + Success &= ERS_FUNCTION_GetBool (Item, "CastDynamicShadows", Model.CastDynamicShadows_ ); + Success &= ERS_FUNCTION_GetBool (Item, "CastStaticShadows", Model.CastStaticShadows_ ); + Success &= ERS_FUNCTION_GetBool (Item, "ReceiveShadows", Model.ReceiveShadows_ ); + Success &= ERS_FUNCTION_GetLong (Item, "ShaderOverrideIndex", Model.ShaderOverrideIndex_ ); + Success &= ERS_FUNCTION_GetString (Item, "AssetName", Model.Name ); + Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Model.AttachedScriptIndexes_ ); Scene->Models.push_back(std::make_shared(Model)); ModelLoader->AddModelToLoadingQueue(Scene->Models[Scene->Models.size()-1]); @@ -47,50 +49,50 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E } else if (AssetType == std::string("DirectionalLight")) { ERS_STRUCT_DirectionalLight Light; - ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); - ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); - ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); - ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); - ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); - ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); - ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); - ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); + Success &= ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); + Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); + Success &= ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); + Success &= ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); + Success &= ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); + Success &= ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); + Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); Scene->DirectionalLights.push_back(std::make_shared(Light)); } else if (AssetType == std::string("PointLight")) { ERS_STRUCT_PointLight Light; - ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); - ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); - ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); - ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); - ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); - ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); - ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); + Success &= ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); + Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); + Success &= ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); + Success &= ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); + Success &= ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); + Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); Scene->PointLights.push_back(std::make_shared(Light)); } else if (AssetType == std::string("SpotLight")) { ERS_STRUCT_SpotLight Light; - ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); - ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); - ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); - ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); - ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); - ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); - ERS_FUNCTION_GetFloat (Item, "CutOff", Light.CutOff ); - ERS_FUNCTION_GetFloat (Item, "RollOff", Light.Rolloff ); - ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); - ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); + Success &= ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); + Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); + Success &= ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); + Success &= ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); + Success &= ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); + Success &= ERS_FUNCTION_GetFloat (Item, "CutOff", Light.CutOff ); + Success &= ERS_FUNCTION_GetFloat (Item, "RollOff", Light.Rolloff ); + Success &= ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); + Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); Scene->SpotLights.push_back(std::make_shared(Light)); } else if (AssetType == std::string("SceneCamera")) { ERS_STRUCT_SceneCamera Camera; - ERS_FUNCTION_GetString (Item, "AssetName", Camera.UserDefinedName_ ); - ERS_FUNCTION_GetVec3 (Item, "Pos", Camera.Pos_ ); - ERS_FUNCTION_GetVec3 (Item, "Rot", Camera.Rot_ ); - ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Camera.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Item, "AssetName", Camera.UserDefinedName_ ); + Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Camera.Pos_ ); + Success &= ERS_FUNCTION_GetVec3 (Item, "Rot", Camera.Rot_ ); + Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Camera.AttachedScriptIndexes_ ); Scene->SceneCameras.push_back(std::make_shared(Camera)); } else { @@ -100,8 +102,8 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E } // Indicate Scene Is Loaded - Scene->IsSceneLoaded = true; - return true; + Scene->IsSceneLoaded = Success; + return Success; } From 66d459849f0d30def044f956b9d2296a01f0521a Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 00:29:28 +0000 Subject: [PATCH 103/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV2.cpp | 109 +++++++++--------- 1 file changed, 55 insertions(+), 54 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp index 2209fc21f1..6f37be6609 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp @@ -15,14 +15,16 @@ bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable) { + // Init + bool Success = true; SystemUtils->Logger_->Log(std::string("Processing Scene '") + Scene->SceneName + "' With Decoder Version 2", 3, LogEnable); // Grab Metadata std::vector SceneItems; - ERS_FUNCTION_GetLong (SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); - ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName ); - ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex ); - ERS_FUNCTION_GetNodeVector (SceneData, "SceneData", SceneItems ); + Success &= ERS_FUNCTION_GetLong (SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); + Success &= ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName ); + Success &= ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex ); + Success &= ERS_FUNCTION_GetNodeVector (SceneData, "SceneData", SceneItems ); // Iterate Through Vector To Add Each Asset To Loading Queue Of Requested Type for (long i = 0; (long)i < (long)SceneItems.size(); i++) { @@ -30,23 +32,23 @@ bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E // Get Asset Information YAML::Node Item = SceneItems[i]; std::string AssetName, AssetType; - ERS_FUNCTION_GetString(Item, "AssetName", AssetName); - ERS_FUNCTION_GetString(Item, "AssetType", AssetType); + Success &= ERS_FUNCTION_GetString(Item, "AssetName", AssetName); + Success &= ERS_FUNCTION_GetString(Item, "AssetType", AssetType); if (AssetType == "Model") { ERS_STRUCT_Model Model; - ERS_FUNCTION_GetLong (Item, "AssetID", Model.AssetID ); - ERS_FUNCTION_GetVec3 (Item, "AssetPosition", Model.ModelPosition ); - ERS_FUNCTION_GetVec3 (Item, "AssetRotation", Model.ModelRotation ); - ERS_FUNCTION_GetVec3 (Item, "AssetScale", Model.ModelScale ); - ERS_FUNCTION_GetBool (Item, "CastDynamicShadows", Model.CastDynamicShadows_ ); - ERS_FUNCTION_GetBool (Item, "CastStaticShadows", Model.CastStaticShadows_ ); - ERS_FUNCTION_GetBool (Item, "ReceiveShadows", Model.ReceiveShadows_ ); - ERS_FUNCTION_GetLong (Item, "ShaderOverrideIndex", Model.ShaderOverrideIndex_ ); - ERS_FUNCTION_GetString (Item, "AssetName", Model.Name ); - ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Model.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetLong (Item, "AssetID", Model.AssetID ); + Success &= ERS_FUNCTION_GetVec3 (Item, "AssetPosition", Model.ModelPosition ); + Success &= ERS_FUNCTION_GetVec3 (Item, "AssetRotation", Model.ModelRotation ); + Success &= ERS_FUNCTION_GetVec3 (Item, "AssetScale", Model.ModelScale ); + Success &= ERS_FUNCTION_GetBool (Item, "CastDynamicShadows", Model.CastDynamicShadows_ ); + Success &= ERS_FUNCTION_GetBool (Item, "CastStaticShadows", Model.CastStaticShadows_ ); + Success &= ERS_FUNCTION_GetBool (Item, "ReceiveShadows", Model.ReceiveShadows_ ); + Success &= ERS_FUNCTION_GetLong (Item, "ShaderOverrideIndex", Model.ShaderOverrideIndex_ ); + Success &= ERS_FUNCTION_GetString (Item, "AssetName", Model.Name ); + Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Model.AttachedScriptIndexes_ ); Scene->Models.push_back(std::make_shared(Model)); ModelLoader->AddModelToLoadingQueue(Scene->Models[Scene->Models.size()-1]); @@ -54,56 +56,56 @@ bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E } else if (AssetType == std::string("DirectionalLight")) { ERS_STRUCT_DirectionalLight Light; - ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); - ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); - ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); - ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); - ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); - ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); - ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); - ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); + Success &= ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); + Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); + Success &= ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); + Success &= ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); + Success &= ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); + Success &= ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); + Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); Scene->DirectionalLights.push_back(std::make_shared(Light)); } else if (AssetType == std::string("PointLight")) { ERS_STRUCT_PointLight Light; - ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); - ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); - ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); - ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); - ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); - ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); - ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); + Success &= ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); + Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); + Success &= ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); + Success &= ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); + Success &= ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); + Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); Scene->PointLights.push_back(std::make_shared(Light)); } else if (AssetType == std::string("SpotLight")) { ERS_STRUCT_SpotLight Light; - ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); - ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); - ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); - ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); - ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); - ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); - ERS_FUNCTION_GetFloat (Item, "CutOff", Light.CutOff ); - ERS_FUNCTION_GetFloat (Item, "RollOff", Light.Rolloff ); - ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); - ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); + Success &= ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); + Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); + Success &= ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); + Success &= ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); + Success &= ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); + Success &= ERS_FUNCTION_GetFloat (Item, "CutOff", Light.CutOff ); + Success &= ERS_FUNCTION_GetFloat (Item, "RollOff", Light.Rolloff ); + Success &= ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); + Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); Scene->SpotLights.push_back(std::make_shared(Light)); } else if (AssetType == std::string("SceneCamera")) { ERS_STRUCT_SceneCamera Camera; - ERS_FUNCTION_GetString (Item, "AssetName", Camera.UserDefinedName_ ); - ERS_FUNCTION_GetVec3 (Item, "Pos", Camera.Pos_ ); - ERS_FUNCTION_GetVec3 (Item, "Rot", Camera.Rot_ ); - ERS_FUNCTION_GetFloat (Item, "NearClip", Camera.NearClip_ ); - ERS_FUNCTION_GetFloat (Item, "FarClip", Camera.FarClip_ ); - ERS_FUNCTION_GetFloat (Item, "FOV", Camera.FOV_ ); - ERS_FUNCTION_GetBool (Item, "EnforceAspectRatio", Camera.EnforceAspectRatio_ ); - ERS_FUNCTION_GetFloat (Item, "AspectRatio", Camera.AspectRatio_ ); - ERS_FUNCTION_GetInt (Item, "StreamingPriority", Camera.StreamingPriority_ ); - ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Camera.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Item, "AssetName", Camera.UserDefinedName_ ); + Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Camera.Pos_ ); + Success &= ERS_FUNCTION_GetVec3 (Item, "Rot", Camera.Rot_ ); + Success &= ERS_FUNCTION_GetFloat (Item, "NearClip", Camera.NearClip_ ); + Success &= ERS_FUNCTION_GetFloat (Item, "FarClip", Camera.FarClip_ ); + Success &= ERS_FUNCTION_GetFloat (Item, "FOV", Camera.FOV_ ); + Success &= ERS_FUNCTION_GetBool (Item, "EnforceAspectRatio", Camera.EnforceAspectRatio_ ); + Success &= ERS_FUNCTION_GetFloat (Item, "AspectRatio", Camera.AspectRatio_ ); + Success &= ERS_FUNCTION_GetInt (Item, "StreamingPriority", Camera.StreamingPriority_ ); + Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Camera.AttachedScriptIndexes_ ); Scene->SceneCameras.push_back(std::make_shared(Camera)); } else { @@ -113,7 +115,6 @@ bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E } // Indicate Scene Is Loaded - Scene->IsSceneLoaded = true; - return true; - + Scene->IsSceneLoaded = Success; + return Success; } \ No newline at end of file From 02f39c71ca5b73866c3381238c32d1ffcd054cd5 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 00:30:05 +0000 Subject: [PATCH 104/125] Update Scene Loader --- .../ERS_FUNCTION_SceneDecoderV3.cpp | 112 +++++++++--------- 1 file changed, 57 insertions(+), 55 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp index 5f8ac1b13b..ab5f45dc81 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp @@ -7,34 +7,36 @@ bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, ERS_STRUCT_SystemUtils *SystemUtils, ERS_CLASS_ModelLoader* ModelLoader, bool LogEnable) { + // Init + bool Success = true; SystemUtils->Logger_->Log(std::string("Processing Scene '") + Scene->SceneName + "' With Decoder Version 3", 3, LogEnable); // Grab Metadata std::vector Models, PointLights, SpotLights, DirectionalLights, SceneCameras; - ERS_FUNCTION_GetLong (SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); - ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName ); - ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex ); - ERS_FUNCTION_GetNodeVector (SceneData, "Models", Models ); - ERS_FUNCTION_GetNodeVector (SceneData, "PointLights", PointLights ); - ERS_FUNCTION_GetNodeVector (SceneData, "SpotLights", SpotLights ); - ERS_FUNCTION_GetNodeVector (SceneData, "DirectionalLights", DirectionalLights ); - ERS_FUNCTION_GetNodeVector (SceneData, "SceneCameras", SceneCameras ); + Success &= ERS_FUNCTION_GetLong (SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); + Success &= ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName ); + Success &= ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex ); + Success &= ERS_FUNCTION_GetNodeVector (SceneData, "Models", Models ); + Success &= ERS_FUNCTION_GetNodeVector (SceneData, "PointLights", PointLights ); + Success &= ERS_FUNCTION_GetNodeVector (SceneData, "SpotLights", SpotLights ); + Success &= ERS_FUNCTION_GetNodeVector (SceneData, "DirectionalLights", DirectionalLights ); + Success &= ERS_FUNCTION_GetNodeVector (SceneData, "SceneCameras", SceneCameras ); for (unsigned int i = 0; i < Models.size(); i++) { YAML::Node Item = Models[i]; ERS_STRUCT_Model Model; - ERS_FUNCTION_GetLong (Item, "AssetID", Model.AssetID ); - ERS_FUNCTION_GetVec3 (Item, "AssetPosition", Model.ModelPosition ); - ERS_FUNCTION_GetVec3 (Item, "AssetRotation", Model.ModelRotation ); - ERS_FUNCTION_GetVec3 (Item, "AssetScale", Model.ModelScale ); - ERS_FUNCTION_GetBool (Item, "CastDynamicShadows", Model.CastDynamicShadows_ ); - ERS_FUNCTION_GetBool (Item, "CastStaticShadows", Model.CastStaticShadows_ ); - ERS_FUNCTION_GetBool (Item, "ReceiveShadows", Model.ReceiveShadows_ ); - ERS_FUNCTION_GetLong (Item, "ShaderOverrideIndex", Model.ShaderOverrideIndex_ ); - ERS_FUNCTION_GetString (Item, "AssetName", Model.Name ); - ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Model.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetLong (Item, "AssetID", Model.AssetID ); + Success &= ERS_FUNCTION_GetVec3 (Item, "AssetPosition", Model.ModelPosition ); + Success &= ERS_FUNCTION_GetVec3 (Item, "AssetRotation", Model.ModelRotation ); + Success &= ERS_FUNCTION_GetVec3 (Item, "AssetScale", Model.ModelScale ); + Success &= ERS_FUNCTION_GetBool (Item, "CastDynamicShadows", Model.CastDynamicShadows_ ); + Success &= ERS_FUNCTION_GetBool (Item, "CastStaticShadows", Model.CastStaticShadows_ ); + Success &= ERS_FUNCTION_GetBool (Item, "ReceiveShadows", Model.ReceiveShadows_ ); + Success &= ERS_FUNCTION_GetLong (Item, "ShaderOverrideIndex", Model.ShaderOverrideIndex_ ); + Success &= ERS_FUNCTION_GetString (Item, "AssetName", Model.Name ); + Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Model.AttachedScriptIndexes_ ); Scene->Models.push_back(std::make_shared(Model)); ModelLoader->AddModelToLoadingQueue(Scene->Models[Scene->Models.size()-1]); @@ -45,13 +47,13 @@ bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E YAML::Node Item = Models[i]; ERS_STRUCT_PointLight Light; - ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); - ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); - ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); - ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); - ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); - ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); - ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); + Success &= ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); + Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); + Success &= ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); + Success &= ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); + Success &= ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); + Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); Scene->PointLights.push_back(std::make_shared(Light)); } @@ -59,16 +61,16 @@ bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E YAML::Node Item = Models[i]; ERS_STRUCT_SpotLight Light; - ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); - ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); - ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); - ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); - ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); - ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); - ERS_FUNCTION_GetFloat (Item, "CutOff", Light.CutOff ); - ERS_FUNCTION_GetFloat (Item, "RollOff", Light.Rolloff ); - ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); - ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); + Success &= ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); + Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); + Success &= ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); + Success &= ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); + Success &= ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); + Success &= ERS_FUNCTION_GetFloat (Item, "CutOff", Light.CutOff ); + Success &= ERS_FUNCTION_GetFloat (Item, "RollOff", Light.Rolloff ); + Success &= ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); + Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); Scene->SpotLights.push_back(std::make_shared(Light)); } @@ -77,14 +79,14 @@ bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E YAML::Node Item = Models[i]; ERS_STRUCT_DirectionalLight Light; - ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); - ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); - ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); - ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); - ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); - ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); - ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); - ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); + Success &= ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); + Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); + Success &= ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); + Success &= ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); + Success &= ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); + Success &= ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); + Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); Scene->DirectionalLights.push_back(std::make_shared(Light)); } @@ -93,16 +95,16 @@ bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E YAML::Node Item = Models[i]; ERS_STRUCT_SceneCamera Camera; - ERS_FUNCTION_GetString (Item, "AssetName", Camera.UserDefinedName_ ); - ERS_FUNCTION_GetVec3 (Item, "Pos", Camera.Pos_ ); - ERS_FUNCTION_GetVec3 (Item, "Rot", Camera.Rot_ ); - ERS_FUNCTION_GetFloat (Item, "NearClip", Camera.NearClip_ ); - ERS_FUNCTION_GetFloat (Item, "FarClip", Camera.FarClip_ ); - ERS_FUNCTION_GetFloat (Item, "FOV", Camera.FOV_ ); - ERS_FUNCTION_GetBool (Item, "EnforceAspectRatio", Camera.EnforceAspectRatio_ ); - ERS_FUNCTION_GetFloat (Item, "AspectRatio", Camera.AspectRatio_ ); - ERS_FUNCTION_GetInt (Item, "StreamingPriority", Camera.StreamingPriority_ ); - ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Camera.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Item, "AssetName", Camera.UserDefinedName_ ); + Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Camera.Pos_ ); + Success &= ERS_FUNCTION_GetVec3 (Item, "Rot", Camera.Rot_ ); + Success &= ERS_FUNCTION_GetFloat (Item, "NearClip", Camera.NearClip_ ); + Success &= ERS_FUNCTION_GetFloat (Item, "FarClip", Camera.FarClip_ ); + Success &= ERS_FUNCTION_GetFloat (Item, "FOV", Camera.FOV_ ); + Success &= ERS_FUNCTION_GetBool (Item, "EnforceAspectRatio", Camera.EnforceAspectRatio_ ); + Success &= ERS_FUNCTION_GetFloat (Item, "AspectRatio", Camera.AspectRatio_ ); + Success &= ERS_FUNCTION_GetInt (Item, "StreamingPriority", Camera.StreamingPriority_ ); + Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Camera.AttachedScriptIndexes_ ); Scene->SceneCameras.push_back(std::make_shared(Camera)); } @@ -110,8 +112,8 @@ bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E // Indicate Scene Is Loaded - Scene->IsSceneLoaded = true; - return true; + Scene->IsSceneLoaded = Success; + return Success; } From 8e8bcdb629bbff4246ed3633106c4750c61bcc7b Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 00:33:56 +0000 Subject: [PATCH 105/125] Update Scene Loader --- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 5 +++++ .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp | 5 +++++ .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 2565381eca..e5a427daa2 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -102,6 +102,11 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E } // Indicate Scene Is Loaded + if (!Success) { + SystemUtils->Logger_->Log("Scene Decoding Failed", 8); + } else { + SystemUtils->Logger_->Log("Finished Decoding Scene", 4); + } Scene->IsSceneLoaded = Success; return Success; diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp index 6f37be6609..a002df6cd7 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp @@ -115,6 +115,11 @@ bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E } // Indicate Scene Is Loaded + if (!Success) { + SystemUtils->Logger_->Log("Scene Decoding Failed", 8); + } else { + SystemUtils->Logger_->Log("Finished Decoding Scene", 4); + } Scene->IsSceneLoaded = Success; return Success; } \ No newline at end of file diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp index ab5f45dc81..0516d7eeb9 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp @@ -112,6 +112,11 @@ bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E // Indicate Scene Is Loaded + if (!Success) { + SystemUtils->Logger_->Log("Scene Decoding Failed", 8); + } else { + SystemUtils->Logger_->Log("Finished Decoding Scene", 4); + } Scene->IsSceneLoaded = Success; return Success; } From f1ed56f022bb9daa00f2e4e68f597ae659f7cca3 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 01:17:44 +0000 Subject: [PATCH 106/125] Update Scene Writer --- .../ERS_SceneWriter/ERS_SceneWriter.cpp | 44 +++++++++++-------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/Source/Core/Writers/ERS_SceneWriter/ERS_SceneWriter.cpp b/Source/Core/Writers/ERS_SceneWriter/ERS_SceneWriter.cpp index 8edd8fa4d3..aec47c5d6d 100644 --- a/Source/Core/Writers/ERS_SceneWriter/ERS_SceneWriter.cpp +++ b/Source/Core/Writers/ERS_SceneWriter/ERS_SceneWriter.cpp @@ -50,19 +50,17 @@ std::string SceneWriter::ProcessScene(ERS_STRUCT_Scene* InputScene) { // Write Metadata Output << YAML::Key << "SceneName" << YAML::Value << InputScene->SceneName; - Output << YAML::Key << "SceneFormatVersion" << YAML::Value << 2; + Output << YAML::Key << "SceneFormatVersion" << YAML::Value << 3; Output << YAML::Key << "ActiveCameraIndex" << YAML::Value << InputScene->ActiveSceneCameraIndex; - // Write SceneData - Output << YAML::Key << "SceneData"; - Output << YAML::Key << YAML::BeginMap; - long AssetIndex = 0; - //---- Write Models ----// + Output << YAML::Key << "Models"; + Output << YAML::Key << YAML::BeginMap; for (int i = 0; (long)i < (long)InputScene->Models.size(); i++) { - Output << YAML::Key << AssetIndex; + + Output << YAML::Key << i; Output << YAML::BeginMap; @@ -101,13 +99,17 @@ std::string SceneWriter::ProcessScene(ERS_STRUCT_Scene* InputScene) { Output << YAML::EndMap; - AssetIndex++; } + Output << YAML::EndMap; + Output << YAML::EndMap; + //---- Write Directional Lights ----// + Output << YAML::Key << "DirectionalLights"; + Output << YAML::Key << YAML::BeginMap; for (int i = 0; (long)i < (long)InputScene->DirectionalLights.size(); i++) { - Output << YAML::Key << AssetIndex; + Output << YAML::Key << i; Output << YAML::BeginMap; @@ -143,11 +145,15 @@ std::string SceneWriter::ProcessScene(ERS_STRUCT_Scene* InputScene) { Output << YAML::EndMap; AssetIndex++; } + Output << YAML::EndMap; + Output << YAML::EndMap; //---- Write Point Lights ----// + Output << YAML::Key << "PointLights"; + Output << YAML::Key << YAML::BeginMap; for (int i = 0; (long)i < (long)InputScene->PointLights.size(); i++) { - Output << YAML::Key << AssetIndex; + Output << YAML::Key << i; Output << YAML::BeginMap; @@ -183,11 +189,15 @@ std::string SceneWriter::ProcessScene(ERS_STRUCT_Scene* InputScene) { Output << YAML::EndMap; AssetIndex++; } + Output << YAML::EndMap; + Output << YAML::EndMap; //---- Write Spot Lights ----// + Output << YAML::Key << "SpotLights"; + Output << YAML::Key << YAML::BeginMap; for (int i = 0; (long)i < (long)InputScene->SpotLights.size(); i++) { - Output << YAML::Key << AssetIndex; + Output << YAML::Key << i; Output << YAML::BeginMap; @@ -231,15 +241,18 @@ std::string SceneWriter::ProcessScene(ERS_STRUCT_Scene* InputScene) { Output << YAML::EndMap; AssetIndex++; } - + Output << YAML::EndMap; + Output << YAML::EndMap; //---- Write Scene Cameras ----// + Output << YAML::Key << "SceneCameras"; + Output << YAML::Key << YAML::BeginMap; for (int i = 0; (long)i < (long)InputScene->SceneCameras.size(); i++) { ERS_STRUCT_SceneCamera* SceneCamera = InputScene->SceneCameras[i].get(); - Output << YAML::Key << AssetIndex; + Output << YAML::Key << i; Output << YAML::BeginMap; @@ -269,12 +282,7 @@ std::string SceneWriter::ProcessScene(ERS_STRUCT_Scene* InputScene) { Output << YAML::EndMap; - AssetIndex++; } - - - - // End Writing Output << YAML::EndMap; Output << YAML::EndMap; From c6340e8d4cad857da6a7507b49ff6ec81b5b3c7f Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 01:18:02 +0000 Subject: [PATCH 107/125] Update Scene Writer --- Source/Core/Writers/ERS_SceneWriter/ERS_SceneWriter.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/Source/Core/Writers/ERS_SceneWriter/ERS_SceneWriter.cpp b/Source/Core/Writers/ERS_SceneWriter/ERS_SceneWriter.cpp index aec47c5d6d..4814d841c2 100644 --- a/Source/Core/Writers/ERS_SceneWriter/ERS_SceneWriter.cpp +++ b/Source/Core/Writers/ERS_SceneWriter/ERS_SceneWriter.cpp @@ -143,7 +143,6 @@ std::string SceneWriter::ProcessScene(ERS_STRUCT_Scene* InputScene) { Output< Date: Sat, 13 Aug 2022 01:21:00 +0000 Subject: [PATCH 108/125] Update Scene Writer --- .../ERS_FUNCTION_YAMLHelpers.cpp | 34 ++++++++--------- .../ERS_FUNCTION_YAMLHelpers.h | 37 ++++++++++--------- 2 files changed, 36 insertions(+), 35 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp index f65bf56a09..1af87a6e94 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -5,7 +5,7 @@ #include // Standart Type Helper Functions -bool ERS_FUNCTION_GetInt(YAML::Node Data, std::string Name, int &Target) { +bool ERS_FUNCTION_GetInt(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, int &Target) { try { Target = Data[Name].as(); return true; @@ -15,7 +15,7 @@ bool ERS_FUNCTION_GetInt(YAML::Node Data, std::string Name, int &Target) { return false; } } -bool ERS_FUNCTION_GetFloat(YAML::Node Data, std::string Name, float &Target) { +bool ERS_FUNCTION_GetFloat(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, float &Target) { try { Target = Data[Name].as(); return true; @@ -25,7 +25,7 @@ bool ERS_FUNCTION_GetFloat(YAML::Node Data, std::string Name, float &Target) { return false; } } -bool ERS_FUNCTION_GetBool(YAML::Node Data, std::string Name, bool &Target) { +bool ERS_FUNCTION_GetBool(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, bool &Target) { try { Target = Data[Name].as(); return true; @@ -35,7 +35,7 @@ bool ERS_FUNCTION_GetBool(YAML::Node Data, std::string Name, bool &Target) { return false; } } -bool ERS_FUNCTION_GetLong(YAML::Node Data, std::string Name, long &Target) { +bool ERS_FUNCTION_GetLong(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, long &Target) { try { Target = Data[Name].as(); return true; @@ -45,7 +45,7 @@ bool ERS_FUNCTION_GetLong(YAML::Node Data, std::string Name, long &Target) { return false; } } -bool ERS_FUNCTION_GetDouble(YAML::Node Data, std::string Name, double &Target) { +bool ERS_FUNCTION_GetDouble(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, double &Target) { try { Target = Data[Name].as(); return true; @@ -55,7 +55,7 @@ bool ERS_FUNCTION_GetDouble(YAML::Node Data, std::string Name, double &Target) { return false; } } -bool ERS_FUNCTION_GetUnsignedInt(YAML::Node Data, std::string Name, unsigned int &Target) { +bool ERS_FUNCTION_GetUnsignedInt(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, unsigned int &Target) { try { Target = Data[Name].as(); return true; @@ -65,7 +65,7 @@ bool ERS_FUNCTION_GetUnsignedInt(YAML::Node Data, std::string Name, unsigned int return false; } } -bool ERS_FUNCTION_GetBool(YAML::Node Data, std::string Name, unsigned long &Target) { +bool ERS_FUNCTION_GetBool(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, unsigned long &Target) { try { Target = Data[Name].as(); return true; @@ -75,7 +75,7 @@ bool ERS_FUNCTION_GetBool(YAML::Node Data, std::string Name, unsigned long &Targ return false; } } -bool ERS_FUNCTION_GetLongLong(YAML::Node Data, std::string Name, long long &Target) { +bool ERS_FUNCTION_GetLongLong(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, long long &Target) { try { Target = Data[Name].as(); return true; @@ -85,7 +85,7 @@ bool ERS_FUNCTION_GetLongLong(YAML::Node Data, std::string Name, long long &Targ return false; } } -bool ERS_FUNCTION_GetUnsignedLongLong(YAML::Node Data, std::string Name, unsigned long long &Target) { +bool ERS_FUNCTION_GetUnsignedLongLong(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, unsigned long long &Target) { try { Target = Data[Name].as(); return true; @@ -95,7 +95,7 @@ bool ERS_FUNCTION_GetUnsignedLongLong(YAML::Node Data, std::string Name, unsigne return false; } } -bool ERS_FUNCTION_GetString(YAML::Node Data, std::string Name, std::string &Target) { +bool ERS_FUNCTION_GetString(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, std::string &Target) { try { Target = Data[Name].as(); return true; @@ -105,7 +105,7 @@ bool ERS_FUNCTION_GetString(YAML::Node Data, std::string Name, std::string &Targ return false; } } -bool ERS_FUNCTION_GetNode(YAML::Node Data, std::string Name, YAML::Node &Target) { +bool ERS_FUNCTION_GetNode(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, YAML::Node &Target) { try { Target = Data[Name]; return true; @@ -116,7 +116,7 @@ bool ERS_FUNCTION_GetNode(YAML::Node Data, std::string Name, YAML::Node &Target) // Vector Helpers -bool ERS_FUNCTION_GetStringVector(YAML::Node Data, std::string Name, std::vector &Target) { +bool ERS_FUNCTION_GetStringVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, std::vector &Target) { try { YAML::Node TargetNode = Data[Name]; for (YAML::const_iterator it=TargetNode.begin(); it!=TargetNode.end(); ++it) { @@ -129,7 +129,7 @@ bool ERS_FUNCTION_GetStringVector(YAML::Node Data, std::string Name, std::vector return false; } } -bool ERS_FUNCTION_GetIntVector(YAML::Node Data, std::string Name, std::vector &Target) { +bool ERS_FUNCTION_GetIntVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, std::vector &Target) { try { YAML::Node TargetNode = Data[Name]; for (YAML::const_iterator it=TargetNode.begin(); it!=TargetNode.end(); ++it) { @@ -142,7 +142,7 @@ bool ERS_FUNCTION_GetIntVector(YAML::Node Data, std::string Name, std::vector &Target) { +bool ERS_FUNCTION_GetLongVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, std::vector &Target) { try { YAML::Node TargetNode = Data[Name]; for (YAML::const_iterator it=TargetNode.begin(); it!=TargetNode.end(); ++it) { @@ -155,7 +155,7 @@ bool ERS_FUNCTION_GetLongVector(YAML::Node Data, std::string Name, std::vector &Target) { +bool ERS_FUNCTION_GetNodeVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, std::vector &Target) { try { YAML::Node TargetNode = Data[Name]; for (YAML::const_iterator it=TargetNode.begin(); it!=TargetNode.end(); ++it) { @@ -169,7 +169,7 @@ bool ERS_FUNCTION_GetNodeVector(YAML::Node Data, std::string Name, std::vector(); float Y = Data[NameBase + "Y"].as(); @@ -182,7 +182,7 @@ bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string NameBase, glm::vec3 &Targ return false; } } -bool ERS_FUNCTION_GetVec3Color(YAML::Node Data, std::string NameBase, glm::vec3 &Target) { +bool ERS_FUNCTION_GetVec3Color(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string NameBase, glm::vec3 &Target) { try { float X = Data[NameBase + "Red"].as(); float Y = Data[NameBase + "Green"].as(); diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h index 3f554a54d2..c071c05705 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h @@ -14,7 +14,7 @@ #include // Internal Libraries (BG convention: use <> instead of "") - +#include @@ -22,13 +22,14 @@ * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. * + * @param Logger Pointer to ERS Logging system, used to log errors. * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node * @param Target Reference to the variable to be set to the decoded value * @return true * @return false */ -bool ERS_FUNCTION_GetInt(YAML::Node Data, std::string Name, int &Target); +bool ERS_FUNCTION_GetInt(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, int &Target); /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. @@ -40,7 +41,7 @@ bool ERS_FUNCTION_GetInt(YAML::Node Data, std::string Name, int &Target); * @return true * @return false */ -bool ERS_FUNCTION_GetFloat(YAML::Node Data, std::string Name, float &Target); +bool ERS_FUNCTION_GetFloat(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, float &Target); /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. @@ -52,7 +53,7 @@ bool ERS_FUNCTION_GetFloat(YAML::Node Data, std::string Name, float &Target); * @return true * @return false */ -bool ERS_FUNCTION_GetBool(YAML::Node Data, std::string Name, bool &Target); +bool ERS_FUNCTION_GetBool(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, bool &Target); /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. @@ -64,7 +65,7 @@ bool ERS_FUNCTION_GetBool(YAML::Node Data, std::string Name, bool &Target); * @return true * @return false */ -bool ERS_FUNCTION_GetLong(YAML::Node Data, std::string Name, long &Target); +bool ERS_FUNCTION_GetLong(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, long &Target); /** @@ -77,7 +78,7 @@ bool ERS_FUNCTION_GetLong(YAML::Node Data, std::string Name, long &Target); * @return true * @return false */ -bool ERS_FUNCTION_GetDouble(YAML::Node Data, std::string Name, double &Target); +bool ERS_FUNCTION_GetDouble(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, double &Target); /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. @@ -89,7 +90,7 @@ bool ERS_FUNCTION_GetDouble(YAML::Node Data, std::string Name, double &Target); * @return true * @return false */ -bool ERS_FUNCTION_GetUnsignedInt(YAML::Node Data, std::string Name, unsigned int &Target); +bool ERS_FUNCTION_GetUnsignedInt(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, unsigned int &Target); /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. @@ -101,7 +102,7 @@ bool ERS_FUNCTION_GetUnsignedInt(YAML::Node Data, std::string Name, unsigned int * @return true * @return false */ -bool ERS_FUNCTION_GetUnsignedLong(YAML::Node Data, std::string Name, unsigned long &Target); +bool ERS_FUNCTION_GetUnsignedLong(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, unsigned long &Target); /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. @@ -113,7 +114,7 @@ bool ERS_FUNCTION_GetUnsignedLong(YAML::Node Data, std::string Name, unsigned lo * @return true * @return false */ -bool ERS_FUNCTION_GetLongLong(YAML::Node Data, std::string Name, long long &Target); +bool ERS_FUNCTION_GetLongLong(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, long long &Target); /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. @@ -125,7 +126,7 @@ bool ERS_FUNCTION_GetLongLong(YAML::Node Data, std::string Name, long long &Targ * @return true * @return false */ -bool ERS_FUNCTION_GetUnsignedLongLong(YAML::Node Data, std::string Name, unsigned long long &Target); +bool ERS_FUNCTION_GetUnsignedLongLong(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, unsigned long long &Target); /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. @@ -137,7 +138,7 @@ bool ERS_FUNCTION_GetUnsignedLongLong(YAML::Node Data, std::string Name, unsigne * @return true * @return false */ -bool ERS_FUNCTION_GetString(YAML::Node Data, std::string Name, std::string &Target); +bool ERS_FUNCTION_GetString(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, std::string &Target); /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. @@ -149,7 +150,7 @@ bool ERS_FUNCTION_GetString(YAML::Node Data, std::string Name, std::string &Targ * @return true * @return false */ -bool ERS_FUNCTION_GetNode(YAML::Node Data, std::string NameBase, YAML::Node &Target); +bool ERS_FUNCTION_GetNode(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string NameBase, YAML::Node &Target); @@ -163,7 +164,7 @@ bool ERS_FUNCTION_GetNode(YAML::Node Data, std::string NameBase, YAML::Node &Tar * @return true * @return false */ -bool ERS_FUNCTION_GetStringVector(YAML::Node Data, std::string NameBase, std::vector &Target); +bool ERS_FUNCTION_GetStringVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string NameBase, std::vector &Target); /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. @@ -175,7 +176,7 @@ bool ERS_FUNCTION_GetStringVector(YAML::Node Data, std::string NameBase, std::ve * @return true * @return false */ -bool ERS_FUNCTION_GetIntVector(YAML::Node Data, std::string NameBase, std::vector &Target); +bool ERS_FUNCTION_GetIntVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string NameBase, std::vector &Target); /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. @@ -187,7 +188,7 @@ bool ERS_FUNCTION_GetIntVector(YAML::Node Data, std::string NameBase, std::vecto * @return true * @return false */ -bool ERS_FUNCTION_GetLongVector(YAML::Node Data, std::string NameBase, std::vector &Target); +bool ERS_FUNCTION_GetLongVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string NameBase, std::vector &Target); /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. @@ -199,7 +200,7 @@ bool ERS_FUNCTION_GetLongVector(YAML::Node Data, std::string NameBase, std::vect * @return true * @return false */ -bool ERS_FUNCTION_GetNodeVector(YAML::Node Data, std::string NameBase, std::vector &Target); +bool ERS_FUNCTION_GetNodeVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string NameBase, std::vector &Target); @@ -214,7 +215,7 @@ bool ERS_FUNCTION_GetNodeVector(YAML::Node Data, std::string NameBase, std::vect * @return true * @return false */ -bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string NameBase, glm::vec3 &Target); +bool ERS_FUNCTION_GetVec3(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string NameBase, glm::vec3 &Target); /** * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. @@ -227,4 +228,4 @@ bool ERS_FUNCTION_GetVec3(YAML::Node Data, std::string NameBase, glm::vec3 &Targ * @return true * @return false */ -bool ERS_FUNCTION_GetVec3Color(YAML::Node Data, std::string NameBase, glm::vec3 &Target); \ No newline at end of file +bool ERS_FUNCTION_GetVec3Color(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string NameBase, glm::vec3 &Target); \ No newline at end of file From cba24d79f2ead6618285b9cf9577f1ac3792feec Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 01:21:40 +0000 Subject: [PATCH 109/125] Update YAML Helpers --- .../ERS_FUNCTION_YAMLHelpers.cpp | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp index 1af87a6e94..1e7b3fc987 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -5,7 +5,7 @@ #include // Standart Type Helper Functions -bool ERS_FUNCTION_GetInt(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, int &Target) { +bool ERS_FUNCTION_GetInt(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, int &Target) { try { Target = Data[Name].as(); return true; @@ -15,7 +15,7 @@ bool ERS_FUNCTION_GetInt(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std: return false; } } -bool ERS_FUNCTION_GetFloat(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, float &Target) { +bool ERS_FUNCTION_GetFloat(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, float &Target) { try { Target = Data[Name].as(); return true; @@ -25,7 +25,7 @@ bool ERS_FUNCTION_GetFloat(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, st return false; } } -bool ERS_FUNCTION_GetBool(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, bool &Target) { +bool ERS_FUNCTION_GetBool(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, bool &Target) { try { Target = Data[Name].as(); return true; @@ -35,7 +35,7 @@ bool ERS_FUNCTION_GetBool(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std return false; } } -bool ERS_FUNCTION_GetLong(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, long &Target) { +bool ERS_FUNCTION_GetLong(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, long &Target) { try { Target = Data[Name].as(); return true; @@ -45,7 +45,7 @@ bool ERS_FUNCTION_GetLong(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std return false; } } -bool ERS_FUNCTION_GetDouble(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, double &Target) { +bool ERS_FUNCTION_GetDouble(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, double &Target) { try { Target = Data[Name].as(); return true; @@ -55,7 +55,7 @@ bool ERS_FUNCTION_GetDouble(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, s return false; } } -bool ERS_FUNCTION_GetUnsignedInt(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, unsigned int &Target) { +bool ERS_FUNCTION_GetUnsignedInt(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, unsigned int &Target) { try { Target = Data[Name].as(); return true; @@ -65,7 +65,7 @@ bool ERS_FUNCTION_GetUnsignedInt(ERS_CLASS_LoggingSystem* Logger, YAML::Node Da return false; } } -bool ERS_FUNCTION_GetBool(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, unsigned long &Target) { +bool ERS_FUNCTION_GetBool(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, unsigned long &Target) { try { Target = Data[Name].as(); return true; @@ -75,7 +75,7 @@ bool ERS_FUNCTION_GetBool(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std return false; } } -bool ERS_FUNCTION_GetLongLong(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, long long &Target) { +bool ERS_FUNCTION_GetLongLong(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, long long &Target) { try { Target = Data[Name].as(); return true; @@ -85,7 +85,7 @@ bool ERS_FUNCTION_GetLongLong(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, return false; } } -bool ERS_FUNCTION_GetUnsignedLongLong(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, unsigned long long &Target) { +bool ERS_FUNCTION_GetUnsignedLongLong(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, unsigned long long &Target) { try { Target = Data[Name].as(); return true; @@ -95,7 +95,7 @@ bool ERS_FUNCTION_GetUnsignedLongLong(ERS_CLASS_LoggingSystem* Logger, YAML::No return false; } } -bool ERS_FUNCTION_GetString(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, std::string &Target) { +bool ERS_FUNCTION_GetString(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, std::string &Target) { try { Target = Data[Name].as(); return true; @@ -105,7 +105,7 @@ bool ERS_FUNCTION_GetString(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, s return false; } } -bool ERS_FUNCTION_GetNode(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, YAML::Node &Target) { +bool ERS_FUNCTION_GetNode(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, YAML::Node &Target) { try { Target = Data[Name]; return true; @@ -116,7 +116,7 @@ bool ERS_FUNCTION_GetNode(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std // Vector Helpers -bool ERS_FUNCTION_GetStringVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, std::vector &Target) { +bool ERS_FUNCTION_GetStringVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, std::vector &Target) { try { YAML::Node TargetNode = Data[Name]; for (YAML::const_iterator it=TargetNode.begin(); it!=TargetNode.end(); ++it) { @@ -129,7 +129,7 @@ bool ERS_FUNCTION_GetStringVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node D return false; } } -bool ERS_FUNCTION_GetIntVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, std::vector &Target) { +bool ERS_FUNCTION_GetIntVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, std::vector &Target) { try { YAML::Node TargetNode = Data[Name]; for (YAML::const_iterator it=TargetNode.begin(); it!=TargetNode.end(); ++it) { @@ -142,7 +142,7 @@ bool ERS_FUNCTION_GetIntVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data return false; } } -bool ERS_FUNCTION_GetLongVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, std::vector &Target) { +bool ERS_FUNCTION_GetLongVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, std::vector &Target) { try { YAML::Node TargetNode = Data[Name]; for (YAML::const_iterator it=TargetNode.begin(); it!=TargetNode.end(); ++it) { @@ -155,7 +155,7 @@ bool ERS_FUNCTION_GetLongVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Dat return false; } } -bool ERS_FUNCTION_GetNodeVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, std::vector &Target) { +bool ERS_FUNCTION_GetNodeVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string Name, std::vector &Target) { try { YAML::Node TargetNode = Data[Name]; for (YAML::const_iterator it=TargetNode.begin(); it!=TargetNode.end(); ++it) { @@ -169,7 +169,7 @@ bool ERS_FUNCTION_GetNodeVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Dat // GLM Helper Functions -bool ERS_FUNCTION_GetVec3(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string NameBase, glm::vec3 &Target) { +bool ERS_FUNCTION_GetVec3(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string NameBase, glm::vec3 &Target) { try { float X = Data[NameBase + "X"].as(); float Y = Data[NameBase + "Y"].as(); @@ -182,7 +182,7 @@ bool ERS_FUNCTION_GetVec3(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std return false; } } -bool ERS_FUNCTION_GetVec3Color(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string NameBase, glm::vec3 &Target) { +bool ERS_FUNCTION_GetVec3Color(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string NameBase, glm::vec3 &Target) { try { float X = Data[NameBase + "Red"].as(); float Y = Data[NameBase + "Green"].as(); From f0f13a9065deabf134eca0d177f2440e3c601c57 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 01:22:11 +0000 Subject: [PATCH 110/125] Update YAML Helpers --- .../ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h index c071c05705..fe05385bf7 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.h @@ -35,6 +35,7 @@ bool ERS_FUNCTION_GetInt(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std:: * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. * + * @param Logger Pointer to ERS Logging system, used to log errors. * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node * @param Target Reference to the variable to be set to the decoded value @@ -47,6 +48,7 @@ bool ERS_FUNCTION_GetFloat(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, st * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. * + * @param Logger Pointer to ERS Logging system, used to log errors. * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node * @param Target Reference to the variable to be set to the decoded value @@ -59,6 +61,7 @@ bool ERS_FUNCTION_GetBool(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. * + * @param Logger Pointer to ERS Logging system, used to log errors. * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node * @param Target Reference to the variable to be set to the decoded value @@ -72,6 +75,7 @@ bool ERS_FUNCTION_GetLong(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. * + * @param Logger Pointer to ERS Logging system, used to log errors. * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node * @param Target Reference to the variable to be set to the decoded value @@ -84,6 +88,7 @@ bool ERS_FUNCTION_GetDouble(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, s * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. * + * @param Logger Pointer to ERS Logging system, used to log errors. * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node * @param Target Reference to the variable to be set to the decoded value @@ -96,6 +101,7 @@ bool ERS_FUNCTION_GetUnsignedInt(ERS_CLASS_LoggingSystem* Logger, YAML::Node Da * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. * + * @param Logger Pointer to ERS Logging system, used to log errors. * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node * @param Target Reference to the variable to be set to the decoded value @@ -108,6 +114,7 @@ bool ERS_FUNCTION_GetUnsignedLong(ERS_CLASS_LoggingSystem* Logger, YAML::Node D * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. * + * @param Logger Pointer to ERS Logging system, used to log errors. * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node * @param Target Reference to the variable to be set to the decoded value @@ -120,6 +127,7 @@ bool ERS_FUNCTION_GetLongLong(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. * + * @param Logger Pointer to ERS Logging system, used to log errors. * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node * @param Target Reference to the variable to be set to the decoded value @@ -132,6 +140,7 @@ bool ERS_FUNCTION_GetUnsignedLongLong(ERS_CLASS_LoggingSystem* Logger, YAML::No * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. * + * @param Logger Pointer to ERS Logging system, used to log errors. * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node * @param Target Reference to the variable to be set to the decoded value @@ -144,6 +153,7 @@ bool ERS_FUNCTION_GetString(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, s * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. * + * @param Logger Pointer to ERS Logging system, used to log errors. * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node * @param Target Reference to the variable to be set to the decoded value @@ -158,6 +168,7 @@ bool ERS_FUNCTION_GetNode(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. * + * @param Logger Pointer to ERS Logging system, used to log errors. * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node * @param Target Reference to the variable to be set to the decoded value @@ -170,6 +181,7 @@ bool ERS_FUNCTION_GetStringVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node D * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. * + * @param Logger Pointer to ERS Logging system, used to log errors. * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node * @param Target Reference to the variable to be set to the decoded value @@ -182,6 +194,7 @@ bool ERS_FUNCTION_GetIntVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. * + * @param Logger Pointer to ERS Logging system, used to log errors. * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node * @param Target Reference to the variable to be set to the decoded value @@ -194,6 +207,7 @@ bool ERS_FUNCTION_GetLongVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Dat * @brief Helper function to the YAML::CPP Library that helps catch errors and other problems. * Returns true on success, false on fail. * + * @param Logger Pointer to ERS Logging system, used to log errors. * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node * @param Target Reference to the variable to be set to the decoded value @@ -209,6 +223,7 @@ bool ERS_FUNCTION_GetNodeVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Dat * Returns true on success, false on fail. * Will append X,Y,Z to get the three components of the vector. * + * @param Logger Pointer to ERS Logging system, used to log errors. * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node * @param Target Reference to the variable to be set to the decoded value @@ -222,6 +237,7 @@ bool ERS_FUNCTION_GetVec3(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std * Returns true on success, false on fail. * Will append Red,Green,Blue to get the three components of the vector. * + * @param Logger Pointer to ERS Logging system, used to log errors. * @param Data YAML::Node containing the target data * @param Name Name of the parameter in the yaml node * @param Target Reference to the variable to be set to the decoded value From c284e521b26942adc65b855e65ce74ba687b99a4 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 01:24:08 +0000 Subject: [PATCH 111/125] Update YAML Helpers --- .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp index 1e7b3fc987..f77bc24fd9 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -10,8 +10,10 @@ bool ERS_FUNCTION_GetInt(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std:: Target = Data[Name].as(); return true; } catch (YAML::TypedBadConversion&) { + Logger->Log(std::string("Failed To Cast Parameter '") + Name + "' To Type 'int'", 8); return false; } catch (YAML::KeyNotFound&) { + Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); return false; } } @@ -22,6 +24,7 @@ bool ERS_FUNCTION_GetFloat(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std } catch (YAML::TypedBadConversion&) { return false; } catch (YAML::KeyNotFound&) { + Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); return false; } } @@ -32,6 +35,7 @@ bool ERS_FUNCTION_GetBool(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std: } catch (YAML::TypedBadConversion&) { return false; } catch (YAML::KeyNotFound&) { + Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); return false; } } From f19c2323c70dd86b1fac74884029497855b3de66 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 01:24:37 +0000 Subject: [PATCH 112/125] Update YAML Helpers --- .../ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp index f77bc24fd9..61f6c4ec10 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -46,6 +46,7 @@ bool ERS_FUNCTION_GetLong(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std: } catch (YAML::TypedBadConversion&) { return false; } catch (YAML::KeyNotFound&) { + Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); return false; } } @@ -56,6 +57,7 @@ bool ERS_FUNCTION_GetDouble(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, st } catch (YAML::TypedBadConversion&) { return false; } catch (YAML::KeyNotFound&) { + Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); return false; } } @@ -66,6 +68,7 @@ bool ERS_FUNCTION_GetUnsignedInt(ERS_CLASS_LoggingSystem* Logger, YAML::Node Dat } catch (YAML::TypedBadConversion&) { return false; } catch (YAML::KeyNotFound&) { + Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); return false; } } @@ -76,6 +79,7 @@ bool ERS_FUNCTION_GetBool(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std: } catch (YAML::TypedBadConversion&) { return false; } catch (YAML::KeyNotFound&) { + Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); return false; } } @@ -86,6 +90,7 @@ bool ERS_FUNCTION_GetLongLong(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, } catch (YAML::TypedBadConversion&) { return false; } catch (YAML::KeyNotFound&) { + Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); return false; } } @@ -96,6 +101,7 @@ bool ERS_FUNCTION_GetUnsignedLongLong(ERS_CLASS_LoggingSystem* Logger, YAML::Nod } catch (YAML::TypedBadConversion&) { return false; } catch (YAML::KeyNotFound&) { + Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); return false; } } @@ -106,6 +112,7 @@ bool ERS_FUNCTION_GetString(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, st } catch (YAML::TypedBadConversion&) { return false; } catch (YAML::KeyNotFound&) { + Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); return false; } } @@ -114,6 +121,7 @@ bool ERS_FUNCTION_GetNode(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std: Target = Data[Name]; return true; } catch (YAML::KeyNotFound&) { + Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); return false; } } @@ -130,6 +138,7 @@ bool ERS_FUNCTION_GetStringVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Da } catch (YAML::TypedBadConversion&) { return false; } catch (YAML::KeyNotFound&) { + Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); return false; } } @@ -143,6 +152,7 @@ bool ERS_FUNCTION_GetIntVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, } catch (YAML::TypedBadConversion&) { return false; } catch (YAML::KeyNotFound&) { + Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); return false; } } @@ -156,6 +166,7 @@ bool ERS_FUNCTION_GetLongVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data } catch (YAML::TypedBadConversion&) { return false; } catch (YAML::KeyNotFound&) { + Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); return false; } } @@ -167,6 +178,7 @@ bool ERS_FUNCTION_GetNodeVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data } return true; } catch (YAML::KeyNotFound&) { + Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); return false; } } @@ -183,6 +195,7 @@ bool ERS_FUNCTION_GetVec3(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std: } catch (YAML::TypedBadConversion&) { return false; } catch (YAML::KeyNotFound&) { + Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); return false; } } @@ -196,6 +209,7 @@ bool ERS_FUNCTION_GetVec3Color(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, } catch (YAML::TypedBadConversion&) { return false; } catch (YAML::KeyNotFound&) { + Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); return false; } } From 6862c380d2abf5dd30f7497d30823cb4439692d4 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 01:27:17 +0000 Subject: [PATCH 113/125] Update YAML Helpers --- .../ERS_FUNCTION_YAMLHelpers.cpp | 44 +++++++++---------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp index 61f6c4ec10..a475cccf5f 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -186,30 +186,26 @@ bool ERS_FUNCTION_GetNodeVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data // GLM Helper Functions bool ERS_FUNCTION_GetVec3(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string NameBase, glm::vec3 &Target) { - try { - float X = Data[NameBase + "X"].as(); - float Y = Data[NameBase + "Y"].as(); - float Z = Data[NameBase + "Z"].as(); - Target = glm::vec3(X,Y,Z); - return true; - } catch (YAML::TypedBadConversion&) { - return false; - } catch (YAML::KeyNotFound&) { - Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); - return false; - } + + float X,Y,Z = 0.0f; + bool Status = true; + + Status &= ERS_FUNCTION_GetFloat(Logger, Data, NameBase + "X", X); + Status &= ERS_FUNCTION_GetFloat(Logger, Data, NameBase + "Y", Y); + Status &= ERS_FUNCTION_GetFloat(Logger, Data, NameBase + "Z", Z); + + Target = glm::vec3(X,Y,Z); + return Status; + } bool ERS_FUNCTION_GetVec3Color(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std::string NameBase, glm::vec3 &Target) { - try { - float X = Data[NameBase + "Red"].as(); - float Y = Data[NameBase + "Green"].as(); - float Z = Data[NameBase + "Blue"].as(); - Target = glm::vec3(X,Y,Z); - return true; - } catch (YAML::TypedBadConversion&) { - return false; - } catch (YAML::KeyNotFound&) { - Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); - return false; - } + float X,Y,Z = 0.0f; + bool Status = true; + + Status &= ERS_FUNCTION_GetFloat(Logger, Data, NameBase + "Red", X); + Status &= ERS_FUNCTION_GetFloat(Logger, Data, NameBase + "Green", Y); + Status &= ERS_FUNCTION_GetFloat(Logger, Data, NameBase + "Blue", Z); + + Target = glm::vec3(X,Y,Z); + return Status; } From a90610b4297547ce1e43f2500f4ee2dc0728f56c Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 01:29:38 +0000 Subject: [PATCH 114/125] Update YAML Helpers --- .../ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp index a475cccf5f..ce42fa6247 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_YAMLHelpers.cpp @@ -22,6 +22,7 @@ bool ERS_FUNCTION_GetFloat(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std Target = Data[Name].as(); return true; } catch (YAML::TypedBadConversion&) { + Logger->Log(std::string("Failed To Cast Parameter '") + Name + "' To Type 'float'", 8); return false; } catch (YAML::KeyNotFound&) { Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); @@ -33,6 +34,7 @@ bool ERS_FUNCTION_GetBool(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std: Target = Data[Name].as(); return true; } catch (YAML::TypedBadConversion&) { + Logger->Log(std::string("Failed To Cast Parameter '") + Name + "' To Type 'bool'", 8); return false; } catch (YAML::KeyNotFound&) { Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); @@ -44,6 +46,7 @@ bool ERS_FUNCTION_GetLong(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std: Target = Data[Name].as(); return true; } catch (YAML::TypedBadConversion&) { + Logger->Log(std::string("Failed To Cast Parameter '") + Name + "' To Type 'long'", 8); return false; } catch (YAML::KeyNotFound&) { Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); @@ -55,6 +58,7 @@ bool ERS_FUNCTION_GetDouble(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, st Target = Data[Name].as(); return true; } catch (YAML::TypedBadConversion&) { + Logger->Log(std::string("Failed To Cast Parameter '") + Name + "' To Type 'double'", 8); return false; } catch (YAML::KeyNotFound&) { Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); @@ -66,6 +70,7 @@ bool ERS_FUNCTION_GetUnsignedInt(ERS_CLASS_LoggingSystem* Logger, YAML::Node Dat Target = Data[Name].as(); return true; } catch (YAML::TypedBadConversion&) { + Logger->Log(std::string("Failed To Cast Parameter '") + Name + "' To Type 'unsigned int'", 8); return false; } catch (YAML::KeyNotFound&) { Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); @@ -77,6 +82,7 @@ bool ERS_FUNCTION_GetBool(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, std: Target = Data[Name].as(); return true; } catch (YAML::TypedBadConversion&) { + Logger->Log(std::string("Failed To Cast Parameter '") + Name + "' To Type 'unsigned long'", 8); return false; } catch (YAML::KeyNotFound&) { Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); @@ -88,6 +94,7 @@ bool ERS_FUNCTION_GetLongLong(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, Target = Data[Name].as(); return true; } catch (YAML::TypedBadConversion&) { + Logger->Log(std::string("Failed To Cast Parameter '") + Name + "' To Type 'long long'", 8); return false; } catch (YAML::KeyNotFound&) { Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); @@ -99,6 +106,7 @@ bool ERS_FUNCTION_GetUnsignedLongLong(ERS_CLASS_LoggingSystem* Logger, YAML::Nod Target = Data[Name].as(); return true; } catch (YAML::TypedBadConversion&) { + Logger->Log(std::string("Failed To Cast Parameter '") + Name + "' To Type 'unsigned long long'", 8); return false; } catch (YAML::KeyNotFound&) { Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); @@ -110,6 +118,7 @@ bool ERS_FUNCTION_GetString(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, st Target = Data[Name].as(); return true; } catch (YAML::TypedBadConversion&) { + Logger->Log(std::string("Failed To Cast Parameter '") + Name + "' To Type 'std::string'", 8); return false; } catch (YAML::KeyNotFound&) { Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); @@ -136,6 +145,7 @@ bool ERS_FUNCTION_GetStringVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Da } return true; } catch (YAML::TypedBadConversion&) { + Logger->Log(std::string("Failed To Cast Parameter '") + Name + "' To Type 'std::string'", 8); return false; } catch (YAML::KeyNotFound&) { Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); @@ -150,6 +160,7 @@ bool ERS_FUNCTION_GetIntVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data, } return true; } catch (YAML::TypedBadConversion&) { + Logger->Log(std::string("Failed To Cast Parameter '") + Name + "' To Type 'int'", 8); return false; } catch (YAML::KeyNotFound&) { Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); @@ -164,6 +175,7 @@ bool ERS_FUNCTION_GetLongVector(ERS_CLASS_LoggingSystem* Logger, YAML::Node Data } return true; } catch (YAML::TypedBadConversion&) { + Logger->Log(std::string("Failed To Cast Parameter '") + Name + "' To Type 'long'", 8); return false; } catch (YAML::KeyNotFound&) { Logger->Log(std::string("Failed To Find Parameter '") + Name + "'", 7); From c8effbab8c101cf290963a1115ceb0fd50fd7dc7 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 01:31:02 +0000 Subject: [PATCH 115/125] Update YAML Helpers --- .../ERS_FUNCTION_SceneDecoderV1.cpp | 91 ++++++++++--------- 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index e5a427daa2..4f30f4e3f5 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -11,13 +11,14 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E // Init bool Success = true; SystemUtils->Logger_->Log(std::string("Processing Scene '") + Scene->SceneName + "' With Decoder Version 1", 3, LogEnable); + ERS_CLASS_LoggingSystem* Logger = SystemUtils->Logger_.get(); // Grab Metadata std::vector SceneItems; - Success &= ERS_FUNCTION_GetLong (SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); - Success &= ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName ); - Success &= ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex ); - Success &= ERS_FUNCTION_GetNodeVector (SceneData, "SceneData", SceneItems ); + Success &= ERS_FUNCTION_GetLong (Logger, SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); + Success &= ERS_FUNCTION_GetString (Logger, SceneData, "SceneName", Scene->SceneName ); + Success &= ERS_FUNCTION_GetInt (Logger, SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex ); + Success &= ERS_FUNCTION_GetNodeVector (Logger, SceneData, "SceneData", SceneItems ); // Iterate Through Vector To Add Each Asset To Loading Queue Of Requested Type for (long i = 0; (long)i < (long)SceneItems.size(); i++) { @@ -25,23 +26,23 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E // Get Asset Information YAML::Node Item = SceneItems[i]; std::string AssetName, AssetType; - Success &= ERS_FUNCTION_GetString(Item, "AssetName", AssetName); - Success &= ERS_FUNCTION_GetString(Item, "AssetType", AssetType); + Success &= ERS_FUNCTION_GetString(Logger, Item, "AssetName", AssetName); + Success &= ERS_FUNCTION_GetString(Logger, Item, "AssetType", AssetType); if (AssetType == "Model") { ERS_STRUCT_Model Model; - Success &= ERS_FUNCTION_GetLong (Item, "AssetID", Model.AssetID ); - Success &= ERS_FUNCTION_GetVec3 (Item, "AssetPosition", Model.ModelPosition ); - Success &= ERS_FUNCTION_GetVec3 (Item, "AssetRotation", Model.ModelRotation ); - Success &= ERS_FUNCTION_GetVec3 (Item, "AssetScale", Model.ModelScale ); - Success &= ERS_FUNCTION_GetBool (Item, "CastDynamicShadows", Model.CastDynamicShadows_ ); - Success &= ERS_FUNCTION_GetBool (Item, "CastStaticShadows", Model.CastStaticShadows_ ); - Success &= ERS_FUNCTION_GetBool (Item, "ReceiveShadows", Model.ReceiveShadows_ ); - Success &= ERS_FUNCTION_GetLong (Item, "ShaderOverrideIndex", Model.ShaderOverrideIndex_ ); - Success &= ERS_FUNCTION_GetString (Item, "AssetName", Model.Name ); - Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Model.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetLong (Logger, Item, "AssetID", Model.AssetID ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "AssetPosition", Model.ModelPosition ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "AssetRotation", Model.ModelRotation ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "AssetScale", Model.ModelScale ); + Success &= ERS_FUNCTION_GetBool (Logger, Item, "CastDynamicShadows", Model.CastDynamicShadows_ ); + Success &= ERS_FUNCTION_GetBool (Logger, Item, "CastStaticShadows", Model.CastStaticShadows_ ); + Success &= ERS_FUNCTION_GetBool (Logger, Item, "ReceiveShadows", Model.ReceiveShadows_ ); + Success &= ERS_FUNCTION_GetLong (Logger, Item, "ShaderOverrideIndex", Model.ShaderOverrideIndex_ ); + Success &= ERS_FUNCTION_GetString (Logger, Item, "AssetName", Model.Name ); + Success &= ERS_FUNCTION_GetLongVector (Logger, Item, "AttachedScripts", Model.AttachedScriptIndexes_ ); Scene->Models.push_back(std::make_shared(Model)); ModelLoader->AddModelToLoadingQueue(Scene->Models[Scene->Models.size()-1]); @@ -49,50 +50,50 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E } else if (AssetType == std::string("DirectionalLight")) { ERS_STRUCT_DirectionalLight Light; - Success &= ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); - Success &= ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); - Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); - Success &= ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); - Success &= ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); - Success &= ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); - Success &= ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); - Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Logger, Item, "AssetName", Light.UserDefinedName ); + Success &= ERS_FUNCTION_GetVec3Color (Logger, Item, "Color", Light.Color ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "Pos", Light.Pos ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "Rot", Light.Rot ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "Intensity", Light.Intensity ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "MaxDistance", Light.MaxDistance ); + Success &= ERS_FUNCTION_GetBool (Logger, Item, "CastShadows", Light.CastsShadows_ ); + Success &= ERS_FUNCTION_GetLongVector (Logger, Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); Scene->DirectionalLights.push_back(std::make_shared(Light)); } else if (AssetType == std::string("PointLight")) { ERS_STRUCT_PointLight Light; - Success &= ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); - Success &= ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); - Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); - Success &= ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); - Success &= ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); - Success &= ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); - Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Logger, Item, "AssetName", Light.UserDefinedName ); + Success &= ERS_FUNCTION_GetVec3Color (Logger, Item, "Color", Light.Color ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "Pos", Light.Pos ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "Intensity", Light.Intensity ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "MaxDistance", Light.MaxDistance ); + Success &= ERS_FUNCTION_GetBool (Logger, Item, "CastShadows", Light.CastsShadows_ ); + Success &= ERS_FUNCTION_GetLongVector (Logger, Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); Scene->PointLights.push_back(std::make_shared(Light)); } else if (AssetType == std::string("SpotLight")) { ERS_STRUCT_SpotLight Light; - Success &= ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); - Success &= ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); - Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); - Success &= ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); - Success &= ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); - Success &= ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); - Success &= ERS_FUNCTION_GetFloat (Item, "CutOff", Light.CutOff ); - Success &= ERS_FUNCTION_GetFloat (Item, "RollOff", Light.Rolloff ); - Success &= ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); - Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Logger, Item, "AssetName", Light.UserDefinedName ); + Success &= ERS_FUNCTION_GetVec3Color (Logger, Item, "Color", Light.Color ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "Pos", Light.Pos ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "Rot", Light.Rot ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "Intensity", Light.Intensity ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "MaxDistance", Light.MaxDistance ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "CutOff", Light.CutOff ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "RollOff", Light.Rolloff ); + Success &= ERS_FUNCTION_GetBool (Logger, Item, "CastShadows", Light.CastsShadows_ ); + Success &= ERS_FUNCTION_GetLongVector (Logger, Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); Scene->SpotLights.push_back(std::make_shared(Light)); } else if (AssetType == std::string("SceneCamera")) { ERS_STRUCT_SceneCamera Camera; - Success &= ERS_FUNCTION_GetString (Item, "AssetName", Camera.UserDefinedName_ ); - Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Camera.Pos_ ); - Success &= ERS_FUNCTION_GetVec3 (Item, "Rot", Camera.Rot_ ); - Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Camera.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Logger, Item, "AssetName", Camera.UserDefinedName_ ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "Pos", Camera.Pos_ ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "Rot", Camera.Rot_ ); + Success &= ERS_FUNCTION_GetLongVector (Logger, Item, "AttachedScripts", Camera.AttachedScriptIndexes_ ); Scene->SceneCameras.push_back(std::make_shared(Camera)); } else { From b1a2fd1ac546a4d81a71ff318fa3d1e54cb262a9 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 01:31:16 +0000 Subject: [PATCH 116/125] Update YAML Helpers --- .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp | 1 + .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp index a002df6cd7..c970da3b87 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp @@ -18,6 +18,7 @@ bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E // Init bool Success = true; SystemUtils->Logger_->Log(std::string("Processing Scene '") + Scene->SceneName + "' With Decoder Version 2", 3, LogEnable); + ERS_CLASS_LoggingSystem* Logger = SystemUtils->Logger_.get(); // Grab Metadata std::vector SceneItems; diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp index 0516d7eeb9..77132ea16a 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp @@ -10,6 +10,7 @@ bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E // Init bool Success = true; SystemUtils->Logger_->Log(std::string("Processing Scene '") + Scene->SceneName + "' With Decoder Version 3", 3, LogEnable); + ERS_CLASS_LoggingSystem* Logger = SystemUtils->Logger_.get(); // Grab Metadata std::vector Models, PointLights, SpotLights, DirectionalLights, SceneCameras; From 965147c50dd6bd3be28e59361746098c4eafd3b6 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 01:31:25 +0000 Subject: [PATCH 117/125] Update YAML Helpers --- .../ERS_FUNCTION_SceneDecoderV2.cpp | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp index c970da3b87..798bcffe41 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp @@ -33,23 +33,23 @@ bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E // Get Asset Information YAML::Node Item = SceneItems[i]; std::string AssetName, AssetType; - Success &= ERS_FUNCTION_GetString(Item, "AssetName", AssetName); - Success &= ERS_FUNCTION_GetString(Item, "AssetType", AssetType); + Success &= ERS_FUNCTION_GetString(Logger, Item, "AssetName", AssetName); + Success &= ERS_FUNCTION_GetString(Logger, Item, "AssetType", AssetType); if (AssetType == "Model") { ERS_STRUCT_Model Model; - Success &= ERS_FUNCTION_GetLong (Item, "AssetID", Model.AssetID ); - Success &= ERS_FUNCTION_GetVec3 (Item, "AssetPosition", Model.ModelPosition ); - Success &= ERS_FUNCTION_GetVec3 (Item, "AssetRotation", Model.ModelRotation ); - Success &= ERS_FUNCTION_GetVec3 (Item, "AssetScale", Model.ModelScale ); - Success &= ERS_FUNCTION_GetBool (Item, "CastDynamicShadows", Model.CastDynamicShadows_ ); - Success &= ERS_FUNCTION_GetBool (Item, "CastStaticShadows", Model.CastStaticShadows_ ); - Success &= ERS_FUNCTION_GetBool (Item, "ReceiveShadows", Model.ReceiveShadows_ ); - Success &= ERS_FUNCTION_GetLong (Item, "ShaderOverrideIndex", Model.ShaderOverrideIndex_ ); - Success &= ERS_FUNCTION_GetString (Item, "AssetName", Model.Name ); - Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Model.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetLong (Logger, Item, "AssetID", Model.AssetID ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "AssetPosition", Model.ModelPosition ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "AssetRotation", Model.ModelRotation ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "AssetScale", Model.ModelScale ); + Success &= ERS_FUNCTION_GetBool (Logger, Item, "CastDynamicShadows", Model.CastDynamicShadows_ ); + Success &= ERS_FUNCTION_GetBool (Logger, Item, "CastStaticShadows", Model.CastStaticShadows_ ); + Success &= ERS_FUNCTION_GetBool (Logger, Item, "ReceiveShadows", Model.ReceiveShadows_ ); + Success &= ERS_FUNCTION_GetLong (Logger, Item, "ShaderOverrideIndex", Model.ShaderOverrideIndex_ ); + Success &= ERS_FUNCTION_GetString (Logger, Item, "AssetName", Model.Name ); + Success &= ERS_FUNCTION_GetLongVector (Logger, Item, "AttachedScripts", Model.AttachedScriptIndexes_ ); Scene->Models.push_back(std::make_shared(Model)); ModelLoader->AddModelToLoadingQueue(Scene->Models[Scene->Models.size()-1]); @@ -57,56 +57,56 @@ bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E } else if (AssetType == std::string("DirectionalLight")) { ERS_STRUCT_DirectionalLight Light; - Success &= ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); - Success &= ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); - Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); - Success &= ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); - Success &= ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); - Success &= ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); - Success &= ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); - Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Logger, Item, "AssetName", Light.UserDefinedName ); + Success &= ERS_FUNCTION_GetVec3Color (Logger, Item, "Color", Light.Color ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "Pos", Light.Pos ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "Rot", Light.Rot ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "Intensity", Light.Intensity ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "MaxDistance", Light.MaxDistance ); + Success &= ERS_FUNCTION_GetBool (Logger, Item, "CastShadows", Light.CastsShadows_ ); + Success &= ERS_FUNCTION_GetLongVector (Logger, Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); Scene->DirectionalLights.push_back(std::make_shared(Light)); } else if (AssetType == std::string("PointLight")) { ERS_STRUCT_PointLight Light; - Success &= ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); - Success &= ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); - Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); - Success &= ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); - Success &= ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); - Success &= ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); - Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Logger, Item, "AssetName", Light.UserDefinedName ); + Success &= ERS_FUNCTION_GetVec3Color (Logger, Item, "Color", Light.Color ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "Pos", Light.Pos ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "Intensity", Light.Intensity ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "MaxDistance", Light.MaxDistance ); + Success &= ERS_FUNCTION_GetBool (Logger, Item, "CastShadows", Light.CastsShadows_ ); + Success &= ERS_FUNCTION_GetLongVector (Logger, Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); Scene->PointLights.push_back(std::make_shared(Light)); } else if (AssetType == std::string("SpotLight")) { ERS_STRUCT_SpotLight Light; - Success &= ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); - Success &= ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); - Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); - Success &= ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); - Success &= ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); - Success &= ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); - Success &= ERS_FUNCTION_GetFloat (Item, "CutOff", Light.CutOff ); - Success &= ERS_FUNCTION_GetFloat (Item, "RollOff", Light.Rolloff ); - Success &= ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); - Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Logger, Item, "AssetName", Light.UserDefinedName ); + Success &= ERS_FUNCTION_GetVec3Color (Logger, Item, "Color", Light.Color ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "Pos", Light.Pos ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "Rot", Light.Rot ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "Intensity", Light.Intensity ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "MaxDistance", Light.MaxDistance ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "CutOff", Light.CutOff ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "RollOff", Light.Rolloff ); + Success &= ERS_FUNCTION_GetBool (Logger, Item, "CastShadows", Light.CastsShadows_ ); + Success &= ERS_FUNCTION_GetLongVector (Logger, Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); Scene->SpotLights.push_back(std::make_shared(Light)); } else if (AssetType == std::string("SceneCamera")) { ERS_STRUCT_SceneCamera Camera; - Success &= ERS_FUNCTION_GetString (Item, "AssetName", Camera.UserDefinedName_ ); - Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Camera.Pos_ ); - Success &= ERS_FUNCTION_GetVec3 (Item, "Rot", Camera.Rot_ ); - Success &= ERS_FUNCTION_GetFloat (Item, "NearClip", Camera.NearClip_ ); - Success &= ERS_FUNCTION_GetFloat (Item, "FarClip", Camera.FarClip_ ); - Success &= ERS_FUNCTION_GetFloat (Item, "FOV", Camera.FOV_ ); - Success &= ERS_FUNCTION_GetBool (Item, "EnforceAspectRatio", Camera.EnforceAspectRatio_ ); - Success &= ERS_FUNCTION_GetFloat (Item, "AspectRatio", Camera.AspectRatio_ ); - Success &= ERS_FUNCTION_GetInt (Item, "StreamingPriority", Camera.StreamingPriority_ ); - Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Camera.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Logger, Item, "AssetName", Camera.UserDefinedName_ ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "Pos", Camera.Pos_ ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "Rot", Camera.Rot_ ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "NearClip", Camera.NearClip_ ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "FarClip", Camera.FarClip_ ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "FOV", Camera.FOV_ ); + Success &= ERS_FUNCTION_GetBool (Logger, Item, "EnforceAspectRatio", Camera.EnforceAspectRatio_ ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "AspectRatio", Camera.AspectRatio_ ); + Success &= ERS_FUNCTION_GetInt (Logger, Item, "StreamingPriority", Camera.StreamingPriority_ ); + Success &= ERS_FUNCTION_GetLongVector (Logger, Item, "AttachedScripts", Camera.AttachedScriptIndexes_ ); Scene->SceneCameras.push_back(std::make_shared(Camera)); } else { From 8c10973337891a4843e4f1aca1ec9a5d947d5f05 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 01:31:42 +0000 Subject: [PATCH 118/125] Update YAML Helpers --- .../ERS_FUNCTION_SceneDecoderV3.cpp | 106 +++++++++--------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp index 77132ea16a..b0ce6f35ff 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp @@ -14,30 +14,30 @@ bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E // Grab Metadata std::vector Models, PointLights, SpotLights, DirectionalLights, SceneCameras; - Success &= ERS_FUNCTION_GetLong (SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); - Success &= ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName ); - Success &= ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex ); - Success &= ERS_FUNCTION_GetNodeVector (SceneData, "Models", Models ); - Success &= ERS_FUNCTION_GetNodeVector (SceneData, "PointLights", PointLights ); - Success &= ERS_FUNCTION_GetNodeVector (SceneData, "SpotLights", SpotLights ); - Success &= ERS_FUNCTION_GetNodeVector (SceneData, "DirectionalLights", DirectionalLights ); - Success &= ERS_FUNCTION_GetNodeVector (SceneData, "SceneCameras", SceneCameras ); + Success &= ERS_FUNCTION_GetLong (Logger, SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); + Success &= ERS_FUNCTION_GetString (Logger, SceneData, "SceneName", Scene->SceneName ); + Success &= ERS_FUNCTION_GetInt (Logger, SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex ); + Success &= ERS_FUNCTION_GetNodeVector (Logger, SceneData, "Models", Models ); + Success &= ERS_FUNCTION_GetNodeVector (Logger, SceneData, "PointLights", PointLights ); + Success &= ERS_FUNCTION_GetNodeVector (Logger, SceneData, "SpotLights", SpotLights ); + Success &= ERS_FUNCTION_GetNodeVector (Logger, SceneData, "DirectionalLights", DirectionalLights ); + Success &= ERS_FUNCTION_GetNodeVector (Logger, SceneData, "SceneCameras", SceneCameras ); for (unsigned int i = 0; i < Models.size(); i++) { YAML::Node Item = Models[i]; ERS_STRUCT_Model Model; - Success &= ERS_FUNCTION_GetLong (Item, "AssetID", Model.AssetID ); - Success &= ERS_FUNCTION_GetVec3 (Item, "AssetPosition", Model.ModelPosition ); - Success &= ERS_FUNCTION_GetVec3 (Item, "AssetRotation", Model.ModelRotation ); - Success &= ERS_FUNCTION_GetVec3 (Item, "AssetScale", Model.ModelScale ); - Success &= ERS_FUNCTION_GetBool (Item, "CastDynamicShadows", Model.CastDynamicShadows_ ); - Success &= ERS_FUNCTION_GetBool (Item, "CastStaticShadows", Model.CastStaticShadows_ ); - Success &= ERS_FUNCTION_GetBool (Item, "ReceiveShadows", Model.ReceiveShadows_ ); - Success &= ERS_FUNCTION_GetLong (Item, "ShaderOverrideIndex", Model.ShaderOverrideIndex_ ); - Success &= ERS_FUNCTION_GetString (Item, "AssetName", Model.Name ); - Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Model.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetLong (Logger, Item, "AssetID", Model.AssetID ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "AssetPosition", Model.ModelPosition ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "AssetRotation", Model.ModelRotation ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "AssetScale", Model.ModelScale ); + Success &= ERS_FUNCTION_GetBool (Logger, Item, "CastDynamicShadows", Model.CastDynamicShadows_ ); + Success &= ERS_FUNCTION_GetBool (Logger, Item, "CastStaticShadows", Model.CastStaticShadows_ ); + Success &= ERS_FUNCTION_GetBool (Logger, Item, "ReceiveShadows", Model.ReceiveShadows_ ); + Success &= ERS_FUNCTION_GetLong (Logger, Item, "ShaderOverrideIndex", Model.ShaderOverrideIndex_ ); + Success &= ERS_FUNCTION_GetString (Logger, Item, "AssetName", Model.Name ); + Success &= ERS_FUNCTION_GetLongVector (Logger, Item, "AttachedScripts", Model.AttachedScriptIndexes_ ); Scene->Models.push_back(std::make_shared(Model)); ModelLoader->AddModelToLoadingQueue(Scene->Models[Scene->Models.size()-1]); @@ -48,13 +48,13 @@ bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E YAML::Node Item = Models[i]; ERS_STRUCT_PointLight Light; - Success &= ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); - Success &= ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); - Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); - Success &= ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); - Success &= ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); - Success &= ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); - Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Logger, Item, "AssetName", Light.UserDefinedName ); + Success &= ERS_FUNCTION_GetVec3Color (Logger, Item, "Color", Light.Color ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "Pos", Light.Pos ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "Intensity", Light.Intensity ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "MaxDistance", Light.MaxDistance ); + Success &= ERS_FUNCTION_GetBool (Logger, Item, "CastShadows", Light.CastsShadows_ ); + Success &= ERS_FUNCTION_GetLongVector (Logger, Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); Scene->PointLights.push_back(std::make_shared(Light)); } @@ -62,16 +62,16 @@ bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E YAML::Node Item = Models[i]; ERS_STRUCT_SpotLight Light; - Success &= ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); - Success &= ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); - Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); - Success &= ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); - Success &= ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); - Success &= ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); - Success &= ERS_FUNCTION_GetFloat (Item, "CutOff", Light.CutOff ); - Success &= ERS_FUNCTION_GetFloat (Item, "RollOff", Light.Rolloff ); - Success &= ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); - Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Logger, Item, "AssetName", Light.UserDefinedName ); + Success &= ERS_FUNCTION_GetVec3Color (Logger, Item, "Color", Light.Color ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "Pos", Light.Pos ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "Rot", Light.Rot ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "Intensity", Light.Intensity ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "MaxDistance", Light.MaxDistance ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "CutOff", Light.CutOff ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "RollOff", Light.Rolloff ); + Success &= ERS_FUNCTION_GetBool (Logger, Item, "CastShadows", Light.CastsShadows_ ); + Success &= ERS_FUNCTION_GetLongVector (Logger, Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); Scene->SpotLights.push_back(std::make_shared(Light)); } @@ -80,14 +80,14 @@ bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E YAML::Node Item = Models[i]; ERS_STRUCT_DirectionalLight Light; - Success &= ERS_FUNCTION_GetString (Item, "AssetName", Light.UserDefinedName ); - Success &= ERS_FUNCTION_GetVec3Color (Item, "Color", Light.Color ); - Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Light.Pos ); - Success &= ERS_FUNCTION_GetVec3 (Item, "Rot", Light.Rot ); - Success &= ERS_FUNCTION_GetFloat (Item, "Intensity", Light.Intensity ); - Success &= ERS_FUNCTION_GetFloat (Item, "MaxDistance", Light.MaxDistance ); - Success &= ERS_FUNCTION_GetBool (Item, "CastShadows", Light.CastsShadows_ ); - Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Logger, Item, "AssetName", Light.UserDefinedName ); + Success &= ERS_FUNCTION_GetVec3Color (Logger, Item, "Color", Light.Color ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "Pos", Light.Pos ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "Rot", Light.Rot ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "Intensity", Light.Intensity ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "MaxDistance", Light.MaxDistance ); + Success &= ERS_FUNCTION_GetBool (Logger, Item, "CastShadows", Light.CastsShadows_ ); + Success &= ERS_FUNCTION_GetLongVector (Logger, Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); Scene->DirectionalLights.push_back(std::make_shared(Light)); } @@ -96,16 +96,16 @@ bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E YAML::Node Item = Models[i]; ERS_STRUCT_SceneCamera Camera; - Success &= ERS_FUNCTION_GetString (Item, "AssetName", Camera.UserDefinedName_ ); - Success &= ERS_FUNCTION_GetVec3 (Item, "Pos", Camera.Pos_ ); - Success &= ERS_FUNCTION_GetVec3 (Item, "Rot", Camera.Rot_ ); - Success &= ERS_FUNCTION_GetFloat (Item, "NearClip", Camera.NearClip_ ); - Success &= ERS_FUNCTION_GetFloat (Item, "FarClip", Camera.FarClip_ ); - Success &= ERS_FUNCTION_GetFloat (Item, "FOV", Camera.FOV_ ); - Success &= ERS_FUNCTION_GetBool (Item, "EnforceAspectRatio", Camera.EnforceAspectRatio_ ); - Success &= ERS_FUNCTION_GetFloat (Item, "AspectRatio", Camera.AspectRatio_ ); - Success &= ERS_FUNCTION_GetInt (Item, "StreamingPriority", Camera.StreamingPriority_ ); - Success &= ERS_FUNCTION_GetLongVector (Item, "AttachedScripts", Camera.AttachedScriptIndexes_ ); + Success &= ERS_FUNCTION_GetString (Logger, Item, "AssetName", Camera.UserDefinedName_ ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "Pos", Camera.Pos_ ); + Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "Rot", Camera.Rot_ ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "NearClip", Camera.NearClip_ ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "FarClip", Camera.FarClip_ ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "FOV", Camera.FOV_ ); + Success &= ERS_FUNCTION_GetBool (Logger, Item, "EnforceAspectRatio", Camera.EnforceAspectRatio_ ); + Success &= ERS_FUNCTION_GetFloat (Logger, Item, "AspectRatio", Camera.AspectRatio_ ); + Success &= ERS_FUNCTION_GetInt (Logger, Item, "StreamingPriority", Camera.StreamingPriority_ ); + Success &= ERS_FUNCTION_GetLongVector (Logger, Item, "AttachedScripts", Camera.AttachedScriptIndexes_ ); Scene->SceneCameras.push_back(std::make_shared(Camera)); } From 0de3eef15dc7da62c16c15ab9222c3a7b9a24cab Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 01:31:48 +0000 Subject: [PATCH 119/125] Update YAML Helpers --- .../ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp index 798bcffe41..ec09617073 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp @@ -22,10 +22,10 @@ bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E // Grab Metadata std::vector SceneItems; - Success &= ERS_FUNCTION_GetLong (SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); - Success &= ERS_FUNCTION_GetString (SceneData, "SceneName", Scene->SceneName ); - Success &= ERS_FUNCTION_GetInt (SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex ); - Success &= ERS_FUNCTION_GetNodeVector (SceneData, "SceneData", SceneItems ); + Success &= ERS_FUNCTION_GetLong (Logger, SceneData., "SceneFormatVersion", Scene->SceneFormatVersion ); + Success &= ERS_FUNCTION_GetString (Logger, SceneData., "SceneName", Scene->SceneName ); + Success &= ERS_FUNCTION_GetInt (Logger, SceneData., "ActiveCameraIndex", Scene->ActiveSceneCameraIndex ); + Success &= ERS_FUNCTION_GetNodeVector (Logger, SceneData., "SceneData", SceneItems ); // Iterate Through Vector To Add Each Asset To Loading Queue Of Requested Type for (long i = 0; (long)i < (long)SceneItems.size(); i++) { From 6380be7215785110cb2ec5b4a045a9b094daf4f4 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 01:32:12 +0000 Subject: [PATCH 120/125] Update YAML Helpers --- .../ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp index ec09617073..c92cfb06a1 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp @@ -22,10 +22,10 @@ bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E // Grab Metadata std::vector SceneItems; - Success &= ERS_FUNCTION_GetLong (Logger, SceneData., "SceneFormatVersion", Scene->SceneFormatVersion ); - Success &= ERS_FUNCTION_GetString (Logger, SceneData., "SceneName", Scene->SceneName ); - Success &= ERS_FUNCTION_GetInt (Logger, SceneData., "ActiveCameraIndex", Scene->ActiveSceneCameraIndex ); - Success &= ERS_FUNCTION_GetNodeVector (Logger, SceneData., "SceneData", SceneItems ); + Success &= ERS_FUNCTION_GetLong (Logger, SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); + Success &= ERS_FUNCTION_GetString (Logger, SceneData, "SceneName", Scene->SceneName ); + Success &= ERS_FUNCTION_GetInt (Logger, SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex ); + Success &= ERS_FUNCTION_GetNodeVector (Logger, SceneData, "SceneData", SceneItems ); // Iterate Through Vector To Add Each Asset To Loading Queue Of Requested Type for (long i = 0; (long)i < (long)SceneItems.size(); i++) { From 9998faf237f775c082a42c39696fae39e508b932 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 01:34:16 +0000 Subject: [PATCH 121/125] Update Scene Loader --- .../ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index 4f30f4e3f5..c22d346c01 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -17,7 +17,6 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E std::vector SceneItems; Success &= ERS_FUNCTION_GetLong (Logger, SceneData, "SceneFormatVersion", Scene->SceneFormatVersion ); Success &= ERS_FUNCTION_GetString (Logger, SceneData, "SceneName", Scene->SceneName ); - Success &= ERS_FUNCTION_GetInt (Logger, SceneData, "ActiveCameraIndex", Scene->ActiveSceneCameraIndex ); Success &= ERS_FUNCTION_GetNodeVector (Logger, SceneData, "SceneData", SceneItems ); // Iterate Through Vector To Add Each Asset To Loading Queue Of Requested Type @@ -87,15 +86,6 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E Success &= ERS_FUNCTION_GetLongVector (Logger, Item, "AttachedScripts", Light.AttachedScriptIndexes_ ); Scene->SpotLights.push_back(std::make_shared(Light)); - } else if (AssetType == std::string("SceneCamera")) { - - ERS_STRUCT_SceneCamera Camera; - Success &= ERS_FUNCTION_GetString (Logger, Item, "AssetName", Camera.UserDefinedName_ ); - Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "Pos", Camera.Pos_ ); - Success &= ERS_FUNCTION_GetVec3 (Logger, Item, "Rot", Camera.Rot_ ); - Success &= ERS_FUNCTION_GetLongVector (Logger, Item, "AttachedScripts", Camera.AttachedScriptIndexes_ ); - Scene->SceneCameras.push_back(std::make_shared(Camera)); - } else { SystemUtils->Logger_->Log(std::string("Unsupported/Unknown Asset Type: ") + AssetType, 9); } From 2822d320cef7f61d72242563133f17d39c7563cc Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 01:36:50 +0000 Subject: [PATCH 122/125] Update Scene Writer --- Source/Core/Writers/ERS_SceneWriter/ERS_SceneWriter.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Source/Core/Writers/ERS_SceneWriter/ERS_SceneWriter.cpp b/Source/Core/Writers/ERS_SceneWriter/ERS_SceneWriter.cpp index 4814d841c2..309b86054f 100644 --- a/Source/Core/Writers/ERS_SceneWriter/ERS_SceneWriter.cpp +++ b/Source/Core/Writers/ERS_SceneWriter/ERS_SceneWriter.cpp @@ -101,7 +101,6 @@ std::string SceneWriter::ProcessScene(ERS_STRUCT_Scene* InputScene) { Output << YAML::EndMap; } Output << YAML::EndMap; - Output << YAML::EndMap; //---- Write Directional Lights ----// @@ -145,7 +144,6 @@ std::string SceneWriter::ProcessScene(ERS_STRUCT_Scene* InputScene) { Output << YAML::EndMap; } Output << YAML::EndMap; - Output << YAML::EndMap; //---- Write Point Lights ----// Output << YAML::Key << "PointLights"; @@ -188,7 +186,6 @@ std::string SceneWriter::ProcessScene(ERS_STRUCT_Scene* InputScene) { Output << YAML::EndMap; } Output << YAML::EndMap; - Output << YAML::EndMap; //---- Write Spot Lights ----// Output << YAML::Key << "SpotLights"; @@ -239,7 +236,6 @@ std::string SceneWriter::ProcessScene(ERS_STRUCT_Scene* InputScene) { Output << YAML::EndMap; } Output << YAML::EndMap; - Output << YAML::EndMap; //---- Write Scene Cameras ----// Output << YAML::Key << "SceneCameras"; @@ -281,6 +277,8 @@ std::string SceneWriter::ProcessScene(ERS_STRUCT_Scene* InputScene) { Output << YAML::EndMap; } Output << YAML::EndMap; + + Output << YAML::EndMap; From 6a34c795fff619809bba9fd48c108c062bc5ff06 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 01:40:27 +0000 Subject: [PATCH 123/125] Update Scene Loader --- .../Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp index b0ce6f35ff..d7cfda3758 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV3.cpp @@ -41,7 +41,8 @@ bool ERS_FUNCTION_DecodeSceneV3(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E Scene->Models.push_back(std::make_shared(Model)); ModelLoader->AddModelToLoadingQueue(Scene->Models[Scene->Models.size()-1]); - + Scene->Models[Scene->Models.size()-1]->ApplyTransformations(); + } for (unsigned int i = 0; i < PointLights.size(); i++) { From ab35624561ed012ac254fc654dff46bcbcd60eda Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 01:40:36 +0000 Subject: [PATCH 124/125] Update Scene Loader --- .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp index c92cfb06a1..fab207f9a6 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV2.cpp @@ -53,6 +53,7 @@ bool ERS_FUNCTION_DecodeSceneV2(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E Scene->Models.push_back(std::make_shared(Model)); ModelLoader->AddModelToLoadingQueue(Scene->Models[Scene->Models.size()-1]); + Scene->Models[Scene->Models.size()-1]->ApplyTransformations(); } else if (AssetType == std::string("DirectionalLight")) { From 11c3796258f9853ed1c9510b4119434e05cffd25 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Sat, 13 Aug 2022 01:40:44 +0000 Subject: [PATCH 125/125] Update Scene Loader --- .../Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp index c22d346c01..e52e184403 100644 --- a/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp +++ b/Source/Core/Loader/ERS_SceneLoader/ERS_FUNCTION_SceneDecoderV1.cpp @@ -45,6 +45,7 @@ bool ERS_FUNCTION_DecodeSceneV1(YAML::Node SceneData, ERS_STRUCT_Scene *Scene, E Scene->Models.push_back(std::make_shared(Model)); ModelLoader->AddModelToLoadingQueue(Scene->Models[Scene->Models.size()-1]); + Scene->Models[Scene->Models.size()-1]->ApplyTransformations(); } else if (AssetType == std::string("DirectionalLight")) {