mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-07-14 05:12:25 +08:00
Nitpicks
This commit is contained in:
parent
8172c970b1
commit
b37c519209
@ -5,8 +5,6 @@
|
||||
#include "WallpaperEngine/Core/Objects/CSound.h"
|
||||
#include "WallpaperEngine/Core/Objects/CParticle.h"
|
||||
|
||||
#include "Core.h"
|
||||
|
||||
using namespace WallpaperEngine::Core;
|
||||
|
||||
CObject::CObject (
|
||||
@ -29,12 +27,12 @@ CObject::CObject (
|
||||
|
||||
CObject* CObject::fromJSON (json data)
|
||||
{
|
||||
auto id_it = jsonFindRequired (&data, "id", "Objects must have id");
|
||||
auto id_it = jsonFindRequired (data, "id", "Objects must have id");
|
||||
auto visible_it = data.find ("visible");
|
||||
auto origin_it = jsonFindRequired (&data, "origin", "Objects must have origin point");
|
||||
auto scale_it = jsonFindRequired (&data, "scale", "Objects must have scale");
|
||||
auto angles_it = jsonFindRequired (&data, "angles", "Objects must have angles");
|
||||
auto name_it = jsonFindRequired (&data, "name", "Objects must have name");
|
||||
auto origin_it = jsonFindRequired (data, "origin", "Objects must have origin point");
|
||||
auto scale_it = jsonFindRequired (data, "scale", "Objects must have scale");
|
||||
auto angles_it = jsonFindRequired (data, "angles", "Objects must have angles");
|
||||
auto name_it = jsonFindRequired (data, "name", "Objects must have name");
|
||||
auto effects_it = data.find ("effects");
|
||||
auto dependencies_it = data.find ("dependencies");
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
#include "Core.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Objects/CEffect.h"
|
||||
|
||||
namespace WallpaperEngine::Core::Objects
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
#include "CProject.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
using namespace WallpaperEngine::Core;
|
||||
|
||||
CProject::CProject (std::string title, std::string type, CScene *scene) :
|
||||
@ -18,9 +16,9 @@ CProject* CProject::fromFile (const irr::io::path& filename)
|
||||
{
|
||||
json content = json::parse (WallpaperEngine::FileSystem::loadFullFile (filename));
|
||||
|
||||
auto title = jsonFindRequired (&content, "title", "Project title missing");
|
||||
auto type = jsonFindRequired (&content, "type", "Project type missing");
|
||||
auto file = jsonFindRequired (&content, "file", "Project's main file missing");
|
||||
auto title = jsonFindRequired (content, "title", "Project title missing");
|
||||
auto type = jsonFindRequired (content, "type", "Project type missing");
|
||||
auto file = jsonFindRequired (content, "file", "Project's main file missing");
|
||||
auto general = content.find ("general");
|
||||
|
||||
CProject* project = new CProject (
|
||||
|
@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "CScene.h"
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
#include "WallpaperEngine/Core/Projects/CProperty.h"
|
||||
|
||||
namespace WallpaperEngine::Core
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "CScene.h"
|
||||
#include "CProject.h"
|
||||
|
||||
#include "Core.h"
|
||||
#include "WallpaperEngine/FileSystem/FileSystem.h"
|
||||
|
||||
using namespace WallpaperEngine::Core;
|
||||
@ -50,27 +49,27 @@ CScene* CScene::fromFile (const irr::io::path& filename)
|
||||
{
|
||||
json content = json::parse (WallpaperEngine::FileSystem::loadFullFile (filename));
|
||||
|
||||
auto camera_it = jsonFindRequired (&content, "camera", "Scenes must have a defined camera");
|
||||
auto general_it = jsonFindRequired (&content, "general", "Scenes must have a general section");
|
||||
auto objects_it = jsonFindRequired (&content, "objects", "Scenes must have a list of objects to display");
|
||||
auto camera_it = jsonFindRequired (content, "camera", "Scenes must have a defined camera");
|
||||
auto general_it = jsonFindRequired (content, "general", "Scenes must have a general section");
|
||||
auto objects_it = jsonFindRequired (content, "objects", "Scenes must have a list of objects to display");
|
||||
|
||||
auto ambientcolor_it = jsonFindRequired (&(*general_it), "ambientcolor", "General section must have ambient color");
|
||||
auto bloom_it = jsonFindRequired (&(*general_it), "bloom", "General section must have bloom flag");
|
||||
auto bloomstrength_it = jsonFindRequired (&(*general_it), "bloomstrength", "General section must have bloom strength");
|
||||
auto bloomthreshold_it = jsonFindRequired (&(*general_it), "bloomthreshold", "General section must have bloom threshold");
|
||||
auto camerafade_it = jsonFindRequired (&(*general_it), "camerafade", "General section must have camera fade");
|
||||
auto cameraparallax_it = jsonFindRequired (&(*general_it), "cameraparallax", "General section must have camera parallax");
|
||||
auto cameraparallaxamount_it = jsonFindRequired (&(*general_it), "cameraparallaxamount", "General section must have camera parallax amount");
|
||||
auto cameraparallaxdelay_it = jsonFindRequired (&(*general_it), "cameraparallaxdelay", "General section must have camera parallax delay");
|
||||
auto cameraparallaxmouseinfluence_it = jsonFindRequired (&(*general_it), "cameraparallaxmouseinfluence", "General section must have camera parallax mouse influence");
|
||||
auto camerapreview_it = jsonFindRequired (&(*general_it), "camerapreview", "General section must have camera preview");
|
||||
auto camerashake_it = jsonFindRequired (&(*general_it), "camerashake", "General section must have camera shake");
|
||||
auto camerashakeamplitude_it = jsonFindRequired (&(*general_it), "camerashakeamplitude", "General section must have camera shake amplitude");
|
||||
auto camerashakeroughness_it = jsonFindRequired (&(*general_it), "camerashakeroughness", "General section must have camera shake roughness");
|
||||
auto camerashakespeed_it = jsonFindRequired (&(*general_it), "camerashakespeed", "General section must have camera shake speed");
|
||||
auto clearcolor_it = jsonFindRequired (&(*general_it), "clearcolor", "General section must have clear color");
|
||||
auto orthogonalprojection_it = jsonFindRequired (&(*general_it), "orthogonalprojection", "General section must have orthogonal projection info");
|
||||
auto skylightcolor_it = jsonFindRequired (&(*general_it), "skylightcolor", "General section must have skylight color");
|
||||
auto ambientcolor_it = jsonFindRequired (*general_it, "ambientcolor", "General section must have ambient color");
|
||||
auto bloom_it = jsonFindRequired (*general_it, "bloom", "General section must have bloom flag");
|
||||
auto bloomstrength_it = jsonFindRequired (*general_it, "bloomstrength", "General section must have bloom strength");
|
||||
auto bloomthreshold_it = jsonFindRequired (*general_it, "bloomthreshold", "General section must have bloom threshold");
|
||||
auto camerafade_it = jsonFindRequired (*general_it, "camerafade", "General section must have camera fade");
|
||||
auto cameraparallax_it = jsonFindRequired (*general_it, "cameraparallax", "General section must have camera parallax");
|
||||
auto cameraparallaxamount_it = jsonFindRequired (*general_it, "cameraparallaxamount", "General section must have camera parallax amount");
|
||||
auto cameraparallaxdelay_it = jsonFindRequired (*general_it, "cameraparallaxdelay", "General section must have camera parallax delay");
|
||||
auto cameraparallaxmouseinfluence_it = jsonFindRequired (*general_it, "cameraparallaxmouseinfluence", "General section must have camera parallax mouse influence");
|
||||
auto camerapreview_it = jsonFindRequired (*general_it, "camerapreview", "General section must have camera preview");
|
||||
auto camerashake_it = jsonFindRequired (*general_it, "camerashake", "General section must have camera shake");
|
||||
auto camerashakeamplitude_it = jsonFindRequired (*general_it, "camerashakeamplitude", "General section must have camera shake amplitude");
|
||||
auto camerashakeroughness_it = jsonFindRequired (*general_it, "camerashakeroughness", "General section must have camera shake roughness");
|
||||
auto camerashakespeed_it = jsonFindRequired (*general_it, "camerashakespeed", "General section must have camera shake speed");
|
||||
auto clearcolor_it = jsonFindRequired (*general_it, "clearcolor", "General section must have clear color");
|
||||
auto orthogonalprojection_it = jsonFindRequired (*general_it, "orthogonalprojection", "General section must have orthogonal projection info");
|
||||
auto skylightcolor_it = jsonFindRequired (*general_it, "skylightcolor", "General section must have skylight color");
|
||||
|
||||
CScene* scene = new CScene (
|
||||
Scenes::CCamera::fromJSON (*camera_it),
|
||||
|
@ -1,11 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "CProject.h"
|
||||
#include "CObject.h"
|
||||
|
||||
#include "Core.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Scenes/CCamera.h"
|
||||
#include "WallpaperEngine/Core/Scenes/CProjection.h"
|
||||
|
||||
|
@ -60,10 +60,10 @@ irr::video::SColor Core::atoSColor (const std::string& str)
|
||||
return Core::atoSColor (str.c_str ());
|
||||
}
|
||||
|
||||
nlohmann::detail::iter_impl<nlohmann::json> Core::jsonFindRequired (nlohmann::json *data, const char *key, const char *notFoundMsg)
|
||||
nlohmann::detail::iter_impl<nlohmann::json> Core::jsonFindRequired (nlohmann::json& data, const char *key, const char *notFoundMsg)
|
||||
{
|
||||
auto value = data->find (key);
|
||||
if (value == data->end ())
|
||||
auto value = data.find (key);
|
||||
if (value == data.end ())
|
||||
{
|
||||
throw std::runtime_error (notFoundMsg);
|
||||
}
|
||||
|
@ -18,5 +18,5 @@ namespace WallpaperEngine::Core
|
||||
irr::video::SColor atoSColor (const char *str);
|
||||
irr::video::SColor atoSColor (const std::string& str);
|
||||
|
||||
nlohmann::detail::iter_impl<nlohmann::json> jsonFindRequired (nlohmann::json *data, const char *key, const char *notFoundMsg);
|
||||
nlohmann::json::iterator jsonFindRequired (nlohmann::json& data, const char *key, const char *notFoundMsg);
|
||||
};
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
#include "WallpaperEngine/Core/Objects/CImage.h"
|
||||
#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.h"
|
||||
#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.h"
|
||||
@ -30,17 +29,17 @@ CEffect::CEffect (
|
||||
|
||||
CEffect* CEffect::fromJSON (json data, Core::CObject* object)
|
||||
{
|
||||
auto file_it = jsonFindRequired (&data, "file", "Object effect must have a file");
|
||||
auto file_it = jsonFindRequired (data, "file", "Object effect must have a file");
|
||||
auto effectpasses_it = data.find ("passes");
|
||||
|
||||
json content = json::parse (WallpaperEngine::FileSystem::loadFullFile ((*file_it).get <std::string> ().c_str ()));
|
||||
|
||||
auto name_it = jsonFindRequired (&content, "name", "Effect must have a name");
|
||||
auto description_it = jsonFindRequired (&content, "description", "Effect must have a description");
|
||||
auto group_it = jsonFindRequired (&content, "group", "Effect must have a group");
|
||||
auto preview_it = jsonFindRequired (&content, "preview", "Effect must have a preview");
|
||||
auto passes_it = jsonFindRequired (&content, "passes", "Effect must have a pass list");
|
||||
auto dependencies_it = jsonFindRequired (&content, "dependencies", "");
|
||||
auto name_it = jsonFindRequired (content, "name", "Effect must have a name");
|
||||
auto description_it = jsonFindRequired (content, "description", "Effect must have a description");
|
||||
auto group_it = jsonFindRequired (content, "group", "Effect must have a group");
|
||||
auto preview_it = jsonFindRequired (content, "preview", "Effect must have a preview");
|
||||
auto passes_it = jsonFindRequired (content, "passes", "Effect must have a pass list");
|
||||
auto dependencies_it = jsonFindRequired (content, "dependencies", "");
|
||||
auto fbos_it = content.find ("fbos");
|
||||
|
||||
CEffect* effect = new CEffect (
|
||||
|
@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
#include "WallpaperEngine/Core/Objects/Effects/CFBO.h"
|
||||
#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.h"
|
||||
#include "WallpaperEngine/Core/CObject.h"
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "CImage.h"
|
||||
#include "WallpaperEngine/Core/Objects/Images/CMaterial.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
#include "WallpaperEngine/FileSystem/FileSystem.h"
|
||||
|
||||
using namespace WallpaperEngine::Core::Objects;
|
||||
@ -31,11 +30,11 @@ WallpaperEngine::Core::CObject* CImage::fromJSON (
|
||||
const irr::core::vector3df& angles)
|
||||
{
|
||||
auto image_it = data.find ("image");
|
||||
auto size_it = jsonFindRequired (&data, "size", "Images must have size");
|
||||
auto size_it = jsonFindRequired (data, "size", "Images must have size");
|
||||
|
||||
json content = json::parse (WallpaperEngine::FileSystem::loadFullFile ((*image_it).get <std::string> ().c_str ()));
|
||||
|
||||
auto material_it = jsonFindRequired (&content, "material", "Image must have a material");
|
||||
auto material_it = jsonFindRequired (content, "material", "Image must have a material");
|
||||
|
||||
return new CImage (
|
||||
Images::CMaterial::fromFile ((*material_it).get <std::string> ().c_str ()),
|
||||
|
@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
#include "WallpaperEngine/Core/Objects/Images/CMaterial.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
#include "WallpaperEngine/Core/CObject.h"
|
||||
|
||||
namespace WallpaperEngine::Core::Objects
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "CParticle.h"
|
||||
#include "WallpaperEngine/FileSystem/FileSystem.h"
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
@ -15,10 +14,10 @@ CParticle* CParticle::fromFile (
|
||||
{
|
||||
json data = json::parse (WallpaperEngine::FileSystem::loadFullFile (filename));
|
||||
auto controlpoint_it = data.find ("controlpoint");
|
||||
auto starttime_it = jsonFindRequired (&data, "starttime", "Particles must have start time");
|
||||
auto maxcount_it = jsonFindRequired (&data, "maxcount", "Particles must have maximum count");
|
||||
auto emitter_it = jsonFindRequired (&data, "emitter", "Particles must have emitters");
|
||||
auto initializer_it = jsonFindRequired (&data, "initializer", "Particles must have initializers");
|
||||
auto starttime_it = jsonFindRequired (data, "starttime", "Particles must have start time");
|
||||
auto maxcount_it = jsonFindRequired (data, "maxcount", "Particles must have maximum count");
|
||||
auto emitter_it = jsonFindRequired (data, "emitter", "Particles must have emitters");
|
||||
auto initializer_it = jsonFindRequired (data, "initializer", "Particles must have initializers");
|
||||
|
||||
CParticle* particle = new CParticle (
|
||||
*starttime_it,
|
||||
|
@ -1,12 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "WallpaperEngine/Core/Objects/Particles/CControlPoint.h"
|
||||
#include "WallpaperEngine/Core/Objects/Particles/CEmitter.h"
|
||||
#include "WallpaperEngine/Core/Objects/Particles/CInitializer.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
#include "WallpaperEngine/Core/CObject.h"
|
||||
|
||||
namespace WallpaperEngine::Core::Objects
|
||||
|
@ -3,8 +3,6 @@
|
||||
#include "WallpaperEngine/Core/CObject.h"
|
||||
#include "CSound.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
using namespace WallpaperEngine::Core::Objects;
|
||||
|
||||
CSound::CSound (
|
||||
@ -27,7 +25,7 @@ WallpaperEngine::Core::CObject* CSound::fromJSON (
|
||||
const irr::core::vector3df& scale,
|
||||
const irr::core::vector3df& angles)
|
||||
{
|
||||
auto sound_it = jsonFindRequired (&data, "sound", "Sound information not present");
|
||||
auto sound_it = jsonFindRequired (data, "sound", "Sound information not present");
|
||||
|
||||
if ((*sound_it).is_array () == false)
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
#include "WallpaperEngine/Core/CObject.h"
|
||||
|
||||
namespace WallpaperEngine::Core::Objects
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "CBind.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
using namespace WallpaperEngine::Core::Objects::Effects;
|
||||
@ -14,8 +12,8 @@ CBind::CBind (std::string name, irr::u32 index) :
|
||||
|
||||
CBind* CBind::fromJSON (json data)
|
||||
{
|
||||
auto name_it = jsonFindRequired (&data, "name", "bind must have texture name");
|
||||
auto index_it = jsonFindRequired (&data, "index", "bind must have index");
|
||||
auto name_it = jsonFindRequired (data, "name", "bind must have texture name");
|
||||
auto index_it = jsonFindRequired (data, "index", "bind must have index");
|
||||
|
||||
return new CBind (*name_it, *index_it);
|
||||
}
|
||||
|
@ -3,7 +3,8 @@
|
||||
#include <string>
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
namespace WallpaperEngine::Core::Objects::Effects
|
||||
{
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include <irrlicht/irrlicht.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
#include "WallpaperEngine/FileSystem/FileSystem.h"
|
||||
|
||||
using namespace WallpaperEngine::Core::Objects;
|
||||
@ -38,7 +37,7 @@ CMaterial* CMaterial::fromJSON (json data, const std::string& target)
|
||||
|
||||
CMaterial* CMaterial::fromJSON (json data)
|
||||
{
|
||||
auto passes_it = jsonFindRequired (&data, "passes", "Material must have at least one pass");
|
||||
auto passes_it = jsonFindRequired (data, "passes", "Material must have at least one pass");
|
||||
|
||||
CMaterial* material = new CMaterial ();
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "WallpaperEngine/Core/Objects/Images/Materials/CPass.h"
|
||||
#include "WallpaperEngine/Core/Objects/Effects/CBind.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
namespace WallpaperEngine::Core::Objects::Images
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "CPass.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
using namespace WallpaperEngine::Core::Objects::Effects::Constants;
|
||||
using namespace WallpaperEngine::Core::Objects::Images::Materials;
|
||||
|
||||
@ -16,11 +14,11 @@ CPass::CPass (std::string blending, std::string cullmode, std::string depthtest,
|
||||
|
||||
CPass* CPass::fromJSON (json data)
|
||||
{
|
||||
auto blending_it = jsonFindRequired (&data, "blending", "Material pass must have blending specified");
|
||||
auto cullmode_it = jsonFindRequired (&data, "cullmode", "Material pass must have cullmode specified");
|
||||
auto depthtest_it = jsonFindRequired (&data, "depthtest", "Material pass must have depthtest specified");
|
||||
auto depthwrite_it = jsonFindRequired (&data, "depthwrite", "Material pass must have depthwrite specified");
|
||||
auto shader_it = jsonFindRequired (&data, "shader", "Material pass must have shader specified");
|
||||
auto blending_it = jsonFindRequired (data, "blending", "Material pass must have blending specified");
|
||||
auto cullmode_it = jsonFindRequired (data, "cullmode", "Material pass must have cullmode specified");
|
||||
auto depthtest_it = jsonFindRequired (data, "depthtest", "Material pass must have depthtest specified");
|
||||
auto depthwrite_it = jsonFindRequired (data, "depthwrite", "Material pass must have depthwrite specified");
|
||||
auto shader_it = jsonFindRequired (data, "shader", "Material pass must have shader specified");
|
||||
auto textures_it = data.find ("textures");
|
||||
auto combos_it = data.find ("combos");
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.h"
|
||||
|
||||
|
@ -1,13 +1,11 @@
|
||||
#include "CControlPoint.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
using namespace WallpaperEngine::Core::Objects::Particles;
|
||||
|
||||
CControlPoint* CControlPoint::fromJSON (json data)
|
||||
{
|
||||
auto flags_it = data.find ("flags");
|
||||
auto id_it = jsonFindRequired (&data, "id", "Particle's control point must have id");
|
||||
auto id_it = jsonFindRequired (data, "id", "Particle's control point must have id");
|
||||
auto offset_it = data.find ("offset");
|
||||
|
||||
CControlPoint* controlpoint = new CControlPoint (*id_it, 0);
|
||||
|
@ -1,8 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
namespace WallpaperEngine::Core::Objects::Particles
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
@ -1,18 +1,16 @@
|
||||
#include "CEmitter.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
using namespace WallpaperEngine::Core::Objects::Particles;
|
||||
|
||||
CEmitter* CEmitter::fromJSON (json data)
|
||||
{
|
||||
auto directions_it = jsonFindRequired (&data, "directions", "Particle emitter must have direction specified");
|
||||
auto distancemax_it = jsonFindRequired (&data, "distancemax", "Particle emitter must have maximum distance");
|
||||
auto distancemin_it = jsonFindRequired (&data, "distancemin", "Particle emitter must have minimum distance");
|
||||
auto directions_it = jsonFindRequired (data, "directions", "Particle emitter must have direction specified");
|
||||
auto distancemax_it = jsonFindRequired (data, "distancemax", "Particle emitter must have maximum distance");
|
||||
auto distancemin_it = jsonFindRequired (data, "distancemin", "Particle emitter must have minimum distance");
|
||||
auto id_it = data.find ("id");
|
||||
auto name_it = jsonFindRequired (&data, "name", "Particle emitter must have a name");
|
||||
auto origin_it = jsonFindRequired (&data, "origin", "Particle emitter must have an origin");
|
||||
auto rate_it = jsonFindRequired (&data, "rate", "Particle emitter must have a rate");
|
||||
auto name_it = jsonFindRequired (data, "name", "Particle emitter must have a name");
|
||||
auto origin_it = jsonFindRequired (data, "origin", "Particle emitter must have an origin");
|
||||
auto rate_it = jsonFindRequired (data, "rate", "Particle emitter must have a rate");
|
||||
|
||||
return new CEmitter (
|
||||
WallpaperEngine::Core::ato3vf (*directions_it),
|
||||
|
@ -1,8 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
namespace WallpaperEngine::Core::Objects::Particles
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "CInitializer.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
#include "WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.h"
|
||||
#include "WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.h"
|
||||
#include "WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.h"
|
||||
@ -14,7 +13,7 @@ using namespace WallpaperEngine::Core::Objects::Particles;
|
||||
CInitializer* CInitializer::fromJSON (json data)
|
||||
{
|
||||
auto id_it = data.find ("id");
|
||||
auto name_it = jsonFindRequired (&data, "name", "Particle's initializer must have a name");
|
||||
auto name_it = jsonFindRequired (data, "name", "Particle's initializer must have a name");
|
||||
irr::u32 id = ((id_it == data.end ()) ? 0 : (irr::u32) (*id_it));
|
||||
|
||||
if (*name_it == "lifetimerandom")
|
||||
|
@ -1,8 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
namespace WallpaperEngine::Core::Objects::Particles
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
@ -1,13 +1,11 @@
|
||||
#include "CAlphaRandom.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
|
||||
|
||||
CAlphaRandom* CAlphaRandom::fromJSON (json data, irr::u32 id)
|
||||
{
|
||||
auto min_it = jsonFindRequired (&data, "min", "Alpharandom initializer must have a minimum value");
|
||||
auto max_it = jsonFindRequired (&data, "max", "Alpharandom initializer must have a maximum value");
|
||||
auto min_it = jsonFindRequired (data, "min", "Alpharandom initializer must have a minimum value");
|
||||
auto max_it = jsonFindRequired (data, "max", "Alpharandom initializer must have a maximum value");
|
||||
|
||||
return new CAlphaRandom (id, *min_it, *max_it);
|
||||
}
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
#include "WallpaperEngine/Core/Objects/Particles/CInitializer.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace WallpaperEngine::Core::Objects::Particles::Initializers
|
||||
|
@ -1,13 +1,11 @@
|
||||
#include "CAngularVelocityRandom.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
|
||||
|
||||
CAngularVelocityRandom* CAngularVelocityRandom::fromJSON (json data, irr::u32 id)
|
||||
{
|
||||
auto min_it = jsonFindRequired (&data, "min", "Angularvelocityrandom initializer must have a minimum value");
|
||||
auto max_it = jsonFindRequired (&data, "max", "Angularvelocityrandom initializer must have a maximum value");
|
||||
auto min_it = jsonFindRequired (data, "min", "Angularvelocityrandom initializer must have a minimum value");
|
||||
auto max_it = jsonFindRequired (data, "max", "Angularvelocityrandom initializer must have a maximum value");
|
||||
|
||||
return new CAngularVelocityRandom (
|
||||
id,
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
#include "WallpaperEngine/Core/Objects/Particles/CInitializer.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace WallpaperEngine::Core::Objects::Particles::Initializers
|
||||
|
@ -1,13 +1,11 @@
|
||||
#include "CColorRandom.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
|
||||
|
||||
CColorRandom* CColorRandom::fromJSON (json data, irr::u32 id)
|
||||
{
|
||||
auto min_it = jsonFindRequired (&data, "min", "Colorrandom initializer must have a minimum value");
|
||||
auto max_it = jsonFindRequired (&data, "max", "Colorrandom initializer must have a maximum value");
|
||||
auto min_it = jsonFindRequired (data, "min", "Colorrandom initializer must have a minimum value");
|
||||
auto max_it = jsonFindRequired (data, "max", "Colorrandom initializer must have a maximum value");
|
||||
|
||||
return new CColorRandom (
|
||||
id,
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
#include "WallpaperEngine/Core/Objects/Particles/CInitializer.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace WallpaperEngine::Core::Objects::Particles::Initializers
|
||||
|
@ -1,13 +1,11 @@
|
||||
#include "CLifeTimeRandom.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
|
||||
|
||||
CLifeTimeRandom* CLifeTimeRandom::fromJSON (json data, irr::u32 id)
|
||||
{
|
||||
auto min_it = jsonFindRequired (&data, "min", "Lifetimerandom initializer must have a minimum value");
|
||||
auto max_it = jsonFindRequired (&data, "max", "Lifetimerandom initializer must have a maximum value");
|
||||
auto min_it = jsonFindRequired (data, "min", "Lifetimerandom initializer must have a minimum value");
|
||||
auto max_it = jsonFindRequired (data, "max", "Lifetimerandom initializer must have a maximum value");
|
||||
|
||||
return new CLifeTimeRandom (id, *min_it, *max_it);
|
||||
}
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
#include "WallpaperEngine/Core/Objects/Particles/CInitializer.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace WallpaperEngine::Core::Objects::Particles::Initializers
|
||||
|
@ -1,13 +1,11 @@
|
||||
#include "CSizeRandom.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
|
||||
|
||||
CSizeRandom* CSizeRandom::fromJSON (json data, irr::u32 id)
|
||||
{
|
||||
auto min_it = jsonFindRequired (&data, "min", "Sizerandom initializer must have a minimum value");
|
||||
auto max_it = jsonFindRequired (&data, "max", "Sizerandom initializer must have a maximum value");
|
||||
auto min_it = jsonFindRequired (data, "min", "Sizerandom initializer must have a minimum value");
|
||||
auto max_it = jsonFindRequired (data, "max", "Sizerandom initializer must have a maximum value");
|
||||
|
||||
return new CSizeRandom (id, *min_it, *max_it);
|
||||
}
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
#include "WallpaperEngine/Core/Objects/Particles/CInitializer.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace WallpaperEngine::Core::Objects::Particles::Initializers
|
||||
|
@ -1,13 +1,11 @@
|
||||
#include "CVelocityRandom.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
|
||||
|
||||
CVelocityRandom* CVelocityRandom::fromJSON (json data, irr::u32 id)
|
||||
{
|
||||
auto min_it = jsonFindRequired (&data, "min", "Velocityrandom initializer must have a minimum value");
|
||||
auto max_it = jsonFindRequired (&data, "max", "Velocityrandom initializer must have a maximum value");
|
||||
auto min_it = jsonFindRequired (data, "min", "Velocityrandom initializer must have a minimum value");
|
||||
auto max_it = jsonFindRequired (data, "max", "Velocityrandom initializer must have a maximum value");
|
||||
|
||||
return new CVelocityRandom (
|
||||
id,
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
#include "WallpaperEngine/Core/Objects/Particles/CInitializer.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace WallpaperEngine::Core::Objects::Particles::Initializers
|
||||
|
@ -1,14 +1,12 @@
|
||||
#include "CProperty.h"
|
||||
#include "CPropertyColor.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
using namespace WallpaperEngine::Core::Projects;
|
||||
|
||||
CProperty* CProperty::fromJSON (json data, const std::string& name)
|
||||
{
|
||||
auto type = jsonFindRequired (&data, "type", "Project properties must have the type field");
|
||||
auto value = jsonFindRequired (&data, "value", "Project properties must have the value field");
|
||||
auto type = jsonFindRequired (data, "type", "Project properties must have the type field");
|
||||
auto value = jsonFindRequired (data, "value", "Project properties must have the value field");
|
||||
auto text = data.find ("text");
|
||||
|
||||
if (*type == CPropertyColor::Type)
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
namespace WallpaperEngine::Core::Projects
|
||||
{
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include "CPropertyColor.h"
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
using namespace WallpaperEngine::Core::Projects;
|
||||
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "CProperty.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
namespace WallpaperEngine::Core::Projects
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include "CCamera.h"
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
using namespace WallpaperEngine::Core::Scenes;
|
||||
|
||||
@ -27,9 +26,9 @@ const irr::core::vector3df& CCamera::getUp () const
|
||||
|
||||
CCamera* CCamera::fromJSON (json data)
|
||||
{
|
||||
auto center_it = jsonFindRequired (&data, "center", "Camera must have a center position");
|
||||
auto eye_it = jsonFindRequired (&data, "eye", "Camera must have an eye position");
|
||||
auto up_it = jsonFindRequired (&data, "up", "Camera must have a up position");
|
||||
auto center_it = jsonFindRequired (data, "center", "Camera must have a center position");
|
||||
auto eye_it = jsonFindRequired (data, "eye", "Camera must have an eye position");
|
||||
auto up_it = jsonFindRequired (data, "up", "Camera must have a up position");
|
||||
|
||||
return new CCamera (
|
||||
WallpaperEngine::Core::ato3vf (*center_it),
|
||||
|
@ -1,8 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
namespace WallpaperEngine::Core::Scenes
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include "CProjection.h"
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
using namespace WallpaperEngine::Core::Scenes;
|
||||
|
||||
@ -21,8 +20,8 @@ const irr::u32& CProjection::getHeight () const
|
||||
|
||||
CProjection* CProjection::fromJSON (json data)
|
||||
{
|
||||
auto width_it = jsonFindRequired (&data, "width", "Projection must have width");
|
||||
auto height_it = jsonFindRequired (&data, "height", "Projection must have height");
|
||||
auto width_it = jsonFindRequired (data, "width", "Projection must have width");
|
||||
auto height_it = jsonFindRequired (data, "height", "Projection must have height");
|
||||
|
||||
return new CProjection (
|
||||
*width_it,
|
||||
|
@ -1,8 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
namespace WallpaperEngine::Core::Scenes
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
// shader compiler
|
||||
#include <WallpaperEngine/Render/Shaders/Compiler.h>
|
||||
#include <WallpaperEngine/Core/Core.h>
|
||||
|
||||
#include "WallpaperEngine/Render/Shaders/Variables/CShaderVariable.h"
|
||||
#include "WallpaperEngine/Render/Shaders/Variables/CShaderVariableFloat.h"
|
||||
@ -485,8 +484,8 @@ namespace WallpaperEngine::Render::Shaders
|
||||
void Compiler::parseComboConfiguration (const std::string& content)
|
||||
{
|
||||
json data = json::parse (content);
|
||||
auto combo = jsonFindRequired (&data, "combo", "cannot parse combo information");
|
||||
auto defvalue = jsonFindRequired (&data, "default", "cannot parse combo information");
|
||||
auto combo = jsonFindRequired (data, "combo", "cannot parse combo information");
|
||||
auto defvalue = jsonFindRequired (data, "default", "cannot parse combo information");
|
||||
|
||||
// add line feed just in case
|
||||
this->m_compiledContent += "\n";
|
||||
|
@ -4,7 +4,8 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "WallpaperEngine/Core/Core.h"
|
||||
|
||||
#include "WallpaperEngine/FileSystem/FileSystem.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user