Browse Source

~ changed all iterators to auto
~ changed most pointers to const references to prevent modification, specially from the background parser

Signed-off-by: Alexis Maiquez <almamu@almamu.com>

Alexis Maiquez 7 years ago
parent
commit
3587fdec1e
76 changed files with 634 additions and 616 deletions
  1. 4 4
      main.cpp
  2. 22 22
      src/WallpaperEngine/Core/CObject.cpp
  3. 9 9
      src/WallpaperEngine/Core/CObject.h
  4. 12 12
      src/WallpaperEngine/Core/CProject.cpp
  5. 4 4
      src/WallpaperEngine/Core/CProject.h
  6. 41 41
      src/WallpaperEngine/Core/CScene.cpp
  7. 19 19
      src/WallpaperEngine/Core/CScene.h
  8. 15 13
      src/WallpaperEngine/Core/Core.cpp
  9. 31 31
      src/WallpaperEngine/Core/Objects/CEffect.cpp
  10. 3 3
      src/WallpaperEngine/Core/Objects/CEffect.h
  11. 6 6
      src/WallpaperEngine/Core/Objects/CImage.cpp
  12. 2 2
      src/WallpaperEngine/Core/Objects/CImage.h
  13. 15 15
      src/WallpaperEngine/Core/Objects/CParticle.cpp
  14. 3 3
      src/WallpaperEngine/Core/Objects/CParticle.h
  15. 5 5
      src/WallpaperEngine/Core/Objects/CSound.cpp
  16. 1 1
      src/WallpaperEngine/Core/Objects/CSound.h
  17. 3 3
      src/WallpaperEngine/Core/Objects/Effects/CShaderConstant.h
  18. 5 5
      src/WallpaperEngine/Core/Objects/Images/CMaterial.cpp
  19. 1 1
      src/WallpaperEngine/Core/Objects/Images/CMaterial.h
  20. 39 20
      src/WallpaperEngine/Core/Objects/Images/Materials/CPassess.cpp
  21. 8 2
      src/WallpaperEngine/Core/Objects/Images/Materials/CPassess.h
  22. 6 6
      src/WallpaperEngine/Core/Objects/Particles/CControlPoint.cpp
  23. 2 2
      src/WallpaperEngine/Core/Objects/Particles/CControlPoint.h
  24. 14 14
      src/WallpaperEngine/Core/Objects/Particles/CEmitter.cpp
  25. 5 5
      src/WallpaperEngine/Core/Objects/Particles/CEmitter.h
  26. 4 4
      src/WallpaperEngine/Core/Objects/Particles/CInitializer.cpp
  27. 2 2
      src/WallpaperEngine/Core/Objects/Particles/CInitializer.h
  28. 4 4
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CAlphaRandom.cpp
  29. 2 2
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CAlphaRandom.h
  30. 6 6
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CAngularVelocityRandom.cpp
  31. 2 2
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CAngularVelocityRandom.h
  32. 6 6
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CColorRandom.cpp
  33. 2 2
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CColorRandom.h
  34. 4 4
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.cpp
  35. 2 2
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.h
  36. 4 4
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.cpp
  37. 2 2
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.h
  38. 4 4
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.cpp
  39. 2 2
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.h
  40. 6 6
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CVelocityRandom.cpp
  41. 2 2
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CVelocityRandom.h
  42. 36 37
      src/WallpaperEngine/Core/Projects/CProperty.cpp
  43. 6 6
      src/WallpaperEngine/Core/Projects/CProperty.h
  44. 4 4
      src/WallpaperEngine/Core/Projects/CPropertyColor.cpp
  45. 1 1
      src/WallpaperEngine/Core/Projects/CPropertyColor.h
  46. 9 9
      src/WallpaperEngine/Core/Scenes/CCamera.cpp
  47. 3 3
      src/WallpaperEngine/Core/Scenes/CCamera.h
  48. 4 4
      src/WallpaperEngine/Core/Scenes/CProjection.cpp
  49. 2 2
      src/WallpaperEngine/Core/Scenes/CProjection.h
  50. 1 1
      src/WallpaperEngine/FileSystem/FileSystem.cpp
  51. 1 1
      src/WallpaperEngine/FileSystem/FileSystem.h
  52. 9 10
      src/WallpaperEngine/Irrlicht/CContext.cpp
  53. 96 98
      src/WallpaperEngine/Irrlicht/CFileList.cpp
  54. 2 2
      src/WallpaperEngine/Irrlicht/CImageLoaderTEX.cpp
  55. 8 7
      src/WallpaperEngine/Render/CCamera.cpp
  56. 5 5
      src/WallpaperEngine/Render/CCamera.h
  57. 1 1
      src/WallpaperEngine/Render/CObject.cpp
  58. 2 2
      src/WallpaperEngine/Render/CObject.h
  59. 9 9
      src/WallpaperEngine/Render/CScene.cpp
  60. 6 6
      src/WallpaperEngine/Render/CScene.h
  61. 48 52
      src/WallpaperEngine/Render/Objects/CImage.cpp
  62. 3 3
      src/WallpaperEngine/Render/Objects/CSound.cpp
  63. 25 27
      src/WallpaperEngine/Render/Shaders/Compiler.cpp
  64. 4 4
      src/WallpaperEngine/Render/Shaders/Compiler.h
  65. 3 3
      src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameter.cpp
  66. 7 7
      src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameter.h
  67. 1 1
      src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameterFloat.cpp
  68. 1 1
      src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameterFloat.h
  69. 1 1
      src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameterInteger.cpp
  70. 1 1
      src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameterInteger.h
  71. 1 1
      src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameterVector2.cpp
  72. 1 1
      src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameterVector2.h
  73. 1 1
      src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameterVector3.cpp
  74. 1 1
      src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameterVector3.h
  75. 1 1
      src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameterVector4.cpp
  76. 1 1
      src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameterVector4.h

+ 4 - 4
main.cpp

@@ -53,8 +53,8 @@ void initialize_viewports ()
         if (info == nullptr)
             continue;
 
-        std::vector<std::string>::iterator cur = Screens.begin ();
-        std::vector<std::string>::iterator end = Screens.end ();
+        auto cur = Screens.begin ();
+        auto end = Screens.end ();
 
         for (; cur != end; cur ++)
         {
@@ -318,8 +318,8 @@ int main (int argc, char* argv[])
 
             if (Viewports.size () > 0)
             {
-                std::vector<irr::core::rect<irr::s32>>::iterator cur = Viewports.begin ();
-                std::vector<irr::core::rect<irr::s32>>::iterator end = Viewports.end ();
+                auto cur = Viewports.begin ();
+                auto end = Viewports.end ();
 
                 for (; cur != end; cur ++)
                 {

+ 22 - 22
src/WallpaperEngine/Core/CObject.cpp

@@ -29,13 +29,13 @@ CObject::CObject (
 
 CObject* CObject::fromJSON (json data)
 {
-    json::const_iterator id_it = data.find ("id");
-    json::const_iterator visible_it = data.find ("visible");
-    json::const_iterator origin_it = data.find ("origin");
-    json::const_iterator scale_it = data.find ("scale");
-    json::const_iterator angles_it = data.find ("angles");
-    json::const_iterator name_it = data.find ("name");
-    json::const_iterator effects_it = data.find ("effects");
+    auto id_it = data.find ("id");
+    auto visible_it = data.find ("visible");
+    auto origin_it = data.find ("origin");
+    auto scale_it = data.find ("scale");
+    auto angles_it = data.find ("angles");
+    auto name_it = data.find ("name");
+    auto effects_it = data.find ("effects");
 
     bool visible = true;
 
@@ -70,9 +70,9 @@ CObject* CObject::fromJSON (json data)
         visible = *visible_it;
     }
 
-    json::const_iterator image_it = data.find ("image");
-    json::const_iterator sound_it = data.find ("sound");
-    json::const_iterator particle_it = data.find ("particle");
+    auto image_it = data.find ("image");
+    auto sound_it = data.find ("sound");
+    auto particle_it = data.find ("particle");
 
     CObject* object = nullptr;
 
@@ -117,8 +117,8 @@ CObject* CObject::fromJSON (json data)
 
     if (effects_it != data.end () && (*effects_it).is_array () == true)
     {
-        json::const_iterator cur = (*effects_it).begin ();
-        json::const_iterator end = (*effects_it).end ();
+        auto cur = (*effects_it).begin ();
+        auto end = (*effects_it).end ();
 
         for (; cur != end; cur ++)
         {
@@ -131,29 +131,29 @@ CObject* CObject::fromJSON (json data)
     return object;
 }
 
-irr::core::vector3df* CObject::getOrigin ()
+const irr::core::vector3df& CObject::getOrigin () const
 {
-    return &this->m_origin;
+    return this->m_origin;
 }
 
-irr::core::vector3df* CObject::getScale ()
+const irr::core::vector3df& CObject::getScale () const
 {
-    return &this->m_scale;
+    return this->m_scale;
 }
 
-irr::core::vector3df* CObject::getAngles ()
+const irr::core::vector3df& CObject::getAngles () const
 {
-    return &this->m_angles;
+    return this->m_angles;
 }
 
-std::string CObject::getName ()
+const std::string& CObject::getName () const
 {
     return this->m_name;
 }
 
-std::vector<Objects::CEffect*>* CObject::getEffects ()
+const std::vector<Objects::CEffect*>& CObject::getEffects () const
 {
-    return &this->m_effects;
+    return this->m_effects;
 }
 
 bool CObject::isVisible ()
@@ -161,7 +161,7 @@ bool CObject::isVisible ()
     return this->m_visible;
 }
 
-int CObject::getId ()
+const int CObject::getId () const
 {
     return this->m_id;
 }

+ 9 - 9
src/WallpaperEngine/Core/CObject.h

@@ -19,18 +19,18 @@ namespace WallpaperEngine::Core
     public:
         static CObject* fromJSON (json data);
 
-        template<class T> const T* As () const { assert (Is<T> ()); return (const T*) this; }
-        template<class T> T* As () { assert (Is<T> ()); return (T*) this; }
+        template<class T> const T* as () const { assert (is <T> ()); return (const T*) this; }
+        template<class T> T* as () { assert (is <T> ()); return (T*) this; }
 
-        template<class T> bool Is () { return this->m_type == T::Type; }
+        template<class T> bool is () { return this->m_type == T::Type; }
 
-        std::vector<Objects::CEffect*>* getEffects ();
-        int getId ();
+        const std::vector<Objects::CEffect*>& getEffects () const;
+        const int getId () const;
 
-        irr::core::vector3df* getOrigin ();
-        irr::core::vector3df* getScale ();
-        irr::core::vector3df* getAngles ();
-        std::string getName ();
+        const irr::core::vector3df& getOrigin () const;
+        const irr::core::vector3df& getScale () const;
+        const irr::core::vector3df& getAngles () const;
+        const std::string& getName () const;
 
         bool isVisible ();
     protected:

+ 12 - 12
src/WallpaperEngine/Core/CProject.cpp

@@ -16,10 +16,10 @@ CProject* CProject::fromFile (const irr::io::path& filename)
 {
     json content = json::parse (WallpaperEngine::FileSystem::loadFullFile (filename));
 
-    json::const_iterator title = content.find ("title");
-    json::const_iterator type = content.find ("type");
-    json::const_iterator file = content.find ("file");
-    json::const_iterator general = content.find ("general");
+    auto title = content.find ("title");
+    auto type = content.find ("type");
+    auto file = content.find ("file");
+    auto general = content.find ("general");
 
     if (title == content.end ())
     {
@@ -44,12 +44,12 @@ CProject* CProject::fromFile (const irr::io::path& filename)
 
     if (general != content.end ())
     {
-        json::const_iterator properties = (*general).find ("properties");
+        auto properties = (*general).find ("properties");
 
         if (properties != (*general).end ())
         {
-            json::const_iterator cur = (*properties).begin ();
-            json::const_iterator end = (*properties).end ();
+            auto cur = (*properties).begin ();
+            auto end = (*properties).end ();
 
             for (; cur != end; cur ++)
             {
@@ -63,24 +63,24 @@ CProject* CProject::fromFile (const irr::io::path& filename)
     return project;
 }
 
-CScene* CProject::getScene ()
+const CScene* CProject::getScene () const
 {
     return this->m_scene;
 }
 
-std::string CProject::getTitle ()
+const std::string& CProject::getTitle () const
 {
     return this->m_title;
 }
 
-std::string CProject::getType ()
+const std::string& CProject::getType () const
 {
     return this->m_type;
 }
 
-std::vector<Projects::CProperty*>* CProject::getProperties ()
+const std::vector<Projects::CProperty*>& CProject::getProperties () const
 {
-    return &this->m_properties;
+    return this->m_properties;
 }
 
 void CProject::insertProperty (Projects::CProperty* property)

+ 4 - 4
src/WallpaperEngine/Core/CProject.h

@@ -17,11 +17,11 @@ namespace WallpaperEngine::Core
     public:
         static CProject* fromFile (const irr::io::path& filename);
 
-        CScene* getScene ();
+        const CScene* getScene () const;
 
-        std::string getTitle ();
-        std::string getType ();
-        std::vector<Projects::CProperty*>* getProperties ();
+        const std::string& getTitle () const;
+        const std::string& getType () const;
+        const std::vector<Projects::CProperty*>& getProperties () const;
 
     protected:
         CProject (std::string title, std::string type, CScene* scene);

+ 41 - 41
src/WallpaperEngine/Core/CScene.cpp

@@ -50,9 +50,9 @@ CScene* CScene::fromFile (const irr::io::path& filename)
 {
     json content = json::parse (WallpaperEngine::FileSystem::loadFullFile (filename));
 
-    json::const_iterator camera_it = content.find ("camera");
-    json::const_iterator general_it = content.find ("general");
-    json::const_iterator objects_it = content.find ("objects");
+    auto camera_it = content.find ("camera");
+    auto general_it = content.find ("general");
+    auto objects_it = content.find ("objects");
 
     if (camera_it == content.end ())
     {
@@ -69,23 +69,23 @@ CScene* CScene::fromFile (const irr::io::path& filename)
         throw std::runtime_error ("Scenes must have a list of objects to display");
     }
 
-    json::const_iterator ambientcolor_it = (*general_it).find ("ambientcolor");
-    json::const_iterator bloom_it = (*general_it).find ("bloom");
-    json::const_iterator bloomstrength_it = (*general_it).find ("bloomstrength");
-    json::const_iterator bloomthreshold_it = (*general_it).find ("bloomthreshold");
-    json::const_iterator camerafade_it = (*general_it).find ("camerafade");
-    json::const_iterator cameraparallax_it = (*general_it).find ("cameraparallax");
-    json::const_iterator cameraparallaxamount_it = (*general_it).find ("cameraparallaxamount");
-    json::const_iterator cameraparallaxdelay_it = (*general_it).find ("cameraparallaxdelay");
-    json::const_iterator cameraparallaxmouseinfluence_it = (*general_it).find ("cameraparallaxmouseinfluence");
-    json::const_iterator camerapreview_it = (*general_it).find ("camerapreview");
-    json::const_iterator camerashake_it = (*general_it).find ("camerashake");
-    json::const_iterator camerashakeamplitude_it = (*general_it).find ("camerashakeamplitude");
-    json::const_iterator camerashakeroughness_it = (*general_it).find ("camerashakeroughness");
-    json::const_iterator camerashakespeed_it = (*general_it).find ("camerashakespeed");
-    json::const_iterator clearcolor_it = (*general_it).find ("clearcolor");
-    json::const_iterator orthogonalprojection_it = (*general_it).find ("orthogonalprojection");
-    json::const_iterator skylightcolor_it = (*general_it).find ("skylightcolor");
+    auto ambientcolor_it = (*general_it).find ("ambientcolor");
+    auto bloom_it = (*general_it).find ("bloom");
+    auto bloomstrength_it = (*general_it).find ("bloomstrength");
+    auto bloomthreshold_it = (*general_it).find ("bloomthreshold");
+    auto camerafade_it = (*general_it).find ("camerafade");
+    auto cameraparallax_it = (*general_it).find ("cameraparallax");
+    auto cameraparallaxamount_it = (*general_it).find ("cameraparallaxamount");
+    auto cameraparallaxdelay_it = (*general_it).find ("cameraparallaxdelay");
+    auto cameraparallaxmouseinfluence_it = (*general_it).find ("cameraparallaxmouseinfluence");
+    auto camerapreview_it = (*general_it).find ("camerapreview");
+    auto camerashake_it = (*general_it).find ("camerashake");
+    auto camerashakeamplitude_it = (*general_it).find ("camerashakeamplitude");
+    auto camerashakeroughness_it = (*general_it).find ("camerashakeroughness");
+    auto camerashakespeed_it = (*general_it).find ("camerashakespeed");
+    auto clearcolor_it = (*general_it).find ("clearcolor");
+    auto orthogonalprojection_it = (*general_it).find ("orthogonalprojection");
+    auto skylightcolor_it = (*general_it).find ("skylightcolor");
 
     if (ambientcolor_it == (*general_it).end ())
     {
@@ -193,8 +193,8 @@ CScene* CScene::fromFile (const irr::io::path& filename)
             WallpaperEngine::Core::atoSColorf (*skylightcolor_it)
     );
 
-    json::const_iterator cur = (*objects_it).begin ();
-    json::const_iterator end = (*objects_it).end ();
+    auto cur = (*objects_it).begin ();
+    auto end = (*objects_it).end ();
 
     for (; cur != end; cur ++)
     {
@@ -207,9 +207,9 @@ CScene* CScene::fromFile (const irr::io::path& filename)
 }
 
 
-std::vector<CObject*>* CScene::getObjects ()
+const std::vector<CObject*>& CScene::getObjects () const
 {
-    return &this->m_objects;
+    return this->m_objects;
 }
 
 void CScene::insertObject (CObject* object)
@@ -227,7 +227,7 @@ void CScene::setProject (CProject* project)
     this->m_project = project;
 }
 
-Scenes::CCamera* CScene::getCamera ()
+const Scenes::CCamera* CScene::getCamera () const
 {
     return this->m_camera;
 }
@@ -237,82 +237,82 @@ const irr::video::SColorf &CScene::getAmbientColor() const
     return this->m_ambientColor;
 }
 
-bool CScene::isBloom () const
+const bool CScene::isBloom () const
 {
     return this->m_bloom;
 }
 
-irr::f64 CScene::getBloomStrength () const
+const irr::f64 CScene::getBloomStrength () const
 {
     return this->m_bloomStrength;
 }
 
-irr::f64 CScene::getBloomThreshold () const
+const irr::f64 CScene::getBloomThreshold () const
 {
     return this->m_bloomThreshold;
 }
 
-bool CScene::isCameraFade () const
+const bool CScene::isCameraFade () const
 {
     return this->m_cameraFade;
 }
 
-bool CScene::isCameraParallax () const
+const bool CScene::isCameraParallax () const
 {
     return this->m_cameraParallax;
 }
 
-irr::f64 CScene::getCameraParallaxAmount () const
+const irr::f64 CScene::getCameraParallaxAmount () const
 {
     return this->m_cameraParallaxAmount;
 }
 
-irr::f64 CScene::getCameraParallaxDelay () const
+const irr::f64 CScene::getCameraParallaxDelay () const
 {
     return this->m_cameraParallaxDelay;
 }
 
-irr::f64 CScene::getCameraParallaxMouseInfluence () const
+const irr::f64 CScene::getCameraParallaxMouseInfluence () const
 {
     return this->m_cameraParallaxMouseInfluence;
 }
 
-bool CScene::isCameraPreview () const
+const bool CScene::isCameraPreview () const
 {
     return this->m_cameraPreview;
 }
 
-bool CScene::isCameraShake () const
+const bool CScene::isCameraShake () const
 {
     return this->m_cameraShake;
 }
 
-irr::f64 CScene::getCameraShakeAmplitude () const
+const irr::f64 CScene::getCameraShakeAmplitude () const
 {
     return this->m_cameraShakeAmplitude;
 }
 
-irr::f64 CScene::getCameraShakeRoughness () const
+const irr::f64 CScene::getCameraShakeRoughness () const
 {
     return this->m_cameraShakeRoughness;
 }
 
-irr::f64 CScene::getCameraShakeSpeed () const
+const irr::f64 CScene::getCameraShakeSpeed () const
 {
     return this->m_cameraShakeSpeed;
 }
 
-const irr::video::SColorf &CScene::getClearColor () const
+const irr::video::SColorf& CScene::getClearColor () const
 {
     return this->m_clearColor;
 }
 
-Scenes::CProjection* CScene::getOrthogonalProjection () const
+const Scenes::CProjection* CScene::getOrthogonalProjection () const
 {
     return this->m_orthogonalProjection;
 }
 
-const irr::video::SColorf &CScene::getSkylightColor () const
+const irr::video::SColorf& CScene::getSkylightColor () const
 {
     return this->m_skylightColor;
 }

+ 19 - 19
src/WallpaperEngine/Core/CScene.h

@@ -22,26 +22,26 @@ namespace WallpaperEngine::Core
         static CScene* fromFile (const irr::io::path& filename);
 
         CProject* getProject ();
-        std::vector<CObject*>* getObjects ();
+        const std::vector<CObject*>& getObjects () const;
 
-        const irr::video::SColorf &getAmbientColor() const;
-        bool isBloom() const;
-        irr::f64 getBloomStrength() const;
-        irr::f64 getBloomThreshold() const;
-        bool isCameraFade() const;
-        bool isCameraParallax() const;
-        irr::f64 getCameraParallaxAmount() const;
-        irr::f64 getCameraParallaxDelay() const;
-        irr::f64 getCameraParallaxMouseInfluence() const;
-        bool isCameraPreview() const;
-        bool isCameraShake() const;
-        irr::f64 getCameraShakeAmplitude() const;
-        irr::f64 getCameraShakeRoughness() const;
-        irr::f64 getCameraShakeSpeed() const;
-        const irr::video::SColorf &getClearColor() const;
-        Scenes::CProjection *getOrthogonalProjection() const;
-        const irr::video::SColorf &getSkylightColor() const;
-        Scenes::CCamera* getCamera ();
+        const irr::video::SColorf& getAmbientColor() const;
+        const bool isBloom() const;
+        const irr::f64 getBloomStrength() const;
+        const irr::f64 getBloomThreshold() const;
+        const bool isCameraFade() const;
+        const bool isCameraParallax() const;
+        const irr::f64 getCameraParallaxAmount() const;
+        const irr::f64 getCameraParallaxDelay() const;
+        const irr::f64 getCameraParallaxMouseInfluence() const;
+        const bool isCameraPreview() const;
+        const bool isCameraShake() const;
+        const irr::f64 getCameraShakeAmplitude() const;
+        const irr::f64 getCameraShakeRoughness() const;
+        const irr::f64 getCameraShakeSpeed() const;
+        const irr::video::SColorf& getClearColor() const;
+        const Scenes::CProjection* getOrthogonalProjection() const;
+        const irr::video::SColorf& getSkylightColor() const;
+        const Scenes::CCamera* getCamera () const;
 
     protected:
         friend class CProject;

+ 15 - 13
src/WallpaperEngine/Core/Core.cpp

@@ -1,7 +1,9 @@
 #include <irrlicht/irrlicht.h>
 #include "Core.h"
 
-irr::core::vector3df WallpaperEngine::Core::ato3vf(const char *str)
+using namespace WallpaperEngine;
+
+irr::core::vector3df Core::ato3vf(const char *str)
 {
     irr::f32 x = irr::core::fast_atof (str, &str); while (*str == ' ') str ++;
     irr::f32 y = irr::core::fast_atof (str, &str); while (*str == ' ') str ++;
@@ -10,7 +12,7 @@ irr::core::vector3df WallpaperEngine::Core::ato3vf(const char *str)
     return irr::core::vector3df (x, y, z);
 }
 
-irr::core::vector2df WallpaperEngine::Core::ato2vf (const char *str)
+irr::core::vector2df Core::ato2vf (const char *str)
 {
     irr::f32 x = irr::core::fast_atof (str, &str); while (*str == ' ') str ++;
     irr::f32 y = irr::core::fast_atof (str, &str);
@@ -18,19 +20,19 @@ irr::core::vector2df WallpaperEngine::Core::ato2vf (const char *str)
     return irr::core::vector2df (x, y);
 }
 
-irr::core::vector3df WallpaperEngine::Core::ato3vf (const std::string& str)
+irr::core::vector3df Core::ato3vf (const std::string& str)
 {
-    return WallpaperEngine::Core::ato3vf (str.c_str ());
+    return Core::ato3vf (str.c_str ());
 }
 
-irr::core::vector2df WallpaperEngine::Core::ato2vf (const std::string& str)
+irr::core::vector2df Core::ato2vf (const std::string& str)
 {
-    return WallpaperEngine::Core::ato2vf (str.c_str ());
+    return Core::ato2vf (str.c_str ());
 }
 
-irr::video::SColorf WallpaperEngine::Core::atoSColorf (const char *str)
+irr::video::SColorf Core::atoSColorf (const char *str)
 {
-    irr::core::vector3df vector = WallpaperEngine::Core::ato3vf (str);
+    irr::core::vector3df vector = Core::ato3vf (str);
 
     return irr::video::SColorf (
             vector.X,
@@ -39,12 +41,12 @@ irr::video::SColorf WallpaperEngine::Core::atoSColorf (const char *str)
     );
 }
 
-irr::video::SColorf WallpaperEngine::Core::atoSColorf (const std::string& str)
+irr::video::SColorf Core::atoSColorf (const std::string& str)
 {
-    return WallpaperEngine::Core::atoSColorf (str.c_str ());
+    return Core::atoSColorf (str.c_str ());
 }
 
-irr::video::SColor WallpaperEngine::Core::atoSColor (const char *str)
+irr::video::SColor Core::atoSColor (const char *str)
 {
     irr::f32 r = irr::core::strtoul10 (str, &str); while (*str == ' ') str ++;
     irr::f32 g = irr::core::strtoul10 (str, &str); while (*str == ' ') str ++;
@@ -53,7 +55,7 @@ irr::video::SColor WallpaperEngine::Core::atoSColor (const char *str)
     return irr::video::SColor (255, r, g, b);
 }
 
-irr::video::SColor WallpaperEngine::Core::atoSColor (const std::string& str)
+irr::video::SColor Core::atoSColor (const std::string& str)
 {
-    return WallpaperEngine::Core::atoSColor (str.c_str ());
+    return Core::atoSColor (str.c_str ());
 }

+ 31 - 31
src/WallpaperEngine/Core/Objects/CEffect.cpp

@@ -28,8 +28,8 @@ CEffect::CEffect (
 
 CEffect* CEffect::fromJSON (json data, Core::CObject* object)
 {
-    json::const_iterator file_it = data.find ("file");
-    json::const_iterator effectpasses_it = data.find ("passes");
+    auto file_it = data.find ("file");
+    auto effectpasses_it = data.find ("passes");
 
     if (file_it == data.end ())
     {
@@ -38,12 +38,12 @@ CEffect* CEffect::fromJSON (json data, Core::CObject* object)
 
     json content = json::parse (WallpaperEngine::FileSystem::loadFullFile ((*file_it).get <std::string> ().c_str ()));
 
-    json::const_iterator name_it = content.find ("name");
-    json::const_iterator description_it = content.find ("description");
-    json::const_iterator group_it = content.find ("group");
-    json::const_iterator preview_it = content.find ("preview");
-    json::const_iterator passes_it = content.find ("passes");
-    json::const_iterator dependencies_it = content.find ("dependencies");
+    auto name_it = content.find ("name");
+    auto description_it = content.find ("description");
+    auto group_it = content.find ("group");
+    auto preview_it = content.find ("preview");
+    auto passes_it = content.find ("passes");
+    auto dependencies_it = content.find ("dependencies");
 
     if (name_it == content.end ())
     {
@@ -83,12 +83,12 @@ CEffect* CEffect::fromJSON (json data, Core::CObject* object)
         object
     );
 
-    json::const_iterator cur = (*passes_it).begin ();
-    json::const_iterator end = (*passes_it).end ();
+    auto cur = (*passes_it).begin ();
+    auto end = (*passes_it).end ();
 
     for (; cur != end; cur ++)
     {
-        json::const_iterator materialfile = (*cur).find ("material");
+        auto materialfile = (*cur).find ("material");
 
         if (materialfile == (*cur).end ())
         {
@@ -115,13 +115,13 @@ CEffect* CEffect::fromJSON (json data, Core::CObject* object)
 
         for (int passNumber = 0; cur != end; cur ++, passNumber ++)
         {
-            json::const_iterator constants_it = (*cur).find ("constantshadervalues");
+            auto constants_it = (*cur).find ("constantshadervalues");
 
             if (constants_it == (*cur).end ())
                 continue;
 
-            json::const_iterator constantCur = (*constants_it).begin ();
-            json::const_iterator constantEnd = (*constants_it).end ();
+            auto constantCur = (*constants_it).begin ();
+            auto constantEnd = (*constants_it).end ();
 
             for (; constantCur != constantEnd; constantCur ++)
             {
@@ -147,19 +147,19 @@ CEffect* CEffect::fromJSON (json data, Core::CObject* object)
                 effect->insertConstant (constantCur.key (), constant);
             }
 
-            json::const_iterator textures_it = (*cur).find ("textures");
+            auto textures_it = (*cur).find ("textures");
 
             if (textures_it == (*cur).end ())
                 continue;
 
-            Images::CMaterial* material = effect->getMaterials ()->at (passNumber);
-            std::vector<Images::Materials::CPassess*>::const_iterator materialCur = material->getPasses ()->begin ();
-            std::vector<Images::Materials::CPassess*>::const_iterator materialEnd = material->getPasses ()->end ();
+            Images::CMaterial* material = effect->getMaterials ().at (passNumber);
+            auto passCur = material->getPasses ().begin ();
+            auto passEnd = material->getPasses ().end ();
 
-            for (; materialCur != materialEnd; materialCur ++)
+            for (; passCur != passEnd; passCur ++)
             {
-                json::const_iterator texturesCur = (*textures_it).begin ();
-                json::const_iterator texturesEnd = (*textures_it).end ();
+                auto texturesCur = (*textures_it).begin ();
+                auto texturesEnd = (*textures_it).end ();
 
                 for (int textureNumber = 0; texturesCur != texturesEnd; texturesCur ++)
                 {
@@ -167,21 +167,21 @@ CEffect* CEffect::fromJSON (json data, Core::CObject* object)
 
                     if ((*texturesCur).is_null () == true)
                     {
-                        if (object->Is <CImage> () == false)
+                        if (object->is<CImage>() == false)
                         {
                             throw std::runtime_error ("unexpected null texture for non-image object");
                         }
 
-                        CImage* image = object->As <CImage> ();
+                        CImage* image = object->as<CImage>();
 
-                        texture = (*(*image->getMaterial ()->getPasses ()->begin ())->getTextures ()->begin ());
+                        texture = (*(*image->getMaterial ()->getPasses ().begin ())->getTextures ()->begin ());
                     }
                     else
                     {
                         texture = *texturesCur;
                     }
 
-                    std::vector<std::string>* passTextures = (*materialCur)->getTextures ();
+                    std::vector<std::string>* passTextures = (*passCur)->getTextures ();
 
                     if (textureNumber < passTextures->size ())
                         passTextures->at (textureNumber) = texture;
@@ -198,19 +198,19 @@ CEffect* CEffect::fromJSON (json data, Core::CObject* object)
     return effect;
 }
 
-std::vector<std::string>* CEffect::getDependencies ()
+const std::vector<std::string>& CEffect::getDependencies () const
 {
-    return &this->m_dependencies;
+    return this->m_dependencies;
 }
 
-std::vector<Images::CMaterial*>* CEffect::getMaterials ()
+const std::vector<Images::CMaterial*>& CEffect::getMaterials () const
 {
-    return &this->m_materials;
+    return this->m_materials;
 }
 
-std::map<std::string, Effects::CShaderConstant*>* CEffect::getConstants ()
+const std::map<std::string, Effects::CShaderConstant*>& CEffect::getConstants () const
 {
-    return &this->m_constants;
+    return this->m_constants;
 }
 
 void CEffect::insertDependency (const std::string& dep)

+ 3 - 3
src/WallpaperEngine/Core/Objects/CEffect.h

@@ -29,9 +29,9 @@ namespace WallpaperEngine::Core::Objects
 
         static CEffect* fromJSON (json data, Core::CObject* object);
 
-        std::vector<std::string>* getDependencies ();
-        std::vector<Images::CMaterial*>* getMaterials ();
-        std::map<std::string, Effects::CShaderConstant*>* getConstants ();
+        const std::vector<std::string>& getDependencies () const;
+        const std::vector<Images::CMaterial*>& getMaterials () const;
+        const std::map<std::string, Effects::CShaderConstant*>& getConstants () const;
     protected:
         void insertDependency (const std::string& dep);
         void insertMaterial (Images::CMaterial* material);

+ 6 - 6
src/WallpaperEngine/Core/Objects/CImage.cpp

@@ -30,8 +30,8 @@ WallpaperEngine::Core::CObject* CImage::fromJSON (
     const irr::core::vector3df& scale,
     const irr::core::vector3df& angles)
 {
-    json::const_iterator image_it = data.find ("image");
-    json::const_iterator size_it = data.find ("size");
+    auto image_it = data.find ("image");
+    auto size_it = data.find ("size");
 
     if (size_it == data.end ())
     {
@@ -40,7 +40,7 @@ WallpaperEngine::Core::CObject* CImage::fromJSON (
 
     json content = json::parse (WallpaperEngine::FileSystem::loadFullFile ((*image_it).get <std::string> ().c_str ()));
 
-    json::const_iterator material_it = content.find ("material");
+    auto material_it = content.find ("material");
 
     if (material_it == content.end ())
     {
@@ -59,14 +59,14 @@ WallpaperEngine::Core::CObject* CImage::fromJSON (
     );
 }
 
-Images::CMaterial* CImage::getMaterial ()
+const Images::CMaterial* CImage::getMaterial () const
 {
     return this->m_material;
 }
 
-irr::core::vector2df* CImage::getSize ()
+const irr::core::vector2df& CImage::getSize () const
 {
-    return &this->m_size;
+    return this->m_size;
 }
 
 

+ 2 - 2
src/WallpaperEngine/Core/Objects/CImage.h

@@ -26,8 +26,8 @@ namespace WallpaperEngine::Core::Objects
                 const irr::core::vector3df& angles
         );
 
-        Images::CMaterial* getMaterial ();
-        irr::core::vector2df* getSize ();
+        const Images::CMaterial* getMaterial () const;
+        const irr::core::vector2df& getSize () const;
 
     protected:
         CImage (

+ 15 - 15
src/WallpaperEngine/Core/Objects/CParticle.cpp

@@ -13,11 +13,11 @@ CParticle* CParticle::fromFile (
     const irr::core::vector3df& scale)
 {
     json data = json::parse (WallpaperEngine::FileSystem::loadFullFile (filename));
-    json::const_iterator controlpoint_it = data.find ("controlpoint");
-    json::const_iterator starttime_it = data.find ("starttime");
-    json::const_iterator maxcount_it = data.find ("maxcount");
-    json::const_iterator emitter_it = data.find ("emitter");
-    json::const_iterator initializer_it = data.find ("initializer");
+    auto controlpoint_it = data.find ("controlpoint");
+    auto starttime_it = data.find ("starttime");
+    auto maxcount_it = data.find ("maxcount");
+    auto emitter_it = data.find ("emitter");
+    auto initializer_it = data.find ("initializer");
 
     if (starttime_it == data.end ())
     {
@@ -50,8 +50,8 @@ CParticle* CParticle::fromFile (
 
     if (controlpoint_it != data.end ())
     {
-        json::const_iterator cur = (*controlpoint_it).begin ();
-        json::const_iterator end = (*controlpoint_it).end ();
+        auto cur = (*controlpoint_it).begin ();
+        auto end = (*controlpoint_it).end ();
 
         for (; cur != end; cur ++)
         {
@@ -61,8 +61,8 @@ CParticle* CParticle::fromFile (
         }
     }
 
-    json::const_iterator cur = (*emitter_it).begin ();
-    json::const_iterator end = (*emitter_it).end ();
+    auto cur = (*emitter_it).begin ();
+    auto end = (*emitter_it).end ();
 
     for (; cur != end; cur ++)
     {
@@ -97,19 +97,19 @@ CParticle::CParticle (
 {
 }
 
-std::vector<Particles::CEmitter*>* CParticle::getEmitters ()
+const std::vector<Particles::CEmitter*>& CParticle::getEmitters () const
 {
-    return &this->m_emitters;
+    return this->m_emitters;
 }
 
-std::vector<Particles::CControlPoint*>* CParticle::getControlPoints ()
+const std::vector<Particles::CControlPoint*>& CParticle::getControlPoints () const
 {
-    return &this->m_controlpoints;
+    return this->m_controlpoints;
 }
 
-std::vector<Particles::CInitializer*>* CParticle::getInitializers ()
+const std::vector<Particles::CInitializer*>& CParticle::getInitializers () const
 {
-    return &this->m_initializers;
+    return this->m_initializers;
 }
 
 void CParticle::insertControlPoint (Particles::CControlPoint* controlpoint)

+ 3 - 3
src/WallpaperEngine/Core/Objects/CParticle.h

@@ -26,9 +26,9 @@ namespace WallpaperEngine::Core::Objects
                 const irr::core::vector3df& scale
         );
 
-        std::vector<Particles::CEmitter*>* getEmitters ();
-        std::vector<Particles::CControlPoint*>* getControlPoints ();
-        std::vector<Particles::CInitializer*>* getInitializers ();
+        const std::vector<Particles::CEmitter*>& getEmitters () const;
+        const std::vector<Particles::CControlPoint*>& getControlPoints () const;
+        const std::vector<Particles::CInitializer*>& getInitializers () const;
 
     protected:
         CParticle (

+ 5 - 5
src/WallpaperEngine/Core/Objects/CSound.cpp

@@ -25,7 +25,7 @@ WallpaperEngine::Core::CObject* CSound::fromJSON (
         const irr::core::vector3df& scale,
         const irr::core::vector3df& angles)
 {
-    json::const_iterator sound_it = data.find ("sound");
+    auto sound_it = data.find ("sound");
 
     if (sound_it == data.end ())
     {
@@ -46,8 +46,8 @@ WallpaperEngine::Core::CObject* CSound::fromJSON (
         angles
     );
 
-    json::const_iterator cur = (*sound_it).begin ();
-    json::const_iterator end = (*sound_it).end ();
+    auto cur = (*sound_it).begin ();
+    auto end = (*sound_it).end ();
 
     for (; cur != end; cur ++)
     {
@@ -62,9 +62,9 @@ void CSound::insertSound (std::string filename)
     this->m_sounds.push_back (filename);
 }
 
-std::vector<std::string>* CSound::getSounds ()
+const std::vector<std::string>& CSound::getSounds () const
 {
-    return &this->m_sounds;
+    return this->m_sounds;
 }
 
 const std::string CSound::Type = "sound";

+ 1 - 1
src/WallpaperEngine/Core/Objects/CSound.h

@@ -25,7 +25,7 @@ namespace WallpaperEngine::Core::Objects
         );
 
         void insertSound (std::string filename);
-        std::vector<std::string>* getSounds ();
+        const std::vector<std::string>& getSounds () const;
 
     protected:
         CSound (

+ 3 - 3
src/WallpaperEngine/Core/Objects/Effects/CShaderConstant.h

@@ -9,10 +9,10 @@ namespace WallpaperEngine::Core::Objects::Effects
     public:
         CShaderConstant (std::string  type);
 
-        template<class T> const T* As () const { assert (Is<T> ()); return (const T*) this; }
-        template<class T> T* As () { assert (Is<T> ()); return (T*) this; }
+        template<class T> const T* as () const { assert (is <T> ()); return (const T*) this; }
+        template<class T> T* as () { assert (is <T> ()); return (T*) this; }
 
-        template<class T> bool Is () { return this->m_type == T::Type; }
+        template<class T> bool is () { return this->m_type == T::Type; }
 
     private:
         std::string m_type;

+ 5 - 5
src/WallpaperEngine/Core/Objects/Images/CMaterial.cpp

@@ -20,7 +20,7 @@ CMaterial* CMaterial::fromFile (irr::io::path filename)
 
 CMaterial* CMaterial::fromJSON (json data)
 {
-    json::const_iterator passes_it = data.find ("passes");
+    auto passes_it = data.find ("passes");
 
     if (passes_it == data.end ())
     {
@@ -29,8 +29,8 @@ CMaterial* CMaterial::fromJSON (json data)
 
     CMaterial* material = new CMaterial ();
 
-    json::const_iterator cur = (*passes_it).begin ();
-    json::const_iterator end = (*passes_it).end ();
+    auto cur = (*passes_it).begin ();
+    auto end = (*passes_it).end ();
 
     for (; cur != end; cur ++)
     {
@@ -47,7 +47,7 @@ void CMaterial::insertPass (Materials::CPassess* mass)
     this->m_passes.push_back (mass);
 }
 
-std::vector <Materials::CPassess*>* CMaterial::getPasses ()
+const std::vector <Materials::CPassess*>& CMaterial::getPasses () const
 {
-    return &this->m_passes;
+    return this->m_passes;
 }

+ 1 - 1
src/WallpaperEngine/Core/Objects/Images/CMaterial.h

@@ -17,7 +17,7 @@ namespace WallpaperEngine::Core::Objects::Images
 
         void insertPass (Materials::CPassess* mass);
 
-        std::vector <Materials::CPassess*>* getPasses ();
+        const std::vector <Materials::CPassess*>& getPasses () const;
     protected:
         CMaterial ();
     private:

+ 39 - 20
src/WallpaperEngine/Core/Objects/Images/Materials/CPassess.cpp

@@ -11,20 +11,15 @@ CPassess::CPassess (std::string blending, std::string cullmode, std::string dept
 {
 }
 
-std::vector<std::string>* CPassess::getTextures ()
-{
-    return &this->m_textures;
-}
-
 CPassess* CPassess::fromJSON (json data)
 {
-    json::const_iterator blending_it = data.find ("blending");
-    json::const_iterator cullmode_it = data.find ("cullmode");
-    json::const_iterator depthtest_it = data.find ("depthtest");
-    json::const_iterator depthwrite_it = data.find ("depthwrite");
-    json::const_iterator shader_it = data.find ("shader");
-    json::const_iterator textures_it = data.find ("textures");
-    json::const_iterator combos_it = data.find ("combos");
+    auto blending_it = data.find ("blending");
+    auto cullmode_it = data.find ("cullmode");
+    auto depthtest_it = data.find ("depthtest");
+    auto depthwrite_it = data.find ("depthwrite");
+    auto shader_it = data.find ("shader");
+    auto textures_it = data.find ("textures");
+    auto combos_it = data.find ("combos");
 
     if (blending_it == data.end ())
     {
@@ -70,8 +65,8 @@ CPassess* CPassess::fromJSON (json data)
 
     if (textures_it != data.end ())
     {
-        json::const_iterator cur = (*textures_it).begin ();
-        json::const_iterator end = (*textures_it).end ();
+        auto cur = (*textures_it).begin ();
+        auto end = (*textures_it).end ();
 
         for (;cur != end; cur ++)
         {
@@ -88,8 +83,8 @@ CPassess* CPassess::fromJSON (json data)
 
     if (combos_it != data.end ())
     {
-        json::const_iterator cur = (*combos_it).begin ();
-        json::const_iterator end = (*combos_it).end ();
+        auto cur = (*combos_it).begin ();
+        auto end = (*combos_it).end ();
 
         for (; cur != end; cur ++)
         {
@@ -109,7 +104,6 @@ CPassess* CPassess::fromJSON (json data)
     return pass;
 }
 
-
 void CPassess::insertTexture (const std::string& texture)
 {
     this->m_textures.push_back (texture);
@@ -120,12 +114,37 @@ void CPassess::insertCombo (const std::string& name, int value)
     this->m_combos.insert (std::pair <std::string, int> (name, value));
 }
 
-std::map<std::string, int>* CPassess::getCombos ()
+std::vector<std::string>* CPassess::getTextures ()
+{
+    return &this->m_textures;
+}
+
+const std::map<std::string, int>& CPassess::getCombos () const
 {
-    return &this->m_combos;
+    return this->m_combos;
 }
 
-std::string CPassess::getShader ()
+const std::string& CPassess::getShader () const
 {
     return this->m_shader;
+}
+
+const std::string& CPassess::getBlendingMode () const
+{
+    return this->m_blending;
+}
+
+const std::string& CPassess::getCullingMode () const
+{
+    return this->m_cullmode;
+}
+
+const std::string& CPassess::getDepthTest () const
+{
+    return this->m_depthtest;
+}
+
+const std::string& CPassess::getDepthWrite ()const
+{
+    return this->m_depthwrite;
 }

+ 8 - 2
src/WallpaperEngine/Core/Objects/Images/Materials/CPassess.h

@@ -12,8 +12,14 @@ namespace WallpaperEngine::Core::Objects::Images::Materials
         static CPassess* fromJSON (json data);
 
         std::vector<std::string>* getTextures ();
-        std::map<std::string, int>* getCombos ();
-        std::string getShader ();
+
+        const std::map<std::string, int>& getCombos () const;
+        const std::string& getShader () const;
+        const std::string& getBlendingMode () const;
+        const std::string& getCullingMode () const;
+        const std::string& getDepthTest () const;
+        const std::string& getDepthWrite () const;
+
     protected:
         CPassess (std::string blending, std::string cullmode, std::string depthtest, std::string depthwrite, std::string shader);
 

+ 6 - 6
src/WallpaperEngine/Core/Objects/Particles/CControlPoint.cpp

@@ -6,9 +6,9 @@ using namespace WallpaperEngine::Core::Objects::Particles;
 
 CControlPoint* CControlPoint::fromJSON (json data)
 {
-    json::const_iterator flags_it = data.find ("flags");
-    json::const_iterator id_it = data.find ("id");
-    json::const_iterator offset_it = data.find ("offset");
+    auto flags_it = data.find ("flags");
+    auto id_it = data.find ("id");
+    auto offset_it = data.find ("offset");
 
     if (id_it == data.end ())
     {
@@ -47,12 +47,12 @@ void CControlPoint::setFlags (irr::u32 flags)
     this->m_flags = flags;
 }
 
-irr::core::vector3df* CControlPoint::getOffset ()
+const irr::core::vector3df& CControlPoint::getOffset () const
 {
-    return &this->m_offset;
+    return this->m_offset;
 }
 
-irr::u32 CControlPoint::getFlags ()
+const irr::u32 CControlPoint::getFlags () const
 {
     return this->m_flags;
 }

+ 2 - 2
src/WallpaperEngine/Core/Objects/Particles/CControlPoint.h

@@ -12,8 +12,8 @@ namespace WallpaperEngine::Core::Objects::Particles
     public:
         static CControlPoint* fromJSON (json data);
 
-        irr::core::vector3df* getOffset ();
-        irr::u32 getFlags ();
+        const irr::core::vector3df& getOffset () const;
+        const irr::u32 getFlags () const;
     protected:
         CControlPoint (irr::u32 id, irr::u32 flags = 0);
 

+ 14 - 14
src/WallpaperEngine/Core/Objects/Particles/CEmitter.cpp

@@ -6,13 +6,13 @@ using namespace WallpaperEngine::Core::Objects::Particles;
 
 CEmitter* CEmitter::fromJSON (json data)
 {
-    json::const_iterator directions_it = data.find ("directions");
-    json::const_iterator distancemax_it = data.find ("distancemax");
-    json::const_iterator distancemin_it = data.find ("distancemin");
-    json::const_iterator id_it = data.find ("id");
-    json::const_iterator name_it = data.find ("name");
-    json::const_iterator origin_it = data.find ("origin");
-    json::const_iterator rate_it = data.find ("rate");
+    auto directions_it = data.find ("directions");
+    auto distancemax_it = data.find ("distancemax");
+    auto distancemin_it = data.find ("distancemin");
+    auto id_it = data.find ("id");
+    auto name_it = data.find ("name");
+    auto origin_it = data.find ("origin");
+    auto rate_it = data.find ("rate");
 
     if (directions_it == data.end ())
     {
@@ -79,27 +79,27 @@ const std::string& CEmitter::getName () const
     return this->m_name;
 }
 
-irr::u32 CEmitter::getDistanceMax () const
+const irr::u32 CEmitter::getDistanceMax () const
 {
     return this->m_distancemax;
 }
 
-irr::u32 CEmitter::getDistanceMin () const
+const irr::u32 CEmitter::getDistanceMin () const
 {
     return this->m_distancemin;
 }
 
-irr::core::vector3df* CEmitter::getDirections ()
+const irr::core::vector3df& CEmitter::getDirections () const
 {
-    return &this->m_directions;
+    return this->m_directions;
 }
 
-irr::core::vector3df* CEmitter::getOrigin ()
+const irr::core::vector3df& CEmitter::getOrigin () const
 {
-    return &this->m_origin;
+    return this->m_origin;
 }
 
-irr::f64 CEmitter::getRate () const
+const irr::f64 CEmitter::getRate () const
 {
     return this->m_rate;
 }

+ 5 - 5
src/WallpaperEngine/Core/Objects/Particles/CEmitter.h

@@ -13,11 +13,11 @@ namespace WallpaperEngine::Core::Objects::Particles
         static CEmitter* fromJSON (json data);
 
         const std::string& getName () const;
-        irr::u32 getDistanceMax () const;
-        irr::u32 getDistanceMin () const;
-        irr::core::vector3df* getDirections ();
-        irr::core::vector3df* getOrigin ();
-        irr::f64 getRate () const;
+        const irr::u32 getDistanceMax () const;
+        const irr::u32 getDistanceMin () const;
+        const irr::core::vector3df& getDirections () const;
+        const irr::core::vector3df& getOrigin () const;
+        const irr::f64 getRate () const;
     protected:
         CEmitter (
             const irr::core::vector3df& directions,

+ 4 - 4
src/WallpaperEngine/Core/Objects/Particles/CInitializer.cpp

@@ -12,8 +12,8 @@ using namespace WallpaperEngine::Core::Objects::Particles;
 
 CInitializer* CInitializer::fromJSON (json data)
 {
-    json::const_iterator id_it = data.find ("id");
-    json::const_iterator name_it = data.find ("name");
+    auto id_it = data.find ("id");
+    auto name_it = data.find ("name");
     irr::u32 id = ((id_it == data.end ()) ? 0 : (irr::u32) (*id_it));
 
     if (name_it == data.end ())
@@ -63,12 +63,12 @@ CInitializer::CInitializer (irr::u32 id, std::string name) :
 }
 
 
-std::string& CInitializer::getName ()
+const std::string& CInitializer::getName () const
 {
     return this->m_name;
 }
 
-irr::u32 CInitializer::getId ()
+const irr::u32 CInitializer::getId () const
 {
     return this->m_id;
 }

+ 2 - 2
src/WallpaperEngine/Core/Objects/Particles/CInitializer.h

@@ -12,8 +12,8 @@ namespace WallpaperEngine::Core::Objects::Particles
     public:
         static CInitializer* fromJSON (json data);
 
-        std::string& getName ();
-        irr::u32 getId ();
+        const std::string& getName () const;
+        const irr::u32 getId () const;
     protected:
         CInitializer (irr::u32 id, std::string name);
     private:

+ 4 - 4
src/WallpaperEngine/Core/Objects/Particles/Initializers/CAlphaRandom.cpp

@@ -4,8 +4,8 @@ using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
 
 CAlphaRandom* CAlphaRandom::fromJSON (json data, irr::u32 id)
 {
-    json::const_iterator min_it = data.find ("min");
-    json::const_iterator max_it = data.find ("max");
+    auto min_it = data.find ("min");
+    auto max_it = data.find ("max");
 
     if (min_it == data.end ())
     {
@@ -27,12 +27,12 @@ CAlphaRandom::CAlphaRandom (irr::u32 id, irr::f64 min, irr::f64 max) :
 {
 }
 
-irr::f64 CAlphaRandom::getMinimum ()
+const irr::f64 CAlphaRandom::getMinimum () const
 {
     return this->m_min;
 }
 
-irr::f64 CAlphaRandom::getMaximum ()
+const irr::f64 CAlphaRandom::getMaximum () const
 {
     return this->m_max;
 }

+ 2 - 2
src/WallpaperEngine/Core/Objects/Particles/Initializers/CAlphaRandom.h

@@ -10,8 +10,8 @@ namespace WallpaperEngine::Core::Objects::Particles::Initializers
     class CAlphaRandom : CInitializer
     {
     public:
-        irr::f64 getMinimum ();
-        irr::f64 getMaximum ();
+        const irr::f64 getMinimum () const;
+        const irr::f64 getMaximum () const;
     protected:
         friend class CInitializer;
 

+ 6 - 6
src/WallpaperEngine/Core/Objects/Particles/Initializers/CAngularVelocityRandom.cpp

@@ -6,8 +6,8 @@ using namespace WallpaperEngine::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");
+    auto min_it = data.find ("min");
+    auto max_it = data.find ("max");
 
     if (min_it == data.end ())
     {
@@ -34,12 +34,12 @@ CAngularVelocityRandom::CAngularVelocityRandom (irr::u32 id, irr::core::vector3d
 {
 }
 
-irr::core::vector3df* CAngularVelocityRandom::getMinimum ()
+const irr::core::vector3df& CAngularVelocityRandom::getMinimum () const
 {
-    return &this->m_min;
+    return this->m_min;
 }
 
-irr::core::vector3df* CAngularVelocityRandom::getMaximum ()
+const irr::core::vector3df& CAngularVelocityRandom::getMaximum () const
 {
-    return &this->m_max;
+    return this->m_max;
 }

+ 2 - 2
src/WallpaperEngine/Core/Objects/Particles/Initializers/CAngularVelocityRandom.h

@@ -10,8 +10,8 @@ namespace WallpaperEngine::Core::Objects::Particles::Initializers
     class CAngularVelocityRandom : CInitializer
     {
     public:
-        irr::core::vector3df* getMinimum ();
-        irr::core::vector3df* getMaximum ();
+        const irr::core::vector3df& getMinimum () const;
+        const irr::core::vector3df& getMaximum () const;
     protected:
         friend class CInitializer;
 

+ 6 - 6
src/WallpaperEngine/Core/Objects/Particles/Initializers/CColorRandom.cpp

@@ -6,8 +6,8 @@ using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
 
 CColorRandom* CColorRandom::fromJSON (json data, irr::u32 id)
 {
-    json::const_iterator min_it = data.find ("min");
-    json::const_iterator max_it = data.find ("max");
+    auto min_it = data.find ("min");
+    auto max_it = data.find ("max");
 
     if (min_it == data.end ())
     {
@@ -34,12 +34,12 @@ CColorRandom::CColorRandom (irr::u32 id, irr::video::SColor min, irr::video::SCo
 {
 }
 
-irr::video::SColor* CColorRandom::getMinimum ()
+const irr::video::SColor& CColorRandom::getMinimum () const
 {
-    return &this->m_min;
+    return this->m_min;
 }
 
-irr::video::SColor* CColorRandom::getMaximum ()
+const irr::video::SColor& CColorRandom::getMaximum () const
 {
-    return &this->m_max;
+    return this->m_max;
 }

+ 2 - 2
src/WallpaperEngine/Core/Objects/Particles/Initializers/CColorRandom.h

@@ -10,8 +10,8 @@ namespace WallpaperEngine::Core::Objects::Particles::Initializers
     class CColorRandom : CInitializer
     {
     public:
-        irr::video::SColor* getMinimum ();
-        irr::video::SColor* getMaximum ();
+        const irr::video::SColor& getMinimum () const;
+        const irr::video::SColor& getMaximum () const;
     protected:
         friend class CInitializer;
 

+ 4 - 4
src/WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.cpp

@@ -4,8 +4,8 @@ using namespace WallpaperEngine::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");
+    auto min_it = data.find ("min");
+    auto max_it = data.find ("max");
 
     if (min_it == data.end ())
     {
@@ -28,12 +28,12 @@ CLifeTimeRandom::CLifeTimeRandom (irr::u32 id, irr::u32 min, irr::u32 max) :
 {
 }
 
-irr::u32 CLifeTimeRandom::getMinimum ()
+const irr::u32 CLifeTimeRandom::getMinimum () const
 {
     return this->m_min;
 }
 
-irr::u32 CLifeTimeRandom::getMaximum ()
+const irr::u32 CLifeTimeRandom::getMaximum () const
 {
     return this->m_max;
 }

+ 2 - 2
src/WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.h

@@ -10,8 +10,8 @@ namespace WallpaperEngine::Core::Objects::Particles::Initializers
     class CLifeTimeRandom : CInitializer
     {
     public:
-        irr::u32 getMinimum ();
-        irr::u32 getMaximum ();
+        const irr::u32 getMinimum () const;
+        const irr::u32 getMaximum () const;
     protected:
         friend class CInitializer;
 

+ 4 - 4
src/WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.cpp

@@ -4,8 +4,8 @@ using namespace WallpaperEngine::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");
+    auto min_it = data.find ("min");
+    auto max_it = data.find ("max");
 
     irr::f64 min = 0.0f;
     irr::f64 max = 360.0f;
@@ -30,12 +30,12 @@ CRotationRandom::CRotationRandom (irr::u32 id, irr::f64 min, irr::f64 max) :
 {
 }
 
-irr::f64 CRotationRandom::getMinimum ()
+const irr::f64 CRotationRandom::getMinimum () const
 {
     return this->m_min;
 }
 
-irr::f64 CRotationRandom::getMaximum ()
+const irr::f64 CRotationRandom::getMaximum () const
 {
     return this->m_max;
 }

+ 2 - 2
src/WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.h

@@ -10,8 +10,8 @@ namespace WallpaperEngine::Core::Objects::Particles::Initializers
     class CRotationRandom : CInitializer
     {
     public:
-        irr::f64 getMinimum ();
-        irr::f64 getMaximum ();
+        const irr::f64 getMinimum () const;
+        const irr::f64 getMaximum () const;
     protected:
         friend class CInitializer;
 

+ 4 - 4
src/WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.cpp

@@ -4,8 +4,8 @@ using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
 
 CSizeRandom* CSizeRandom::fromJSON (json data, irr::u32 id)
 {
-    json::const_iterator min_it = data.find ("min");
-    json::const_iterator max_it = data.find ("max");
+    auto min_it = data.find ("min");
+    auto max_it = data.find ("max");
 
     if (min_it == data.end ())
     {
@@ -27,12 +27,12 @@ CSizeRandom::CSizeRandom (irr::u32 id, irr::u32 min, irr::u32 max) :
 {
 }
 
-irr::u32 CSizeRandom::getMinimum ()
+const irr::u32 CSizeRandom::getMinimum () const
 {
     return this->m_min;
 }
 
-irr::u32 CSizeRandom::getMaximum ()
+const irr::u32 CSizeRandom::getMaximum () const
 {
     return this->m_max;
 }

+ 2 - 2
src/WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.h

@@ -10,8 +10,8 @@ namespace WallpaperEngine::Core::Objects::Particles::Initializers
     class CSizeRandom : CInitializer
     {
     public:
-        irr::u32 getMinimum ();
-        irr::u32 getMaximum ();
+        const irr::u32 getMinimum () const;
+        const irr::u32 getMaximum () const;
     protected:
         friend class CInitializer;
 

+ 6 - 6
src/WallpaperEngine/Core/Objects/Particles/Initializers/CVelocityRandom.cpp

@@ -6,8 +6,8 @@ using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
 
 CVelocityRandom* CVelocityRandom::fromJSON (json data, irr::u32 id)
 {
-    json::const_iterator min_it = data.find ("min");
-    json::const_iterator max_it = data.find ("max");
+    auto min_it = data.find ("min");
+    auto max_it = data.find ("max");
 
     if (min_it == data.end ())
     {
@@ -34,12 +34,12 @@ CVelocityRandom::CVelocityRandom (irr::u32 id, irr::core::vector3df min, irr::co
 {
 }
 
-irr::core::vector3df* CVelocityRandom::getMinimum ()
+const irr::core::vector3df& CVelocityRandom::getMinimum () const
 {
-    return &this->m_min;
+    return this->m_min;
 }
 
-irr::core::vector3df* CVelocityRandom::getMaximum ()
+const irr::core::vector3df& CVelocityRandom::getMaximum () const
 {
-    return &this->m_max;
+    return this->m_max;
 }

+ 2 - 2
src/WallpaperEngine/Core/Objects/Particles/Initializers/CVelocityRandom.h

@@ -10,8 +10,8 @@ namespace WallpaperEngine::Core::Objects::Particles::Initializers
     class CVelocityRandom : CInitializer
     {
     public:
-        irr::core::vector3df* getMinimum ();
-        irr::core::vector3df* getMaximum ();
+        const irr::core::vector3df& getMinimum () const;
+        const irr::core::vector3df& getMaximum () const;
     protected:
         friend class CInitializer;
 

+ 36 - 37
src/WallpaperEngine/Core/Projects/CProperty.cpp

@@ -1,51 +1,50 @@
 #include "CProperty.h"
 #include "CPropertyColor.h"
 
-namespace WallpaperEngine::Core::Projects
+using namespace WallpaperEngine::Core::Projects;
+
+CProperty* CProperty::fromJSON (json data, const std::string& name)
 {
-    CProperty* CProperty::fromJSON (json data, const std::string& name)
-    {
-        json::const_iterator type = data.find ("type");
-        json::const_iterator value = data.find ("value");
-        json::const_iterator text = data.find ("text");
-
-        if (value == data.end ())
-        {
-            throw std::runtime_error ("Project properties must have the value field");
-        }
-
-        if (type == data.end ())
-        {
-            throw std::runtime_error ("Project properties must have the type field");
-        }
-
-        if (*type == CPropertyColor::Type)
-        {
-            return CPropertyColor::fromJSON (data, name);
-        }
-
-        throw std::runtime_error ("Unexpected type for property");
-    }
+    auto type = data.find ("type");
+    auto value = data.find ("value");
+    auto text = data.find ("text");
 
-    CProperty::CProperty (std::string name, std::string type, std::string text) :
-        m_name (std::move(name)),
-        m_type (std::move(type)),
-        m_text (std::move(text))
+    if (value == data.end ())
     {
+        throw std::runtime_error ("Project properties must have the value field");
     }
 
-    std::string& CProperty::getName ()
+    if (type == data.end ())
     {
-        return this->m_name;
+        throw std::runtime_error ("Project properties must have the type field");
     }
 
-    std::string& CProperty::getType ()
+    if (*type == CPropertyColor::Type)
     {
-        return this->m_type;
+        return CPropertyColor::fromJSON (data, name);
     }
 
-    std::string& CProperty::getText ()
-    {
-        return this->m_text;
-    }
-};
+    throw std::runtime_error ("Unexpected type for property");
+}
+
+CProperty::CProperty (std::string name, std::string type, std::string text) :
+    m_name (std::move(name)),
+    m_type (std::move(type)),
+    m_text (std::move(text))
+{
+}
+
+const std::string& CProperty::getName () const
+{
+    return this->m_name;
+}
+
+const std::string& CProperty::getType () const
+{
+    return this->m_type;
+}
+
+const std::string& CProperty::getText () const
+{
+    return this->m_text;
+}

+ 6 - 6
src/WallpaperEngine/Core/Projects/CProperty.h

@@ -13,14 +13,14 @@ namespace WallpaperEngine::Core::Projects
     public:
         static CProperty* fromJSON (json data, const std::string& name);
 
-        template<class T> const T* As () const { assert (Is<T> ()); return (const T*) this; }
-        template<class T> T* As () { assert (Is<T> ()); return (T*) this; }
+        template<class T> const T* as () const { assert (is <T> ()); return (const T*) this; }
+        template<class T> T* as () { assert (is <T> ()); return (T*) this; }
 
-        template<class T> bool Is () { return this->m_type == T::Type; }
+        template<class T> bool is () { return this->m_type == T::Type; }
 
-        std::string& getName ();
-        std::string& getType ();
-        std::string& getText ();
+        const std::string& getName () const;
+        const std::string& getType () const;
+        const std::string& getText () const;
     protected:
         CProperty (std::string name, std::string type, std::string text);
 

+ 4 - 4
src/WallpaperEngine/Core/Projects/CPropertyColor.cpp

@@ -5,8 +5,8 @@ using namespace WallpaperEngine::Core::Projects;
 
 CPropertyColor* CPropertyColor::fromJSON (json data, const std::string& name)
 {
-    json::const_iterator value = data.find ("value");
-    json::const_iterator text = data.find ("type");
+    auto value = data.find ("value");
+    auto text = data.find ("type");
 
     return new CPropertyColor (
         WallpaperEngine::Core::atoSColor (*value),
@@ -15,9 +15,9 @@ CPropertyColor* CPropertyColor::fromJSON (json data, const std::string& name)
     );
 }
 
-irr::video::SColor* CPropertyColor::getValue ()
+const irr::video::SColor& CPropertyColor::getValue () const
 {
-    return &this->m_color;
+    return this->m_color;
 }
 
 CPropertyColor::CPropertyColor (irr::video::SColor color, const std::string& name, const std::string& text) :

+ 1 - 1
src/WallpaperEngine/Core/Projects/CPropertyColor.h

@@ -13,7 +13,7 @@ namespace WallpaperEngine::Core::Projects
     public:
         static CPropertyColor* fromJSON (json data, const std::string& name);
 
-        irr::video::SColor* getValue ();
+        const irr::video::SColor& getValue () const;
 
         static const std::string Type;
 

+ 9 - 9
src/WallpaperEngine/Core/Scenes/CCamera.cpp

@@ -10,26 +10,26 @@ CCamera::CCamera (irr::core::vector3df center, irr::core::vector3df eye, irr::co
 {
 }
 
-irr::core::vector3df* CCamera::getCenter ()
+const irr::core::vector3df& CCamera::getCenter () const
 {
-    return &this->m_center;
+    return this->m_center;
 }
 
-irr::core::vector3df* CCamera::getEye ()
+const irr::core::vector3df& CCamera::getEye () const
 {
-    return &this->m_eye;
+    return this->m_eye;
 }
 
-irr::core::vector3df* CCamera::getUp ()
+const irr::core::vector3df& CCamera::getUp () const
 {
-    return &this->m_up;
+    return this->m_up;
 }
 
 CCamera* CCamera::fromJSON (json data)
 {
-    json::const_iterator center_it = data.find ("center");
-    json::const_iterator eye_it = data.find ("eye");
-    json::const_iterator up_it = data.find ("up");
+    auto center_it = data.find ("center");
+    auto eye_it = data.find ("eye");
+    auto up_it = data.find ("up");
 
     if (center_it == data.end ())
     {

+ 3 - 3
src/WallpaperEngine/Core/Scenes/CCamera.h

@@ -12,9 +12,9 @@ namespace WallpaperEngine::Core::Scenes
     public:
         static CCamera* fromJSON (json data);
 
-        irr::core::vector3df* getCenter ();
-        irr::core::vector3df* getEye ();
-        irr::core::vector3df* getUp ();
+        const irr::core::vector3df& getCenter () const;
+        const irr::core::vector3df& getEye () const;
+        const irr::core::vector3df& getUp () const;
     protected:
         CCamera (irr::core::vector3df center, irr::core::vector3df eye, irr::core::vector3df up);
     private:

+ 4 - 4
src/WallpaperEngine/Core/Scenes/CProjection.cpp

@@ -9,20 +9,20 @@ CProjection::CProjection (irr::u32 width, irr::u32 height) :
 {
 }
 
-irr::u32 CProjection::getWidth ()
+const irr::u32& CProjection::getWidth () const
 {
     return this->m_width;
 }
 
-irr::u32 CProjection::getHeight ()
+const irr::u32& CProjection::getHeight () const
 {
     return this->m_height;
 }
 
 CProjection* CProjection::fromJSON (json data)
 {
-    json::const_iterator width_it = data.find ("width");
-    json::const_iterator height_it = data.find ("height");
+    auto width_it = data.find ("width");
+    auto height_it = data.find ("height");
 
     if (width_it == data.end ())
     {

+ 2 - 2
src/WallpaperEngine/Core/Scenes/CProjection.h

@@ -12,8 +12,8 @@ namespace WallpaperEngine::Core::Scenes
     public:
         static CProjection* fromJSON (json data);
 
-        irr::u32 getWidth ();
-        irr::u32 getHeight ();
+        const irr::u32& getWidth () const;
+        const irr::u32& getHeight () const;
     protected:
         CProjection (irr::u32 width, irr::u32 height);
     private:

+ 1 - 1
src/WallpaperEngine/FileSystem/FileSystem.cpp

@@ -8,7 +8,7 @@ extern WallpaperEngine::Irrlicht::CContext* IrrlichtContext;
 
 namespace WallpaperEngine::FileSystem
 {
-    std::string loadFullFile (irr::io::path file)
+    std::string loadFullFile (const irr::io::path& file)
     {
         irr::io::IReadFile* reader = IrrlichtContext->getDevice ()->getFileSystem ()->createAndOpenFile (file);
 

+ 1 - 1
src/WallpaperEngine/FileSystem/FileSystem.h

@@ -16,5 +16,5 @@ namespace WallpaperEngine::FileSystem
      * @param file
      * @return
      */
-    std::string loadFullFile (irr::io::path file);
+    std::string loadFullFile (const irr::io::path& file);
 }

+ 9 - 10
src/WallpaperEngine/Irrlicht/CContext.cpp

@@ -1,14 +1,13 @@
 #include "CContext.h"
 
-namespace WallpaperEngine::Irrlicht
+using namespace WallpaperEngine::Irrlicht;
+
+void CContext::setDevice (irr::IrrlichtDevice* device)
 {
-    void CContext::setDevice (irr::IrrlichtDevice* device)
-    {
-        this->m_device = device;
-    }
+    this->m_device = device;
+}
 
-    irr::IrrlichtDevice* CContext::getDevice ()
-    {
-        return this->m_device;
-    }
-};
+irr::IrrlichtDevice* CContext::getDevice ()
+{
+    return this->m_device;
+}

+ 96 - 98
src/WallpaperEngine/Irrlicht/CFileList.cpp

@@ -2,135 +2,133 @@
 
 #include "CFileList.h"
 
-namespace WallpaperEngine::Irrlicht
-{
-    static const irr::io::path emptyFileListEntry;
+using namespace WallpaperEngine::Irrlicht;
+static const irr::io::path emptyFileListEntry;
 
-    CFileList::CFileList (const irr::io::path& path, bool ignoreCase, bool ignorePaths) :
-            m_ignorePaths (ignorePaths),
-            m_ignoreCase (ignoreCase),
-            m_path(path)
-    {
-        this->m_path.replace ('\\', '/');
-    }
+CFileList::CFileList (const irr::io::path& path, bool ignoreCase, bool ignorePaths) :
+        m_ignorePaths (ignorePaths),
+        m_ignoreCase (ignoreCase),
+        m_path(path)
+{
+    this->m_path.replace ('\\', '/');
+}
 
-    CFileList::~CFileList ()
-    {
-        this->m_files.clear ();
-    }
+CFileList::~CFileList ()
+{
+    this->m_files.clear ();
+}
 
-    irr::u32 CFileList::getFileCount () const
-    {
-        return this->m_files.size ();
-    }
+irr::u32 CFileList::getFileCount () const
+{
+    return this->m_files.size ();
+}
 
-    void CFileList::sort ()
-    {
-        this->m_files.sort ();
-    }
+void CFileList::sort ()
+{
+    this->m_files.sort ();
+}
 
-    const irr::io::path& CFileList::getFileName (irr::u32 index) const
-    {
-        return (index < this->m_files.size ()) ? this->m_files [index].Name : emptyFileListEntry;
-    }
+const irr::io::path& CFileList::getFileName (irr::u32 index) const
+{
+    return (index < this->m_files.size ()) ? this->m_files [index].Name : emptyFileListEntry;
+}
 
 
 //! Gets the full name of a file in the list, path included, based on an index.
-    const irr::io::path& CFileList::getFullFileName (irr::u32 index) const
-    {
-        return (index < this->m_files.size ()) ? this->m_files [index].FullName : emptyFileListEntry;
-    }
+const irr::io::path& CFileList::getFullFileName (irr::u32 index) const
+{
+    return (index < this->m_files.size ()) ? this->m_files [index].FullName : emptyFileListEntry;
+}
 
 //! adds a file or folder
-    irr::u32 CFileList::addItem (const irr::io::path& fullPath, irr::u32 offset, irr::u32 size, bool isDirectory, irr::u32 id)
+irr::u32 CFileList::addItem (const irr::io::path& fullPath, irr::u32 offset, irr::u32 size, bool isDirectory, irr::u32 id)
+{
+    SFileListEntry entry;
+    entry.ID   = id ? id : this->m_files.size ();
+    entry.Offset = offset;
+    entry.Size = size;
+    entry.Name = fullPath;
+    entry.Name.replace ('\\', '/');
+    entry.IsDirectory = isDirectory;
+
+    // remove trailing slash
+    if (entry.Name.lastChar () == '/')
     {
-        SFileListEntry entry;
-        entry.ID   = id ? id : this->m_files.size ();
-        entry.Offset = offset;
-        entry.Size = size;
-        entry.Name = fullPath;
-        entry.Name.replace ('\\', '/');
-        entry.IsDirectory = isDirectory;
-
-        // remove trailing slash
-        if (entry.Name.lastChar () == '/')
-        {
-            entry.IsDirectory = true;
-            entry.Name [entry.Name.size ()-1] = 0;
-            entry.Name.validate ();
-        }
-
-        if (this->m_ignoreCase)
-            entry.Name.make_lower ();
+        entry.IsDirectory = true;
+        entry.Name [entry.Name.size ()-1] = 0;
+        entry.Name.validate ();
+    }
 
-        entry.FullName = entry.Name;
+    if (this->m_ignoreCase)
+        entry.Name.make_lower ();
 
-        irr::core::deletePathFromFilename (entry.Name);
+    entry.FullName = entry.Name;
 
-        if (this->m_ignorePaths)
-            entry.FullName = entry.Name;
+    irr::core::deletePathFromFilename (entry.Name);
 
-        this->m_files.push_back (entry);
+    if (this->m_ignorePaths)
+        entry.FullName = entry.Name;
 
-        return this->m_files.size () - 1;
-    }
+    this->m_files.push_back (entry);
+
+    return this->m_files.size () - 1;
+}
 
 //! Returns the ID of a file in the file list, based on an index.
-    irr::u32 CFileList::getID (irr::u32 index) const
-    {
-        return (index < this->m_files.size ()) ? this->m_files [index].ID : 0;
-    }
+irr::u32 CFileList::getID (irr::u32 index) const
+{
+    return (index < this->m_files.size ()) ? this->m_files [index].ID : 0;
+}
 
-    bool CFileList::isDirectory (irr::u32 index) const
-    {
-        return (index < this->m_files.size ()) ? this->m_files [index].IsDirectory : false;
-    }
+bool CFileList::isDirectory (irr::u32 index) const
+{
+    return (index < this->m_files.size ()) ? this->m_files [index].IsDirectory : false;
+}
 
 //! Returns the size of a file
-    irr::u32 CFileList::getFileSize (irr::u32 index) const
-    {
-        return (index < this->m_files.size ()) ? this->m_files [index].Size : 0;
-    }
+irr::u32 CFileList::getFileSize (irr::u32 index) const
+{
+    return (index < this->m_files.size ()) ? this->m_files [index].Size : 0;
+}
 
 //! Returns the size of a file
-    irr::u32 CFileList::getFileOffset (irr::u32 index) const
-    {
-        return (index < this->m_files.size ()) ? this->m_files [index].Offset : 0;
-    }
+irr::u32 CFileList::getFileOffset (irr::u32 index) const
+{
+    return (index < this->m_files.size ()) ? this->m_files [index].Offset : 0;
+}
 
 
 //! Searches for a file or folder within the list, returns the index
-    irr::s32 CFileList::findFile (const irr::io::path& filename, bool isDirectory = false) const
-    {
-        SFileListEntry entry;
-        // we only need FullName to be set for the search
-        entry.FullName = filename;
-        entry.IsDirectory = isDirectory;
+irr::s32 CFileList::findFile (const irr::io::path& filename, bool isDirectory = false) const
+{
+    SFileListEntry entry;
+    // we only need FullName to be set for the search
+    entry.FullName = filename;
+    entry.IsDirectory = isDirectory;
 
-        // exchange
-        entry.FullName.replace('\\', '/');
+    // exchange
+    entry.FullName.replace('\\', '/');
 
-        // remove trailing slash
-        if (entry.FullName.lastChar () == '/')
-        {
-            entry.IsDirectory = true;
-            entry.FullName [entry.FullName.size ()-1] = 0;
-            entry.FullName.validate ();
-        }
+    // remove trailing slash
+    if (entry.FullName.lastChar () == '/')
+    {
+        entry.IsDirectory = true;
+        entry.FullName [entry.FullName.size ()-1] = 0;
+        entry.FullName.validate ();
+    }
 
-        if (this->m_ignoreCase)
-            entry.FullName.make_lower ();
+    if (this->m_ignoreCase)
+        entry.FullName.make_lower ();
 
-        if (this->m_ignorePaths)
-            irr::core::deletePathFromFilename (entry.FullName);
+    if (this->m_ignorePaths)
+        irr::core::deletePathFromFilename (entry.FullName);
 
-        return this->m_files.binary_search (entry);
-    }
+    return this->m_files.binary_search (entry);
+}
 
 
 //! Returns the base path of the file list
-    const irr::io::path& CFileList::getPath () const
-    {
-        return m_path;
-    }
-};
+const irr::io::path& CFileList::getPath () const
+{
+    return m_path;
+}

+ 2 - 2
src/WallpaperEngine/Irrlicht/CImageLoaderTEX.cpp

@@ -46,8 +46,8 @@ namespace WallpaperEngine::Irrlicht
 
     CImageLoaderTex::TextureContainer::~TextureContainer ()
     {
-        std::vector <TextureMipmap*>::const_iterator cur = this->mipmaps.begin ();
-        std::vector <TextureMipmap*>::const_iterator end = this->mipmaps.end ();
+        auto cur = this->mipmaps.begin ();
+        auto end = this->mipmaps.end ();
 
         for (; cur != end; cur ++)
         {

+ 8 - 7
src/WallpaperEngine/Render/CCamera.cpp

@@ -3,13 +3,14 @@
 using namespace WallpaperEngine;
 using namespace WallpaperEngine::Render;
 
-CCamera::CCamera (CScene* scene, Core::Scenes::CCamera* camera) :
+CCamera::CCamera (CScene* scene, const Core::Scenes::CCamera* camera) :
     m_camera (camera),
     m_scene (scene)
 {
     this->m_sceneCamera = scene->getContext ()->getDevice ()->getSceneManager ()->addCameraSceneNode (
-        scene, *this->getEye (), *this->getCenter (), scene->nextId ()
+        scene, this->getEye (), this->getCenter (), scene->nextId ()
     );
+    this->m_sceneCamera->setUpVector (this->getUp ());
 }
 
 CCamera::~CCamera ()
@@ -17,17 +18,17 @@ CCamera::~CCamera ()
     this->m_sceneCamera->remove ();
 }
 
-irr::core::vector3df* CCamera::getCenter ()
+const irr::core::vector3df& CCamera::getCenter () const
 {
     return this->m_camera->getCenter ();
 }
 
-irr::core::vector3df* CCamera::getEye ()
+const irr::core::vector3df& CCamera::getEye () const
 {
     return this->m_camera->getEye ();
 }
 
-irr::core::vector3df* CCamera::getUp ()
+const irr::core::vector3df& CCamera::getUp () const
 {
     return this->m_camera->getUp ();
 }
@@ -37,8 +38,8 @@ void CCamera::setOrthogonalProjection (irr::f32 width, irr::f32 height)
     irr::core::matrix4 identity; identity.makeIdentity ();
     irr::core::matrix4 orthogonalProjection; orthogonalProjection.buildProjectionMatrixOrthoLH (
             width, height,
-            this->getCenter ()->Z,
-            this->getEye ()->Z
+            this->getCenter ().Z,
+            this->getEye ().Z
     );
 
     this->m_sceneCamera->setProjectionMatrix (orthogonalProjection);

+ 5 - 5
src/WallpaperEngine/Render/CCamera.h

@@ -11,17 +11,17 @@ namespace WallpaperEngine::Render
     class CCamera
     {
     public:
-        CCamera (CScene* scene, Core::Scenes::CCamera* camera);
+        CCamera (CScene* scene, const Core::Scenes::CCamera* camera);
         ~CCamera ();
 
         void setOrthogonalProjection (irr::f32 width, irr::f32 height);
 
-        irr::core::vector3df* getCenter ();
-        irr::core::vector3df* getEye ();
-        irr::core::vector3df* getUp ();
+        const irr::core::vector3df& getCenter () const;
+        const irr::core::vector3df& getEye () const;
+        const irr::core::vector3df& getUp () const;
 
     private:
-        Core::Scenes::CCamera* m_camera;
+        const Core::Scenes::CCamera* m_camera;
         irr::scene::ICameraSceneNode* m_sceneCamera;
         CScene* m_scene;
     };

+ 1 - 1
src/WallpaperEngine/Render/CObject.cpp

@@ -19,7 +19,7 @@ CObject::~CObject()
 {
 }
 
-CScene* CObject::getScene ()
+CScene* CObject::getScene () const
 {
     return this->m_scene;
 }

+ 2 - 2
src/WallpaperEngine/Render/CObject.h

@@ -21,11 +21,11 @@ namespace WallpaperEngine::Render
 
     protected:
         CObject (CScene* scene, std::string type, Core::CObject *object);
-        ~CObject ();
+        ~CObject () override;
 
         void OnRegisterSceneNode () override;
 
-        CScene* getScene ();
+        CScene* getScene () const;
 
     private:
         std::string m_type;

+ 9 - 9
src/WallpaperEngine/Render/CScene.cpp

@@ -9,7 +9,7 @@
 using namespace WallpaperEngine;
 using namespace WallpaperEngine::Render;
 
-CScene::CScene (Core::CProject* project, Irrlicht::CContext* context) :
+CScene::CScene (const Core::CProject* project, Irrlicht::CContext* context) :
     irr::scene::ISceneNode (
         context->getDevice ()->getSceneManager ()->getRootSceneNode (),
         context->getDevice ()->getSceneManager ()
@@ -24,8 +24,8 @@ CScene::CScene (Core::CProject* project, Irrlicht::CContext* context) :
             this->m_scene->getOrthogonalProjection ()->getHeight ()
     );
 
-    std::vector<Core::CObject*>::const_iterator cur = this->m_scene->getObjects ()->begin ();
-    std::vector<Core::CObject*>::const_iterator end = this->m_scene->getObjects ()->end ();
+    auto cur = this->m_scene->getObjects ().begin ();
+    auto end = this->m_scene->getObjects ().end ();
 
     int highestId = 0;
 
@@ -34,13 +34,13 @@ CScene::CScene (Core::CProject* project, Irrlicht::CContext* context) :
         if ((*cur)->getId () > highestId)
             highestId = (*cur)->getId ();
 
-        if ((*cur)->Is <Core::Objects::CImage> () == true)
+        if ((*cur)->is<Core::Objects::CImage>() == true)
         {
-            new Objects::CImage (this, (*cur)->As <Core::Objects::CImage> ());
+            new Objects::CImage (this, (*cur)->as<Core::Objects::CImage>());
         }
-        else if ((*cur)->Is <Core::Objects::CSound> () == true)
+        else if ((*cur)->is<Core::Objects::CSound>() == true)
         {
-            new Objects::CSound (this, (*cur)->As <Core::Objects::CSound> ());
+            new Objects::CSound (this, (*cur)->as<Core::Objects::CSound>());
         }
     }
 
@@ -58,12 +58,12 @@ Irrlicht::CContext* CScene::getContext ()
     return this->m_context;
 }
 
-Core::CScene* CScene::getScene ()
+const Core::CScene* CScene::getScene () const
 {
     return this->m_scene;
 }
 
-CCamera* CScene::getCamera ()
+CCamera* CScene::getCamera () const
 {
     return this->m_camera;
 }

+ 6 - 6
src/WallpaperEngine/Render/CScene.h

@@ -14,20 +14,20 @@ namespace WallpaperEngine::Render
     class CScene : public irr::scene::ISceneNode
     {
     public:
-        CScene (Core::CProject* project, Irrlicht::CContext* context);
-        ~CScene ();
+        CScene (const Core::CProject* project, Irrlicht::CContext* context);
+        ~CScene () override;
 
         Irrlicht::CContext* getContext ();
-        Core::CScene* getScene ();
-        CCamera* getCamera ();
+        const Core::CScene* getScene () const;
+        CCamera* getCamera () const;
         int nextId ();
 
         void render () override;
         const irr::core::aabbox3d<irr::f32>& getBoundingBox() const override;
         void OnRegisterSceneNode () override;
     private:
-        Core::CProject* m_project;
-        Core::CScene* m_scene;
+        const Core::CProject* m_project;
+        const Core::CScene* m_scene;
         CCamera* m_camera;
         Irrlicht::CContext* m_context;
         irr::u32 m_nextId;

+ 48 - 52
src/WallpaperEngine/Render/Objects/CImage.cpp

@@ -20,11 +20,11 @@ CImage::CImage (CScene* scene, Core::Objects::CImage* image) :
     m_passes (0)
 {
     // TODO: INITIALIZE NEEDED EFFECTS AND PROPERLY CALCULATE THESE?
-    irr::f32 xright     = this->m_image->getOrigin ()->X;
-    irr::f32 xleft      = -this->m_image->getOrigin ()->X;
-    irr::f32 ztop       = this->m_image->getOrigin ()->Y;
-    irr::f32 zbottom    = -this->m_image->getOrigin ()->Y;
-    irr::f32 z          = this->m_image->getOrigin ()->Z;
+    irr::f32 xright     = this->m_image->getOrigin ().X;
+    irr::f32 xleft      = -this->m_image->getOrigin ().X;
+    irr::f32 ztop       = this->m_image->getOrigin ().Y;
+    irr::f32 zbottom    = -this->m_image->getOrigin ().Y;
+    irr::f32 z          = this->m_image->getOrigin ().Z;
 
     // top left
     this->m_vertex [0].Pos = irr::core::vector3df (xleft,  ztop,    z);
@@ -59,11 +59,11 @@ void CImage::render()
 
     irr::video::IVideoDriver* driver = SceneManager->getVideoDriver ();
 
-    std::vector<irr::video::SMaterial>::const_iterator cur = this->m_materials.begin ();
-    std::vector<irr::video::SMaterial>::const_iterator end = this->m_materials.end ();
+    auto cur = this->m_materials.begin ();
+    auto end = this->m_materials.end ();
 
-    std::vector<irr::video::ITexture*>::const_iterator textureCur = this->m_renderTextures.begin ();
-    std::vector<irr::video::ITexture*>::const_iterator textureEnd = this->m_renderTextures.end ();
+    auto textureCur = this->m_renderTextures.begin ();
+    auto textureEnd = this->m_renderTextures.end ();
 
     for (; cur != end; cur ++)
     {
@@ -87,26 +87,26 @@ void CImage::render()
 
 void CImage::generateMaterial ()
 {
-    std::vector<Core::Objects::Images::Materials::CPassess*>::const_iterator cur = this->m_image->getMaterial ()->getPasses ()->begin ();
-    std::vector<Core::Objects::Images::Materials::CPassess*>::const_iterator end = this->m_image->getMaterial ()->getPasses ()->end ();
+    auto cur = this->m_image->getMaterial ()->getPasses ().begin ();
+    auto end = this->m_image->getMaterial ()->getPasses ().end ();
 
     for (; cur != end; cur++)
     {
         this->generatePass (*cur);
     }
 
-    std::vector<Core::Objects::CEffect*>::const_iterator effectCur = this->m_image->getEffects ()->begin ();
-    std::vector<Core::Objects::CEffect*>::const_iterator effectEnd = this->m_image->getEffects ()->end ();
+    auto effectCur = this->m_image->getEffects ().begin ();
+    auto effectEnd = this->m_image->getEffects ().end ();
 
     for (; effectCur != effectEnd; effectCur++)
     {
-        std::vector<Core::Objects::Images::CMaterial*>::const_iterator materialCur = (*effectCur)->getMaterials ()->begin ();
-        std::vector<Core::Objects::Images::CMaterial*>::const_iterator materialEnd = (*effectCur)->getMaterials ()->end ();
+        auto materialCur = (*effectCur)->getMaterials ().begin ();
+        auto materialEnd = (*effectCur)->getMaterials ().end ();
 
         for (; materialCur != materialEnd; materialCur++)
         {
-            cur = (*materialCur)->getPasses ()->begin ();
-            end = (*materialCur)->getPasses ()->end ();
+            cur = (*materialCur)->getPasses ().begin ();
+            end = (*materialCur)->getPasses ().end ();
 
             for (; cur != end; cur++)
             {
@@ -121,8 +121,8 @@ void CImage::generatePass (Core::Objects::Images::Materials::CPassess* pass)
     std::vector<std::string>* textures = pass->getTextures ();
     irr::video::SMaterial material;
 
-    std::vector<std::string>::const_iterator texturesCur = textures->begin ();
-    std::vector<std::string>::const_iterator texturesEnd = textures->end ();
+    auto texturesCur = textures->begin ();
+    auto texturesEnd = textures->end ();
 
     for (int textureNumber = 0; texturesCur != texturesEnd; texturesCur ++, textureNumber ++)
     {
@@ -141,8 +141,6 @@ void CImage::generatePass (Core::Objects::Images::Materials::CPassess* pass)
                 ), ("_RT_" + this->m_image->getName () + std::to_string (textureNumber) + "_" + std::to_string (this->m_passes)).c_str ()
             );
 
-            //originalTexture->drop ();
-
             this->m_renderTextures.push_back (texture);
         }
         else
@@ -150,8 +148,6 @@ void CImage::generatePass (Core::Objects::Images::Materials::CPassess* pass)
             texture = this->getScene ()->getContext ()->getDevice ()->getVideoDriver ()->getTexture (texturepath);
         }
 
-        //texture->grab ();
-
         material.setTexture (textureNumber, texture);
     }
 
@@ -196,23 +192,23 @@ void CImage::OnSetConstants (irr::video::IMaterialRendererServices *services, in
     irr::f32 g_Texture6 = 6;
     irr::f32 g_Texture7 = 7;
 
-    irr::f32 g_Texture0Rotation [4] = { this->m_image->getAngles ()->X, this->m_image->getAngles ()->Y, this->m_image->getAngles ()->Z, this->m_image->getAngles ()->Z };
-    irr::f32 g_Texture1Rotation [4] = { this->m_image->getAngles ()->X, this->m_image->getAngles ()->Y, this->m_image->getAngles ()->Z, this->m_image->getAngles ()->Z };
-    irr::f32 g_Texture2Rotation [4] = { this->m_image->getAngles ()->X, this->m_image->getAngles ()->Y, this->m_image->getAngles ()->Z, this->m_image->getAngles ()->Z };
-    irr::f32 g_Texture3Rotation [4] = { this->m_image->getAngles ()->X, this->m_image->getAngles ()->Y, this->m_image->getAngles ()->Z, this->m_image->getAngles ()->Z };
-    irr::f32 g_Texture4Rotation [4] = { this->m_image->getAngles ()->X, this->m_image->getAngles ()->Y, this->m_image->getAngles ()->Z, this->m_image->getAngles ()->Z };
-    irr::f32 g_Texture5Rotation [4] = { this->m_image->getAngles ()->X, this->m_image->getAngles ()->Y, this->m_image->getAngles ()->Z, this->m_image->getAngles ()->Z };
-    irr::f32 g_Texture6Rotation [4] = { this->m_image->getAngles ()->X, this->m_image->getAngles ()->Y, this->m_image->getAngles ()->Z, this->m_image->getAngles ()->Z };
-    irr::f32 g_Texture7Rotation [4] = { this->m_image->getAngles ()->X, this->m_image->getAngles ()->Y, this->m_image->getAngles ()->Z, this->m_image->getAngles ()->Z };
-
-    irr::f32 g_Texture0Resolution [4] = { this->m_image->getSize ()->X, this->m_image->getSize ()->Y, this->m_image->getSize ()->X, this->m_image->getSize ()->Y };
-    irr::f32 g_Texture1Resolution [4] = { this->m_image->getSize ()->X, this->m_image->getSize ()->Y, this->m_image->getSize ()->X, this->m_image->getSize ()->Y };
-    irr::f32 g_Texture2Resolution [4] = { this->m_image->getSize ()->X, this->m_image->getSize ()->Y, this->m_image->getSize ()->X, this->m_image->getSize ()->Y };
-    irr::f32 g_Texture3Resolution [4] = { this->m_image->getSize ()->X, this->m_image->getSize ()->Y, this->m_image->getSize ()->X, this->m_image->getSize ()->Y };
-    irr::f32 g_Texture4Resolution [4] = { this->m_image->getSize ()->X, this->m_image->getSize ()->Y, this->m_image->getSize ()->X, this->m_image->getSize ()->Y };
-    irr::f32 g_Texture5Resolution [4] = { this->m_image->getSize ()->X, this->m_image->getSize ()->Y, this->m_image->getSize ()->X, this->m_image->getSize ()->Y };
-    irr::f32 g_Texture6Resolution [4] = { this->m_image->getSize ()->X, this->m_image->getSize ()->Y, this->m_image->getSize ()->X, this->m_image->getSize ()->Y };
-    irr::f32 g_Texture7Resolution [4] = { this->m_image->getSize ()->X, this->m_image->getSize ()->Y, this->m_image->getSize ()->X, this->m_image->getSize ()->Y };
+    irr::f32 g_Texture0Rotation [4] = { this->m_image->getAngles ().X, this->m_image->getAngles ().Y, this->m_image->getAngles ().Z, this->m_image->getAngles ().Z };
+    irr::f32 g_Texture1Rotation [4] = { this->m_image->getAngles ().X, this->m_image->getAngles ().Y, this->m_image->getAngles ().Z, this->m_image->getAngles ().Z };
+    irr::f32 g_Texture2Rotation [4] = { this->m_image->getAngles ().X, this->m_image->getAngles ().Y, this->m_image->getAngles ().Z, this->m_image->getAngles ().Z };
+    irr::f32 g_Texture3Rotation [4] = { this->m_image->getAngles ().X, this->m_image->getAngles ().Y, this->m_image->getAngles ().Z, this->m_image->getAngles ().Z };
+    irr::f32 g_Texture4Rotation [4] = { this->m_image->getAngles ().X, this->m_image->getAngles ().Y, this->m_image->getAngles ().Z, this->m_image->getAngles ().Z };
+    irr::f32 g_Texture5Rotation [4] = { this->m_image->getAngles ().X, this->m_image->getAngles ().Y, this->m_image->getAngles ().Z, this->m_image->getAngles ().Z };
+    irr::f32 g_Texture6Rotation [4] = { this->m_image->getAngles ().X, this->m_image->getAngles ().Y, this->m_image->getAngles ().Z, this->m_image->getAngles ().Z };
+    irr::f32 g_Texture7Rotation [4] = { this->m_image->getAngles ().X, this->m_image->getAngles ().Y, this->m_image->getAngles ().Z, this->m_image->getAngles ().Z };
+
+    irr::f32 g_Texture0Resolution [4] = { this->m_image->getSize ().X, this->m_image->getSize ().Y, this->m_image->getSize ().X, this->m_image->getSize ().Y };
+    irr::f32 g_Texture1Resolution [4] = { this->m_image->getSize ().X, this->m_image->getSize ().Y, this->m_image->getSize ().X, this->m_image->getSize ().Y };
+    irr::f32 g_Texture2Resolution [4] = { this->m_image->getSize ().X, this->m_image->getSize ().Y, this->m_image->getSize ().X, this->m_image->getSize ().Y };
+    irr::f32 g_Texture3Resolution [4] = { this->m_image->getSize ().X, this->m_image->getSize ().Y, this->m_image->getSize ().X, this->m_image->getSize ().Y };
+    irr::f32 g_Texture4Resolution [4] = { this->m_image->getSize ().X, this->m_image->getSize ().Y, this->m_image->getSize ().X, this->m_image->getSize ().Y };
+    irr::f32 g_Texture5Resolution [4] = { this->m_image->getSize ().X, this->m_image->getSize ().Y, this->m_image->getSize ().X, this->m_image->getSize ().Y };
+    irr::f32 g_Texture6Resolution [4] = { this->m_image->getSize ().X, this->m_image->getSize ().Y, this->m_image->getSize ().X, this->m_image->getSize ().Y };
+    irr::f32 g_Texture7Resolution [4] = { this->m_image->getSize ().X, this->m_image->getSize ().Y, this->m_image->getSize ().X, this->m_image->getSize ().Y };
 
     irr::video::IVideoDriver* driver = services->getVideoDriver ();
 
@@ -224,12 +220,12 @@ void CImage::OnSetConstants (irr::video::IMaterialRendererServices *services, in
     Render::Shaders::Compiler* vertexShader = this->m_vertexShaders.at (userData);
     Render::Shaders::Compiler* pixelShader = this->m_pixelShaders.at (userData);
 
-    std::vector<Render::Shaders::Parameters::CShaderParameter*>::const_iterator cur = vertexShader->getParameters ().begin ();
-    std::vector<Render::Shaders::Parameters::CShaderParameter*>::const_iterator end = vertexShader->getParameters ().end ();
+    auto cur = vertexShader->getParameters ().begin ();
+    auto end = vertexShader->getParameters ().end ();
 
     for (; cur != end; cur ++)
     {
-        if ((*cur)->Is <CShaderParameterInteger> () == true)
+        if ((*cur)->is <CShaderParameterInteger> () == true)
         {
             services->setVertexShaderConstant (
                 (*cur)->getName ().c_str (),
@@ -238,10 +234,10 @@ void CImage::OnSetConstants (irr::video::IMaterialRendererServices *services, in
             );
         }
         else if (
-            (*cur)->Is <CShaderParameterFloat> () == true ||
-            (*cur)->Is <CShaderParameterVector2> () == true ||
-            (*cur)->Is <CShaderParameterVector3> () == true ||
-            (*cur)->Is <CShaderParameterVector4> () == true)
+            (*cur)->is <CShaderParameterFloat> () == true ||
+            (*cur)->is <CShaderParameterVector2> () == true ||
+            (*cur)->is <CShaderParameterVector3> () == true ||
+            (*cur)->is <CShaderParameterVector4> () == true)
         {
             services->setVertexShaderConstant (
                 (*cur)->getName ().c_str (),
@@ -256,7 +252,7 @@ void CImage::OnSetConstants (irr::video::IMaterialRendererServices *services, in
 
     for (; cur != end; cur ++)
     {
-        if ((*cur)->Is <CShaderParameterInteger> () == true)
+        if ((*cur)->is <CShaderParameterInteger> () == true)
         {
             services->setPixelShaderConstant (
                 (*cur)->getName ().c_str (),
@@ -265,10 +261,10 @@ void CImage::OnSetConstants (irr::video::IMaterialRendererServices *services, in
             );
         }
         else if (
-            (*cur)->Is <CShaderParameterFloat> () == true ||
-            (*cur)->Is <CShaderParameterVector2> () == true ||
-            (*cur)->Is <CShaderParameterVector3> () == true ||
-            (*cur)->Is <CShaderParameterVector4> () == true)
+            (*cur)->is <CShaderParameterFloat> () == true ||
+            (*cur)->is <CShaderParameterVector2> () == true ||
+            (*cur)->is <CShaderParameterVector3> () == true ||
+            (*cur)->is <CShaderParameterVector4> () == true)
         {
             services->setPixelShaderConstant (
                 (*cur)->getName ().c_str (),

+ 3 - 3
src/WallpaperEngine/Render/Objects/CSound.cpp

@@ -18,8 +18,8 @@ CSound::CSound (CScene* scene, Core::Objects::CSound* sound) :
 
 void CSound::load ()
 {
-    std::vector<std::string>::const_iterator cur = this->m_sound->getSounds ()->begin ();
-    std::vector<std::string>::const_iterator end = this->m_sound->getSounds ()->end ();
+    std::vector<std::string>::const_iterator cur = this->m_sound->getSounds ().begin ();
+    std::vector<std::string>::const_iterator end = this->m_sound->getSounds ().end ();
 
     for (; cur != end; cur ++)
     {
@@ -31,7 +31,7 @@ void CSound::load ()
 
         readfile->read (filebuffer, filesize);
 
-        sdlRwops = SDL_RWFromConstMem(filebuffer, filesize);
+        sdlRwops = SDL_RWFromConstMem (filebuffer, filesize);
         music = Mix_LoadMUS_RW (sdlRwops);
         readfile->drop ();
 

+ 25 - 27
src/WallpaperEngine/Render/Shaders/Compiler.cpp

@@ -19,13 +19,16 @@
 
 namespace WallpaperEngine::Render::Shaders
 {
-    Compiler::Compiler (irr::io::path& file, Type type, std::map<std::string, int>* combos, bool recursive)
+    Compiler::Compiler (irr::io::path& file, Type type, const std::map<std::string, int>& combos, bool recursive) :
+        m_combos (combos),
+        m_recursive (recursive),
+        m_type (type),
+        m_file (file),
+        m_error (""),
+        m_errorInfo ("")
     {
-        this->m_recursive = recursive;
-        this->m_combos = combos;
-
         // begin with an space so it gets ignored properly on parse
-        if (recursive == false)
+        if (this->m_recursive == false)
         {
             // compatibility layer for OpenGL shaders
             this->m_content =   "#version 120\n"
@@ -47,8 +50,8 @@ namespace WallpaperEngine::Render::Shaders
                                 "#define ddy(x) dFdy(-(x))\n"
                                 "#define GLSL 1\n\n";
 
-            std::map<std::string, int>::const_iterator cur = this->m_combos->begin ();
-            std::map<std::string, int>::const_iterator end = this->m_combos->end ();
+            auto cur = this->m_combos.begin ();
+            auto end = this->m_combos.end ();
 
             for (; cur != end; cur ++)
             {
@@ -61,11 +64,6 @@ namespace WallpaperEngine::Render::Shaders
         }
 
         this->m_content.append (WallpaperEngine::FileSystem::loadFullFile (file));
-
-        // append file content
-        this->m_type = type;
-
-        this->m_file = file;
     }
 
     bool Compiler::peekString(std::string str, std::string::const_iterator& it)
@@ -126,8 +124,8 @@ namespace WallpaperEngine::Render::Shaders
 
     std::string Compiler::extractType (std::string::const_iterator& it)
     {
-        std::vector<std::string>::const_iterator cur = sTypes.begin ();
-        std::vector<std::string>::const_iterator end = sTypes.end ();
+        auto cur = sTypes.begin ();
+        auto end = sTypes.end ();
 
         while (cur != end)
         {
@@ -227,8 +225,8 @@ namespace WallpaperEngine::Render::Shaders
 
     std::string Compiler::lookupReplaceSymbol (std::string symbol)
     {
-        std::map<std::string, std::string>::const_iterator cur = sVariableReplacement.begin ();
-        std::map<std::string, std::string>::const_iterator end = sVariableReplacement.end ();
+        auto cur = sVariableReplacement.begin ();
+        auto end = sVariableReplacement.end ();
 
         while (cur != end)
         {
@@ -458,8 +456,8 @@ namespace WallpaperEngine::Render::Shaders
     void Compiler::parseComboConfiguration (const std::string& content)
     {
         json data = json::parse (content);
-        json::const_iterator combo = data.find ("combo");
-        json::const_iterator defvalue = data.find ("default");
+        auto combo = data.find ("combo");
+        auto defvalue = data.find ("default");
 
         // add line feed just in case
         this->m_compiledContent += "\n";
@@ -470,11 +468,11 @@ namespace WallpaperEngine::Render::Shaders
         }
 
         // check the combos
-        std::map<std::string, int>::const_iterator entry = this->m_combos->find ((*combo).get <std::string> ());
+        std::map<std::string, int>::const_iterator entry = this->m_combos.find ((*combo).get <std::string> ());
 
         // if the combo was not found in the predefined values this means that the default value in the JSON data can be used
         // so only define the ones that are not already defined
-        if (entry == this->m_combos->end ())
+        if (entry == this->m_combos.end ())
         {
             // if no combo is defined just load the default settings
             if ((*defvalue).is_number_float ())
@@ -499,9 +497,9 @@ namespace WallpaperEngine::Render::Shaders
     void Compiler::parseParameterConfiguration (const std::string& type, const std::string& name, const std::string& content)
     {
         json data = json::parse (content);
-        json::const_iterator material = data.find ("material");
-        json::const_iterator defvalue = data.find ("default");
-        json::const_iterator range = data.find ("range");
+        auto material = data.find ("material");
+        auto defvalue = data.find ("default");
+        auto range = data.find ("range");
 
         // this is not a real parameter
         if (material == data.end () || defvalue == data.end ())
@@ -558,10 +556,10 @@ namespace WallpaperEngine::Render::Shaders
         this->m_parameters.push_back (parameter);
     }
 
-    Parameters::CShaderParameter* Compiler::findParameter (std::string identifier)
+    Parameters::CShaderParameter* Compiler::findParameter (const std::string& identifier)
     {
-        std::vector<Parameters::CShaderParameter*>::const_iterator cur = this->m_parameters.begin ();
-        std::vector<Parameters::CShaderParameter*>::const_iterator end = this->m_parameters.end ();
+        auto cur = this->m_parameters.begin ();
+        auto end = this->m_parameters.end ();
 
         for (; cur != end; cur ++)
         {
@@ -574,7 +572,7 @@ namespace WallpaperEngine::Render::Shaders
         return nullptr;
     }
 
-    std::vector <Parameters::CShaderParameter*>& Compiler::getParameters ()
+    const std::vector <Parameters::CShaderParameter*>& Compiler::getParameters () const
     {
         return this->m_parameters;
     }

+ 4 - 4
src/WallpaperEngine/Render/Shaders/Compiler.h

@@ -46,7 +46,7 @@ namespace WallpaperEngine::Render::Shaders
          * @param type The type of shader
          * @param recursive Whether the compiler should add base definitions or not
          */
-        Compiler (irr::io::path& file, Type type, std::map<std::string, int>* combos, bool recursive = false);
+        Compiler (irr::io::path& file, Type type, const std::map<std::string, int>& combos, bool recursive = false);
         /**
          * Performs the actual pre-compilation/pre-processing over the shader files
          * This step is kinda big, replaces variables names on sVariableReplacement,
@@ -62,12 +62,12 @@ namespace WallpaperEngine::Render::Shaders
          * @param identifier The identifier to search for
          * @return The shader information
          */
-        Parameters::CShaderParameter* findParameter (std::string identifier);
+        Parameters::CShaderParameter* findParameter (const std::string& identifier);
 
         /**
          * @return The list of parameters available for this shader with their default values
          */
-        std::vector <Parameters::CShaderParameter*>& getParameters ();
+        const std::vector <Parameters::CShaderParameter*>& getParameters () const;
 
     private:
         /**
@@ -206,7 +206,7 @@ namespace WallpaperEngine::Render::Shaders
         /**
          * The combos the shader should be generated with
          */
-         std::map <std::string, int>* m_combos;
+         const std::map <std::string, int>& m_combos;
          /**
           * Whether this compilation is a recursive one or not
           */

+ 3 - 3
src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameter.cpp

@@ -12,7 +12,7 @@ CShaderParameter::CShaderParameter (void* defaultValue, void* value, std::string
 
 }
 
-void* CShaderParameter::getValue ()
+const void* CShaderParameter::getValue () const
 {
     if (this->m_value)
         return this->m_value;
@@ -25,12 +25,12 @@ void CShaderParameter::setValue (void* value)
     this->m_value = value;
 }
 
-std::string CShaderParameter::getIdentifierName ()
+const std::string& CShaderParameter::getIdentifierName () const
 {
     return this->m_identifierName;
 }
 
-std::string CShaderParameter::getName ()
+const std::string& CShaderParameter::getName () const
 {
     return this->m_name;
 }

+ 7 - 7
src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameter.h

@@ -9,19 +9,19 @@ namespace WallpaperEngine::Render::Shaders::Parameters
     public:
         CShaderParameter (void* defaultValue, void* value, std::string type);
 
-        template<class T> const T* As () const { assert (Is<T> ()); return (const T*) this; }
-        template<class T> T* As () { assert (Is<T> ()); return (T*) this; }
+        template<class T> const T* as () const { assert (is <T> ()); return (const T*) this; }
+        template<class T> T* as () { assert (is <T> ()); return (T*) this; }
 
-        template<class T> bool Is () { return this->m_type == T::Type; }
+        template<class T> bool is () { return this->m_type == T::Type; }
 
-        std::string getIdentifierName ();
-        std::string getName ();
+        const std::string& getIdentifierName () const;
+        const std::string& getName () const;
 
         void setIdentifierName (std::string identifierName);
         void setName (std::string name);
-        void* getValue ();
+        const void* getValue () const;
 
-        virtual int getSize () = 0;
+        virtual const int getSize () const = 0;
 
     protected:
         void setValue (void* value);

+ 1 - 1
src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameterFloat.cpp

@@ -17,7 +17,7 @@ void CShaderParameterFloat::setValue (irr::f32 value)
     CShaderParameter::setValue (&this->m_value);
 }
 
-int CShaderParameterFloat::getSize ()
+const int CShaderParameterFloat::getSize () const
 {
     return 1;
 }

+ 1 - 1
src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameterFloat.h

@@ -11,7 +11,7 @@ namespace WallpaperEngine::Render::Shaders::Parameters
     public:
         CShaderParameterFloat (irr::f32 defaultValue);
 
-        int getSize () override;
+        const int getSize () const override;
 
         void setValue (irr::f32 value);
 

+ 1 - 1
src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameterInteger.cpp

@@ -16,7 +16,7 @@ void CShaderParameterInteger::setValue (irr::s32 value)
     CShaderParameter::setValue (&this->m_value);
 }
 
-int CShaderParameterInteger::getSize ()
+const int CShaderParameterInteger::getSize () const
 {
     return 1;
 }

+ 1 - 1
src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameterInteger.h

@@ -11,7 +11,7 @@ namespace WallpaperEngine::Render::Shaders::Parameters
     public:
         CShaderParameterInteger (irr::s32 defaultValue);
 
-        int getSize () override;
+        const int getSize () const override;
 
         static const std::string Type;
 

+ 1 - 1
src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameterVector2.cpp

@@ -17,7 +17,7 @@ void CShaderParameterVector2::setValue (irr::core::vector2df value)
     CShaderParameter::setValue (&this->m_value);
 }
 
-int CShaderParameterVector2::getSize ()
+const int CShaderParameterVector2::getSize () const
 {
     return 2;
 }

+ 1 - 1
src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameterVector2.h

@@ -11,7 +11,7 @@ namespace WallpaperEngine::Render::Shaders::Parameters
     public:
         CShaderParameterVector2 (const irr::core::vector2df& defaultValue);
 
-        int getSize () override;
+        const int getSize () const override;
 
         void setValue (irr::core::vector2df value);
 

+ 1 - 1
src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameterVector3.cpp

@@ -16,7 +16,7 @@ void CShaderParameterVector3::setValue (irr::core::vector3df value)
     CShaderParameter::setValue (&this->m_value);
 }
 
-int CShaderParameterVector3::getSize ()
+const int CShaderParameterVector3::getSize () const
 {
     return 3;
 }

+ 1 - 1
src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameterVector3.h

@@ -11,7 +11,7 @@ namespace WallpaperEngine::Render::Shaders::Parameters
     public:
         CShaderParameterVector3 (const irr::core::vector3df& defaultValue);
 
-        int getSize () override;
+        const int getSize () const override;
 
         void setValue (irr::core::vector3df value);
 

+ 1 - 1
src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameterVector4.cpp

@@ -16,7 +16,7 @@ void CShaderParameterVector4::setValue (irr::core::vector3df value)
     CShaderParameter::setValue (&this->m_value);
 }
 
-int CShaderParameterVector4::getSize ()
+const int CShaderParameterVector4::getSize () const
 {
     return 4;
 }

+ 1 - 1
src/WallpaperEngine/Render/Shaders/Parameters/CShaderParameterVector4.h

@@ -11,7 +11,7 @@ namespace WallpaperEngine::Render::Shaders::Parameters
     public:
         CShaderParameterVector4 (const irr::core::vector3df& defaultValue);
 
-        int getSize () override;
+        const int getSize () const override;
 
         void setValue (irr::core::vector3df value);