From bf44e7d7f09f51a125daf394b464c37b3e90367a Mon Sep 17 00:00:00 2001 From: Almamu Date: Tue, 2 Sep 2025 00:55:28 +0200 Subject: [PATCH] chore: fix inconsistencies --- src/WallpaperEngine/Data/Model/Effect.h | 1 + src/WallpaperEngine/Data/Model/Object.h | 7 ++++--- src/WallpaperEngine/Data/Model/Project.h | 1 - src/WallpaperEngine/Data/Model/Property.h | 6 +++--- src/WallpaperEngine/Data/Model/Types.h | 2 +- src/WallpaperEngine/Data/Model/UserSetting.h | 3 +-- src/WallpaperEngine/Data/Model/Wallpaper.h | 8 ++------ src/WallpaperEngine/Render/Wallpapers/CScene.cpp | 7 ++++--- 8 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/WallpaperEngine/Data/Model/Effect.h b/src/WallpaperEngine/Data/Model/Effect.h index 217ec97..432523e 100644 --- a/src/WallpaperEngine/Data/Model/Effect.h +++ b/src/WallpaperEngine/Data/Model/Effect.h @@ -29,6 +29,7 @@ struct EffectPass { /** The target this material renders to (if specified) */ std::optional target; }; + struct Effect { /** Effect's name for the UI */ std::string name; diff --git a/src/WallpaperEngine/Data/Model/Object.h b/src/WallpaperEngine/Data/Model/Object.h index 8e3e9b1..624fc09 100644 --- a/src/WallpaperEngine/Data/Model/Object.h +++ b/src/WallpaperEngine/Data/Model/Object.h @@ -7,13 +7,14 @@ #include #include "Types.h" -#include "Effect.h" +#include "UserSetting.h" #include "Material.h" #include "Model.h" +#include "Effect.h" #include "WallpaperEngine/Data/Utils/TypeCaster.h" namespace WallpaperEngine::Data::Model { -using TypeCaster = WallpaperEngine::Data::Utils::TypeCaster; +using namespace WallpaperEngine::Data::Utils; struct ObjectData { int id; @@ -48,7 +49,7 @@ struct ImageEffectPassOverride { int id; ComboMap combos; ShaderConstantMap constants; - std::map textures; + TextureMap textures; }; /** diff --git a/src/WallpaperEngine/Data/Model/Project.h b/src/WallpaperEngine/Data/Model/Project.h index 493904a..1d00a3b 100644 --- a/src/WallpaperEngine/Data/Model/Project.h +++ b/src/WallpaperEngine/Data/Model/Project.h @@ -10,7 +10,6 @@ namespace WallpaperEngine::Data::Model { * Represents a wallpaper engine project */ struct Project { - public: enum Type { Type_Scene = 0, Type_Web = 1, diff --git a/src/WallpaperEngine/Data/Model/Property.h b/src/WallpaperEngine/Data/Model/Property.h index de17ebf..dcd0eed 100644 --- a/src/WallpaperEngine/Data/Model/Property.h +++ b/src/WallpaperEngine/Data/Model/Property.h @@ -60,7 +60,7 @@ class PropertyBoolean : public Property { class PropertyColor : public Property { public: explicit PropertyColor (PropertyData data, std::string value) : Property (std::move(data)) { - this->update (value); + this->PropertyColor::update (value); } using Property::update; @@ -113,7 +113,7 @@ class PropertyColor : public Property { class PropertyCombo : public Property, ComboData { public: PropertyCombo (PropertyData data, ComboData comboData, std::string value) : Property (std::move(data)), ComboData (std::move(comboData)) { - this->update (value); + this->PropertyCombo::update (value); } using Property::update; @@ -139,7 +139,7 @@ class PropertyText : public Property { class PropertySceneTexture : public Property { public: explicit PropertySceneTexture (PropertyData data, std::string value) : Property (std::move(data)) { - this->update (value); + this->PropertySceneTexture::update (value); } void update(const std::string& value) override { diff --git a/src/WallpaperEngine/Data/Model/Types.h b/src/WallpaperEngine/Data/Model/Types.h index 4d4e374..d57ea83 100644 --- a/src/WallpaperEngine/Data/Model/Types.h +++ b/src/WallpaperEngine/Data/Model/Types.h @@ -14,7 +14,7 @@ class Wallpaper; class Scene; class Web; class Video; -class UserSetting; +struct UserSetting; class Object; class Sound; class Image; diff --git a/src/WallpaperEngine/Data/Model/UserSetting.h b/src/WallpaperEngine/Data/Model/UserSetting.h index 8ad1c9c..edbaa52 100644 --- a/src/WallpaperEngine/Data/Model/UserSetting.h +++ b/src/WallpaperEngine/Data/Model/UserSetting.h @@ -8,12 +8,11 @@ namespace WallpaperEngine::Data::Model { struct ConditionInfo { - public: std::string name; std::string condition; }; + struct UserSetting { - public: /** * The value of this setting, can be a few different things: * - a value connected to the property diff --git a/src/WallpaperEngine/Data/Model/Wallpaper.h b/src/WallpaperEngine/Data/Model/Wallpaper.h index ced5d13..55c366c 100644 --- a/src/WallpaperEngine/Data/Model/Wallpaper.h +++ b/src/WallpaperEngine/Data/Model/Wallpaper.h @@ -8,11 +8,9 @@ #include "Types.h" #include "Object.h" #include "WallpaperEngine/Data/Utils/TypeCaster.h" -#include "WallpaperEngine/Data/JSON.h" namespace WallpaperEngine::Data::Model { -using json = WallpaperEngine::Data::JSON::JSON; -using TypeCaster = WallpaperEngine::Data::Utils::TypeCaster; +using namespace WallpaperEngine::Data::Utils; struct WallpaperData { std::string filename; @@ -110,10 +108,8 @@ struct SceneData { class Scene : public Wallpaper, public SceneData { public: - explicit Scene (WallpaperData data, SceneData sceneData) noexcept : SceneData (std::move(sceneData)), Wallpaper (data) {} + explicit Scene (WallpaperData data, SceneData sceneData) noexcept : Wallpaper (std::move (data)), SceneData (std::move (sceneData)) {} ~Scene () override = default; - - // TODO: ADD OBJECTS HERE }; } // namespace WallpaperEngine::Data::Model diff --git a/src/WallpaperEngine/Render/Wallpapers/CScene.cpp b/src/WallpaperEngine/Render/Wallpapers/CScene.cpp index 0e73350..87c01ec 100644 --- a/src/WallpaperEngine/Render/Wallpapers/CScene.cpp +++ b/src/WallpaperEngine/Render/Wallpapers/CScene.cpp @@ -17,6 +17,7 @@ using namespace WallpaperEngine::Render; using namespace WallpaperEngine::Data::Model; using namespace WallpaperEngine::Data::Parsers; using namespace WallpaperEngine::Render::Wallpapers; +using JSON = WallpaperEngine::Data::JSON::JSON; CScene::CScene ( const Wallpaper& wallpaper, CRenderContext& context, CAudioContext& audioContext, @@ -88,7 +89,7 @@ CScene::CScene ( const auto bloomOrigin = glm::vec3 { sceneWidth / 2, sceneHeight / 2, 0.0f }; const auto bloomSize = glm::vec2 { sceneWidth, sceneHeight }; - const nlohmann::json bloom = { + const JSON bloom = { {"image", "models/wpenginelinux.json"}, {"name", "bloomimagewpenginelinux"}, {"visible", true}, @@ -98,14 +99,14 @@ CScene::CScene ( {"size", std::to_string (bloomSize.x) + " " + std::to_string (bloomSize.y)}, {"id", -1}, {"effects", - json::array ( + JSON::array ( { { {"file", "effects/wpenginelinux/bloomeffect.json"}, {"id", 15242000}, {"name", ""}, {"passes", - json::array ( + JSON::array ( { { {"constantshadervalues",