From 806b65b490f8d365608808ed294084cf843e49fd Mon Sep 17 00:00:00 2001 From: Almamu Date: Tue, 19 Aug 2025 10:35:33 +0200 Subject: [PATCH] chore: cleanup old Core stuff + update shader constant to use user settings as they should --- CMakeLists.txt | 51 ----------- src/WallpaperEngine/Core/Core.cpp | 4 - .../Core/DynamicValues/CDynamicValue.cpp | 25 +++++ .../Core/DynamicValues/CDynamicValue.h | 1 + .../Core/Objects/CParticle.cpp | 73 --------------- src/WallpaperEngine/Core/Objects/CParticle.h | 60 ------------ .../Effects/Constants/CShaderConstant.cpp | 5 - .../Effects/Constants/CShaderConstant.h | 40 -------- .../Constants/CShaderConstantFloat.cpp | 11 --- .../Effects/Constants/CShaderConstantFloat.h | 17 ---- .../Constants/CShaderConstantInteger.cpp | 11 --- .../Constants/CShaderConstantInteger.h | 17 ---- .../Constants/CShaderConstantProperty.cpp | 12 --- .../Constants/CShaderConstantProperty.h | 20 ---- .../Constants/CShaderConstantVector2.cpp | 18 ---- .../Constants/CShaderConstantVector2.h | 19 ---- .../Constants/CShaderConstantVector3.cpp | 20 ---- .../Constants/CShaderConstantVector3.h | 18 ---- .../Constants/CShaderConstantVector4.cpp | 22 ----- .../Constants/CShaderConstantVector4.h | 18 ---- .../Core/Objects/Particles/CControlPoint.cpp | 28 ------ .../Core/Objects/Particles/CControlPoint.h | 39 -------- .../Core/Objects/Particles/CEmitter.cpp | 75 --------------- .../Core/Objects/Particles/CEmitter.h | 65 ------------- .../Core/Objects/Particles/CInitializer.cpp | 59 ------------ .../Core/Objects/Particles/CInitializer.h | 56 ------------ .../Particles/Initializers/CAlphaRandom.cpp | 24 ----- .../Particles/Initializers/CAlphaRandom.h | 34 ------- .../Initializers/CAngularVelocityRandom.cpp | 24 ----- .../Initializers/CAngularVelocityRandom.h | 34 ------- .../Particles/Initializers/CColorRandom.cpp | 24 ----- .../Particles/Initializers/CColorRandom.h | 35 ------- .../Initializers/CLifeTimeRandom.cpp | 24 ----- .../Particles/Initializers/CLifeTimeRandom.h | 35 ------- .../Initializers/CRotationRandom.cpp | 77 ---------------- .../Particles/Initializers/CRotationRandom.h | 70 -------------- .../Particles/Initializers/CSizeRandom.cpp | 24 ----- .../Particles/Initializers/CSizeRandom.h | 35 ------- .../Initializers/CTurbulentVelocityRandom.cpp | 46 ---------- .../Initializers/CTurbulentVelocityRandom.h | 54 ----------- .../Initializers/CVelocityRandom.cpp | 24 ----- .../Particles/Initializers/CVelocityRandom.h | 35 ------- .../Core/UserSettings/CUserSettingBoolean.cpp | 91 ------------------- .../Core/UserSettings/CUserSettingBoolean.h | 25 ----- .../Core/UserSettings/CUserSettingFloat.cpp | 85 ----------------- .../Core/UserSettings/CUserSettingFloat.h | 26 ------ .../Core/UserSettings/CUserSettingValue.cpp | 5 - .../Core/UserSettings/CUserSettingValue.h | 35 ------- .../Core/UserSettings/CUserSettingVector3.cpp | 86 ------------------ .../Core/UserSettings/CUserSettingVector3.h | 28 ------ .../Data/Builders/UserSettingBuilder.h | 4 +- .../Data/Dumpers/StringPrinter.cpp | 2 +- src/WallpaperEngine/Data/JSON.cpp | 2 +- src/WallpaperEngine/Data/JSON.h | 4 +- src/WallpaperEngine/Data/Model/Types.h | 18 +--- src/WallpaperEngine/Data/Model/UserSetting.h | 1 + src/WallpaperEngine/Data/Model/Wallpaper.h | 8 +- .../Data/Parsers/ShaderConstantParser.cpp | 62 +------------ .../Data/Parsers/ShaderConstantParser.h | 1 - .../Data/Parsers/UserSettingParser.cpp | 15 ++- .../Data/Parsers/UserSettingParser.h | 2 +- src/WallpaperEngine/Render/Objects/CImage.cpp | 1 - .../Render/Objects/Effects/CPass.cpp | 11 +-- .../Render/Objects/Effects/CPass.h | 3 - .../Render/Shaders/CShader.cpp | 3 - src/WallpaperEngine/Render/Shaders/CShader.h | 2 - .../Render/Shaders/CShaderUnit.cpp | 6 -- .../Render/Shaders/CShaderUnit.h | 2 - 68 files changed, 55 insertions(+), 1856 deletions(-) delete mode 100644 src/WallpaperEngine/Core/Objects/CParticle.cpp delete mode 100644 src/WallpaperEngine/Core/Objects/CParticle.h delete mode 100644 src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.cpp delete mode 100644 src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.h delete mode 100644 src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.cpp delete mode 100644 src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.h delete mode 100644 src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantInteger.cpp delete mode 100644 src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantInteger.h delete mode 100644 src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantProperty.cpp delete mode 100644 src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantProperty.h delete mode 100644 src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector2.cpp delete mode 100644 src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector2.h delete mode 100644 src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector3.cpp delete mode 100644 src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector3.h delete mode 100644 src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector4.cpp delete mode 100644 src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector4.h delete mode 100644 src/WallpaperEngine/Core/Objects/Particles/CControlPoint.cpp delete mode 100644 src/WallpaperEngine/Core/Objects/Particles/CControlPoint.h delete mode 100644 src/WallpaperEngine/Core/Objects/Particles/CEmitter.cpp delete mode 100644 src/WallpaperEngine/Core/Objects/Particles/CEmitter.h delete mode 100644 src/WallpaperEngine/Core/Objects/Particles/CInitializer.cpp delete mode 100644 src/WallpaperEngine/Core/Objects/Particles/CInitializer.h delete mode 100644 src/WallpaperEngine/Core/Objects/Particles/Initializers/CAlphaRandom.cpp delete mode 100644 src/WallpaperEngine/Core/Objects/Particles/Initializers/CAlphaRandom.h delete mode 100644 src/WallpaperEngine/Core/Objects/Particles/Initializers/CAngularVelocityRandom.cpp delete mode 100644 src/WallpaperEngine/Core/Objects/Particles/Initializers/CAngularVelocityRandom.h delete mode 100644 src/WallpaperEngine/Core/Objects/Particles/Initializers/CColorRandom.cpp delete mode 100644 src/WallpaperEngine/Core/Objects/Particles/Initializers/CColorRandom.h delete mode 100644 src/WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.cpp delete mode 100644 src/WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.h delete mode 100644 src/WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.cpp delete mode 100644 src/WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.h delete mode 100644 src/WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.cpp delete mode 100644 src/WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.h delete mode 100644 src/WallpaperEngine/Core/Objects/Particles/Initializers/CTurbulentVelocityRandom.cpp delete mode 100644 src/WallpaperEngine/Core/Objects/Particles/Initializers/CTurbulentVelocityRandom.h delete mode 100644 src/WallpaperEngine/Core/Objects/Particles/Initializers/CVelocityRandom.cpp delete mode 100644 src/WallpaperEngine/Core/Objects/Particles/Initializers/CVelocityRandom.h delete mode 100644 src/WallpaperEngine/Core/UserSettings/CUserSettingBoolean.cpp delete mode 100644 src/WallpaperEngine/Core/UserSettings/CUserSettingBoolean.h delete mode 100644 src/WallpaperEngine/Core/UserSettings/CUserSettingFloat.cpp delete mode 100644 src/WallpaperEngine/Core/UserSettings/CUserSettingFloat.h delete mode 100644 src/WallpaperEngine/Core/UserSettings/CUserSettingValue.cpp delete mode 100644 src/WallpaperEngine/Core/UserSettings/CUserSettingValue.h delete mode 100644 src/WallpaperEngine/Core/UserSettings/CUserSettingVector3.cpp delete mode 100644 src/WallpaperEngine/Core/UserSettings/CUserSettingVector3.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f72994..f9eeb54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -407,15 +407,6 @@ add_executable( src/WallpaperEngine/Core/DynamicValues/CDynamicValue.cpp src/WallpaperEngine/Core/DynamicValues/CDynamicValue.h - src/WallpaperEngine/Core/UserSettings/CUserSettingValue.cpp - src/WallpaperEngine/Core/UserSettings/CUserSettingValue.h - src/WallpaperEngine/Core/UserSettings/CUserSettingBoolean.cpp - src/WallpaperEngine/Core/UserSettings/CUserSettingBoolean.h - src/WallpaperEngine/Core/UserSettings/CUserSettingVector3.cpp - src/WallpaperEngine/Core/UserSettings/CUserSettingVector3.h - src/WallpaperEngine/Core/UserSettings/CUserSettingFloat.cpp - src/WallpaperEngine/Core/UserSettings/CUserSettingFloat.h - src/WallpaperEngine/Core/Projects/CProperty.h src/WallpaperEngine/Core/Projects/CProperty.cpp src/WallpaperEngine/Core/Projects/CPropertyColor.h @@ -429,48 +420,6 @@ add_executable( src/WallpaperEngine/Core/Projects/CPropertyText.h src/WallpaperEngine/Core/Projects/CPropertyText.cpp -# src/WallpaperEngine/Core/Objects/CParticle.cpp -# src/WallpaperEngine/Core/Objects/CParticle.h - - src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.h - src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.cpp - src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.h - src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.cpp - src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector2.h - src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector2.cpp - src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector3.h - src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector3.cpp - src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector4.h - src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector4.cpp - src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantInteger.h - src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantInteger.cpp - src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantProperty.h - src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantProperty.cpp - -# src/WallpaperEngine/Core/Objects/Particles/CControlPoint.cpp -# src/WallpaperEngine/Core/Objects/Particles/CControlPoint.h -# src/WallpaperEngine/Core/Objects/Particles/CEmitter.cpp -# src/WallpaperEngine/Core/Objects/Particles/CEmitter.h -# src/WallpaperEngine/Core/Objects/Particles/CInitializer.cpp -# src/WallpaperEngine/Core/Objects/Particles/CInitializer.h -# -# src/WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.cpp -# src/WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.h -# src/WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.cpp -# src/WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.h -# src/WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.cpp -# src/WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.h -# src/WallpaperEngine/Core/Objects/Particles/Initializers/CVelocityRandom.cpp -# src/WallpaperEngine/Core/Objects/Particles/Initializers/CVelocityRandom.h -# src/WallpaperEngine/Core/Objects/Particles/Initializers/CColorRandom.cpp -# src/WallpaperEngine/Core/Objects/Particles/Initializers/CColorRandom.h -# src/WallpaperEngine/Core/Objects/Particles/Initializers/CAlphaRandom.cpp -# src/WallpaperEngine/Core/Objects/Particles/Initializers/CAlphaRandom.h -# src/WallpaperEngine/Core/Objects/Particles/Initializers/CAngularVelocityRandom.cpp -# src/WallpaperEngine/Core/Objects/Particles/Initializers/CAngularVelocityRandom.h -# src/WallpaperEngine/Core/Objects/Particles/Initializers/CTurbulentVelocityRandom.cpp -# src/WallpaperEngine/Core/Objects/Particles/Initializers/CTurbulentVelocityRandom.h - src/WallpaperEngine/Data/Model/Types.h src/WallpaperEngine/Data/Model/Project.h src/WallpaperEngine/Data/Model/Wallpaper.h diff --git a/src/WallpaperEngine/Core/Core.cpp b/src/WallpaperEngine/Core/Core.cpp index 0f33015..2758281 100644 --- a/src/WallpaperEngine/Core/Core.cpp +++ b/src/WallpaperEngine/Core/Core.cpp @@ -1,12 +1,8 @@ #include "Core.h" -#include "WallpaperEngine/Core/UserSettings/CUserSettingBoolean.h" -#include "WallpaperEngine/Core/UserSettings/CUserSettingFloat.h" -#include "WallpaperEngine/Core/UserSettings/CUserSettingVector3.h" #include "WallpaperEngine/Logging/CLog.h" using namespace WallpaperEngine; -using namespace WallpaperEngine::Core::UserSettings; glm::vec4 Core::aToVector4 (const char* str) { float x = strtof (str, const_cast (&str)); diff --git a/src/WallpaperEngine/Core/DynamicValues/CDynamicValue.cpp b/src/WallpaperEngine/Core/DynamicValues/CDynamicValue.cpp index f7c7750..49e1689 100644 --- a/src/WallpaperEngine/Core/DynamicValues/CDynamicValue.cpp +++ b/src/WallpaperEngine/Core/DynamicValues/CDynamicValue.cpp @@ -215,4 +215,29 @@ const bool& CDynamicValue::getBool () const { CDynamicValue::UnderlyingType CDynamicValue::getType () const { return this->m_type; +} + +std::string CDynamicValue::toString () const { + switch (this->m_type) { + case UnderlyingType::Float: + return std::to_string (this->m_float); + case UnderlyingType::Int: + return std::to_string (this->m_int); + case UnderlyingType::Boolean: + return std::to_string (this->m_bool); + case UnderlyingType::Vec2: + return std::to_string (this->m_vec2.x) + ", " + std::to_string (this->m_vec2.y); + case UnderlyingType::Vec3: + return std::to_string (this->m_vec3.x) + ", " + std::to_string (this->m_vec3.y) + ", " + std::to_string (this->m_vec3.z); + case UnderlyingType::Vec4: + return std::to_string (this->m_vec4.x) + ", " + std::to_string (this->m_vec4.y) + ", " + std::to_string (this->m_vec4.z) + ", " + std::to_string (this->m_vec4.w); + case UnderlyingType::IVec2: + return std::to_string (this->m_ivec2.x) + ", " + std::to_string (this->m_ivec2.y); + case UnderlyingType::IVec3: + return std::to_string (this->m_ivec3.x) + ", " + std::to_string (this->m_ivec3.y) + ", " + std::to_string (this->m_ivec3.z); + case UnderlyingType::IVec4: + return std::to_string (this->m_ivec4.x) + ", " + std::to_string (this->m_ivec4.y) + ", " + std::to_string (this->m_ivec4.z) + ", " + std::to_string (this->m_ivec4.w); + default: + return "Unknown conversion for dynamic value of type: " + std::to_string (static_cast (this->m_type)); + } } \ No newline at end of file diff --git a/src/WallpaperEngine/Core/DynamicValues/CDynamicValue.h b/src/WallpaperEngine/Core/DynamicValues/CDynamicValue.h index 7347da8..904fbba 100644 --- a/src/WallpaperEngine/Core/DynamicValues/CDynamicValue.h +++ b/src/WallpaperEngine/Core/DynamicValues/CDynamicValue.h @@ -44,6 +44,7 @@ class CDynamicValue { [[nodiscard]] const int& getInt () const; [[nodiscard]] const bool& getBool () const; [[nodiscard]] UnderlyingType getType () const; + [[nodiscard]] std::string toString () const; /** * Connects the current instance to the given instance, updating it's values diff --git a/src/WallpaperEngine/Core/Objects/CParticle.cpp b/src/WallpaperEngine/Core/Objects/CParticle.cpp deleted file mode 100644 index 11ec6ba..0000000 --- a/src/WallpaperEngine/Core/Objects/CParticle.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include "CParticle.h" - -#include - -using namespace WallpaperEngine::Core::Objects; - -const CParticle* CParticle::fromFile ( - std::shared_ptr project, const std::string& filename, - const std::shared_ptr& container, const CUserSettingBoolean* visible, int id, - const std::string& name, const CUserSettingVector3* origin, const CUserSettingVector3* angles, - const CUserSettingVector3* scale, std::vector dependencies -) { - json data = json::parse (container->readFileAsString (filename)); - const auto controlpoint_it = data.find ("controlpoint"); - const auto emitter_it = jsonFindRequired (data, "emitter", "Particles must have emitters"); - const auto initializer_it = jsonFindRequired (data, "initializer", "Particles must have initializers"); - - std::vector controlpoints; - std::vector emitters; - std::vector initializers; - - if (controlpoint_it != data.end ()) - for (const auto& cur : (*controlpoint_it)) - controlpoints.push_back (Particles::CControlPoint::fromJSON (cur)); - - for (const auto& cur : (*emitter_it)) - emitters.push_back (Particles::CEmitter::fromJSON (cur)); - for (const auto& cur : (*initializer_it)) - initializers.push_back (Particles::CInitializer::fromJSON (cur)); - - return new CParticle ( - project, - jsonFindRequired (data, "starttime", "Particles must have start time"), - jsonFindRequired (data, "maxcount", "Particles must have maximum count"), - visible, - id, - name, - origin, - scale, - angles, - controlpoints, - emitters, - initializers, - std::move(dependencies) - ); -} - -CParticle::CParticle ( - std::shared_ptr project, uint32_t starttime, uint32_t maxcount, - const CUserSettingBoolean* visible, int id, const std::string& name, const CUserSettingVector3* origin, - const CUserSettingVector3* scale, const CUserSettingVector3* angles, - const std::vector& controlpoints, - const std::vector& emitters, - const std::vector& initializers, std::vector dependencies -) : - CObject (project, visible, id, name, origin, scale, angles, std::move(dependencies)), - m_starttime (starttime), - m_maxcount (maxcount), - m_controlpoints (controlpoints), - m_emitters (emitters), - m_initializers (initializers) {} - -const std::vector& CParticle::getEmitters () const { - return this->m_emitters; -} - -const std::vector& CParticle::getControlPoints () const { - return this->m_controlpoints; -} - -const std::vector& CParticle::getInitializers () const { - return this->m_initializers; -} diff --git a/src/WallpaperEngine/Core/Objects/CParticle.h b/src/WallpaperEngine/Core/Objects/CParticle.h deleted file mode 100644 index 687b50e..0000000 --- a/src/WallpaperEngine/Core/Objects/CParticle.h +++ /dev/null @@ -1,60 +0,0 @@ -#pragma once - -#include "WallpaperEngine/Core/Objects/Particles/CControlPoint.h" -#include "WallpaperEngine/Core/Objects/Particles/CEmitter.h" -#include "WallpaperEngine/Core/Objects/Particles/CInitializer.h" - -#include "WallpaperEngine/Core/CObject.h" -#include "WallpaperEngine/Core/Core.h" - -namespace WallpaperEngine::Core::Objects { -using json = nlohmann::json; - -/** - * Represents a particle system in the background - */ -class CParticle : public CObject { - friend class CObject; - - public: - static const CParticle* fromFile ( - std::shared_ptr project, const std::string& filename, - const std::shared_ptr& container, const CUserSettingBoolean* visible, int id, - const std::string& name, const CUserSettingVector3* origin, const CUserSettingVector3* angles, - const CUserSettingVector3* scale, std::vector dependencies); - - /** - * @return The list of emitters for the particle system - */ - [[nodiscard]] const std::vector& getEmitters () const; - /** - * @return The list of control points for the particle system - */ - [[nodiscard]] const std::vector& getControlPoints () const; - /** - * @return The list of initializers for the particle system - */ - [[nodiscard]] const std::vector& getInitializers () const; - - protected: - CParticle ( - std::shared_ptr project, uint32_t starttime, uint32_t maxcount, - const CUserSettingBoolean* visible, int id, const std::string& name, const CUserSettingVector3* origin, - const CUserSettingVector3* scale, const CUserSettingVector3* angles, - const std::vector& controlpoints, - const std::vector& emitters, - const std::vector& initializers, std::vector dependencies); - - private: - /** The time at which the particle system should start emitting */ - const uint32_t m_starttime; - /** Maximum number of particles at the same time */ - const uint32_t m_maxcount; - /** List of control points */ - const std::vector m_controlpoints; - /** List of emitters */ - const std::vector m_emitters; - /** List of initializers */ - const std::vector m_initializers; -}; -} // namespace WallpaperEngine::Core::Objects diff --git a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.cpp b/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.cpp deleted file mode 100644 index 2f7f343..0000000 --- a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "CShaderConstant.h" - -#include - -using namespace WallpaperEngine::Core::Objects::Effects::Constants; diff --git a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.h b/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.h deleted file mode 100644 index df80be6..0000000 --- a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -#include -#include -#include "WallpaperEngine/Core/DynamicValues/CDynamicValue.h" - -namespace WallpaperEngine::Core::Objects::Effects::Constants { -/** - * Shader constants base class - */ -class CShaderConstant : public DynamicValues::CDynamicValue { - public: - virtual ~CShaderConstant () = default; - - template [[nodiscard]] const T* as () const { - if (is ()) { - return static_cast (this); - } - - throw std::bad_cast (); - } - - template [[nodiscard]] T* as () { - if (is ()) { - return static_cast (this); - } - - throw std::bad_cast (); - } - - template [[nodiscard]] bool is () const { - return typeid (*this) == typeid(T); - } - - /** - * @return String representation of the constant's value - */ - [[nodiscard]] virtual std::string toString () const = 0; -}; -} // namespace WallpaperEngine::Core::Objects::Effects::Constants diff --git a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.cpp b/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.cpp deleted file mode 100644 index 43eb304..0000000 --- a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "CShaderConstantFloat.h" - -using namespace WallpaperEngine::Core::Objects::Effects::Constants; - -CShaderConstantFloat::CShaderConstantFloat (float value) { - this->update (value); -} - -std::string CShaderConstantFloat::toString () const { - return std::to_string (this->getFloat ()); -} diff --git a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.h b/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.h deleted file mode 100644 index 6cc3eff..0000000 --- a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include "CShaderConstant.h" - -#include - -namespace WallpaperEngine::Core::Objects::Effects::Constants { -/** - * Shader constant of type float - */ -class CShaderConstantFloat : public CShaderConstant { - public: - explicit CShaderConstantFloat (float value); - - [[nodiscard]] std::string toString () const override; -}; -} // namespace WallpaperEngine::Core::Objects::Effects::Constants diff --git a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantInteger.cpp b/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantInteger.cpp deleted file mode 100644 index 766d3a3..0000000 --- a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantInteger.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "CShaderConstantInteger.h" - -using namespace WallpaperEngine::Core::Objects::Effects::Constants; - -CShaderConstantInteger::CShaderConstantInteger (int32_t value) { - this->update (value); -} - -std::string CShaderConstantInteger::toString () const { - return std::to_string (this->getInt ()); -} diff --git a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantInteger.h b/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantInteger.h deleted file mode 100644 index da70241..0000000 --- a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantInteger.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include "CShaderConstant.h" - -#include - -namespace WallpaperEngine::Core::Objects::Effects::Constants { -/** - * Shader constant of type integer - */ -class CShaderConstantInteger : public CShaderConstant { - public: - explicit CShaderConstantInteger (int32_t value); - - [[nodiscard]] std::string toString () const override; -}; -} // namespace WallpaperEngine::Core::Objects::Effects::Constants diff --git a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantProperty.cpp b/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantProperty.cpp deleted file mode 100644 index 18fbc99..0000000 --- a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantProperty.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "WallpaperEngine/Core/DynamicValues/CDynamicValue.h" -#include "CShaderConstantProperty.h" - -using namespace WallpaperEngine::Core::Objects::Effects::Constants; - -CShaderConstantProperty::CShaderConstantProperty (const std::shared_ptr & property) { - property->connectOutgoing (this); -} - -std::string CShaderConstantProperty::toString () const { - return "no string representation yet!"; -} diff --git a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantProperty.h b/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantProperty.h deleted file mode 100644 index 2ce8c86..0000000 --- a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantProperty.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include "WallpaperEngine/Core/Projects/CProperty.h" - -#include "CShaderConstant.h" - -#include - -namespace WallpaperEngine::Core::Objects::Effects::Constants { -using namespace WallpaperEngine::Core::Projects; -/** - * Shader constant that comes from a property - */ -class CShaderConstantProperty : public CShaderConstant { - public: - explicit CShaderConstantProperty (const std::shared_ptr & property); - - [[nodiscard]] std::string toString () const override; -}; -} // namespace WallpaperEngine::Core::Objects::Effects::Constants diff --git a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector2.cpp b/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector2.cpp deleted file mode 100644 index 28b7a35..0000000 --- a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector2.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "CShaderConstantVector2.h" - -using namespace WallpaperEngine::Core::Objects::Effects::Constants; - -CShaderConstantVector2::CShaderConstantVector2 (glm::vec2 value) { - this->update (value); -} - -std::string CShaderConstantVector2::toString () const { - std::string result = "("; - - result.append (std::to_string (this->getVec2 ().x)); - result.append (","); - result.append (std::to_string (this->getVec2 ().y)); - result.append (")"); - - return result; -} diff --git a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector2.h b/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector2.h deleted file mode 100644 index e9d6f3a..0000000 --- a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector2.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include "CShaderConstant.h" - -#include -#include -#include - -namespace WallpaperEngine::Core::Objects::Effects::Constants { -/** - * Shader constant of vector2 type - */ -class CShaderConstantVector2 : public CShaderConstant { - public: - explicit CShaderConstantVector2 (glm::vec2 value); - - [[nodiscard]] std::string toString () const override; -}; -} // namespace WallpaperEngine::Core::Objects::Effects::Constants diff --git a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector3.cpp b/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector3.cpp deleted file mode 100644 index b588d28..0000000 --- a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector3.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "CShaderConstantVector3.h" - -using namespace WallpaperEngine::Core::Objects::Effects::Constants; - -CShaderConstantVector3::CShaderConstantVector3 (glm::vec3 value) { - this->update (value); -} - -std::string CShaderConstantVector3::toString () const { - std::string result = "("; - - result.append (std::to_string (this->getVec3 ().x)); - result.append (","); - result.append (std::to_string (this->getVec3 ().y)); - result.append (","); - result.append (std::to_string (this->getVec3 ().z)); - result.append (")"); - - return result; -} diff --git a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector3.h b/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector3.h deleted file mode 100644 index 693d124..0000000 --- a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector3.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "CShaderConstant.h" - -#include -#include - -namespace WallpaperEngine::Core::Objects::Effects::Constants { -/** - * Shader constant of vector3 type - */ -class CShaderConstantVector3 : public CShaderConstant { - public: - explicit CShaderConstantVector3 (glm::vec3 value); - - [[nodiscard]] std::string toString () const override; -}; -} // namespace WallpaperEngine::Core::Objects::Effects::Constants diff --git a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector4.cpp b/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector4.cpp deleted file mode 100644 index 4cf2ee1..0000000 --- a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector4.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "CShaderConstantVector4.h" - -using namespace WallpaperEngine::Core::Objects::Effects::Constants; - -CShaderConstantVector4::CShaderConstantVector4 (glm::vec4 value) { - this->update (value); -} - -std::string CShaderConstantVector4::toString () const { - std::string result = "("; - - result.append (std::to_string (this->getVec4 ().x)); - result.append (","); - result.append (std::to_string (this->getVec4 ().y)); - result.append (","); - result.append (std::to_string (this->getVec4 ().z)); - result.append (","); - result.append (std::to_string (this->getVec4 ().w)); - result.append (")"); - - return result; -} diff --git a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector4.h b/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector4.h deleted file mode 100644 index 119662d..0000000 --- a/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector4.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "CShaderConstant.h" - -#include -#include - -namespace WallpaperEngine::Core::Objects::Effects::Constants { -/** - * Shader constant of vector4 type - */ -class CShaderConstantVector4 : public CShaderConstant { - public: - explicit CShaderConstantVector4 (glm::vec4 value); - - [[nodiscard]] std::string toString () const override; -}; -} // namespace WallpaperEngine::Core::Objects::Effects::Constants diff --git a/src/WallpaperEngine/Core/Objects/Particles/CControlPoint.cpp b/src/WallpaperEngine/Core/Objects/Particles/CControlPoint.cpp deleted file mode 100644 index 586bf3a..0000000 --- a/src/WallpaperEngine/Core/Objects/Particles/CControlPoint.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "CControlPoint.h" - -using namespace WallpaperEngine::Core::Objects::Particles; - -const CControlPoint* CControlPoint::fromJSON (const json& data) { - return new CControlPoint ( - jsonFindRequired (data, "id", "Particle's control point must have id"), - jsonFindDefault (data, "flags", 0), - jsonFindDefault (data, "offset", glm::vec3()) - ); -} - -CControlPoint::CControlPoint (uint32_t id, uint32_t flags, glm::vec3 offset) : - m_id (id), - m_flags (flags), - m_offset (offset) {} - -uint32_t CControlPoint::getId () const { - return this->m_id; -} - -const glm::vec3& CControlPoint::getOffset () const { - return this->m_offset; -} - -uint32_t CControlPoint::getFlags () const { - return this->m_flags; -} \ No newline at end of file diff --git a/src/WallpaperEngine/Core/Objects/Particles/CControlPoint.h b/src/WallpaperEngine/Core/Objects/Particles/CControlPoint.h deleted file mode 100644 index 734c714..0000000 --- a/src/WallpaperEngine/Core/Objects/Particles/CControlPoint.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include "WallpaperEngine/Core/Core.h" - -namespace WallpaperEngine::Core::Objects::Particles { -using json = nlohmann::json; - -/** - * Control point for particles - */ -class CControlPoint { - public: - static const CControlPoint* fromJSON (const json& data); - - /** - * @return The id of the controlpoint used for ordering purposes - */ - [[nodiscard]] uint32_t getId () const; - /** - * @return The offset from origin - */ - [[nodiscard]] const glm::vec3& getOffset () const; - /** - * @return Flags for the control point, controls how it should behave - */ - [[nodiscard]] uint32_t getFlags () const; - - protected: - explicit CControlPoint (uint32_t id, uint32_t flags, glm::vec3 offset); - - private: - /** ID used for ordering purposes */ - const uint32_t m_id; - /** Flags that control how it behaves */ - const uint32_t m_flags; - /** The offset from starting position */ - const glm::vec3 m_offset; -}; -} // namespace WallpaperEngine::Core::Objects::Particles diff --git a/src/WallpaperEngine/Core/Objects/Particles/CEmitter.cpp b/src/WallpaperEngine/Core/Objects/Particles/CEmitter.cpp deleted file mode 100644 index d067c46..0000000 --- a/src/WallpaperEngine/Core/Objects/Particles/CEmitter.cpp +++ /dev/null @@ -1,75 +0,0 @@ -#include "CEmitter.h" - -#include - -using namespace WallpaperEngine::Core::Objects::Particles; - -const CEmitter* CEmitter::fromJSON (const json& data) { - const auto distancemax_it = jsonFindRequired (data, "distancemax", "Particle emitter must have maximum distance"); - const auto distancemin_it = jsonFindRequired (data, "distancemin", "Particle emitter must have minimum distance"); - - auto distancemin = glm::vec3(0); - auto distancemax = glm::vec3(0); - - if (distancemin_it->is_number()) { - distancemin = glm::vec3(static_cast(*distancemin_it)); - } else { - distancemin = WallpaperEngine::Core::aToVector3(*distancemin_it); - } - - if (distancemax_it->is_number()) { - distancemax = glm::vec3(static_cast(*distancemax_it)); - } else { - distancemax = WallpaperEngine::Core::aToVector3(*distancemax_it); - } - - return new CEmitter ( - jsonFindRequired (data, "directions", "Particle emitter must have direction specified"), - distancemax, - distancemin, - jsonFindDefault (data, "id", 0), - jsonFindRequired (data, "name", "Particle emitter must have a name"), - jsonFindRequired (data, "origin", "Particle emitter must have an origin"), - jsonFindRequired (data, "rate", "Particle emitter must have a rate") - ); -} - -CEmitter::CEmitter ( - glm::vec3 directions, glm::vec3 distancemax, glm::vec3 distancemin, uint32_t id, std::string name, glm::vec3 origin, - double rate -) : - m_directions (directions), - m_distancemax (distancemax), - m_distancemin (distancemin), - m_id (id), - m_name (std::move(name)), - m_origin (origin), - m_rate (rate) {} - -uint32_t CEmitter::getId () const { - return this->m_id; -} - -const std::string& CEmitter::getName () const { - return this->m_name; -} - -const glm::vec3& CEmitter::getDistanceMax () const { - return this->m_distancemax; -} - -const glm::vec3& CEmitter::getDistanceMin () const { - return this->m_distancemin; -} - -const glm::vec3& CEmitter::getDirections () const { - return this->m_directions; -} - -const glm::vec3& CEmitter::getOrigin () const { - return this->m_origin; -} - -const double CEmitter::getRate () const { - return this->m_rate; -} \ No newline at end of file diff --git a/src/WallpaperEngine/Core/Objects/Particles/CEmitter.h b/src/WallpaperEngine/Core/Objects/Particles/CEmitter.h deleted file mode 100644 index c96cd3b..0000000 --- a/src/WallpaperEngine/Core/Objects/Particles/CEmitter.h +++ /dev/null @@ -1,65 +0,0 @@ -#pragma once - -#include "WallpaperEngine/Core/Core.h" - -namespace WallpaperEngine::Core::Objects::Particles { -using json = nlohmann::json; - -/** - * Particle emitter, controls the area where the particles have to be created - */ -class CEmitter { - public: - static const CEmitter* fromJSON (const json& data); - - /** - * @return The ID of the emitter - */ - [[nodiscard]] uint32_t getId () const; - /** - * @return The name of the emitter, indicates what type of emission to do - */ - [[nodiscard]] const std::string& getName () const; - /** - * @return The maximum distance a particle can travel before being dead - */ - [[nodiscard]] const glm::vec3& getDistanceMax () const; - /** - * @return The minimum distance a particle can travel before being dead - */ - [[nodiscard]] const glm::vec3& getDistanceMin () const; - /** - * @return The direction a particle should move to - */ - [[nodiscard]] const glm::vec3& getDirections () const; - /** - * @return The center of the particle emission - */ - [[nodiscard]] const glm::vec3& getOrigin () const; - /** - * @return The rate of particle emission - */ - [[nodiscard]] const double getRate () const; - - protected: - CEmitter ( - glm::vec3 directions, glm::vec3 distancemax, glm::vec3 distancemin, uint32_t id, std::string name, - glm::vec3 origin, double rate); - - private: - /** Direction the particles should move to */ - const glm::vec3 m_directions; - /** Maximum distance before the particle is dead */ - const glm::vec3 m_distancemax; - /** Minimum distance before the particle is dead */ - const glm::vec3 m_distancemin; - /** ID of the emitter */ - const uint32_t m_id; - /** Name of the emitter, indicates the type of emitter */ - const std::string m_name; - /** The center of the emitter */ - const glm::vec3 m_origin; - /** The rate of emission */ - const double m_rate; -}; -} // namespace WallpaperEngine::Core::Objects::Particles diff --git a/src/WallpaperEngine/Core/Objects/Particles/CInitializer.cpp b/src/WallpaperEngine/Core/Objects/Particles/CInitializer.cpp deleted file mode 100644 index 5d0be86..0000000 --- a/src/WallpaperEngine/Core/Objects/Particles/CInitializer.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "CInitializer.h" - -#include - -#include "WallpaperEngine/Core/Objects/Particles/Initializers/CAlphaRandom.h" -#include "WallpaperEngine/Core/Objects/Particles/Initializers/CAngularVelocityRandom.h" -#include "WallpaperEngine/Core/Objects/Particles/Initializers/CColorRandom.h" -#include "WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.h" -#include "WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.h" -#include "WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.h" -#include "WallpaperEngine/Core/Objects/Particles/Initializers/CTurbulentVelocityRandom.h" -#include "WallpaperEngine/Core/Objects/Particles/Initializers/CVelocityRandom.h" -#include "WallpaperEngine/Logging/CLog.h" - -using namespace WallpaperEngine::Core::Objects::Particles; - -const CInitializer* CInitializer::fromJSON (const json& data) { - const auto name = jsonFindRequired (data, "name", "Particle's initializer must have a name"); - const auto id = jsonFindDefault (data, "id", 0); - - if (name == "lifetimerandom") { - return Initializers::CLifeTimeRandom::fromJSON (data, id); - } - if (name == "sizerandom") { - return Initializers::CSizeRandom::fromJSON (data, id); - } - if (name == "rotationrandom") { - return Initializers::CRotationRandom::fromJSON (data, id); - } - if (name == "velocityrandom") { - return Initializers::CVelocityRandom::fromJSON (data, id); - } - if (name == "colorrandom") { - return Initializers::CColorRandom::fromJSON (data, id); - } - if (name == "alpharandom") { - return Initializers::CAlphaRandom::fromJSON (data, id); - } - if (name == "angularvelocityrandom") { - return Initializers::CAngularVelocityRandom::fromJSON (data, id); - } - if (name == "turbulentvelocityrandom") { - return Initializers::CTurbulentVelocityRandom::fromJSON (data, id); - } - - sLog.exception ("Found unknown initializer for particles: ", name); -} - -CInitializer::CInitializer (uint32_t id, std::string name) : - m_id (id), - m_name (std::move(name)) {} - -const std::string& CInitializer::getName () const { - return this->m_name; -} - -uint32_t CInitializer::getId () const { - return this->m_id; -} \ No newline at end of file diff --git a/src/WallpaperEngine/Core/Objects/Particles/CInitializer.h b/src/WallpaperEngine/Core/Objects/Particles/CInitializer.h deleted file mode 100644 index b3884cb..0000000 --- a/src/WallpaperEngine/Core/Objects/Particles/CInitializer.h +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once - -#include "WallpaperEngine/Core/Core.h" - -namespace WallpaperEngine::Core::Objects::Particles { -using json = nlohmann::json; - -/** - * Initializer for particles, controls the different attributes a particle will have - * on emission - */ -class CInitializer { - public: - static const CInitializer* fromJSON (const json& data); - - template [[nodiscard]] const T* as () const { - if (is ()) { - return static_cast (this); - } - - throw std::bad_cast (); - } - - template [[nodiscard]] T* as () { - if (is ()) { - return static_cast (this); - } - - throw std::bad_cast (); - } - - template [[nodiscard]] bool is () const { - return typeid (*this) == typeid(T); - } - - /** - * @return The name of the particle initializer, indicates what type of initialization to do - */ - [[nodiscard]] const std::string& getName () const; - /** - * @return The id of the initializer - */ - [[nodiscard]] uint32_t getId () const; - - protected: - CInitializer (uint32_t id, std::string name); - - virtual ~CInitializer() = default; - - private: - /** ID for ordering purposes */ - const uint32_t m_id; - /** The name of the initializer, indicates what type of initialization to do */ - const std::string m_name; -}; -} // namespace WallpaperEngine::Core::Objects::Particles diff --git a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CAlphaRandom.cpp b/src/WallpaperEngine/Core/Objects/Particles/Initializers/CAlphaRandom.cpp deleted file mode 100644 index 2d33066..0000000 --- a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CAlphaRandom.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "CAlphaRandom.h" - -using namespace WallpaperEngine::Core::Objects::Particles::Initializers; - -const CAlphaRandom* CAlphaRandom::fromJSON (const json& data, uint32_t id) { - return new CAlphaRandom ( - id, - jsonFindRequired (data, "min", "Alpharandom initializer must have a minimum value"), - jsonFindRequired (data, "max", "Alpharandom initializer must have a maximum value") - ); -} - -CAlphaRandom::CAlphaRandom (uint32_t id, double min, double max) : - CInitializer (id, "alpharandom"), - m_max (max), - m_min (min) {} - -double CAlphaRandom::getMinimum () const { - return this->m_min; -} - -double CAlphaRandom::getMaximum () const { - return this->m_max; -} \ No newline at end of file diff --git a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CAlphaRandom.h b/src/WallpaperEngine/Core/Objects/Particles/Initializers/CAlphaRandom.h deleted file mode 100644 index 4c3e08b..0000000 --- a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CAlphaRandom.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include "WallpaperEngine/Core/Core.h" -#include "WallpaperEngine/Core/Objects/Particles/CInitializer.h" - -namespace WallpaperEngine::Core::Objects::Particles::Initializers { -/** - * Initializer for particles that decides the base alpha for the particles - */ -class CAlphaRandom : CInitializer { - public: - /** - * @return The minimum alpha value to be used - */ - [[nodiscard]] double getMinimum () const; - /** - * @return The maximum alpha value to be used - */ - [[nodiscard]] double getMaximum () const; - - protected: - friend class CInitializer; - - static const CAlphaRandom* fromJSON (const json& data, uint32_t id); - - CAlphaRandom (uint32_t id, double min, double max); - - private: - /** Maximum alpha */ - const double m_max; - /** Minimum alpha */ - const double m_min; -}; -} // namespace WallpaperEngine::Core::Objects::Particles::Initializers diff --git a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CAngularVelocityRandom.cpp b/src/WallpaperEngine/Core/Objects/Particles/Initializers/CAngularVelocityRandom.cpp deleted file mode 100644 index 838e90e..0000000 --- a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CAngularVelocityRandom.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "CAngularVelocityRandom.h" - -using namespace WallpaperEngine::Core::Objects::Particles::Initializers; - -const CAngularVelocityRandom* CAngularVelocityRandom::fromJSON (const json& data, uint32_t id) { - return new CAngularVelocityRandom ( - id, - jsonFindRequired (data, "min", "Angularvelocityrandom initializer must have a minimum value"), - jsonFindRequired (data, "max", "Angularvelocityrandom initializer must have a maximum value") - ); -} - -CAngularVelocityRandom::CAngularVelocityRandom (uint32_t id, glm::vec3 min, glm::vec3 max) : - CInitializer (id, "angularvelocityrandom"), - m_max (max), - m_min (min) {} - -const glm::vec3& CAngularVelocityRandom::getMinimum () const { - return this->m_min; -} - -const glm::vec3& CAngularVelocityRandom::getMaximum () const { - return this->m_max; -} \ No newline at end of file diff --git a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CAngularVelocityRandom.h b/src/WallpaperEngine/Core/Objects/Particles/Initializers/CAngularVelocityRandom.h deleted file mode 100644 index ffc99ee..0000000 --- a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CAngularVelocityRandom.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include "WallpaperEngine/Core/Core.h" -#include "WallpaperEngine/Core/Objects/Particles/CInitializer.h" - -namespace WallpaperEngine::Core::Objects::Particles::Initializers { -/** - * Initializer for particles that decides the base angular velocity for particles - */ -class CAngularVelocityRandom : CInitializer { - public: - /** - * @return Minimum angular velocity (direction * speed) - */ - [[nodiscard]] const glm::vec3& getMinimum () const; - /** - * @return Maximum angular velocity (direction * speed) - */ - [[nodiscard]] const glm::vec3& getMaximum () const; - - protected: - friend class CInitializer; - - static const CAngularVelocityRandom* fromJSON (const json& data, uint32_t id); - - CAngularVelocityRandom (uint32_t id, glm::vec3 min, glm::vec3 max); - - private: - /** Maximum velocity (direction * speed) */ - const glm::vec3 m_max; - /** Minimum velocity (direction * speed) */ - const glm::vec3 m_min; -}; -} // namespace WallpaperEngine::Core::Objects::Particles::Initializers diff --git a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CColorRandom.cpp b/src/WallpaperEngine/Core/Objects/Particles/Initializers/CColorRandom.cpp deleted file mode 100644 index e23c019..0000000 --- a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CColorRandom.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "CColorRandom.h" - -using namespace WallpaperEngine::Core::Objects::Particles::Initializers; - -const CColorRandom* CColorRandom::fromJSON (const json& data, uint32_t id) { - return new CColorRandom ( - id, - jsonFindRequired (data, "min", "Colorrandom initializer must have a minimum value"), - jsonFindRequired (data, "max", "Colorrandom initializer must have a maximum value") - ); -} - -CColorRandom::CColorRandom (uint32_t id, glm::ivec3 min, glm::ivec3 max) : - CInitializer (id, "colorrandom"), - m_max (max), - m_min (min) {} - -const glm::ivec3& CColorRandom::getMinimum () const { - return this->m_min; -} - -const glm::ivec3& CColorRandom::getMaximum () const { - return this->m_max; -} \ No newline at end of file diff --git a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CColorRandom.h b/src/WallpaperEngine/Core/Objects/Particles/Initializers/CColorRandom.h deleted file mode 100644 index b84f30b..0000000 --- a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CColorRandom.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include "WallpaperEngine/Core/Objects/Particles/CInitializer.h" - -#include "WallpaperEngine/Core/Core.h" - -namespace WallpaperEngine::Core::Objects::Particles::Initializers { -/** - * Initializer for particles that decides the base color - */ -class CColorRandom : CInitializer { - public: - /** - * @return The minimum color to use (RGB) - */ - [[nodiscard]] const glm::ivec3& getMinimum () const; - /** - * @return The maximum color to use (RGB) - */ - [[nodiscard]] const glm::ivec3& getMaximum () const; - - protected: - friend class CInitializer; - - static const CColorRandom* fromJSON (const json& data, uint32_t id); - - CColorRandom (uint32_t id, glm::ivec3 min, glm::ivec3 max); - - private: - /** Maximum color */ - const glm::ivec3 m_max; - /** Minimum color */ - const glm::ivec3 m_min; -}; -} // namespace WallpaperEngine::Core::Objects::Particles::Initializers diff --git a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.cpp b/src/WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.cpp deleted file mode 100644 index 421ca2e..0000000 --- a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "CLifeTimeRandom.h" - -using namespace WallpaperEngine::Core::Objects::Particles::Initializers; - -const CLifeTimeRandom* CLifeTimeRandom::fromJSON (const json& data, uint32_t id) { - return new CLifeTimeRandom ( - id, - jsonFindRequired (data, "min", "Lifetimerandom initializer must have a minimum value"), - jsonFindRequired (data, "max", "Lifetimerandom initializer must have a maximum value") - ); -} - -CLifeTimeRandom::CLifeTimeRandom (uint32_t id, uint32_t min, uint32_t max) : - CInitializer (id, "lifetimerandom"), - m_max (max), - m_min (min) {} - -uint32_t CLifeTimeRandom::getMinimum () const { - return this->m_min; -} - -uint32_t CLifeTimeRandom::getMaximum () const { - return this->m_max; -} \ No newline at end of file diff --git a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.h b/src/WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.h deleted file mode 100644 index efdf379..0000000 --- a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include "WallpaperEngine/Core/Objects/Particles/CInitializer.h" - -#include "WallpaperEngine/Core/Core.h" - -namespace WallpaperEngine::Core::Objects::Particles::Initializers { -/** - * Initializer for particles that decides the lifetime of each particle on startup - */ -class CLifeTimeRandom : CInitializer { - public: - /** - * @return The minimum lifetime to be used - */ - [[nodiscard]] uint32_t getMinimum () const; - /** - * @return The maximum lifetime to be used - */ - [[nodiscard]] uint32_t getMaximum () const; - - protected: - friend class CInitializer; - - static const CLifeTimeRandom* fromJSON (const json& data, uint32_t id); - - CLifeTimeRandom (uint32_t id, uint32_t min, uint32_t max); - - private: - /** Maximum lifetime */ - const uint32_t m_max; - /** Minimum lifetime */ - const uint32_t m_min; -}; -} // namespace WallpaperEngine::Core::Objects::Particles::Initializers diff --git a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.cpp b/src/WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.cpp deleted file mode 100644 index 0787bf7..0000000 --- a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#include "CRotationRandom.h" - -#include "WallpaperEngine/Core/Core.h" - -using namespace WallpaperEngine::Core::Objects::Particles::Initializers; - -const CRotationRandom* CRotationRandom::fromJSON (const json& data, uint32_t id) { - const auto min_it = data.find ("minVector"); - const auto max_it = data.find ("max"); - - glm::vec3 minVector = glm::vec3 (); - glm::vec3 maxVector = glm::vec3 (); - double minNumber = 0.0f; - double maxNumber = 0.0f; - bool isMinVector = false; - bool isMaxVector = false; - - if (min_it != data.end () && min_it->is_string ()) { - minVector = WallpaperEngine::Core::aToVector3 (*min_it); - isMinVector = true; - } else if (min_it != data.end () && min_it->is_number ()) { - minNumber = *min_it; - isMinVector = false; - } - - if (max_it != data.end () && max_it->is_string ()) { - maxVector = WallpaperEngine::Core::aToVector3 (*max_it); - isMaxVector = true; - } else if (max_it != data.end () && max_it->is_number ()) { - maxNumber = *max_it; - isMaxVector = false; - } - - return new CRotationRandom (id, minVector, minNumber, isMinVector, maxVector, maxNumber, isMaxVector); -} - -CRotationRandom::CRotationRandom (uint32_t id, glm::vec3 minVector, double minNumber, bool isMinimumVector, - glm::vec3 maxVector, double maxNumber, bool isMaximumVector) : - CInitializer (id, "rotationrandom"), - m_maxVector (maxVector), - m_maxNumber (maxNumber), - m_minVector (minVector), - m_minNumber (minNumber), - m_isMinimumVector (isMinimumVector), - m_isMaximumVector (isMaximumVector) {} - -glm::vec3 CRotationRandom::getMinimumVector () const { - return this->m_minVector; -} - -glm::vec3 CRotationRandom::getMaximumVector () const { - return this->m_maxVector; -} - -double CRotationRandom::getMinimumNumber () const { - return this->m_minNumber; -} - -double CRotationRandom::getMaximumNumber () const { - return this->m_maxNumber; -} - -bool CRotationRandom::isMinimumVector () const { - return this->m_isMinimumVector; -} - -bool CRotationRandom::isMinimumNumber () const { - return !this->m_isMinimumVector; -} - -bool CRotationRandom::isMaximumVector () const { - return this->m_isMaximumVector; -} - -bool CRotationRandom::isMaximumNumber () const { - return !this->m_isMaximumVector; -} \ No newline at end of file diff --git a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.h b/src/WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.h deleted file mode 100644 index cc5d2ff..0000000 --- a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.h +++ /dev/null @@ -1,70 +0,0 @@ -#pragma once - -#include "WallpaperEngine/Core/Objects/Particles/CInitializer.h" - -#include - -namespace WallpaperEngine::Core::Objects::Particles::Initializers { -/** - * Initializer for particles that decides the base rotation for the particles - */ -class CRotationRandom : CInitializer { - public: - /** - * @return The minimum rotation in vector format if available - */ - [[nodiscard]] glm::vec3 getMinimumVector () const; - /** - * @return The maximum rotation in vector format if available - */ - [[nodiscard]] glm::vec3 getMaximumVector () const; - /** - * @return The minimum rotation in angle format if available - */ - [[nodiscard]] double getMinimumNumber () const; - /** - * @return The maximum rotation in angle format if available - */ - [[nodiscard]] double getMaximumNumber () const; - - /** - * @return Indicates if the minimum rotation is a vector - */ - [[nodiscard]] bool isMinimumVector () const; - /** - * @return Indicates if the minimum rotation is an angle - */ - [[nodiscard]] bool isMinimumNumber () const; - /** - * @return Indicates if the maximum rotation is a vector - */ - [[nodiscard]] bool isMaximumVector () const; - /** - * @return Indicates if the maximum rotation is an angle - */ - [[nodiscard]] bool isMaximumNumber () const; - - protected: - friend class CInitializer; - - static const CRotationRandom* fromJSON (const json& data, uint32_t id); - - CRotationRandom (uint32_t id, glm::vec3 minVector, double minNumber, bool isMinimumVector, glm::vec3 maxVector, - double maxNumber, bool isMaximumVector); - - private: - /** Maximum rotation vector */ - const glm::vec3 m_maxVector; - /** Maximum rotation angle */ - const double m_maxNumber; - /** Minimum rotation vector */ - const glm::vec3 m_minVector; - /** Minimum rotation angle */ - const double m_minNumber; - - /** If minimum is a vector */ - const bool m_isMinimumVector; - /** If maximum is a vector */ - const bool m_isMaximumVector; -}; -} // namespace WallpaperEngine::Core::Objects::Particles::Initializers diff --git a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.cpp b/src/WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.cpp deleted file mode 100644 index 191ff37..0000000 --- a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "CSizeRandom.h" - -using namespace WallpaperEngine::Core::Objects::Particles::Initializers; - -const CSizeRandom* CSizeRandom::fromJSON (const json& data, uint32_t id) { - return new CSizeRandom ( - id, - jsonFindRequired (data, "min", "Sizerandom initializer must have a minimum value"), - jsonFindRequired (data, "max", "Sizerandom initializer must have a maximum value") - ); -} - -CSizeRandom::CSizeRandom (uint32_t id, uint32_t min, uint32_t max) : - CInitializer (id, "sizerandom"), - m_max (max), - m_min (min) {} - -uint32_t CSizeRandom::getMinimum () const { - return this->m_min; -} - -uint32_t CSizeRandom::getMaximum () const { - return this->m_max; -} \ No newline at end of file diff --git a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.h b/src/WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.h deleted file mode 100644 index a398760..0000000 --- a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include "WallpaperEngine/Core/Objects/Particles/CInitializer.h" - -#include "WallpaperEngine/Core/Core.h" - -namespace WallpaperEngine::Core::Objects::Particles::Initializers { -/** - * Initializer for particles that decides the base size for the particles - */ -class CSizeRandom : CInitializer { - public: - /** - * @return The minimum size to be used - */ - [[nodiscard]] uint32_t getMinimum () const; - /** - * @return The maximum size to be used - */ - [[nodiscard]] uint32_t getMaximum () const; - - protected: - friend class CInitializer; - - static const CSizeRandom* fromJSON (const json& data, uint32_t id); - - CSizeRandom (uint32_t id, uint32_t min, uint32_t max); - - private: - /** Maximum size */ - const uint32_t m_max; - /** Minimum size */ - const uint32_t m_min; -}; -} // namespace WallpaperEngine::Core::Objects::Particles::Initializers diff --git a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CTurbulentVelocityRandom.cpp b/src/WallpaperEngine/Core/Objects/Particles/Initializers/CTurbulentVelocityRandom.cpp deleted file mode 100644 index 40c92fb..0000000 --- a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CTurbulentVelocityRandom.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include "CTurbulentVelocityRandom.h" - -#include "WallpaperEngine/Core/Core.h" -#include "WallpaperEngine/Logging/CLog.h" - -using namespace WallpaperEngine::Core::Objects::Particles::Initializers; - -const CTurbulentVelocityRandom* CTurbulentVelocityRandom::fromJSON (const json& data, uint32_t id) { - return new CTurbulentVelocityRandom ( - id, - jsonFindRequired (data, "phasemax", "TurbulentVelocityRandom initializer must have a phasemax value"), - jsonFindRequired (data, "scale", "TurbulentVelocityRandom initializer must have a scale value"), - jsonFindRequired (data, "timescale", "TurbulentVelocityRandom initializer must have a timescale value"), - jsonFindRequired (data, "speedmin", "TurbulentVelocityRandom initializer must have a minimum speed value"), - jsonFindRequired (data, "speedmax", "TurbulentVelocityRandom initializer must have a maximum speed value") - ); -} - -CTurbulentVelocityRandom::CTurbulentVelocityRandom (uint32_t id, double phasemax, double scale, double timescale, - uint32_t speedmin, uint32_t speedmax) : - CInitializer (id, "turbulentvelocityrandom"), - m_phasemax (phasemax), - m_scale (scale), - m_timescale (timescale), - m_speedmin (speedmin), - m_speedmax (speedmax) {} - -double CTurbulentVelocityRandom::getPhaseMax () const { - return this->m_phasemax; -} - -double CTurbulentVelocityRandom::getScale () const { - return this->m_scale; -} - -double CTurbulentVelocityRandom::getTimeScale () const { - return this->m_timescale; -} - -uint32_t CTurbulentVelocityRandom::getMinimumSpeed () const { - return this->m_speedmin; -} - -uint32_t CTurbulentVelocityRandom::getMaximumSpeed () const { - return this->m_speedmax; -} diff --git a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CTurbulentVelocityRandom.h b/src/WallpaperEngine/Core/Objects/Particles/Initializers/CTurbulentVelocityRandom.h deleted file mode 100644 index e1d2293..0000000 --- a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CTurbulentVelocityRandom.h +++ /dev/null @@ -1,54 +0,0 @@ -#pragma once - -#include "WallpaperEngine/Core/Objects/Particles/CInitializer.h" - -#include - -namespace WallpaperEngine::Core::Objects::Particles::Initializers { -/** - * Initializer for particles that decides the turbulent velocity for the particles - */ -class CTurbulentVelocityRandom : CInitializer { - public: - /** - * @return The phase to use - */ - double getPhaseMax () const; - /** - * @return The scale to use - */ - double getScale () const; - /** - * @return How time affects to the scale - */ - double getTimeScale () const; - /** - * @return The minimum speed - */ - uint32_t getMinimumSpeed () const; - /** - * @return The maximum speed - */ - uint32_t getMaximumSpeed () const; - - protected: - friend class CInitializer; - - static const CTurbulentVelocityRandom* fromJSON (const json& data, uint32_t id); - - CTurbulentVelocityRandom (uint32_t id, double phasemax, double scale, double timescale, uint32_t speedmin, - uint32_t speedmax); - - private: - /** Phase */ - const double m_phasemax; - /** Scale */ - const double m_scale; - /** Time scale, how the time affects the scale */ - const double m_timescale; - /** Minimum speed */ - const uint32_t m_speedmin; - /** Maximum speed */ - const uint32_t m_speedmax; -}; -} // namespace WallpaperEngine::Core::Objects::Particles::Initializers diff --git a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CVelocityRandom.cpp b/src/WallpaperEngine/Core/Objects/Particles/Initializers/CVelocityRandom.cpp deleted file mode 100644 index 3559850..0000000 --- a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CVelocityRandom.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "CVelocityRandom.h" - -using namespace WallpaperEngine::Core::Objects::Particles::Initializers; - -const CVelocityRandom* CVelocityRandom::fromJSON (const json& data, uint32_t id) { - return new CVelocityRandom ( - id, - jsonFindRequired (data, "min", "Velocityrandom initializer must have a minimum value"), - jsonFindRequired (data, "max", "Velocityrandom initializer must have a maximum value") - ); -} - -CVelocityRandom::CVelocityRandom (uint32_t id, glm::vec3 min, glm::vec3 max) : - CInitializer (id, "velocityrandom"), - m_max (max), - m_min (min) {} - -const glm::vec3& CVelocityRandom::getMinimum () const { - return this->m_min; -} - -const glm::vec3& CVelocityRandom::getMaximum () const { - return this->m_max; -} \ No newline at end of file diff --git a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CVelocityRandom.h b/src/WallpaperEngine/Core/Objects/Particles/Initializers/CVelocityRandom.h deleted file mode 100644 index 1fb390a..0000000 --- a/src/WallpaperEngine/Core/Objects/Particles/Initializers/CVelocityRandom.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include "WallpaperEngine/Core/Objects/Particles/CInitializer.h" - -#include "WallpaperEngine/Core/Core.h" - -namespace WallpaperEngine::Core::Objects::Particles::Initializers { -/** - * Initializer for particles that decides the base velocity for the particles - */ -class CVelocityRandom : CInitializer { - public: - /** - * @return The minimum velocity (direction * speed) - */ - [[nodiscard]] const glm::vec3& getMinimum () const; - /** - * @return The maximum velocity (direction * speed) - */ - [[nodiscard]] const glm::vec3& getMaximum () const; - - protected: - friend class CInitializer; - - static const CVelocityRandom* fromJSON (const json& data, uint32_t id); - - CVelocityRandom (uint32_t id, glm::vec3 min, glm::vec3 max); - - private: - /** Maximum velocity */ - const glm::vec3 m_max; - /** Minimum velocity */ - const glm::vec3 m_min; -}; -} // namespace WallpaperEngine::Core::Objects::Particles::Initializers diff --git a/src/WallpaperEngine/Core/UserSettings/CUserSettingBoolean.cpp b/src/WallpaperEngine/Core/UserSettings/CUserSettingBoolean.cpp deleted file mode 100644 index ba6601f..0000000 --- a/src/WallpaperEngine/Core/UserSettings/CUserSettingBoolean.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include "CUserSettingBoolean.h" - -#include -#include "WallpaperEngine/Core/Core.h" - -#include "WallpaperEngine/Core/Projects/CProperty.h" -#include "WallpaperEngine/Core/Projects/CPropertyBoolean.h" -#include "WallpaperEngine/Core/Projects/CPropertyCombo.h" -#include "WallpaperEngine/Core/Projects/CPropertySlider.h" -#include "WallpaperEngine/Core/Projects/CPropertyText.h" -#include "WallpaperEngine/Logging/CLog.h" - -using namespace WallpaperEngine::Core; -using namespace WallpaperEngine::Core::Projects; -using namespace WallpaperEngine::Core::UserSettings; - -CUserSettingBoolean::CUserSettingBoolean ( - bool hasCondition, bool defaultValue, std::shared_ptr source, std::string expectedValue -) : - CUserSettingValue (), - m_hasCondition (hasCondition), - m_source (source), - m_expectedValue (std::move(expectedValue)) { - this->update (defaultValue); - - if (this->m_source != nullptr) { - this->m_source->subscribe ([this](const Projects::CProperty* property) -> void { - if (!this->m_hasCondition) { - this->update (property->getBool ()); - } else if (property->is ()) { - this->update ( - property->as ()->translateValueToIndex (this->m_expectedValue) == property->getInt () - ); - } else { - sLog.error ("Cannot update boolean user setting for an unknown property type ", property->getType ()); - } - }); - } -} - -const CUserSettingBoolean* CUserSettingBoolean::fromJSON (const nlohmann::json& data, const std::map >& properties) { - bool hasCondition = false; - std::shared_ptr sourceProperty = nullptr; - bool defaultValue; - std::string source; - std::string expectedValue; - - if (data.is_object ()) { - auto animation = data.find ("animation"); - auto userIt = data.find ("user"); - defaultValue = jsonFindDefault (data, "value", true); // is this default value right? - - if (userIt != data.end ()) { - if (userIt->is_string ()) { - source = *userIt; - } else { - hasCondition = true; - source = jsonFindRequired (userIt, "name", "Name for conditional setting must be present"); - expectedValue = - jsonFindRequired (userIt, "condition", "Condition for conditional setting must be present"); - } - - const auto propertyIt = properties.find (source); - - if (propertyIt != properties.end ()) { - sourceProperty = propertyIt->second; - } - - if (sourceProperty == nullptr) { - sLog.error ("Cannot find property ", source, " to get value from for user setting value, using default value: ", defaultValue); - } - } else { - sLog.error ("Boolean property doesn't have user member, this could mean an scripted value"); - } - - if (animation != data.end ()) { - sLog.error ("Detected a setting with animation data, which is not supported yet!"); - } - } else { - if (!data.is_boolean ()) - sLog.error ("Expected boolean value on user setting"); - - defaultValue = data.get (); - } - - return new CUserSettingBoolean (hasCondition, defaultValue, sourceProperty, expectedValue); -} - -const CUserSettingBoolean* CUserSettingBoolean::fromScalar (const bool value) { - return new CUserSettingBoolean (false, value, nullptr, ""); -} diff --git a/src/WallpaperEngine/Core/UserSettings/CUserSettingBoolean.h b/src/WallpaperEngine/Core/UserSettings/CUserSettingBoolean.h deleted file mode 100644 index 8b6930e..0000000 --- a/src/WallpaperEngine/Core/UserSettings/CUserSettingBoolean.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -#include "CUserSettingValue.h" - -namespace WallpaperEngine::Core::Projects { -class CProperty; -} - -namespace WallpaperEngine::Core::UserSettings { -class CUserSettingBoolean : public CUserSettingValue { - public: - typedef bool data_type; - - static const CUserSettingBoolean* fromJSON (const nlohmann::json& data, const std::map >& properties); - static const CUserSettingBoolean* fromScalar (bool value); - - private: - CUserSettingBoolean ( - bool hasCondition, bool defaultValue, std::shared_ptr source, std::string expectedValue); - - const bool m_hasCondition; - const std::string m_expectedValue; - const std::shared_ptr m_source; -}; -} // namespace WallpaperEngine::Core::UserSettings \ No newline at end of file diff --git a/src/WallpaperEngine/Core/UserSettings/CUserSettingFloat.cpp b/src/WallpaperEngine/Core/UserSettings/CUserSettingFloat.cpp deleted file mode 100644 index 7e99230..0000000 --- a/src/WallpaperEngine/Core/UserSettings/CUserSettingFloat.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include "CUserSettingFloat.h" - -#include -#include "WallpaperEngine/Core/Core.h" - -#include "WallpaperEngine/Core/Projects/CProperty.h" -#include "WallpaperEngine/Core/Projects/CPropertySlider.h" -#include "WallpaperEngine/Logging/CLog.h" - -using namespace WallpaperEngine::Core; -using namespace WallpaperEngine::Core::Projects; -using namespace WallpaperEngine::Core::UserSettings; - -CUserSettingFloat::CUserSettingFloat ( - bool hasCondition, float defaultValue, std::shared_ptr source, std::string expectedValue -) : - CUserSettingValue (), - m_default (defaultValue), - m_hasCondition (hasCondition), - m_source (source), - m_expectedValue (std::move(expectedValue)) { - this->update (defaultValue); - - if (this->m_source != nullptr) { - this->m_source->subscribe ([this](const Projects::CProperty* property) -> void { - if (!this->m_hasCondition) { - this->update (property->getFloat ()); - } else { - sLog.error ("Don't know how to check for condition on a float property... Expected value: ", this->m_expectedValue); - } - }); - } -} - -const CUserSettingFloat* CUserSettingFloat::fromJSON (const nlohmann::json& data, const std::map >& properties) { - float defaultValue; - std::string source; - std::string expectedValue; - bool hasCondition = false; - std::shared_ptr sourceProperty = nullptr; - - if (data.is_object ()) { - auto animation = data.find ("animation"); - auto userIt = data.find ("user"); - defaultValue = jsonFindDefault (data, "value", 1.0f); // is this default value right? - - if (userIt != data.end ()) { - if (userIt->is_string ()) { - source = *userIt; - } else { - hasCondition = true; - source = jsonFindRequired (userIt, "name", "Name for conditional setting must be present"); - expectedValue = - jsonFindRequired (userIt, "condition", "Condition for conditional setting must be present"); - } - - const auto propertyIt = properties.find (source); - - if (propertyIt != properties.end ()) { - sourceProperty = propertyIt->second; - } - - if (sourceProperty == nullptr) { - sLog.error ("Cannot find property ", source, " to get value from for user setting value, using default value: ", defaultValue); - } - - if (animation != data.end ()) { - sLog.error ("Detected a setting with animation data, which is not supported yet!"); - } - } else { - sLog.error ("Float property doesn't have user member, this could mean an scripted value"); - } - } else { - if (!data.is_number ()) - sLog.exception ("Expected numeric value on user settings"); - - defaultValue = data.get (); - } - - return new CUserSettingFloat (hasCondition, defaultValue, sourceProperty, expectedValue); -} - -const CUserSettingFloat* CUserSettingFloat::fromScalar (const float value) { - return new CUserSettingFloat (false, value, nullptr, ""); -} diff --git a/src/WallpaperEngine/Core/UserSettings/CUserSettingFloat.h b/src/WallpaperEngine/Core/UserSettings/CUserSettingFloat.h deleted file mode 100644 index eea2fa1..0000000 --- a/src/WallpaperEngine/Core/UserSettings/CUserSettingFloat.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include "CUserSettingValue.h" - -namespace WallpaperEngine::Core::Projects { -class CProperty; -} - -namespace WallpaperEngine::Core::UserSettings { -class CUserSettingFloat : public CUserSettingValue { - public: - typedef float data_type; - - static const CUserSettingFloat* fromJSON (const nlohmann::json& data, const std::map >& properties); - static const CUserSettingFloat* fromScalar (float value); - - private: - CUserSettingFloat ( - bool hasCondition, float defaultValue, std::shared_ptr source, std::string expectedValue); - - const double m_default; - const bool m_hasCondition; - const std::shared_ptr m_source; - const std::string m_expectedValue; -}; -} // namespace WallpaperEngine::Core::UserSettings \ No newline at end of file diff --git a/src/WallpaperEngine/Core/UserSettings/CUserSettingValue.cpp b/src/WallpaperEngine/Core/UserSettings/CUserSettingValue.cpp deleted file mode 100644 index 5bcb172..0000000 --- a/src/WallpaperEngine/Core/UserSettings/CUserSettingValue.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "CUserSettingValue.h" - -#include - -using namespace WallpaperEngine::Core::UserSettings; diff --git a/src/WallpaperEngine/Core/UserSettings/CUserSettingValue.h b/src/WallpaperEngine/Core/UserSettings/CUserSettingValue.h deleted file mode 100644 index 90ee8f7..0000000 --- a/src/WallpaperEngine/Core/UserSettings/CUserSettingValue.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include - -#include "WallpaperEngine/Core/DynamicValues/CDynamicValue.h" - -namespace WallpaperEngine::Core::UserSettings { -using namespace WallpaperEngine::Core::DynamicValues; - -class CUserSettingValue : public CDynamicValue { - public: - template [[nodiscard]] const T* as () const { - if (is ()) { - return static_cast (this); - } - - throw std::bad_cast (); - } - - template [[nodiscard]] T* as () { - if (is ()) { - return static_cast (this); - } - - throw std::bad_cast (); - } - - template [[nodiscard]] bool is () const { - return typeid (*this) == typeid(T); - } - - protected: - virtual ~CUserSettingValue() = default; -}; -} // namespace WallpaperEngine::Core::UserSettings diff --git a/src/WallpaperEngine/Core/UserSettings/CUserSettingVector3.cpp b/src/WallpaperEngine/Core/UserSettings/CUserSettingVector3.cpp deleted file mode 100644 index a1c7659..0000000 --- a/src/WallpaperEngine/Core/UserSettings/CUserSettingVector3.cpp +++ /dev/null @@ -1,86 +0,0 @@ -#include "CUserSettingVector3.h" - -#include -#include "WallpaperEngine/Core/Core.h" - -#include "WallpaperEngine/Core/Projects/CProperty.h" -#include "WallpaperEngine/Core/Projects/CPropertyColor.h" -#include "WallpaperEngine/Core/Projects/CPropertySlider.h" -#include "WallpaperEngine/Logging/CLog.h" - -using namespace WallpaperEngine::Core; -using namespace WallpaperEngine::Core::Projects; -using namespace WallpaperEngine::Core::UserSettings; - -CUserSettingVector3::CUserSettingVector3 ( - bool hasCondition, glm::vec3 defaultValue, std::shared_ptr source, std::string expectedValue -) : - CUserSettingValue (), - m_hasCondition (hasCondition), - m_source (source), - m_expectedValue (std::move(expectedValue)) { - this->update (defaultValue); - - if (this->m_source != nullptr) { - this->m_source->subscribe ([this](const Projects::CProperty* property) -> void { - if (this->m_hasCondition) { - sLog.error ("Don't know how to check for condition on a float property... Expected value: ", this->m_expectedValue); - return; - } - - this->update (property->getVec3 ()); - }); - } -} - -const CUserSettingVector3* CUserSettingVector3::fromJSON (const nlohmann::json& data, const std::map >& properties) { - bool hasCondition = false; - std::shared_ptr sourceProperty = nullptr; - glm::vec3 defaultValue; - std::string source; - std::string expectedValue; - - if (data.is_object ()) { - auto animation = data.find ("animation"); - auto userIt = data.find ("user"); - defaultValue = jsonFindDefault (data, "value", glm::vec3()); // is this default value right? - - if (userIt != data.end ()) { - if (userIt->is_string ()) { - source = *userIt; - } else { - hasCondition = true; - source = jsonFindRequired (userIt, "name", "Name for conditional setting must be present"); - expectedValue = - jsonFindRequired (userIt, "condition", "Condition for conditional setting must be present"); - } - - const auto propertyIt = properties.find (source); - - if (propertyIt != properties.end ()) { - sourceProperty = propertyIt->second; - } - - if (sourceProperty == nullptr) { - sLog.error ("Cannot find property ", source, " to get value from for user setting value, using default value: (", defaultValue.x, ",", defaultValue.y, ",", defaultValue.z, ")"); - } - } else { - sLog.error ("Vector property doesn't have user member, this could mean an scripted value"); - } - - if (animation != data.end ()) { - sLog.error ("Detected a setting with animation data, which is not supported yet!"); - } - } else { - if (!data.is_string ()) - sLog.exception ("Expected vector value on user settings"); - - defaultValue = WallpaperEngine::Core::aToColorf (data.get ().c_str ()); - } - - return new CUserSettingVector3 (hasCondition, defaultValue, sourceProperty, expectedValue); -} - -const CUserSettingVector3* CUserSettingVector3::fromScalar (const glm::vec3 value) { - return new CUserSettingVector3 (false, value, nullptr, ""); -} diff --git a/src/WallpaperEngine/Core/UserSettings/CUserSettingVector3.h b/src/WallpaperEngine/Core/UserSettings/CUserSettingVector3.h deleted file mode 100644 index 992c461..0000000 --- a/src/WallpaperEngine/Core/UserSettings/CUserSettingVector3.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -#include - -#include "CUserSettingValue.h" - -namespace WallpaperEngine::Core::Projects { -class CProperty; -} - -namespace WallpaperEngine::Core::UserSettings { -class CUserSettingVector3 : public CUserSettingValue { - public: - typedef glm::vec3 data_type; - - static const CUserSettingVector3* fromJSON (const nlohmann::json& data, const std::map >& properties); - static const CUserSettingVector3* fromScalar (glm::vec3 value); - - private: - CUserSettingVector3 ( - bool hasCondition, glm::vec3 defaultValue, std::shared_ptr source, - std::string expectedValue); - - const bool m_hasCondition; - const std::shared_ptr m_source; - const std::string m_expectedValue; -}; -} // namespace WallpaperEngine::Core::UserSettings \ No newline at end of file diff --git a/src/WallpaperEngine/Data/Builders/UserSettingBuilder.h b/src/WallpaperEngine/Data/Builders/UserSettingBuilder.h index fbd63c9..bc5dfe5 100644 --- a/src/WallpaperEngine/Data/Builders/UserSettingBuilder.h +++ b/src/WallpaperEngine/Data/Builders/UserSettingBuilder.h @@ -8,12 +8,12 @@ using namespace WallpaperEngine::Data::Model; class UserSettingBuilder { public: template - static UserSettingSharedPtr fromValue (T defaultValue) { + static UserSettingUniquePtr fromValue (T defaultValue) { DynamicValueUniquePtr value = std::make_unique (); value->update (defaultValue); - return std::make_shared (UserSetting { + return std::make_unique (UserSetting { .value = std::move (value), .property = PropertyWeakPtr (), .condition = std::nullopt, diff --git a/src/WallpaperEngine/Data/Dumpers/StringPrinter.cpp b/src/WallpaperEngine/Data/Dumpers/StringPrinter.cpp index 3e544a0..3a52b04 100644 --- a/src/WallpaperEngine/Data/Dumpers/StringPrinter.cpp +++ b/src/WallpaperEngine/Data/Dumpers/StringPrinter.cpp @@ -191,7 +191,7 @@ void StringPrinter::printImageEffectPassOverride (const ImageEffectPassOverride& for (const auto& constant : imageEffectPass.constants) { this->lineEnd (); - this->m_out << "Constant " << constant.first << "=" << constant.second->toString(); + this->m_out << "Constant " << constant.first << "=" << constant.second->value->toString(); } this->decreaseIndentation (); diff --git a/src/WallpaperEngine/Data/JSON.cpp b/src/WallpaperEngine/Data/JSON.cpp index 41848c1..4371890 100644 --- a/src/WallpaperEngine/Data/JSON.cpp +++ b/src/WallpaperEngine/Data/JSON.cpp @@ -5,7 +5,7 @@ using namespace WallpaperEngine::Data::JSON; using namespace WallpaperEngine::Data::Model; -UserSettingSharedPtr JsonExtensions::user (const std::string& key, const Properties& properties) const { +UserSettingUniquePtr JsonExtensions::user (const std::string& key, const Properties& properties) const { const auto value = this->require (key, "User setting without default value must be present"); return UserSettingParser::parse (value, properties); diff --git a/src/WallpaperEngine/Data/JSON.h b/src/WallpaperEngine/Data/JSON.h index f3dc81d..b3564c3 100644 --- a/src/WallpaperEngine/Data/JSON.h +++ b/src/WallpaperEngine/Data/JSON.h @@ -130,9 +130,9 @@ class JsonExtensions { return (*it); } - [[nodiscard]] UserSettingSharedPtr user (const std::string& key, const Properties& properties) const; + [[nodiscard]] UserSettingUniquePtr user (const std::string& key, const Properties& properties) const; template - [[nodiscard]] UserSettingSharedPtr user (const std::string& key, const Properties& properties, T defaultValue) const { + [[nodiscard]] UserSettingUniquePtr user (const std::string& key, const Properties& properties, T defaultValue) const { const auto value = this->optional (key); if (!value.has_value ()) { diff --git a/src/WallpaperEngine/Data/Model/Types.h b/src/WallpaperEngine/Data/Model/Types.h index 20a7f43..2b1c101 100644 --- a/src/WallpaperEngine/Data/Model/Types.h +++ b/src/WallpaperEngine/Data/Model/Types.h @@ -4,13 +4,6 @@ #include "WallpaperEngine/Assets/CContainer.h" #include "WallpaperEngine/Core/DynamicValues/CDynamicValue.h" -#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.h" -#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantProperty.h" -#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.h" -#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantInteger.h" -#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector2.h" -#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector3.h" -#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector4.h" #include "WallpaperEngine/Core/Projects/CProperty.h" namespace WallpaperEngine::Data::Model { @@ -35,13 +28,6 @@ struct ModelStruct; // TODO: REMOVE ONCE THESE ARE RENAMED AND MOVED using Container = WallpaperEngine::Assets::CContainer; -using ShaderConstant = WallpaperEngine::Core::Objects::Effects::Constants::CShaderConstant; -using ShaderConstantProperty = WallpaperEngine::Core::Objects::Effects::Constants::CShaderConstantProperty; -using ShaderConstantFloat = WallpaperEngine::Core::Objects::Effects::Constants::CShaderConstantFloat; -using ShaderConstantInteger = WallpaperEngine::Core::Objects::Effects::Constants::CShaderConstantInteger; -using ShaderConstantVector2 = WallpaperEngine::Core::Objects::Effects::Constants::CShaderConstantVector2; -using ShaderConstantVector3 = WallpaperEngine::Core::Objects::Effects::Constants::CShaderConstantVector3; -using ShaderConstantVector4 = WallpaperEngine::Core::Objects::Effects::Constants::CShaderConstantVector4; using Property = WallpaperEngine::Core::Projects::CProperty; using PropertySharedPtr = std::shared_ptr ; @@ -52,11 +38,11 @@ using DynamicValueUniquePtr = std::unique_ptr ; using DynamicValueSharedPtr = std::shared_ptr ; using DynamicValueWeakPtr = std::weak_ptr ; using UserSettingSharedPtr = std::shared_ptr ; +using UserSettingUniquePtr = std::unique_ptr ; using UserSettingWeakPtr = std::weak_ptr ; -using ShaderConstantUniquePtr = std::unique_ptr ; // TODO: UP TO THIS POINT -using ShaderConstantMap = std::map ; +using ShaderConstantMap = std::map ; using ProjectUniquePtr = std::unique_ptr ; using WallpaperUniquePtr = std::unique_ptr ; diff --git a/src/WallpaperEngine/Data/Model/UserSetting.h b/src/WallpaperEngine/Data/Model/UserSetting.h index 82612b9..ce3f46b 100644 --- a/src/WallpaperEngine/Data/Model/UserSetting.h +++ b/src/WallpaperEngine/Data/Model/UserSetting.h @@ -27,5 +27,6 @@ struct UserSetting { PropertyWeakPtr property; /** Condition required for this setting, this should be possible to run in JS' V8 */ std::optional condition; + /** TODO: Value might come from a script and not have conditions, implement this later */ }; } // namespace WallpaperEngine::Data::Model \ No newline at end of file diff --git a/src/WallpaperEngine/Data/Model/Wallpaper.h b/src/WallpaperEngine/Data/Model/Wallpaper.h index 0717e56..327fff5 100644 --- a/src/WallpaperEngine/Data/Model/Wallpaper.h +++ b/src/WallpaperEngine/Data/Model/Wallpaper.h @@ -44,7 +44,7 @@ struct SceneData { struct { glm::vec3 ambient; glm::vec3 skylight; - UserSettingSharedPtr clear; + UserSettingUniquePtr clear; } colors; /** * Camera configuration @@ -60,11 +60,11 @@ struct SceneData { */ struct { /** If bloom is enabled or not */ - UserSettingSharedPtr enabled; + UserSettingUniquePtr enabled; /** Bloom's strength to pass onto the shader */ - UserSettingSharedPtr strength; + UserSettingUniquePtr strength; /** Bloom's threshold to pass onto the shader */ - UserSettingSharedPtr threshold; + UserSettingUniquePtr threshold; } bloom; /** * Parallax effect configuration diff --git a/src/WallpaperEngine/Data/Parsers/ShaderConstantParser.cpp b/src/WallpaperEngine/Data/Parsers/ShaderConstantParser.cpp index 5e2c01b..066a330 100644 --- a/src/WallpaperEngine/Data/Parsers/ShaderConstantParser.cpp +++ b/src/WallpaperEngine/Data/Parsers/ShaderConstantParser.cpp @@ -1,5 +1,6 @@ #include "ShaderConstantParser.h" +#include "WallpaperEngine/Data/Parsers/UserSettingParser.h" #include "WallpaperEngine/Data/Model/Project.h" using namespace WallpaperEngine::Data::Parsers; @@ -10,68 +11,11 @@ ShaderConstantMap ShaderConstantParser::parse (const JSON& it, Project& project) return {}; } - std::map result = {}; + ShaderConstantMap result = {}; for (const auto& cur : it.items ()) { - result.emplace (cur.key(), parseConstant (cur.value(), project)); + result.emplace (cur.key(), UserSettingParser::parse (cur.value(), project.properties)); } return result; } - -ShaderConstantUniquePtr ShaderConstantParser::parseConstant (const JSON& it, Project& project) { - ShaderConstant* constant = nullptr; - auto valueIt = it; - - if (it.is_object ()) { - auto user = it.find ("user"); - auto value = it.find ("value"); - - if (user == it.end () && value == it.end ()) { - sLog.error (R"(Found object for shader constant without "value" and "user" setting)"); - return ShaderConstantUniquePtr (constant); - } - - if (user != it.end () && user->is_string ()) { - const auto& properties = project.properties; - const auto& propertyIt = properties.find (*user); - - if (propertyIt != properties.end ()) { - constant = new ShaderConstantProperty (propertyIt->second); - } else { - sLog.error ("Shader constant pointing to non-existant project property: ", user->get ()); - } - } else { - valueIt = *value; - } - } - - // TODO: REFACTOR THIS, SAME OLD THING WE HAD BEFORE, THESE SHADERCONSTANT CLASSES HAVE TO GO AND WE SHOULD HAVE JUST ONE - if (constant == nullptr) { - if (valueIt.is_number_float ()) { - constant = new ShaderConstantFloat (valueIt); - } else if (valueIt.is_number_integer ()) { - constant = new ShaderConstantInteger (valueIt); - } else if (valueIt.is_string ()) { - // TODO: USE VECTOR PARSER HERE? MAKE USE OF CDYNAMICVALUE FOR SHADERCONSTANTS TOO - - // count the number of spaces to determine which type of vector we have - std::string value = valueIt; - - size_t spaces = - std::count_if (value.begin (), value.end (), [&] (const auto& item) { return item == ' '; }); - - if (spaces == 1) { - constant = new ShaderConstantVector2 (valueIt); - } else if (spaces == 2) { - constant = new ShaderConstantVector3 (valueIt); - } else if (spaces == 3) { - constant = new ShaderConstantVector4 (valueIt); - } else { - sLog.exception ("unknown shader constant type ", value); - } - } - } - - return ShaderConstantUniquePtr (constant); -} \ No newline at end of file diff --git a/src/WallpaperEngine/Data/Parsers/ShaderConstantParser.h b/src/WallpaperEngine/Data/Parsers/ShaderConstantParser.h index 2911131..c02edd7 100644 --- a/src/WallpaperEngine/Data/Parsers/ShaderConstantParser.h +++ b/src/WallpaperEngine/Data/Parsers/ShaderConstantParser.h @@ -10,6 +10,5 @@ using namespace WallpaperEngine::Data::Model; class ShaderConstantParser { public: static ShaderConstantMap parse (const JSON& it, Project& project); - static ShaderConstantUniquePtr parseConstant (const JSON& it, Project& project); }; } // namespace WallpaperEngine::Data::Parsers diff --git a/src/WallpaperEngine/Data/Parsers/UserSettingParser.cpp b/src/WallpaperEngine/Data/Parsers/UserSettingParser.cpp index 3ea6acd..9d7224a 100644 --- a/src/WallpaperEngine/Data/Parsers/UserSettingParser.cpp +++ b/src/WallpaperEngine/Data/Parsers/UserSettingParser.cpp @@ -5,19 +5,26 @@ using namespace WallpaperEngine::Data::Parsers; using namespace WallpaperEngine::Data::Builders; -UserSettingSharedPtr UserSettingParser::parse (const json& data, const Properties& properties) { +UserSettingUniquePtr UserSettingParser::parse (const json& data, const Properties& properties) { DynamicValueUniquePtr value = std::make_unique (); PropertyWeakPtr property; std::optional condition; auto valueIt = data; + std::string content = data.dump (); if (data.is_object ()) { const auto user = data.optional ("user"); + const auto script = data.optional ("script"); valueIt = data.require ("value", "User setting must have a value"); - if (user.has_value ()) { + // TODO: PARSE SCRIPT VALUES + if (script.has_value () && !script->is_null ()) { + sLog.error ("Found user setting with script value: ", script.value ().dump ()); + } + + if (user.has_value () && !user->is_null ()) { std::string source; - const auto& it = user.value (); + const auto& it = *user; if (it.is_string ()) { source = it; @@ -61,7 +68,7 @@ UserSettingSharedPtr UserSettingParser::parse (const json& data, const Propertie sLog.exception ("Unsupported user setting type ", valueIt.type_name ()); } - return std::make_shared (UserSetting { + return std::make_unique (UserSetting { .value = std::move (value), .property = property, .condition = condition, diff --git a/src/WallpaperEngine/Data/Parsers/UserSettingParser.h b/src/WallpaperEngine/Data/Parsers/UserSettingParser.h index 94508c8..758497b 100644 --- a/src/WallpaperEngine/Data/Parsers/UserSettingParser.h +++ b/src/WallpaperEngine/Data/Parsers/UserSettingParser.h @@ -11,6 +11,6 @@ using namespace WallpaperEngine::Data::Model; class UserSettingParser { public: - static UserSettingSharedPtr parse (const json& data, const Properties& properties); + static UserSettingUniquePtr parse (const json& data, const Properties& properties); }; } // namespace WallpaperEngine::Data::Parsers diff --git a/src/WallpaperEngine/Render/Objects/CImage.cpp b/src/WallpaperEngine/Render/Objects/CImage.cpp index a4d36b2..d0ca2b0 100644 --- a/src/WallpaperEngine/Render/Objects/CImage.cpp +++ b/src/WallpaperEngine/Render/Objects/CImage.cpp @@ -1,7 +1,6 @@ #include "CImage.h" #include -#include "WallpaperEngine/Core/UserSettings/CUserSettingBoolean.h" #include "WallpaperEngine/Data/Parsers/MaterialParser.h" #include "WallpaperEngine/Data/Builders/UserSettingBuilder.h" #include "WallpaperEngine/Data/Model/Object.h" diff --git a/src/WallpaperEngine/Render/Objects/Effects/CPass.cpp b/src/WallpaperEngine/Render/Objects/Effects/CPass.cpp index 0dc01f3..433c89f 100644 --- a/src/WallpaperEngine/Render/Objects/Effects/CPass.cpp +++ b/src/WallpaperEngine/Render/Objects/Effects/CPass.cpp @@ -23,21 +23,12 @@ #include "WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector3.h" #include "WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector4.h" -#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.h" -#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.h" -#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantInteger.h" -#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector2.h" -#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector3.h" -#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector4.h" -#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantProperty.h" #include "WallpaperEngine/Logging/CLog.h" using namespace WallpaperEngine; using namespace WallpaperEngine::Render; using namespace WallpaperEngine::Render::Objects; -using namespace WallpaperEngine::Core::Objects::Effects::Constants; - using namespace WallpaperEngine::Render::Shaders::Variables; using namespace WallpaperEngine::Render::Objects::Effects; @@ -725,7 +716,7 @@ void CPass::setupShaderVariables () { // this takes care of all possible casts, even invalid ones, which will use whatever default behaviour // of the underlying CDynamicValue used for the value - this->addUniform (var, value.get ()); + this->addUniform (var, value->value.get ()); } } diff --git a/src/WallpaperEngine/Render/Objects/Effects/CPass.h b/src/WallpaperEngine/Render/Objects/Effects/CPass.h index e853b41..b1eb6a1 100644 --- a/src/WallpaperEngine/Render/Objects/Effects/CPass.h +++ b/src/WallpaperEngine/Render/Objects/Effects/CPass.h @@ -4,8 +4,6 @@ #include #include "WallpaperEngine/Assets/ITexture.h" -#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.h" -#include "WallpaperEngine/Core/UserSettings/CUserSettingValue.h" #include "WallpaperEngine/Render/CFBO.h" #include "WallpaperEngine/Render/CFBOProvider.h" #include "WallpaperEngine/Render/Helpers/CContextAware.h" @@ -20,7 +18,6 @@ namespace WallpaperEngine::Render::Objects::Effects { using namespace WallpaperEngine::Assets; using namespace WallpaperEngine::Render::Shaders::Variables; using namespace WallpaperEngine::Core::Projects; -using namespace WallpaperEngine::Core::Objects::Effects::Constants; using namespace WallpaperEngine::Data::Model; class CPass final : public Helpers::CContextAware { diff --git a/src/WallpaperEngine/Render/Shaders/CShader.cpp b/src/WallpaperEngine/Render/Shaders/CShader.cpp index 6b5d424..947b9fd 100644 --- a/src/WallpaperEngine/Render/Shaders/CShader.cpp +++ b/src/WallpaperEngine/Render/Shaders/CShader.cpp @@ -3,9 +3,6 @@ #include // shader compiler -#include -#include -#include #include #include diff --git a/src/WallpaperEngine/Render/Shaders/CShader.h b/src/WallpaperEngine/Render/Shaders/CShader.h index 5bbe810..25e992b 100644 --- a/src/WallpaperEngine/Render/Shaders/CShader.h +++ b/src/WallpaperEngine/Render/Shaders/CShader.h @@ -7,7 +7,6 @@ #include "WallpaperEngine/Assets/CContainer.h" #include "WallpaperEngine/Assets/ITexture.h" #include "WallpaperEngine/Core/Core.h" -#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.h" #include "WallpaperEngine/Render/Shaders/Variables/CShaderVariable.h" #include "CShaderUnit.h" @@ -18,7 +17,6 @@ namespace WallpaperEngine::Render::Shaders { using json = nlohmann::json; using namespace WallpaperEngine::Assets; -using namespace WallpaperEngine::Core::Objects::Effects::Constants; using namespace WallpaperEngine::Data::Model; /** diff --git a/src/WallpaperEngine/Render/Shaders/CShaderUnit.cpp b/src/WallpaperEngine/Render/Shaders/CShaderUnit.cpp index 915510f..45c1989 100644 --- a/src/WallpaperEngine/Render/Shaders/CShaderUnit.cpp +++ b/src/WallpaperEngine/Render/Shaders/CShaderUnit.cpp @@ -6,12 +6,6 @@ #include #include "WallpaperEngine/Logging/CLog.h" -#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.h" -#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantInteger.h" -#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector2.h" -#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector3.h" -#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector4.h" - #include "CGLSLContext.h" #include "WallpaperEngine/Assets/CAssetLoadException.h" #include "WallpaperEngine/Render/Shaders/Variables/CShaderVariable.h" diff --git a/src/WallpaperEngine/Render/Shaders/CShaderUnit.h b/src/WallpaperEngine/Render/Shaders/CShaderUnit.h index 19dc0c5..4974f44 100644 --- a/src/WallpaperEngine/Render/Shaders/CShaderUnit.h +++ b/src/WallpaperEngine/Render/Shaders/CShaderUnit.h @@ -7,7 +7,6 @@ #include "CGLSLContext.h" #include "WallpaperEngine/Assets/CContainer.h" #include "WallpaperEngine/Core/Core.h" -#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.h" #include "WallpaperEngine/Render/Shaders/Variables/CShaderVariable.h" #include "nlohmann/json.hpp" @@ -16,7 +15,6 @@ namespace WallpaperEngine::Render::Shaders { using json = nlohmann::json; using namespace WallpaperEngine::Assets; -using namespace WallpaperEngine::Core::Objects::Effects::Constants; using namespace WallpaperEngine::Data::Model; /**