mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-09-14 13:56:48 +08:00
~ Changed class names to something more sensible for the long run
Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
parent
b85b12d4a1
commit
217daa1dd4
@ -1,16 +1,16 @@
|
||||
#include "object.h"
|
||||
#include "CObject.h"
|
||||
|
||||
#include <utility>
|
||||
#include "objects/image.h"
|
||||
#include "objects/sound.h"
|
||||
#include "objects/particles/particle.h"
|
||||
#include "Objects/CImage.h"
|
||||
#include "Objects/CSound.h"
|
||||
#include "Objects/Particles/CParticle.h"
|
||||
|
||||
#include "../core.h"
|
||||
|
||||
using namespace wp::core;
|
||||
|
||||
|
||||
object::object (
|
||||
CObject::CObject (
|
||||
bool visible,
|
||||
irr::u32 id,
|
||||
std::string name,
|
||||
@ -26,7 +26,7 @@ object::object (
|
||||
{
|
||||
}
|
||||
|
||||
object* object::fromJSON (json data)
|
||||
CObject* CObject::fromJSON (json data)
|
||||
{
|
||||
json::const_iterator id_it = data.find ("id");
|
||||
json::const_iterator visible_it = data.find ("visible");
|
||||
@ -74,11 +74,11 @@ object* object::fromJSON (json data)
|
||||
json::const_iterator sound_it = data.find ("sound");
|
||||
json::const_iterator particle_it = data.find ("particle");
|
||||
|
||||
object* object = nullptr;
|
||||
CObject* object = nullptr;
|
||||
|
||||
if (image_it != data.end () && (*image_it).is_null () == false)
|
||||
{
|
||||
object = objects::image::fromJSON (
|
||||
object = Objects::CImage::fromJSON (
|
||||
data,
|
||||
visible,
|
||||
*id_it,
|
||||
@ -90,7 +90,7 @@ object* object::fromJSON (json data)
|
||||
}
|
||||
else if (sound_it != data.end ())
|
||||
{
|
||||
object = objects::sound::fromJSON (
|
||||
object = Objects::CSound::fromJSON (
|
||||
data,
|
||||
visible,
|
||||
*id_it,
|
||||
@ -102,7 +102,7 @@ object* object::fromJSON (json data)
|
||||
}
|
||||
else if (particle_it != data.end ())
|
||||
{
|
||||
object = objects::particles::particle::fromFile (
|
||||
object = Objects::Particles::CParticle::fromFile (
|
||||
(*particle_it).get <std::string> ().c_str (),
|
||||
*id_it,
|
||||
*name_it,
|
||||
@ -123,7 +123,7 @@ object* object::fromJSON (json data)
|
||||
for (; cur != end; cur ++)
|
||||
{
|
||||
object->insertEffect (
|
||||
objects::effect::fromJSON (*cur)
|
||||
Objects::CEffect::fromJSON (*cur)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -131,12 +131,12 @@ object* object::fromJSON (json data)
|
||||
return object;
|
||||
}
|
||||
|
||||
std::vector<objects::effect*>* object::getEffects ()
|
||||
std::vector<Objects::CEffect*>* CObject::getEffects ()
|
||||
{
|
||||
return &this->m_effects;
|
||||
}
|
||||
|
||||
void object::insertEffect (objects::effect* effect)
|
||||
void CObject::insertEffect (Objects::CEffect* effect)
|
||||
{
|
||||
this->m_effects.push_back (effect);
|
||||
}
|
@ -3,20 +3,20 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
#include "objects/effect.h"
|
||||
#include "Objects/CEffect.h"
|
||||
|
||||
namespace wp::core
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
||||
class object
|
||||
class CObject
|
||||
{
|
||||
public:
|
||||
static object* fromJSON (json data);
|
||||
static CObject* fromJSON (json data);
|
||||
|
||||
std::vector<objects::effect*>* getEffects ();
|
||||
std::vector<Objects::CEffect*>* getEffects ();
|
||||
protected:
|
||||
object (
|
||||
CObject (
|
||||
bool visible,
|
||||
irr::u32 id,
|
||||
std::string name,
|
||||
@ -25,7 +25,7 @@ namespace wp::core
|
||||
const irr::core::vector3df& angles
|
||||
);
|
||||
|
||||
void insertEffect (objects::effect* effect);
|
||||
void insertEffect (Objects::CEffect* effect);
|
||||
private:
|
||||
bool m_visible;
|
||||
irr::u32 m_id;
|
||||
@ -34,6 +34,6 @@ namespace wp::core
|
||||
irr::core::vector3df m_scale;
|
||||
irr::core::vector3df m_angles;
|
||||
|
||||
std::vector<objects::effect*> m_effects;
|
||||
std::vector<Objects::CEffect*> m_effects;
|
||||
};
|
||||
};
|
@ -1,12 +1,12 @@
|
||||
#include <wallpaperengine/fs/utils.h>
|
||||
|
||||
#include "project.h"
|
||||
#include "CProject.h"
|
||||
|
||||
#include "../fs/utils.h"
|
||||
|
||||
using namespace wp::core;
|
||||
|
||||
project::project (std::string title, std::string type, scene *scene) :
|
||||
CProject::CProject (std::string title, std::string type, CScene *scene) :
|
||||
m_title (std::move (title)),
|
||||
m_type (std::move (type)),
|
||||
m_scene (scene)
|
||||
@ -14,7 +14,7 @@ project::project (std::string title, std::string type, scene *scene) :
|
||||
this->m_scene->setProject (this);
|
||||
}
|
||||
|
||||
project* project::fromFile (const irr::io::path& filename)
|
||||
CProject* CProject::fromFile (const irr::io::path& filename)
|
||||
{
|
||||
json content = json::parse (wp::fs::utils::loadFullFile (filename));
|
||||
|
||||
@ -37,24 +37,24 @@ project* project::fromFile (const irr::io::path& filename)
|
||||
throw std::runtime_error ("Project's main file missing");
|
||||
}
|
||||
|
||||
return new project (
|
||||
*title,
|
||||
*type,
|
||||
scene::fromFile ((*file).get <std::string> ().c_str ())
|
||||
return new CProject (
|
||||
*title,
|
||||
*type,
|
||||
CScene::fromFile ((*file).get <std::string> ().c_str ())
|
||||
);
|
||||
}
|
||||
|
||||
scene* project::getScene ()
|
||||
CScene* CProject::getScene ()
|
||||
{
|
||||
return this->m_scene;
|
||||
}
|
||||
|
||||
std::string project::getTitle ()
|
||||
std::string CProject::getTitle ()
|
||||
{
|
||||
return this->m_title;
|
||||
}
|
||||
|
||||
std::string project::getType ()
|
||||
std::string CProject::getType ()
|
||||
{
|
||||
return this->m_type;
|
||||
}
|
@ -3,29 +3,29 @@
|
||||
#include <irrlicht/irrlicht.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "scene.h"
|
||||
#include "CScene.h"
|
||||
|
||||
namespace wp::core
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
||||
class scene;
|
||||
class CScene;
|
||||
|
||||
class project
|
||||
class CProject
|
||||
{
|
||||
public:
|
||||
static project* fromFile (const irr::io::path& filename);
|
||||
static CProject* fromFile (const irr::io::path& filename);
|
||||
|
||||
scene* getScene ();
|
||||
CScene* getScene ();
|
||||
|
||||
std::string getTitle ();
|
||||
std::string getType ();
|
||||
protected:
|
||||
project (std::string title, std::string type, scene* scene);
|
||||
CProject (std::string title, std::string type, CScene* scene);
|
||||
private:
|
||||
std::string m_title;
|
||||
std::string m_type;
|
||||
scene* m_scene;
|
||||
CScene* m_scene;
|
||||
};
|
||||
};
|
||||
|
@ -1,13 +1,13 @@
|
||||
#include "scene.h"
|
||||
#include "project.h"
|
||||
#include "CScene.h"
|
||||
#include "CProject.h"
|
||||
|
||||
#include "../core.h"
|
||||
#include "../fs/utils.h"
|
||||
|
||||
using namespace wp::core;
|
||||
|
||||
scene::scene (
|
||||
scenes::camera* camera,
|
||||
CScene::CScene (
|
||||
Scenes::CCamera* camera,
|
||||
irr::video::SColorf ambientColor,
|
||||
bool bloom,
|
||||
irr::f64 bloomStrength,
|
||||
@ -23,7 +23,7 @@ scene::scene (
|
||||
irr::f64 cameraShakeRoughness,
|
||||
irr::f64 cameraShakeSpeed,
|
||||
irr::video::SColorf clearColor,
|
||||
scenes::projection* orthogonalProjection,
|
||||
Scenes::CProjection* orthogonalProjection,
|
||||
irr::video::SColorf skylightColor) :
|
||||
m_camera (camera),
|
||||
m_ambientColor (ambientColor),
|
||||
@ -46,7 +46,7 @@ scene::scene (
|
||||
{
|
||||
}
|
||||
|
||||
scene* scene::fromFile (const irr::io::path& filename)
|
||||
CScene* CScene::fromFile (const irr::io::path& filename)
|
||||
{
|
||||
json content = json::parse (wp::fs::utils::loadFullFile (filename));
|
||||
|
||||
@ -172,25 +172,25 @@ scene* scene::fromFile (const irr::io::path& filename)
|
||||
throw std::runtime_error ("General section must have skylight color");
|
||||
}
|
||||
|
||||
scene* scene = new class scene (
|
||||
scenes::camera::fromJSON (*camera_it),
|
||||
wp::core::atoSColorf (*ambientcolor_it),
|
||||
*bloom_it,
|
||||
*bloomstrength_it,
|
||||
*bloomthreshold_it,
|
||||
*camerafade_it,
|
||||
*cameraparallax_it,
|
||||
*cameraparallaxamount_it,
|
||||
*cameraparallaxdelay_it,
|
||||
*cameraparallaxmouseinfluence_it,
|
||||
*camerapreview_it,
|
||||
*camerashake_it,
|
||||
*camerashakeamplitude_it,
|
||||
*camerashakeroughness_it,
|
||||
*camerashakespeed_it,
|
||||
wp::core::atoSColorf (*clearcolor_it),
|
||||
scenes::projection::fromJSON (*orthogonalprojection_it),
|
||||
wp::core::atoSColorf (*skylightcolor_it)
|
||||
CScene* scene = new CScene (
|
||||
Scenes::CCamera::fromJSON (*camera_it),
|
||||
wp::core::atoSColorf (*ambientcolor_it),
|
||||
*bloom_it,
|
||||
*bloomstrength_it,
|
||||
*bloomthreshold_it,
|
||||
*camerafade_it,
|
||||
*cameraparallax_it,
|
||||
*cameraparallaxamount_it,
|
||||
*cameraparallaxdelay_it,
|
||||
*cameraparallaxmouseinfluence_it,
|
||||
*camerapreview_it,
|
||||
*camerashake_it,
|
||||
*camerashakeamplitude_it,
|
||||
*camerashakeroughness_it,
|
||||
*camerashakespeed_it,
|
||||
wp::core::atoSColorf (*clearcolor_it),
|
||||
Scenes::CProjection::fromJSON (*orthogonalprojection_it),
|
||||
wp::core::atoSColorf (*skylightcolor_it)
|
||||
);
|
||||
|
||||
json::const_iterator cur = (*objects_it).begin ();
|
||||
@ -199,7 +199,7 @@ scene* scene::fromFile (const irr::io::path& filename)
|
||||
for (; cur != end; cur ++)
|
||||
{
|
||||
scene->insertObject (
|
||||
object::fromJSON (*cur)
|
||||
CObject::fromJSON (*cur)
|
||||
);
|
||||
}
|
||||
|
||||
@ -207,112 +207,112 @@ scene* scene::fromFile (const irr::io::path& filename)
|
||||
}
|
||||
|
||||
|
||||
std::vector<object*>* scene::getObjects ()
|
||||
std::vector<CObject*>* CScene::getObjects ()
|
||||
{
|
||||
return &this->m_objects;
|
||||
}
|
||||
|
||||
void scene::insertObject (object* object)
|
||||
void CScene::insertObject (CObject* object)
|
||||
{
|
||||
this->m_objects.push_back (object);
|
||||
}
|
||||
|
||||
project* scene::getProject ()
|
||||
CProject* CScene::getProject ()
|
||||
{
|
||||
return this->m_project;
|
||||
}
|
||||
|
||||
void scene::setProject (project* project)
|
||||
void CScene::setProject (CProject* project)
|
||||
{
|
||||
this->m_project = project;
|
||||
}
|
||||
|
||||
scenes::camera* scene::getCamera ()
|
||||
Scenes::CCamera* CScene::getCamera ()
|
||||
{
|
||||
return this->m_camera;
|
||||
}
|
||||
|
||||
const irr::video::SColorf &scene::getAmbientColor() const
|
||||
const irr::video::SColorf &CScene::getAmbientColor() const
|
||||
{
|
||||
return this->m_ambientColor;
|
||||
}
|
||||
|
||||
bool scene::isBloom () const
|
||||
bool CScene::isBloom () const
|
||||
{
|
||||
return this->m_bloom;
|
||||
}
|
||||
|
||||
irr::f64 scene::getBloomStrength () const
|
||||
irr::f64 CScene::getBloomStrength () const
|
||||
{
|
||||
return this->m_bloomStrength;
|
||||
}
|
||||
|
||||
irr::f64 scene::getBloomThreshold () const
|
||||
irr::f64 CScene::getBloomThreshold () const
|
||||
{
|
||||
return this->m_bloomThreshold;
|
||||
}
|
||||
|
||||
bool scene::isCameraFade () const
|
||||
bool CScene::isCameraFade () const
|
||||
{
|
||||
return this->m_cameraFade;
|
||||
}
|
||||
|
||||
bool scene::isCameraParallax () const
|
||||
bool CScene::isCameraParallax () const
|
||||
{
|
||||
return this->m_cameraParallax;
|
||||
}
|
||||
|
||||
irr::f64 scene::getCameraParallaxAmount () const
|
||||
irr::f64 CScene::getCameraParallaxAmount () const
|
||||
{
|
||||
return this->m_cameraParallaxAmount;
|
||||
}
|
||||
|
||||
irr::f64 scene::getCameraParallaxDelay () const
|
||||
irr::f64 CScene::getCameraParallaxDelay () const
|
||||
{
|
||||
return this->m_cameraParallaxDelay;
|
||||
}
|
||||
|
||||
irr::f64 scene::getCameraParallaxMouseInfluence () const
|
||||
irr::f64 CScene::getCameraParallaxMouseInfluence () const
|
||||
{
|
||||
return this->m_cameraParallaxMouseInfluence;
|
||||
}
|
||||
|
||||
bool scene::isCameraPreview () const
|
||||
bool CScene::isCameraPreview () const
|
||||
{
|
||||
return this->m_cameraPreview;
|
||||
}
|
||||
|
||||
bool scene::isCameraShake () const
|
||||
bool CScene::isCameraShake () const
|
||||
{
|
||||
return this->m_cameraShake;
|
||||
}
|
||||
|
||||
irr::f64 scene::getCameraShakeAmplitude () const
|
||||
irr::f64 CScene::getCameraShakeAmplitude () const
|
||||
{
|
||||
return this->m_cameraShakeAmplitude;
|
||||
}
|
||||
|
||||
irr::f64 scene::getCameraShakeRoughness () const
|
||||
irr::f64 CScene::getCameraShakeRoughness () const
|
||||
{
|
||||
return this->m_cameraShakeRoughness;
|
||||
}
|
||||
|
||||
irr::f64 scene::getCameraShakeSpeed () const
|
||||
irr::f64 CScene::getCameraShakeSpeed () const
|
||||
{
|
||||
return this->m_cameraShakeSpeed;
|
||||
}
|
||||
|
||||
const irr::video::SColorf &scene::getClearColor () const
|
||||
const irr::video::SColorf &CScene::getClearColor () const
|
||||
{
|
||||
return this->m_clearColor;
|
||||
}
|
||||
|
||||
scenes::projection *scene::getOrthogonalProjection () const
|
||||
Scenes::CProjection* CScene::getOrthogonalProjection () const
|
||||
{
|
||||
return this->m_orthogonalProjection;
|
||||
}
|
||||
|
||||
const irr::video::SColorf &scene::getSkylightColor () const
|
||||
const irr::video::SColorf &CScene::getSkylightColor () const
|
||||
{
|
||||
return this->m_skylightColor;
|
||||
}
|
@ -3,26 +3,26 @@
|
||||
#include <irrlicht/irrlicht.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "project.h"
|
||||
#include "object.h"
|
||||
#include "CProject.h"
|
||||
#include "CObject.h"
|
||||
|
||||
#include "scenes/camera.h"
|
||||
#include "scenes/projection.h"
|
||||
#include "Scenes/CCamera.h"
|
||||
#include "Scenes/CProjection.h"
|
||||
|
||||
namespace wp::core
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
||||
class project;
|
||||
class object;
|
||||
class CProject;
|
||||
class CObject;
|
||||
|
||||
class scene
|
||||
class CScene
|
||||
{
|
||||
public:
|
||||
static scene* fromFile (const irr::io::path& filename);
|
||||
static CScene* fromFile (const irr::io::path& filename);
|
||||
|
||||
project* getProject ();
|
||||
std::vector<object*>* getObjects ();
|
||||
CProject* getProject ();
|
||||
std::vector<CObject*>* getObjects ();
|
||||
|
||||
const irr::video::SColorf &getAmbientColor() const;
|
||||
bool isBloom() const;
|
||||
@ -39,40 +39,40 @@ namespace wp::core
|
||||
irr::f64 getCameraShakeRoughness() const;
|
||||
irr::f64 getCameraShakeSpeed() const;
|
||||
const irr::video::SColorf &getClearColor() const;
|
||||
scenes::projection *getOrthogonalProjection() const;
|
||||
Scenes::CProjection *getOrthogonalProjection() const;
|
||||
const irr::video::SColorf &getSkylightColor() const;
|
||||
|
||||
protected:
|
||||
friend class project;
|
||||
friend class CProject;
|
||||
|
||||
void setProject (project* project);
|
||||
scenes::camera* getCamera ();
|
||||
void setProject (CProject* project);
|
||||
Scenes::CCamera* getCamera ();
|
||||
|
||||
scene (
|
||||
scenes::camera* camera,
|
||||
irr::video::SColorf ambientColor,
|
||||
bool bloom,
|
||||
irr::f64 bloomStrength,
|
||||
irr::f64 bloomThreshold,
|
||||
bool cameraFade,
|
||||
bool cameraParallax,
|
||||
irr::f64 cameraParallaxAmount,
|
||||
irr::f64 cameraParallaxDelay,
|
||||
irr::f64 cameraParallaxMouseInfluence,
|
||||
bool cameraPreview,
|
||||
bool cameraShake,
|
||||
irr::f64 cameraShakeAmplitude,
|
||||
irr::f64 cameraShakeRoughness,
|
||||
irr::f64 cameraShakeSpeed,
|
||||
irr::video::SColorf clearColor,
|
||||
scenes::projection* orthogonalProjection,
|
||||
irr::video::SColorf skylightColor
|
||||
CScene (
|
||||
Scenes::CCamera* camera,
|
||||
irr::video::SColorf ambientColor,
|
||||
bool bloom,
|
||||
irr::f64 bloomStrength,
|
||||
irr::f64 bloomThreshold,
|
||||
bool cameraFade,
|
||||
bool cameraParallax,
|
||||
irr::f64 cameraParallaxAmount,
|
||||
irr::f64 cameraParallaxDelay,
|
||||
irr::f64 cameraParallaxMouseInfluence,
|
||||
bool cameraPreview,
|
||||
bool cameraShake,
|
||||
irr::f64 cameraShakeAmplitude,
|
||||
irr::f64 cameraShakeRoughness,
|
||||
irr::f64 cameraShakeSpeed,
|
||||
irr::video::SColorf clearColor,
|
||||
Scenes::CProjection* orthogonalProjection,
|
||||
irr::video::SColorf skylightColor
|
||||
);
|
||||
|
||||
void insertObject (object* object);
|
||||
void insertObject (CObject* object);
|
||||
private:
|
||||
project* m_project;
|
||||
scenes::camera* m_camera;
|
||||
CProject* m_project;
|
||||
Scenes::CCamera* m_camera;
|
||||
|
||||
// data from general section on the json
|
||||
irr::video::SColorf m_ambientColor;
|
||||
@ -90,9 +90,9 @@ namespace wp::core
|
||||
irr::f64 m_cameraShakeRoughness;
|
||||
irr::f64 m_cameraShakeSpeed;
|
||||
irr::video::SColorf m_clearColor;
|
||||
scenes::projection* m_orthogonalProjection;
|
||||
Scenes::CProjection* m_orthogonalProjection;
|
||||
irr::video::SColorf m_skylightColor;
|
||||
|
||||
std::vector<object*> m_objects;
|
||||
std::vector<CObject*> m_objects;
|
||||
};
|
||||
};
|
@ -1,12 +1,12 @@
|
||||
#include "effect.h"
|
||||
#include "CEffect.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "../../fs/utils.h"
|
||||
|
||||
using namespace wp::core::objects;
|
||||
using namespace wp::core::Objects;
|
||||
|
||||
effect::effect (
|
||||
CEffect::CEffect (
|
||||
std::string name,
|
||||
std::string description,
|
||||
std::string group,
|
||||
@ -18,7 +18,7 @@ effect::effect (
|
||||
{
|
||||
}
|
||||
|
||||
effect* effect::fromJSON (json data)
|
||||
CEffect* CEffect::fromJSON (json data)
|
||||
{
|
||||
json::const_iterator file_it = data.find ("file");
|
||||
|
||||
@ -66,7 +66,7 @@ effect* effect::fromJSON (json data)
|
||||
throw std::runtime_error ("Effect must have dependencies");
|
||||
}
|
||||
|
||||
effect* effect = new class effect (
|
||||
CEffect* effect = new CEffect (
|
||||
*name_it,
|
||||
*description_it,
|
||||
*group_it,
|
||||
@ -86,7 +86,7 @@ effect* effect::fromJSON (json data)
|
||||
}
|
||||
|
||||
effect->insertMaterial (
|
||||
images::material::fromFile ((*materialfile).get <std::string> ().c_str ())
|
||||
Images::CMaterial::fromFile ((*materialfile).get <std::string> ().c_str ())
|
||||
);
|
||||
}
|
||||
|
||||
@ -101,22 +101,22 @@ effect* effect::fromJSON (json data)
|
||||
return effect;
|
||||
}
|
||||
|
||||
std::vector<std::string>* effect::getDependencies ()
|
||||
std::vector<std::string>* CEffect::getDependencies ()
|
||||
{
|
||||
return &this->m_dependencies;
|
||||
}
|
||||
|
||||
std::vector<images::material*>* effect::getMaterials ()
|
||||
std::vector<Images::CMaterial*>* CEffect::getMaterials ()
|
||||
{
|
||||
return &this->m_materials;
|
||||
}
|
||||
|
||||
void effect::insertDependency (const std::string& dep)
|
||||
void CEffect::insertDependency (const std::string& dep)
|
||||
{
|
||||
this->m_dependencies.push_back (dep);
|
||||
}
|
||||
|
||||
void effect::insertMaterial (images::material* material)
|
||||
void CEffect::insertMaterial (Images::CMaterial* material)
|
||||
{
|
||||
this->m_materials.push_back (material);
|
||||
}
|
@ -3,29 +3,29 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
#include "images/material.h"
|
||||
#include "Images/CMaterial.h"
|
||||
|
||||
namespace wp::core::objects
|
||||
namespace wp::core::Objects
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
||||
class effect
|
||||
class CEffect
|
||||
{
|
||||
public:
|
||||
effect (
|
||||
CEffect (
|
||||
std::string name,
|
||||
std::string description,
|
||||
std::string group,
|
||||
std::string preview
|
||||
);
|
||||
|
||||
static effect* fromJSON (json data);
|
||||
static CEffect* fromJSON (json data);
|
||||
|
||||
std::vector<std::string>* getDependencies ();
|
||||
std::vector<images::material*>* getMaterials ();
|
||||
std::vector<Images::CMaterial*>* getMaterials ();
|
||||
protected:
|
||||
void insertDependency (const std::string& dep);
|
||||
void insertMaterial (images::material* material);
|
||||
void insertMaterial (Images::CMaterial* material);
|
||||
private:
|
||||
std::string m_name;
|
||||
std::string m_description;
|
||||
@ -33,6 +33,6 @@ namespace wp::core::objects
|
||||
std::string m_preview;
|
||||
|
||||
std::vector<std::string> m_dependencies;
|
||||
std::vector<images::material*> m_materials;
|
||||
std::vector<Images::CMaterial*> m_materials;
|
||||
};
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
#include "image.h"
|
||||
#include "images/material.h"
|
||||
#include "CImage.h"
|
||||
#include "Images/CMaterial.h"
|
||||
|
||||
#include "../../core.h"
|
||||
#include "../../fs/utils.h"
|
||||
|
||||
using namespace wp::core::objects;
|
||||
using namespace wp::core::Objects;
|
||||
|
||||
image::image (
|
||||
images::material* material,
|
||||
CImage::CImage (
|
||||
Images::CMaterial* material,
|
||||
bool visible,
|
||||
irr::u32 id,
|
||||
std::string name,
|
||||
@ -15,13 +15,13 @@ image::image (
|
||||
const irr::core::vector3df& scale,
|
||||
const irr::core::vector3df& angles,
|
||||
const irr::core::vector2df& size) :
|
||||
object (visible, id, std::move(name), origin, scale, angles),
|
||||
m_size (size)
|
||||
CObject (visible, id, std::move(name), origin, scale, angles),
|
||||
m_size (size)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
wp::core::object* image::fromJSON (
|
||||
wp::core::CObject* CImage::fromJSON (
|
||||
json data,
|
||||
bool visible,
|
||||
irr::u32 id,
|
||||
@ -47,14 +47,14 @@ wp::core::object* image::fromJSON (
|
||||
throw std::runtime_error ("Image must have a material");
|
||||
}
|
||||
|
||||
return new image (
|
||||
images::material::fromFile ((*material_it).get <std::string> ().c_str ()),
|
||||
visible,
|
||||
id,
|
||||
name,
|
||||
origin,
|
||||
scale,
|
||||
angles,
|
||||
wp::core::ato2vf (*size_it)
|
||||
return new CImage (
|
||||
Images::CMaterial::fromFile ((*material_it).get <std::string> ().c_str ()),
|
||||
visible,
|
||||
id,
|
||||
name,
|
||||
origin,
|
||||
scale,
|
||||
angles,
|
||||
wp::core::ato2vf (*size_it)
|
||||
);
|
||||
}
|
42
wallpaperengine/core/Objects/CImage.h
Normal file
42
wallpaperengine/core/Objects/CImage.h
Normal file
@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
#include "wallpaperengine/core/CObject.h"
|
||||
#include "Images/CMaterial.h"
|
||||
|
||||
namespace wp::core::Objects
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
||||
class CImage : CObject
|
||||
{
|
||||
protected:
|
||||
friend class CObject;
|
||||
|
||||
static CObject* fromJSON (
|
||||
json data,
|
||||
bool visible,
|
||||
irr::u32 id,
|
||||
std::string name,
|
||||
const irr::core::vector3df& origin,
|
||||
const irr::core::vector3df& scale,
|
||||
const irr::core::vector3df& angles
|
||||
);
|
||||
|
||||
CImage (
|
||||
Images::CMaterial* material,
|
||||
bool visible,
|
||||
irr::u32 id,
|
||||
std::string name,
|
||||
const irr::core::vector3df& origin,
|
||||
const irr::core::vector3df& scale,
|
||||
const irr::core::vector3df& angles,
|
||||
const irr::core::vector2df& size
|
||||
);
|
||||
|
||||
private:
|
||||
irr::core::vector2df m_size;
|
||||
};
|
||||
};
|
@ -1,21 +1,21 @@
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
#include "../object.h"
|
||||
#include "sound.h"
|
||||
#include "wallpaperengine/core/CObject.h"
|
||||
#include "CSound.h"
|
||||
|
||||
using namespace wp::core::objects;
|
||||
sound::sound (
|
||||
using namespace wp::core::Objects;
|
||||
CSound::CSound (
|
||||
bool visible,
|
||||
irr::u32 id,
|
||||
std::string name,
|
||||
const irr::core::vector3df& origin,
|
||||
const irr::core::vector3df& scale,
|
||||
const irr::core::vector3df& angles) :
|
||||
object (visible, id, std::move(name), origin, scale, angles)
|
||||
CObject (visible, id, std::move(name), origin, scale, angles)
|
||||
{
|
||||
}
|
||||
|
||||
wp::core::object* sound::fromJSON (
|
||||
wp::core::CObject* CSound::fromJSON (
|
||||
json data,
|
||||
bool visible,
|
||||
irr::u32 id,
|
||||
@ -36,7 +36,7 @@ wp::core::object* sound::fromJSON (
|
||||
throw std::runtime_error ("Expected sound list");
|
||||
}
|
||||
|
||||
sound* sound = new class sound (
|
||||
CSound* sound = new CSound (
|
||||
visible,
|
||||
id,
|
||||
name,
|
||||
@ -56,12 +56,12 @@ wp::core::object* sound::fromJSON (
|
||||
return sound;
|
||||
}
|
||||
|
||||
void sound::insertSound (std::string filename)
|
||||
void CSound::insertSound (std::string filename)
|
||||
{
|
||||
this->m_sounds.push_back (filename);
|
||||
}
|
||||
|
||||
std::vector<std::string>* sound::getSounds ()
|
||||
std::vector<std::string>* CSound::getSounds ()
|
||||
{
|
||||
return &this->m_sounds;
|
||||
}
|
@ -3,16 +3,16 @@
|
||||
#include <irrlicht/irrlicht.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "../object.h"
|
||||
#include "wallpaperengine/core/CObject.h"
|
||||
|
||||
namespace wp::core::objects
|
||||
namespace wp::core::Objects
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
||||
class sound : object
|
||||
class CSound : CObject
|
||||
{
|
||||
public:
|
||||
static object* fromJSON (
|
||||
static CObject* fromJSON (
|
||||
json data,
|
||||
bool visible,
|
||||
irr::u32 id,
|
||||
@ -26,7 +26,7 @@ namespace wp::core::objects
|
||||
std::vector<std::string>* getSounds ();
|
||||
protected:
|
||||
|
||||
sound (
|
||||
CSound (
|
||||
bool visible,
|
||||
irr::u32 id,
|
||||
std::string name,
|
@ -1,24 +1,24 @@
|
||||
#include "material.h"
|
||||
#include "CMaterial.h"
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "../../../fs/utils.h"
|
||||
|
||||
using namespace wp::core::objects::images;
|
||||
using namespace wp::core::Objects::Images;
|
||||
|
||||
material::material ()
|
||||
CMaterial::CMaterial ()
|
||||
{
|
||||
}
|
||||
|
||||
material* material::fromFile (irr::io::path filename)
|
||||
CMaterial* CMaterial::fromFile (irr::io::path filename)
|
||||
{
|
||||
return fromJSON (
|
||||
json::parse (wp::fs::utils::loadFullFile (filename))
|
||||
);
|
||||
}
|
||||
|
||||
material* material::fromJSON (json data)
|
||||
CMaterial* CMaterial::fromJSON (json data)
|
||||
{
|
||||
json::const_iterator passes_it = data.find ("passes");
|
||||
|
||||
@ -27,7 +27,7 @@ material* material::fromJSON (json data)
|
||||
throw std::runtime_error ("Material must have at least one pass");
|
||||
}
|
||||
|
||||
material* material = new class material ();
|
||||
CMaterial* material = new CMaterial ();
|
||||
|
||||
json::const_iterator cur = (*passes_it).begin ();
|
||||
json::const_iterator end = (*passes_it).end ();
|
||||
@ -35,19 +35,19 @@ material* material::fromJSON (json data)
|
||||
for (; cur != end; cur ++)
|
||||
{
|
||||
material->insertPass (
|
||||
materials::passes::fromJSON (*cur)
|
||||
Materials::CPassess::fromJSON (*cur)
|
||||
);
|
||||
}
|
||||
|
||||
return material;
|
||||
}
|
||||
|
||||
void material::insertPass (materials::passes* mass)
|
||||
void CMaterial::insertPass (Materials::CPassess* mass)
|
||||
{
|
||||
this->m_passes.push_back (mass);
|
||||
}
|
||||
|
||||
std::vector <materials::passes*>* material::getPasses ()
|
||||
std::vector <Materials::CPassess*>* CMaterial::getPasses ()
|
||||
{
|
||||
return &this->m_passes;
|
||||
}
|
26
wallpaperengine/core/Objects/Images/CMaterial.h
Normal file
26
wallpaperengine/core/Objects/Images/CMaterial.h
Normal file
@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "Materials/CPassess.h"
|
||||
|
||||
namespace wp::core::Objects::Images
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
||||
class CMaterial
|
||||
{
|
||||
public:
|
||||
static CMaterial* fromFile (irr::io::path filename);
|
||||
static CMaterial* fromJSON (json data);
|
||||
|
||||
void insertPass (Materials::CPassess* mass);
|
||||
|
||||
std::vector <Materials::CPassess*>* getPasses ();
|
||||
protected:
|
||||
CMaterial ();
|
||||
private:
|
||||
std::vector <Materials::CPassess*> m_passes;
|
||||
};
|
||||
};
|
@ -1,15 +1,8 @@
|
||||
//
|
||||
// Created by almamu on 13/08/19.
|
||||
//
|
||||
#include "CPassess.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <utility>
|
||||
using namespace wp::core::Objects::Images::Materials;
|
||||
|
||||
#include "passes.h"
|
||||
|
||||
using namespace wp::core::objects::images::materials;
|
||||
|
||||
passes::passes (std::string blending, std::string cullmode, std::string depthtest, std::string depthwrite, std::string shader) :
|
||||
CPassess::CPassess (std::string blending, std::string cullmode, std::string depthtest, std::string depthwrite, std::string shader) :
|
||||
m_blending (std::move(blending)),
|
||||
m_cullmode (std::move(cullmode)),
|
||||
m_depthtest (std::move(depthtest)),
|
||||
@ -18,12 +11,12 @@ passes::passes (std::string blending, std::string cullmode, std::string depthtes
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<std::string>* passes::getTextures ()
|
||||
std::vector<std::string>* CPassess::getTextures ()
|
||||
{
|
||||
return &this->m_textures;
|
||||
}
|
||||
|
||||
passes* passes::fromJSON (json data)
|
||||
CPassess* CPassess::fromJSON (json data)
|
||||
{
|
||||
json::const_iterator blending_it = data.find ("blending");
|
||||
json::const_iterator cullmode_it = data.find ("cullmode");
|
||||
@ -65,7 +58,7 @@ passes* passes::fromJSON (json data)
|
||||
}
|
||||
}
|
||||
|
||||
passes* pass = new passes (
|
||||
CPassess* pass = new CPassess (
|
||||
*blending_it,
|
||||
*cullmode_it,
|
||||
*depthtest_it,
|
||||
@ -95,7 +88,7 @@ passes* passes::fromJSON (json data)
|
||||
}
|
||||
|
||||
|
||||
void passes::insertTexture (const std::string& texture)
|
||||
void CPassess::insertTexture (const std::string& texture)
|
||||
{
|
||||
this->m_textures.push_back (texture);
|
||||
}
|
@ -2,18 +2,18 @@
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace wp::core::objects::images::materials
|
||||
namespace wp::core::Objects::Images::Materials
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
||||
class passes
|
||||
class CPassess
|
||||
{
|
||||
public:
|
||||
static passes* fromJSON (json data);
|
||||
static CPassess* fromJSON (json data);
|
||||
|
||||
std::vector<std::string>* getTextures ();
|
||||
protected:
|
||||
passes (std::string blending, std::string cullmode, std::string depthtest, std::string depthwrite, std::string shader);
|
||||
CPassess (std::string blending, std::string cullmode, std::string depthtest, std::string depthwrite, std::string shader);
|
||||
|
||||
void insertTexture (const std::string& texture);
|
||||
private:
|
@ -1,10 +1,10 @@
|
||||
#include "controlpoint.h"
|
||||
#include "CControlPoint.h"
|
||||
|
||||
#include "../../../core.h"
|
||||
|
||||
using namespace wp::core::objects::particles;
|
||||
using namespace wp::core::Objects::Particles;
|
||||
|
||||
controlpoint* controlpoint::fromJSON (json data)
|
||||
CControlPoint* CControlPoint::fromJSON (json data)
|
||||
{
|
||||
json::const_iterator flags_it = data.find ("flags");
|
||||
json::const_iterator id_it = data.find ("id");
|
||||
@ -15,7 +15,7 @@ controlpoint* controlpoint::fromJSON (json data)
|
||||
throw std::runtime_error ("Particle's control point must have id");
|
||||
}
|
||||
|
||||
controlpoint* controlpoint = new class controlpoint (*id_it, 0);
|
||||
CControlPoint* controlpoint = new CControlPoint (*id_it, 0);
|
||||
|
||||
if (offset_it != data.end ())
|
||||
{
|
||||
@ -30,29 +30,29 @@ controlpoint* controlpoint::fromJSON (json data)
|
||||
return controlpoint;
|
||||
}
|
||||
|
||||
controlpoint::controlpoint (irr::u32 id, irr::u32 flags) :
|
||||
CControlPoint::CControlPoint (irr::u32 id, irr::u32 flags) :
|
||||
m_id (id),
|
||||
m_flags (flags),
|
||||
m_offset (irr::core::vector3df ())
|
||||
{
|
||||
}
|
||||
|
||||
void controlpoint::setOffset (const irr::core::vector3df& offset)
|
||||
void CControlPoint::setOffset (const irr::core::vector3df& offset)
|
||||
{
|
||||
this->m_offset = offset;
|
||||
}
|
||||
|
||||
void controlpoint::setFlags (irr::u32 flags)
|
||||
void CControlPoint::setFlags (irr::u32 flags)
|
||||
{
|
||||
this->m_flags = flags;
|
||||
}
|
||||
|
||||
irr::core::vector3df* controlpoint::getOffset ()
|
||||
irr::core::vector3df* CControlPoint::getOffset ()
|
||||
{
|
||||
return &this->m_offset;
|
||||
}
|
||||
|
||||
irr::u32 controlpoint::getFlags ()
|
||||
irr::u32 CControlPoint::getFlags ()
|
||||
{
|
||||
return this->m_flags;
|
||||
}
|
@ -3,21 +3,21 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace wp::core::objects::particles
|
||||
namespace wp::core::Objects::Particles
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
||||
class controlpoint
|
||||
class CControlPoint
|
||||
{
|
||||
public:
|
||||
irr::core::vector3df* getOffset ();
|
||||
irr::u32 getFlags ();
|
||||
protected:
|
||||
friend class particle;
|
||||
friend class CParticle;
|
||||
|
||||
static controlpoint* fromJSON (json data);
|
||||
static CControlPoint* fromJSON (json data);
|
||||
|
||||
controlpoint (irr::u32 id, irr::u32 flags = 0);
|
||||
CControlPoint (irr::u32 id, irr::u32 flags = 0);
|
||||
|
||||
void setOffset (const irr::core::vector3df& offset);
|
||||
void setFlags (irr::u32 flags);
|
@ -1,10 +1,10 @@
|
||||
#include "emitter.h"
|
||||
#include "CEmitter.h"
|
||||
|
||||
#include "../../../core.h"
|
||||
|
||||
using namespace wp::core::objects::particles;
|
||||
using namespace wp::core::Objects::Particles;
|
||||
|
||||
emitter* emitter::fromJSON (json data)
|
||||
CEmitter* CEmitter::fromJSON (json data)
|
||||
{
|
||||
json::const_iterator directions_it = data.find ("directions");
|
||||
json::const_iterator distancemax_it = data.find ("distancemax");
|
||||
@ -29,11 +29,6 @@ emitter* emitter::fromJSON (json data)
|
||||
throw std::runtime_error ("Particle emitter must have minimum distance");
|
||||
}
|
||||
|
||||
if (id_it == data.end ())
|
||||
{
|
||||
throw std::runtime_error ("Particle emitter must have an id");
|
||||
}
|
||||
|
||||
if (name_it == data.end ())
|
||||
{
|
||||
throw std::runtime_error ("Particle emitter must have a name");
|
||||
@ -49,18 +44,18 @@ emitter* emitter::fromJSON (json data)
|
||||
throw std::runtime_error ("Particle emitter must have a rate");
|
||||
}
|
||||
|
||||
return new emitter (
|
||||
return new CEmitter (
|
||||
wp::core::ato3vf (*directions_it),
|
||||
*distancemax_it,
|
||||
*distancemin_it,
|
||||
*id_it,
|
||||
(id_it == data.end () ? 0 : (irr::u32) (*id_it)),
|
||||
*name_it,
|
||||
wp::core::ato3vf (*origin_it),
|
||||
*rate_it
|
||||
);
|
||||
}
|
||||
|
||||
emitter::emitter (
|
||||
CEmitter::CEmitter (
|
||||
const irr::core::vector3df& directions,
|
||||
irr::u32 distancemax,
|
||||
irr::u32 distancemin,
|
||||
@ -79,32 +74,32 @@ emitter::emitter (
|
||||
}
|
||||
|
||||
|
||||
const std::string& emitter::getName () const
|
||||
const std::string& CEmitter::getName () const
|
||||
{
|
||||
return this->m_name;
|
||||
}
|
||||
|
||||
irr::u32 emitter::getDistanceMax () const
|
||||
irr::u32 CEmitter::getDistanceMax () const
|
||||
{
|
||||
return this->m_distancemax;
|
||||
}
|
||||
|
||||
irr::u32 emitter::getDistanceMin () const
|
||||
irr::u32 CEmitter::getDistanceMin () const
|
||||
{
|
||||
return this->m_distancemin;
|
||||
}
|
||||
|
||||
irr::core::vector3df* emitter::getDirections ()
|
||||
irr::core::vector3df* CEmitter::getDirections ()
|
||||
{
|
||||
return &this->m_directions;
|
||||
}
|
||||
|
||||
irr::core::vector3df* emitter::getOrigin ()
|
||||
irr::core::vector3df* CEmitter::getOrigin ()
|
||||
{
|
||||
return &this->m_origin;
|
||||
}
|
||||
|
||||
irr::f64 emitter::getRate () const
|
||||
irr::f64 CEmitter::getRate () const
|
||||
{
|
||||
return this->m_rate;
|
||||
}
|
@ -3,11 +3,11 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace wp::core::objects::particles
|
||||
namespace wp::core::Objects::Particles
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
||||
class emitter
|
||||
class CEmitter
|
||||
{
|
||||
public:
|
||||
const std::string& getName () const;
|
||||
@ -17,11 +17,11 @@ namespace wp::core::objects::particles
|
||||
irr::core::vector3df* getOrigin ();
|
||||
irr::f64 getRate () const;
|
||||
protected:
|
||||
friend class particle;
|
||||
friend class CParticle;
|
||||
|
||||
static emitter* fromJSON (json data);
|
||||
static CEmitter* fromJSON (json data);
|
||||
|
||||
emitter (
|
||||
CEmitter (
|
||||
const irr::core::vector3df& directions,
|
||||
irr::u32 distancemax,
|
||||
irr::u32 distancemin,
|
74
wallpaperengine/core/Objects/Particles/CInitializer.cpp
Normal file
74
wallpaperengine/core/Objects/Particles/CInitializer.cpp
Normal file
@ -0,0 +1,74 @@
|
||||
#include "CInitializer.h"
|
||||
|
||||
#include "Initializers/CLifeTimeRandom.h"
|
||||
#include "Initializers/CSizeRandom.h"
|
||||
#include "Initializers/CRotationRandom.h"
|
||||
#include "Initializers/CVelocityRandom.h"
|
||||
#include "Initializers/CColorRandom.h"
|
||||
#include "Initializers/CAlphaRandom.h"
|
||||
#include "Initializers/CAngularVelocityRandom.h"
|
||||
|
||||
using namespace wp::core::Objects::Particles;
|
||||
|
||||
CInitializer* CInitializer::fromJSON (json data)
|
||||
{
|
||||
json::const_iterator id_it = data.find ("id");
|
||||
json::const_iterator name_it = data.find ("name");
|
||||
irr::u32 id = ((id_it == data.end ()) ? 0 : (irr::u32) (*id_it));
|
||||
|
||||
if (name_it == data.end ())
|
||||
{
|
||||
throw std::runtime_error ("Particle's initializer must have a name");
|
||||
}
|
||||
|
||||
if (*name_it == "lifetimerandom")
|
||||
{
|
||||
return Initializers::CLifeTimeRandom::fromJSON (data, id);
|
||||
}
|
||||
else if (*name_it == "sizerandom")
|
||||
{
|
||||
return Initializers::CSizeRandom::fromJSON (data, id);
|
||||
}
|
||||
else if (*name_it == "rotationrandom")
|
||||
{
|
||||
return Initializers::CRotationRandom::fromJSON (data, id);
|
||||
}
|
||||
else if (*name_it == "velocityrandom")
|
||||
{
|
||||
return Initializers::CVelocityRandom::fromJSON (data, id);
|
||||
}
|
||||
else if (*name_it == "colorrandom")
|
||||
{
|
||||
return Initializers::CColorRandom::fromJSON (data, id);
|
||||
}
|
||||
else if (*name_it == "alpharandom")
|
||||
{
|
||||
return Initializers::CAlphaRandom::fromJSON (data, id);
|
||||
}
|
||||
else if (*name_it == "angularvelocityrandom")
|
||||
{
|
||||
return Initializers::CAngularVelocityRandom::fromJSON (data, id);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error ("Particle's got an unknown initializer");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CInitializer::CInitializer (irr::u32 id, std::string name) :
|
||||
m_id (id),
|
||||
m_name (std::move(name))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
std::string& CInitializer::getName ()
|
||||
{
|
||||
return this->m_name;
|
||||
}
|
||||
|
||||
irr::u32 CInitializer::getId ()
|
||||
{
|
||||
return this->m_id;
|
||||
}
|
@ -3,21 +3,21 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace wp::core::objects::particles
|
||||
namespace wp::core::Objects::Particles
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
||||
class initializer
|
||||
class CInitializer
|
||||
{
|
||||
public:
|
||||
std::string& getName ();
|
||||
irr::u32 getId ();
|
||||
protected:
|
||||
friend class particle;
|
||||
friend class CParticle;
|
||||
|
||||
static initializer* fromJSON (json data);
|
||||
static CInitializer* fromJSON (json data);
|
||||
|
||||
initializer (irr::u32 id, std::string name);
|
||||
CInitializer (irr::u32 id, std::string name);
|
||||
private:
|
||||
irr::u32 m_id;
|
||||
std::string m_name;
|
@ -1,11 +1,11 @@
|
||||
#include "particle.h"
|
||||
#include "CParticle.h"
|
||||
#include "../../../fs/utils.h"
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
using namespace wp::core::objects::particles;
|
||||
using namespace wp::core::Objects::Particles;
|
||||
|
||||
particle* particle::fromFile (
|
||||
CParticle* CParticle::fromFile (
|
||||
const irr::io::path& filename,
|
||||
irr::u32 id,
|
||||
std::string name,
|
||||
@ -39,7 +39,7 @@ particle* particle::fromFile (
|
||||
throw std::runtime_error ("Particles must have initializers");
|
||||
}
|
||||
|
||||
particle* particle = new class particle (
|
||||
CParticle* particle = new CParticle (
|
||||
*starttime_it,
|
||||
*maxcount_it,
|
||||
id,
|
||||
@ -56,7 +56,7 @@ particle* particle::fromFile (
|
||||
for (; cur != end; cur ++)
|
||||
{
|
||||
particle->insertControlPoint (
|
||||
controlpoint::fromJSON (*cur)
|
||||
CControlPoint::fromJSON (*cur)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -67,7 +67,7 @@ particle* particle::fromFile (
|
||||
for (; cur != end; cur ++)
|
||||
{
|
||||
particle->insertEmitter (
|
||||
emitter::fromJSON (*cur)
|
||||
CEmitter::fromJSON (*cur)
|
||||
);
|
||||
}
|
||||
|
||||
@ -77,52 +77,52 @@ particle* particle::fromFile (
|
||||
for (; cur != end; cur ++)
|
||||
{
|
||||
particle->insertInitializer (
|
||||
initializer::fromJSON (*cur)
|
||||
CInitializer::fromJSON (*cur)
|
||||
);
|
||||
}
|
||||
|
||||
return particle;
|
||||
}
|
||||
|
||||
particle::particle (
|
||||
CParticle::CParticle (
|
||||
irr::u32 starttime,
|
||||
irr::u32 maxcount,
|
||||
irr::u32 id,
|
||||
std::string name,
|
||||
const irr::core::vector3df& origin,
|
||||
const irr::core::vector3df& scale):
|
||||
object (true, id, std::move(name), origin, scale, irr::core::vector3df ()),
|
||||
m_starttime (starttime),
|
||||
m_maxcount (maxcount)
|
||||
CObject (true, id, std::move(name), origin, scale, irr::core::vector3df ()),
|
||||
m_starttime (starttime),
|
||||
m_maxcount (maxcount)
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<emitter*>* particle::getEmitters ()
|
||||
std::vector<CEmitter*>* CParticle::getEmitters ()
|
||||
{
|
||||
return &this->m_emitters;
|
||||
}
|
||||
|
||||
std::vector<controlpoint*>* particle::getControlPoints ()
|
||||
std::vector<CControlPoint*>* CParticle::getControlPoints ()
|
||||
{
|
||||
return &this->m_controlpoints;
|
||||
}
|
||||
|
||||
std::vector<initializer*>* particle::getInitializers ()
|
||||
std::vector<CInitializer*>* CParticle::getInitializers ()
|
||||
{
|
||||
return &this->m_initializers;
|
||||
}
|
||||
|
||||
void particle::insertControlPoint (controlpoint* controlpoint)
|
||||
void CParticle::insertControlPoint (CControlPoint* controlpoint)
|
||||
{
|
||||
this->m_controlpoints.push_back (controlpoint);
|
||||
}
|
||||
|
||||
void particle::insertEmitter (emitter* emitter)
|
||||
void CParticle::insertEmitter (CEmitter* emitter)
|
||||
{
|
||||
this->m_emitters.push_back (emitter);
|
||||
}
|
||||
|
||||
void particle::insertInitializer (initializer* initializer)
|
||||
void CParticle::insertInitializer (CInitializer* initializer)
|
||||
{
|
||||
this->m_initializers.push_back (initializer);
|
||||
}
|
51
wallpaperengine/core/Objects/Particles/CParticle.h
Normal file
51
wallpaperengine/core/Objects/Particles/CParticle.h
Normal file
@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "CControlPoint.h"
|
||||
#include "CEmitter.h"
|
||||
#include "CInitializer.h"
|
||||
|
||||
#include "wallpaperengine/core/CObject.h"
|
||||
|
||||
namespace wp::core::Objects::Particles
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
||||
class CParticle : CObject
|
||||
{
|
||||
public:
|
||||
std::vector<CEmitter*>* getEmitters ();
|
||||
std::vector<CControlPoint*>* getControlPoints ();
|
||||
std::vector<CInitializer*>* getInitializers ();
|
||||
protected:
|
||||
friend class CObject;
|
||||
|
||||
static CParticle* fromFile (
|
||||
const irr::io::path& filename,
|
||||
irr::u32 id,
|
||||
std::string name,
|
||||
const irr::core::vector3df& origin,
|
||||
const irr::core::vector3df& scale
|
||||
);
|
||||
|
||||
CParticle (
|
||||
irr::u32 starttime,
|
||||
irr::u32 maxcount,
|
||||
irr::u32 id,
|
||||
std::string name,
|
||||
const irr::core::vector3df& origin,
|
||||
const irr::core::vector3df& scale
|
||||
);
|
||||
void insertControlPoint (CControlPoint* controlpoint);
|
||||
void insertEmitter (CEmitter* emitter);
|
||||
void insertInitializer (CInitializer* initializer);
|
||||
private:
|
||||
irr::u32 m_starttime;
|
||||
irr::u32 m_maxcount;
|
||||
std::vector<CControlPoint*> m_controlpoints;
|
||||
std::vector<CEmitter*> m_emitters;
|
||||
std::vector<CInitializer*> m_initializers;
|
||||
};
|
||||
};
|
@ -1,8 +1,8 @@
|
||||
#include "alpharandom.h"
|
||||
#include "CAlphaRandom.h"
|
||||
|
||||
using namespace wp::core::objects::particles::initializers;
|
||||
using namespace wp::core::Objects::Particles::Initializers;
|
||||
|
||||
alpharandom* alpharandom::fromJSON (json data, irr::u32 id)
|
||||
CAlphaRandom* CAlphaRandom::fromJSON (json data, irr::u32 id)
|
||||
{
|
||||
json::const_iterator min_it = data.find ("min");
|
||||
json::const_iterator max_it = data.find ("max");
|
||||
@ -17,22 +17,22 @@ alpharandom* alpharandom::fromJSON (json data, irr::u32 id)
|
||||
throw std::runtime_error ("Alpharandom initializer must have a maximum value");
|
||||
}
|
||||
|
||||
return new alpharandom (id, *min_it, *max_it);
|
||||
return new CAlphaRandom (id, *min_it, *max_it);
|
||||
}
|
||||
|
||||
alpharandom::alpharandom (irr::u32 id, irr::f64 min, irr::f64 max) :
|
||||
initializer (id, "alpharandom"),
|
||||
m_min (min),
|
||||
m_max (max)
|
||||
CAlphaRandom::CAlphaRandom (irr::u32 id, irr::f64 min, irr::f64 max) :
|
||||
CInitializer (id, "alpharandom"),
|
||||
m_min (min),
|
||||
m_max (max)
|
||||
{
|
||||
}
|
||||
|
||||
irr::f64 alpharandom::getMinimum ()
|
||||
irr::f64 CAlphaRandom::getMinimum ()
|
||||
{
|
||||
return this->m_min;
|
||||
}
|
||||
|
||||
irr::f64 alpharandom::getMaximum ()
|
||||
irr::f64 CAlphaRandom::getMaximum ()
|
||||
{
|
||||
return this->m_max;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "../CInitializer.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace wp::core::Objects::Particles::Initializers
|
||||
{
|
||||
class CAlphaRandom : CInitializer
|
||||
{
|
||||
public:
|
||||
irr::f64 getMinimum ();
|
||||
irr::f64 getMaximum ();
|
||||
protected:
|
||||
friend class CInitializer;
|
||||
|
||||
static CAlphaRandom* fromJSON (json data, irr::u32 id);
|
||||
|
||||
CAlphaRandom (irr::u32 id, irr::f64 min, irr::f64 max);
|
||||
private:
|
||||
irr::f64 m_max;
|
||||
irr::f64 m_min;
|
||||
};
|
||||
};
|
@ -0,0 +1,45 @@
|
||||
#include "CAngularVelocityRandom.h"
|
||||
|
||||
#include "../../../../core.h"
|
||||
|
||||
using namespace wp::core::Objects::Particles::Initializers;
|
||||
|
||||
CAngularVelocityRandom* CAngularVelocityRandom::fromJSON (json data, irr::u32 id)
|
||||
{
|
||||
json::const_iterator min_it = data.find ("min");
|
||||
json::const_iterator max_it = data.find ("max");
|
||||
|
||||
if (min_it == data.end ())
|
||||
{
|
||||
throw std::runtime_error ("Angularvelocityrandom initializer must have a minimum value");
|
||||
}
|
||||
|
||||
if (max_it == data.end ())
|
||||
{
|
||||
throw std::runtime_error ("Angularvelocityrandom initializer must have a maximum value");
|
||||
}
|
||||
|
||||
return new CAngularVelocityRandom (
|
||||
id,
|
||||
wp::core::ato3vf (*min_it),
|
||||
wp::core::ato3vf (*max_it)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
CAngularVelocityRandom::CAngularVelocityRandom (irr::u32 id, irr::core::vector3df min, irr::core::vector3df max) :
|
||||
CInitializer (id, "angularvelocityrandom"),
|
||||
m_min (min),
|
||||
m_max (max)
|
||||
{
|
||||
}
|
||||
|
||||
irr::core::vector3df* CAngularVelocityRandom::getMinimum ()
|
||||
{
|
||||
return &this->m_min;
|
||||
}
|
||||
|
||||
irr::core::vector3df* CAngularVelocityRandom::getMaximum ()
|
||||
{
|
||||
return &this->m_max;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "../CInitializer.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace wp::core::Objects::Particles::Initializers
|
||||
{
|
||||
class CAngularVelocityRandom : CInitializer
|
||||
{
|
||||
public:
|
||||
irr::core::vector3df* getMinimum ();
|
||||
irr::core::vector3df* getMaximum ();
|
||||
protected:
|
||||
friend class CInitializer;
|
||||
|
||||
static CAngularVelocityRandom* fromJSON (json data, irr::u32 id);
|
||||
|
||||
CAngularVelocityRandom (irr::u32 id, irr::core::vector3df min, irr::core::vector3df max);
|
||||
private:
|
||||
irr::core::vector3df m_max;
|
||||
irr::core::vector3df m_min;
|
||||
};
|
||||
};
|
@ -1,10 +1,10 @@
|
||||
#include "colorrandom.h"
|
||||
#include "CColorRandom.h"
|
||||
|
||||
#include "../../../../core.h"
|
||||
|
||||
using namespace wp::core::objects::particles::initializers;
|
||||
using namespace wp::core::Objects::Particles::Initializers;
|
||||
|
||||
colorrandom* colorrandom::fromJSON (json data, irr::u32 id)
|
||||
CColorRandom* CColorRandom::fromJSON (json data, irr::u32 id)
|
||||
{
|
||||
json::const_iterator min_it = data.find ("min");
|
||||
json::const_iterator max_it = data.find ("max");
|
||||
@ -19,7 +19,7 @@ colorrandom* colorrandom::fromJSON (json data, irr::u32 id)
|
||||
throw std::runtime_error ("Colorrandom initializer must have a maximum value");
|
||||
}
|
||||
|
||||
return new colorrandom (
|
||||
return new CColorRandom (
|
||||
id,
|
||||
wp::core::atoSColor (*min_it),
|
||||
wp::core::atoSColor (*max_it)
|
||||
@ -27,19 +27,19 @@ colorrandom* colorrandom::fromJSON (json data, irr::u32 id)
|
||||
}
|
||||
|
||||
|
||||
colorrandom::colorrandom (irr::u32 id, irr::video::SColor min, irr::video::SColor max) :
|
||||
initializer (id, "colorrandom"),
|
||||
m_min (min),
|
||||
m_max (max)
|
||||
CColorRandom::CColorRandom (irr::u32 id, irr::video::SColor min, irr::video::SColor max) :
|
||||
CInitializer (id, "colorrandom"),
|
||||
m_min (min),
|
||||
m_max (max)
|
||||
{
|
||||
}
|
||||
|
||||
irr::video::SColor* colorrandom::getMinimum ()
|
||||
irr::video::SColor* CColorRandom::getMinimum ()
|
||||
{
|
||||
return &this->m_min;
|
||||
}
|
||||
|
||||
irr::video::SColor* colorrandom::getMaximum ()
|
||||
irr::video::SColor* CColorRandom::getMaximum ()
|
||||
{
|
||||
return &this->m_max;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "../CInitializer.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace wp::core::Objects::Particles::Initializers
|
||||
{
|
||||
class CColorRandom : CInitializer
|
||||
{
|
||||
public:
|
||||
irr::video::SColor* getMinimum ();
|
||||
irr::video::SColor* getMaximum ();
|
||||
protected:
|
||||
friend class CInitializer;
|
||||
|
||||
static CColorRandom* fromJSON (json data, irr::u32 id);
|
||||
|
||||
CColorRandom (irr::u32 id, irr::video::SColor min, irr::video::SColor max);
|
||||
private:
|
||||
irr::video::SColor m_max;
|
||||
irr::video::SColor m_min;
|
||||
};
|
||||
};
|
@ -0,0 +1,39 @@
|
||||
#include "CLifeTimeRandom.h"
|
||||
|
||||
using namespace wp::core::Objects::Particles::Initializers;
|
||||
|
||||
CLifeTimeRandom* CLifeTimeRandom::fromJSON (json data, irr::u32 id)
|
||||
{
|
||||
json::const_iterator min_it = data.find ("min");
|
||||
json::const_iterator max_it = data.find ("max");
|
||||
|
||||
if (min_it == data.end ())
|
||||
{
|
||||
throw std::runtime_error ("Lifetimerandom initializer must have a minimum value");
|
||||
}
|
||||
|
||||
if (max_it == data.end ())
|
||||
{
|
||||
throw std::runtime_error ("Lifetimerandom initializer must have a maximum value");
|
||||
}
|
||||
|
||||
return new CLifeTimeRandom (id, *min_it, *max_it);
|
||||
}
|
||||
|
||||
|
||||
CLifeTimeRandom::CLifeTimeRandom (irr::u32 id, irr::u32 min, irr::u32 max) :
|
||||
CInitializer (id, "lifetimerandom"),
|
||||
m_min (min),
|
||||
m_max (max)
|
||||
{
|
||||
}
|
||||
|
||||
irr::u32 CLifeTimeRandom::getMinimum ()
|
||||
{
|
||||
return this->m_min;
|
||||
}
|
||||
|
||||
irr::u32 CLifeTimeRandom::getMaximum ()
|
||||
{
|
||||
return this->m_max;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "../CInitializer.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace wp::core::Objects::Particles::Initializers
|
||||
{
|
||||
class CLifeTimeRandom : CInitializer
|
||||
{
|
||||
public:
|
||||
irr::u32 getMinimum ();
|
||||
irr::u32 getMaximum ();
|
||||
protected:
|
||||
friend class CInitializer;
|
||||
|
||||
static CLifeTimeRandom* fromJSON (json data, irr::u32 id);
|
||||
|
||||
CLifeTimeRandom (irr::u32 id, irr::u32 min, irr::u32 max);
|
||||
private:
|
||||
irr::u32 m_max;
|
||||
irr::u32 m_min;
|
||||
};
|
||||
};
|
@ -0,0 +1,41 @@
|
||||
#include "CRotationRandom.h"
|
||||
|
||||
using namespace wp::core::Objects::Particles::Initializers;
|
||||
|
||||
CRotationRandom* CRotationRandom::fromJSON (json data, irr::u32 id)
|
||||
{
|
||||
json::const_iterator min_it = data.find ("min");
|
||||
json::const_iterator max_it = data.find ("max");
|
||||
|
||||
irr::f64 min = 0.0f;
|
||||
irr::f64 max = 360.0f;
|
||||
|
||||
if (min_it != data.end ())
|
||||
{
|
||||
min = *min_it;
|
||||
}
|
||||
|
||||
if (max_it != data.end ())
|
||||
{
|
||||
max = *max_it;
|
||||
}
|
||||
|
||||
return new CRotationRandom (id, min, max);
|
||||
}
|
||||
|
||||
CRotationRandom::CRotationRandom (irr::u32 id, irr::f64 min, irr::f64 max) :
|
||||
CInitializer (id, "rotationrandom"),
|
||||
m_min (min),
|
||||
m_max (max)
|
||||
{
|
||||
}
|
||||
|
||||
irr::f64 CRotationRandom::getMinimum ()
|
||||
{
|
||||
return this->m_min;
|
||||
}
|
||||
|
||||
irr::f64 CRotationRandom::getMaximum ()
|
||||
{
|
||||
return this->m_max;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "../CInitializer.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace wp::core::Objects::Particles::Initializers
|
||||
{
|
||||
class CRotationRandom : CInitializer
|
||||
{
|
||||
public:
|
||||
irr::f64 getMinimum ();
|
||||
irr::f64 getMaximum ();
|
||||
protected:
|
||||
friend class CInitializer;
|
||||
|
||||
static CRotationRandom* fromJSON (json data, irr::u32 id);
|
||||
|
||||
CRotationRandom (irr::u32 id, irr::f64 min, irr::f64 max);
|
||||
private:
|
||||
irr::f64 m_max;
|
||||
irr::f64 m_min;
|
||||
};
|
||||
};
|
@ -1,8 +1,8 @@
|
||||
#include "sizerandom.h"
|
||||
#include "CSizeRandom.h"
|
||||
|
||||
using namespace wp::core::objects::particles::initializers;
|
||||
using namespace wp::core::Objects::Particles::Initializers;
|
||||
|
||||
sizerandom* sizerandom::fromJSON (json data, irr::u32 id)
|
||||
CSizeRandom* CSizeRandom::fromJSON (json data, irr::u32 id)
|
||||
{
|
||||
json::const_iterator min_it = data.find ("min");
|
||||
json::const_iterator max_it = data.find ("max");
|
||||
@ -17,22 +17,22 @@ sizerandom* sizerandom::fromJSON (json data, irr::u32 id)
|
||||
throw std::runtime_error ("Sizerandom initializer must have a maximum value");
|
||||
}
|
||||
|
||||
return new sizerandom (id, *min_it, *max_it);
|
||||
return new CSizeRandom (id, *min_it, *max_it);
|
||||
}
|
||||
|
||||
sizerandom::sizerandom (irr::u32 id, irr::u32 min, irr::u32 max) :
|
||||
initializer (id, "sizerandom"),
|
||||
m_min (min),
|
||||
m_max (max)
|
||||
CSizeRandom::CSizeRandom (irr::u32 id, irr::u32 min, irr::u32 max) :
|
||||
CInitializer (id, "sizerandom"),
|
||||
m_min (min),
|
||||
m_max (max)
|
||||
{
|
||||
}
|
||||
|
||||
irr::u32 sizerandom::getMinimum ()
|
||||
irr::u32 CSizeRandom::getMinimum ()
|
||||
{
|
||||
return this->m_min;
|
||||
}
|
||||
|
||||
irr::u32 sizerandom::getMaximum ()
|
||||
irr::u32 CSizeRandom::getMaximum ()
|
||||
{
|
||||
return this->m_max;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "../CInitializer.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace wp::core::Objects::Particles::Initializers
|
||||
{
|
||||
class CSizeRandom : CInitializer
|
||||
{
|
||||
public:
|
||||
irr::u32 getMinimum ();
|
||||
irr::u32 getMaximum ();
|
||||
protected:
|
||||
friend class CInitializer;
|
||||
|
||||
static CSizeRandom* fromJSON (json data, irr::u32 id);
|
||||
|
||||
CSizeRandom (irr::u32 id, irr::u32 min, irr::u32 max);
|
||||
private:
|
||||
irr::u32 m_max;
|
||||
irr::u32 m_min;
|
||||
};
|
||||
};
|
@ -1,10 +1,10 @@
|
||||
#include "velocityrandom.h"
|
||||
#include "CVelocityRandom.h"
|
||||
|
||||
#include "../../../../core.h"
|
||||
|
||||
using namespace wp::core::objects::particles::initializers;
|
||||
using namespace wp::core::Objects::Particles::Initializers;
|
||||
|
||||
velocityrandom* velocityrandom::fromJSON (json data, irr::u32 id)
|
||||
CVelocityRandom* CVelocityRandom::fromJSON (json data, irr::u32 id)
|
||||
{
|
||||
json::const_iterator min_it = data.find ("min");
|
||||
json::const_iterator max_it = data.find ("max");
|
||||
@ -19,7 +19,7 @@ velocityrandom* velocityrandom::fromJSON (json data, irr::u32 id)
|
||||
throw std::runtime_error ("Velocityrandom initializer must have a maximum value");
|
||||
}
|
||||
|
||||
return new velocityrandom (
|
||||
return new CVelocityRandom (
|
||||
id,
|
||||
wp::core::ato3vf (*min_it),
|
||||
wp::core::ato3vf (*max_it)
|
||||
@ -27,19 +27,19 @@ velocityrandom* velocityrandom::fromJSON (json data, irr::u32 id)
|
||||
}
|
||||
|
||||
|
||||
velocityrandom::velocityrandom (irr::u32 id, irr::core::vector3df min, irr::core::vector3df max) :
|
||||
initializer (id, "velocityrandom"),
|
||||
m_min (min),
|
||||
m_max (max)
|
||||
CVelocityRandom::CVelocityRandom (irr::u32 id, irr::core::vector3df min, irr::core::vector3df max) :
|
||||
CInitializer (id, "velocityrandom"),
|
||||
m_min (min),
|
||||
m_max (max)
|
||||
{
|
||||
}
|
||||
|
||||
irr::core::vector3df* velocityrandom::getMinimum ()
|
||||
irr::core::vector3df* CVelocityRandom::getMinimum ()
|
||||
{
|
||||
return &this->m_min;
|
||||
}
|
||||
|
||||
irr::core::vector3df* velocityrandom::getMaximum ()
|
||||
irr::core::vector3df* CVelocityRandom::getMaximum ()
|
||||
{
|
||||
return &this->m_max;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "../CInitializer.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace wp::core::Objects::Particles::Initializers
|
||||
{
|
||||
class CVelocityRandom : CInitializer
|
||||
{
|
||||
public:
|
||||
irr::core::vector3df* getMinimum ();
|
||||
irr::core::vector3df* getMaximum ();
|
||||
protected:
|
||||
friend class CInitializer;
|
||||
|
||||
static CVelocityRandom* fromJSON (json data, irr::u32 id);
|
||||
|
||||
CVelocityRandom (irr::u32 id, irr::core::vector3df min, irr::core::vector3df max);
|
||||
private:
|
||||
irr::core::vector3df m_max;
|
||||
irr::core::vector3df m_min;
|
||||
};
|
||||
};
|
@ -1,31 +1,31 @@
|
||||
#include "camera.h"
|
||||
#include "CCamera.h"
|
||||
#include "../../core.h"
|
||||
|
||||
using namespace wp::core::scenes;
|
||||
using namespace wp::core::Scenes;
|
||||
|
||||
camera::camera (irr::core::vector3df center, irr::core::vector3df eye, irr::core::vector3df up) :
|
||||
CCamera::CCamera (irr::core::vector3df center, irr::core::vector3df eye, irr::core::vector3df up) :
|
||||
m_center (center),
|
||||
m_eye (eye),
|
||||
m_up (up)
|
||||
{
|
||||
}
|
||||
|
||||
irr::core::vector3df* camera::getCenter ()
|
||||
irr::core::vector3df* CCamera::getCenter ()
|
||||
{
|
||||
return &this->m_center;
|
||||
}
|
||||
|
||||
irr::core::vector3df* camera::getEye ()
|
||||
irr::core::vector3df* CCamera::getEye ()
|
||||
{
|
||||
return &this->m_eye;
|
||||
}
|
||||
|
||||
irr::core::vector3df* camera::getUp ()
|
||||
irr::core::vector3df* CCamera::getUp ()
|
||||
{
|
||||
return &this->m_up;
|
||||
}
|
||||
|
||||
camera* camera::fromJSON (json data)
|
||||
CCamera* CCamera::fromJSON (json data)
|
||||
{
|
||||
json::const_iterator center_it = data.find ("center");
|
||||
json::const_iterator eye_it = data.find ("eye");
|
||||
@ -46,7 +46,7 @@ camera* camera::fromJSON (json data)
|
||||
throw std::runtime_error ("Camera must have a up position");
|
||||
}
|
||||
|
||||
return new camera (
|
||||
return new CCamera (
|
||||
wp::core::ato3vf (*center_it),
|
||||
wp::core::ato3vf (*eye_it),
|
||||
wp::core::ato3vf (*up_it)
|
@ -3,20 +3,20 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace wp::core::scenes
|
||||
namespace wp::core::Scenes
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
||||
class camera
|
||||
class CCamera
|
||||
{
|
||||
public:
|
||||
static camera* fromJSON (json data);
|
||||
static CCamera* fromJSON (json data);
|
||||
|
||||
irr::core::vector3df* getCenter ();
|
||||
irr::core::vector3df* getEye ();
|
||||
irr::core::vector3df* getUp ();
|
||||
protected:
|
||||
camera (irr::core::vector3df center, irr::core::vector3df eye, irr::core::vector3df up);
|
||||
CCamera (irr::core::vector3df center, irr::core::vector3df eye, irr::core::vector3df up);
|
||||
private:
|
||||
irr::core::vector3df m_center;
|
||||
irr::core::vector3df m_eye;
|
@ -1,25 +1,25 @@
|
||||
#include "projection.h"
|
||||
#include "CProjection.h"
|
||||
#include "../../core.h"
|
||||
|
||||
using namespace wp::core::scenes;
|
||||
using namespace wp::core::Scenes;
|
||||
|
||||
projection::projection (irr::u32 width, irr::u32 height) :
|
||||
CProjection::CProjection (irr::u32 width, irr::u32 height) :
|
||||
m_width (width),
|
||||
m_height (height)
|
||||
{
|
||||
}
|
||||
|
||||
irr::u32 projection::getWidth ()
|
||||
irr::u32 CProjection::getWidth ()
|
||||
{
|
||||
return this->m_width;
|
||||
}
|
||||
|
||||
irr::u32 projection::getHeight ()
|
||||
irr::u32 CProjection::getHeight ()
|
||||
{
|
||||
return this->m_height;
|
||||
}
|
||||
|
||||
projection* projection::fromJSON (json data)
|
||||
CProjection* CProjection::fromJSON (json data)
|
||||
{
|
||||
json::const_iterator width_it = data.find ("width");
|
||||
json::const_iterator height_it = data.find ("height");
|
||||
@ -34,7 +34,7 @@ projection* projection::fromJSON (json data)
|
||||
throw std::runtime_error ("Projection must have height");
|
||||
}
|
||||
|
||||
return new projection (
|
||||
return new CProjection (
|
||||
*width_it,
|
||||
*height_it
|
||||
);
|
@ -3,19 +3,19 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace wp::core::scenes
|
||||
namespace wp::core::Scenes
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
||||
class projection
|
||||
class CProjection
|
||||
{
|
||||
public:
|
||||
static projection* fromJSON (json data);
|
||||
static CProjection* fromJSON (json data);
|
||||
|
||||
irr::u32 getWidth ();
|
||||
irr::u32 getHeight ();
|
||||
protected:
|
||||
projection (irr::u32 width, irr::u32 height);
|
||||
CProjection (irr::u32 width, irr::u32 height);
|
||||
private:
|
||||
irr::u32 m_width;
|
||||
irr::u32 m_height;
|
@ -1,42 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
#include "../object.h"
|
||||
#include "images/material.h"
|
||||
|
||||
namespace wp::core::objects
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
||||
class image : object
|
||||
{
|
||||
protected:
|
||||
friend class object;
|
||||
|
||||
static object* fromJSON (
|
||||
json data,
|
||||
bool visible,
|
||||
irr::u32 id,
|
||||
std::string name,
|
||||
const irr::core::vector3df& origin,
|
||||
const irr::core::vector3df& scale,
|
||||
const irr::core::vector3df& angles
|
||||
);
|
||||
|
||||
image (
|
||||
images::material* material,
|
||||
bool visible,
|
||||
irr::u32 id,
|
||||
std::string name,
|
||||
const irr::core::vector3df& origin,
|
||||
const irr::core::vector3df& scale,
|
||||
const irr::core::vector3df& angles,
|
||||
const irr::core::vector2df& size
|
||||
);
|
||||
|
||||
private:
|
||||
irr::core::vector2df m_size;
|
||||
};
|
||||
};
|
@ -1,26 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "materials/passes.h"
|
||||
|
||||
namespace wp::core::objects::images
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
||||
class material
|
||||
{
|
||||
public:
|
||||
static material* fromFile (irr::io::path filename);
|
||||
static material* fromJSON (json data);
|
||||
|
||||
void insertPass (materials::passes* mass);
|
||||
|
||||
std::vector <materials::passes*>* getPasses ();
|
||||
protected:
|
||||
material ();
|
||||
private:
|
||||
std::vector <materials::passes*> m_passes;
|
||||
};
|
||||
};
|
@ -1,73 +0,0 @@
|
||||
#include "initializer.h"
|
||||
|
||||
#include "initializers/lifetimerandom.h"
|
||||
#include "initializers/sizerandom.h"
|
||||
#include "initializers/rotationrandom.h"
|
||||
#include "initializers/velocityrandom.h"
|
||||
#include "initializers/colorrandom.h"
|
||||
#include "initializers/alpharandom.h"
|
||||
|
||||
using namespace wp::core::objects::particles;
|
||||
|
||||
initializer* initializer::fromJSON (json data)
|
||||
{
|
||||
json::const_iterator id_it = data.find ("id");
|
||||
json::const_iterator name_it = data.find ("name");
|
||||
|
||||
if (id_it == data.end ())
|
||||
{
|
||||
throw std::runtime_error ("Particle's initializer must have an id");
|
||||
}
|
||||
|
||||
if (name_it == data.end ())
|
||||
{
|
||||
throw std::runtime_error ("Particle's initializer must have a name");
|
||||
}
|
||||
|
||||
if (*name_it == "lifetimerandom")
|
||||
{
|
||||
return initializers::lifetimerandom::fromJSON (data, *id_it);
|
||||
}
|
||||
else if (*name_it == "sizerandom")
|
||||
{
|
||||
return initializers::sizerandom::fromJSON (data, *id_it);
|
||||
}
|
||||
else if (*name_it == "rotationrandom")
|
||||
{
|
||||
return initializers::rotationrandom::fromJSON (data, *id_it);
|
||||
}
|
||||
else if (*name_it == "velocityrandom")
|
||||
{
|
||||
return initializers::velocityrandom::fromJSON (data, *id_it);
|
||||
}
|
||||
else if (*name_it == "colorrandom")
|
||||
{
|
||||
return initializers::colorrandom::fromJSON (data, *id_it);
|
||||
}
|
||||
else if (*name_it == "alpharandom")
|
||||
{
|
||||
return initializers::alpharandom::fromJSON (data, *id_it);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error ("Particle's got an unknown initializer");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
initializer::initializer (irr::u32 id, std::string name) :
|
||||
m_id (id),
|
||||
m_name (std::move(name))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
std::string& initializer::getName ()
|
||||
{
|
||||
return this->m_name;
|
||||
}
|
||||
|
||||
irr::u32 initializer::getId ()
|
||||
{
|
||||
return this->m_id;
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "../initializer.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace wp::core::objects::particles::initializers
|
||||
{
|
||||
class alpharandom : initializer
|
||||
{
|
||||
public:
|
||||
irr::f64 getMinimum ();
|
||||
irr::f64 getMaximum ();
|
||||
protected:
|
||||
friend class initializer;
|
||||
|
||||
static alpharandom* fromJSON (json data, irr::u32 id);
|
||||
|
||||
alpharandom (irr::u32 id, irr::f64 min, irr::f64 max);
|
||||
private:
|
||||
irr::f64 m_max;
|
||||
irr::f64 m_min;
|
||||
};
|
||||
};
|
@ -1,25 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "../initializer.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace wp::core::objects::particles::initializers
|
||||
{
|
||||
class colorrandom : initializer
|
||||
{
|
||||
public:
|
||||
irr::video::SColor* getMinimum ();
|
||||
irr::video::SColor* getMaximum ();
|
||||
protected:
|
||||
friend class initializer;
|
||||
|
||||
static colorrandom* fromJSON (json data, irr::u32 id);
|
||||
|
||||
colorrandom (irr::u32 id, irr::video::SColor min, irr::video::SColor max);
|
||||
private:
|
||||
irr::video::SColor m_max;
|
||||
irr::video::SColor m_min;
|
||||
};
|
||||
};
|
@ -1,39 +0,0 @@
|
||||
#include "lifetimerandom.h"
|
||||
|
||||
using namespace wp::core::objects::particles::initializers;
|
||||
|
||||
lifetimerandom* lifetimerandom::fromJSON (json data, irr::u32 id)
|
||||
{
|
||||
json::const_iterator min_it = data.find ("min");
|
||||
json::const_iterator max_it = data.find ("max");
|
||||
|
||||
if (min_it == data.end ())
|
||||
{
|
||||
throw std::runtime_error ("Lifetimerandom initializer must have a minimum value");
|
||||
}
|
||||
|
||||
if (max_it == data.end ())
|
||||
{
|
||||
throw std::runtime_error ("Lifetimerandom initializer must have a maximum value");
|
||||
}
|
||||
|
||||
return new lifetimerandom (id, *min_it, *max_it);
|
||||
}
|
||||
|
||||
|
||||
lifetimerandom::lifetimerandom (irr::u32 id, irr::u32 min, irr::u32 max) :
|
||||
initializer (id, "lifetimerandom"),
|
||||
m_min (min),
|
||||
m_max (max)
|
||||
{
|
||||
}
|
||||
|
||||
irr::u32 lifetimerandom::getMinimum ()
|
||||
{
|
||||
return this->m_min;
|
||||
}
|
||||
|
||||
irr::u32 lifetimerandom::getMaximum ()
|
||||
{
|
||||
return this->m_max;
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "../initializer.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace wp::core::objects::particles::initializers
|
||||
{
|
||||
class lifetimerandom : initializer
|
||||
{
|
||||
public:
|
||||
irr::u32 getMinimum ();
|
||||
irr::u32 getMaximum ();
|
||||
protected:
|
||||
friend class initializer;
|
||||
|
||||
static lifetimerandom* fromJSON (json data, irr::u32 id);
|
||||
|
||||
lifetimerandom (irr::u32 id, irr::u32 min, irr::u32 max);
|
||||
private:
|
||||
irr::u32 m_max;
|
||||
irr::u32 m_min;
|
||||
};
|
||||
};
|
@ -1,38 +0,0 @@
|
||||
#include "rotationrandom.h"
|
||||
|
||||
using namespace wp::core::objects::particles::initializers;
|
||||
|
||||
rotationrandom* rotationrandom::fromJSON (json data, irr::u32 id)
|
||||
{
|
||||
json::const_iterator min_it = data.find ("min");
|
||||
json::const_iterator max_it = data.find ("max");
|
||||
|
||||
if (min_it == data.end ())
|
||||
{
|
||||
throw std::runtime_error ("Rotationrandom initializer must have a minimum value");
|
||||
}
|
||||
|
||||
if (max_it == data.end ())
|
||||
{
|
||||
throw std::runtime_error ("Rotationrandom initializer must have a maximum value");
|
||||
}
|
||||
|
||||
return new rotationrandom (id, *min_it, *max_it);
|
||||
}
|
||||
|
||||
rotationrandom::rotationrandom (irr::u32 id, irr::f64 min, irr::f64 max) :
|
||||
initializer (id, "rotationrandom"),
|
||||
m_min (min),
|
||||
m_max (max)
|
||||
{
|
||||
}
|
||||
|
||||
irr::f64 rotationrandom::getMinimum ()
|
||||
{
|
||||
return this->m_min;
|
||||
}
|
||||
|
||||
irr::f64 rotationrandom::getMaximum ()
|
||||
{
|
||||
return this->m_max;
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "../initializer.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace wp::core::objects::particles::initializers
|
||||
{
|
||||
class rotationrandom : initializer
|
||||
{
|
||||
public:
|
||||
irr::f64 getMinimum ();
|
||||
irr::f64 getMaximum ();
|
||||
protected:
|
||||
friend class initializer;
|
||||
|
||||
static rotationrandom* fromJSON (json data, irr::u32 id);
|
||||
|
||||
rotationrandom (irr::u32 id, irr::f64 min, irr::f64 max);
|
||||
private:
|
||||
irr::f64 m_max;
|
||||
irr::f64 m_min;
|
||||
};
|
||||
};
|
@ -1,25 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "../initializer.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace wp::core::objects::particles::initializers
|
||||
{
|
||||
class sizerandom : initializer
|
||||
{
|
||||
public:
|
||||
irr::u32 getMinimum ();
|
||||
irr::u32 getMaximum ();
|
||||
protected:
|
||||
friend class initializer;
|
||||
|
||||
static sizerandom* fromJSON (json data, irr::u32 id);
|
||||
|
||||
sizerandom (irr::u32 id, irr::u32 min, irr::u32 max);
|
||||
private:
|
||||
irr::u32 m_max;
|
||||
irr::u32 m_min;
|
||||
};
|
||||
};
|
@ -1,25 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "../initializer.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
|
||||
namespace wp::core::objects::particles::initializers
|
||||
{
|
||||
class velocityrandom : initializer
|
||||
{
|
||||
public:
|
||||
irr::core::vector3df* getMinimum ();
|
||||
irr::core::vector3df* getMaximum ();
|
||||
protected:
|
||||
friend class initializer;
|
||||
|
||||
static velocityrandom* fromJSON (json data, irr::u32 id);
|
||||
|
||||
velocityrandom (irr::u32 id, irr::core::vector3df min, irr::core::vector3df max);
|
||||
private:
|
||||
irr::core::vector3df m_max;
|
||||
irr::core::vector3df m_min;
|
||||
};
|
||||
};
|
@ -1,51 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "controlpoint.h"
|
||||
#include "emitter.h"
|
||||
#include "initializer.h"
|
||||
|
||||
#include "../../object.h"
|
||||
|
||||
namespace wp::core::objects::particles
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
||||
class particle : object
|
||||
{
|
||||
public:
|
||||
std::vector<emitter*>* getEmitters ();
|
||||
std::vector<controlpoint*>* getControlPoints ();
|
||||
std::vector<initializer*>* getInitializers ();
|
||||
protected:
|
||||
friend class object;
|
||||
|
||||
static particle* fromFile (
|
||||
const irr::io::path& filename,
|
||||
irr::u32 id,
|
||||
std::string name,
|
||||
const irr::core::vector3df& origin,
|
||||
const irr::core::vector3df& scale
|
||||
);
|
||||
|
||||
particle (
|
||||
irr::u32 starttime,
|
||||
irr::u32 maxcount,
|
||||
irr::u32 id,
|
||||
std::string name,
|
||||
const irr::core::vector3df& origin,
|
||||
const irr::core::vector3df& scale
|
||||
);
|
||||
void insertControlPoint (controlpoint* controlpoint);
|
||||
void insertEmitter (emitter* emitter);
|
||||
void insertInitializer (initializer* initializer);
|
||||
private:
|
||||
irr::u32 m_starttime;
|
||||
irr::u32 m_maxcount;
|
||||
std::vector<controlpoint*> m_controlpoints;
|
||||
std::vector<emitter*> m_emitters;
|
||||
std::vector<initializer*> m_initializers;
|
||||
};
|
||||
};
|
Loading…
Reference in New Issue
Block a user