Bladeren bron

~ More changes to the new parser to properly load object passes from JSON (combos, elements missing, shader, etc)
+ Added camera for new renderization code
+ Added scene for new renderization code
+ Added object for new renderization code
+ Added image for new renderization code
WARNING: THIS IS A REGRESSION AS IN SHADERS ARE NOT AS COMPLETE AS IN THE MASTER BRANCH
~ New renderization code in place

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

Alexis Maiquez 7 jaren geleden
bovenliggende
commit
fc8778ab64
53 gewijzigde bestanden met toevoegingen van 743 en 1950 verwijderingen
  1. 18 28
      CMakeLists.txt
  2. 14 25
      main.cpp
  3. 26 5
      src/WallpaperEngine/Core/CObject.cpp
  4. 19 0
      src/WallpaperEngine/Core/CObject.h
  5. 1 1
      src/WallpaperEngine/Core/CScene.h
  6. 65 4
      src/WallpaperEngine/Core/Objects/CEffect.cpp
  7. 10 2
      src/WallpaperEngine/Core/Objects/CEffect.h
  8. 19 12
      src/WallpaperEngine/Core/Objects/CImage.cpp
  9. 15 9
      src/WallpaperEngine/Core/Objects/CImage.h
  10. 14 12
      src/WallpaperEngine/Core/Objects/CParticle.cpp
  11. 54 0
      src/WallpaperEngine/Core/Objects/CParticle.h
  12. 5 2
      src/WallpaperEngine/Core/Objects/CSound.cpp
  13. 6 2
      src/WallpaperEngine/Core/Objects/CSound.h
  14. 37 0
      src/WallpaperEngine/Core/Objects/Images/Materials/CPassess.cpp
  15. 5 0
      src/WallpaperEngine/Core/Objects/Images/Materials/CPassess.h
  16. 2 4
      src/WallpaperEngine/Core/Objects/Particles/CControlPoint.h
  17. 2 4
      src/WallpaperEngine/Core/Objects/Particles/CEmitter.h
  18. 2 4
      src/WallpaperEngine/Core/Objects/Particles/CInitializer.h
  19. 0 51
      src/WallpaperEngine/Core/Objects/Particles/CParticle.h
  20. 2 2
      src/WallpaperEngine/Core/Projects/CProperty.h
  21. 21 22
      src/WallpaperEngine/Core/Projects/CPropertyColor.cpp
  22. 48 0
      src/WallpaperEngine/Render/CCamera.cpp
  23. 28 0
      src/WallpaperEngine/Render/CCamera.h
  24. 25 0
      src/WallpaperEngine/Render/CObject.cpp
  25. 34 0
      src/WallpaperEngine/Render/CObject.h
  26. 81 0
      src/WallpaperEngine/Render/CScene.cpp
  27. 36 0
      src/WallpaperEngine/Render/CScene.h
  28. 118 0
      src/WallpaperEngine/Render/Objects/CImage.cpp
  29. 36 0
      src/WallpaperEngine/Render/Objects/CImage.h
  30. 0 49
      src/WallpaperEngine/camera.cpp
  31. 0 24
      src/WallpaperEngine/camera.h
  32. 0 548
      src/WallpaperEngine/effect.cpp
  33. 0 64
      src/WallpaperEngine/effect.h
  34. 0 162
      src/WallpaperEngine/image.cpp
  35. 0 36
      src/WallpaperEngine/image.h
  36. 0 171
      src/WallpaperEngine/object.cpp
  37. 0 54
      src/WallpaperEngine/object.h
  38. 0 30
      src/WallpaperEngine/object3d.cpp
  39. 0 37
      src/WallpaperEngine/object3d.h
  40. 0 48
      src/WallpaperEngine/project.cpp
  41. 0 30
      src/WallpaperEngine/project.h
  42. 0 110
      src/WallpaperEngine/scene.cpp
  43. 0 41
      src/WallpaperEngine/scene.h
  44. 0 63
      src/WallpaperEngine/sound.cpp
  45. 0 31
      src/WallpaperEngine/sound.h
  46. 0 20
      src/WallpaperEngine/texture.cpp
  47. 0 21
      src/WallpaperEngine/texture.h
  48. 0 67
      src/WallpaperEngine/video/material.cpp
  49. 0 32
      src/WallpaperEngine/video/material.h
  50. 0 12
      src/WallpaperEngine/video/node.cpp
  51. 0 17
      src/WallpaperEngine/video/node.h
  52. 0 65
      src/WallpaperEngine/video/renderer.cpp
  53. 0 29
      src/WallpaperEngine/video/renderer.h

+ 18 - 28
CMakeLists.txt

@@ -21,34 +21,26 @@ include_directories(${X11_INCLUDE_DIR} ${XRANDR_INCLUDE_DIR} ${IRRLICHT_INCLUDE_
 add_executable(
         wallengine
         main.cpp
+
+        src/WallpaperEngine/Core/Core.h
+        src/WallpaperEngine/Core/Core.cpp
+
         src/WallpaperEngine/Render/Shaders/Compiler.h
         src/WallpaperEngine/Render/Shaders/Compiler.cpp
-        src/WallpaperEngine/project.cpp
-        src/WallpaperEngine/project.h
-        src/WallpaperEngine/scene.cpp
-        src/WallpaperEngine/scene.h
-        src/WallpaperEngine/object.cpp
-        src/WallpaperEngine/object.h
-        src/WallpaperEngine/camera.cpp
-        src/WallpaperEngine/camera.h
-        src/WallpaperEngine/Core/Core.cpp
-        src/WallpaperEngine/Core/Core.h
-        src/WallpaperEngine/image.cpp
-        src/WallpaperEngine/image.h
-        src/WallpaperEngine/object3d.cpp
-        src/WallpaperEngine/object3d.h
-        src/WallpaperEngine/effect.cpp
-        src/WallpaperEngine/effect.h
+
+        src/WallpaperEngine/Render/CScene.h
+        src/WallpaperEngine/Render/CScene.cpp
+        src/WallpaperEngine/Render/CCamera.h
+        src/WallpaperEngine/Render/CCamera.cpp
+        src/WallpaperEngine/Render/CObject.h
+        src/WallpaperEngine/Render/CObject.cpp
+
+        src/WallpaperEngine/Render/Objects/CImage.h
+        src/WallpaperEngine/Render/Objects/CImage.cpp
+
         src/WallpaperEngine/FileSystem/FileSystem.cpp
         src/WallpaperEngine/FileSystem/FileSystem.h
-        src/WallpaperEngine/video/renderer.cpp
-        src/WallpaperEngine/video/renderer.h
-        src/WallpaperEngine/video/node.cpp
-        src/WallpaperEngine/video/node.h
-        src/WallpaperEngine/video/material.cpp
-        src/WallpaperEngine/video/material.h
-        src/WallpaperEngine/texture.cpp
-        src/WallpaperEngine/texture.h
+
         src/WallpaperEngine/Irrlicht/CContext.h
         src/WallpaperEngine/Irrlicht/CContext.cpp
         src/WallpaperEngine/Irrlicht/CImageLoaderTEX.h
@@ -57,8 +49,6 @@ add_executable(
         src/WallpaperEngine/Irrlicht/CPkgReader.cpp
         src/WallpaperEngine/Irrlicht/CFileList.h
         src/WallpaperEngine/Irrlicht/CFileList.cpp
-        src/WallpaperEngine/sound.cpp
-        src/WallpaperEngine/sound.h
 
         src/WallpaperEngine/Core/CProject.cpp
         src/WallpaperEngine/Core/CProject.h
@@ -83,8 +73,8 @@ add_executable(
         src/WallpaperEngine/Core/Objects/CSound.h
         src/WallpaperEngine/Core/Objects/CEffect.cpp
         src/WallpaperEngine/Core/Objects/CEffect.h
-        src/WallpaperEngine/Core/Objects/Particles/CParticle.cpp
-        src/WallpaperEngine/Core/Objects/Particles/CParticle.h
+        src/WallpaperEngine/Core/Objects/CParticle.cpp
+        src/WallpaperEngine/Core/Objects/CParticle.h
 
         src/WallpaperEngine/Core/Objects/Particles/CControlPoint.cpp
         src/WallpaperEngine/Core/Objects/Particles/CControlPoint.h

+ 14 - 25
main.cpp

@@ -1,8 +1,6 @@
 #include <iostream>
 #include <irrlicht/irrlicht.h>
 #include <sstream>
-#include <WallpaperEngine/video/renderer.h>
-#include <WallpaperEngine/video/material.h>
 #include <WallpaperEngine/Irrlicht/CPkgReader.h>
 #include <getopt.h>
 #include <SDL_mixer.h>
@@ -12,11 +10,11 @@
 #include <X11/extensions/Xrandr.h>
 
 #include "WallpaperEngine/Render/Shaders/Compiler.h"
-#include "WallpaperEngine/project.h"
 #include "WallpaperEngine/Irrlicht/CImageLoaderTEX.h"
 
 #include "WallpaperEngine/Core/CProject.h"
 #include "WallpaperEngine/Irrlicht/CContext.h"
+#include "WallpaperEngine/Render/CScene.h"
 
 bool IsRootWindow = false;
 std::vector<std::string> Screens;
@@ -291,23 +289,8 @@ int main (int argc, char* argv[])
         Mix_OpenAudio (22050, AUDIO_S16SYS, 2, 640);
     }
 
-    WallpaperEngine::project* wp_project = new WallpaperEngine::project (project_path);
-
-    if (wp_project->getScene ()->isOrthogonal() == true)
-    {
-        WallpaperEngine::video::renderer::setupOrthographicCamera (wp_project->getScene ());
-    }
-    else
-    {
-        IrrlichtContext->getDevice ()->getLogger ()->log (
-            "Non-orthogonal cameras not supported yet!!", irr::ELL_ERROR
-        );
-
-        return -2;
-    }
-
-    // register nodes
-    WallpaperEngine::video::renderer::queueNode (wp_project->getScene ());
+    WallpaperEngine::Core::CProject* project = WallpaperEngine::Core::CProject::fromFile (project_path);
+    WallpaperEngine::Render::CScene* sceneRender = new WallpaperEngine::Render::CScene (project, IrrlichtContext);
 
     irr::u32 lastTime = 0;
     irr::u32 minimumTime = 1000 / max_fps;
@@ -316,7 +299,7 @@ int main (int argc, char* argv[])
     irr::u32 startTime = 0;
     irr::u32 endTime = 0;
 
-    while (IrrlichtContext->getDevice ()->run () && IrrlichtContext && IrrlichtContext->getDevice ())
+    while (IrrlichtContext && IrrlichtContext->getDevice () && IrrlichtContext->getDevice ()->run ())
     {
         // if (device->isWindowActive ())
         {
@@ -332,12 +315,20 @@ int main (int argc, char* argv[])
                 {
                     // change viewport to render to the correct portion of the display
                     IrrlichtContext->getDevice ()->getVideoDriver ()->setViewPort (*cur);
-                    WallpaperEngine::video::renderer::render ();
+
+                    if (IrrlichtContext->getDevice ()->getVideoDriver () == nullptr)
+                        continue;
+
+                    IrrlichtContext->getDevice ()->getVideoDriver ()->beginScene(false, true, irr::video::SColor(0, 0, 0, 0));
+                    IrrlichtContext->getDevice ()->getSceneManager ()->drawAll ();
+                    IrrlichtContext->getDevice ()->getVideoDriver ()->endScene ();
                 }
             }
             else
             {
-                WallpaperEngine::video::renderer::render ();
+                IrrlichtContext->getDevice ()->getVideoDriver ()->beginScene(false, true, irr::video::SColor(0, 0, 0, 0));
+                IrrlichtContext->getDevice ()->getSceneManager ()->drawAll ();
+                IrrlichtContext->getDevice ()->getVideoDriver ()->endScene ();
             }
 
             endTime = IrrlichtContext->getDevice ()->getTimer ()->getTime ();
@@ -347,7 +338,5 @@ int main (int argc, char* argv[])
     }
 
     SDL_Quit ();
-    delete wp_project;
-
     return 0;
 }

+ 26 - 5
src/WallpaperEngine/Core/CObject.cpp

@@ -3,23 +3,24 @@
 #include <utility>
 #include "WallpaperEngine/Core/Objects/CImage.h"
 #include "WallpaperEngine/Core/Objects/CSound.h"
-#include "WallpaperEngine/Core/Objects/Particles/CParticle.h"
+#include "WallpaperEngine/Core/Objects/CParticle.h"
 
 #include "Core.h"
 
 using namespace WallpaperEngine::Core;
 
-
 CObject::CObject (
         bool visible,
         irr::u32 id,
         std::string name,
+        std::string type,
         const irr::core::vector3df& origin,
         const irr::core::vector3df& scale,
         const irr::core::vector3df& angles) :
     m_visible (visible),
     m_id (id),
     m_name (std::move(name)),
+    m_type (type),
     m_origin (origin),
     m_scale (scale),
     m_angles (angles)
@@ -102,7 +103,7 @@ CObject* CObject::fromJSON (json data)
     }
     else if (particle_it != data.end ())
     {
-        object = Objects::Particles::CParticle::fromFile (
+        object = Objects::CParticle::fromFile (
                 (*particle_it).get <std::string> ().c_str (),
                 *id_it,
                 *name_it,
@@ -115,7 +116,7 @@ CObject* CObject::fromJSON (json data)
         throw std::runtime_error ("Unkonwn object type detected");
     }
 
-    if (effects_it != data.end () && (*effects_it).is_array () == true && object != nullptr)
+    if (effects_it != data.end () && (*effects_it).is_array () == true)
     {
         json::const_iterator cur = (*effects_it).begin ();
         json::const_iterator end = (*effects_it).end ();
@@ -123,7 +124,7 @@ CObject* CObject::fromJSON (json data)
         for (; cur != end; cur ++)
         {
             object->insertEffect (
-                    Objects::CEffect::fromJSON (*cur)
+                    Objects::CEffect::fromJSON (*cur, object)
             );
         }
     }
@@ -131,11 +132,31 @@ CObject* CObject::fromJSON (json data)
     return object;
 }
 
+irr::core::vector3df* CObject::getOrigin ()
+{
+    return &this->m_origin;
+}
+
+irr::core::vector3df* CObject::getScale ()
+{
+    return &this->m_scale;
+}
+
+irr::core::vector3df* CObject::getAngles ()
+{
+    return &this->m_angles;
+}
+
 std::vector<Objects::CEffect*>* CObject::getEffects ()
 {
     return &this->m_effects;
 }
 
+int CObject::getId ()
+{
+    return this->m_id;
+}
+
 void CObject::insertEffect (Objects::CEffect* effect)
 {
     this->m_effects.push_back (effect);

+ 19 - 0
src/WallpaperEngine/Core/CObject.h

@@ -5,6 +5,11 @@
 
 #include "WallpaperEngine/Core/Objects/CEffect.h"
 
+namespace WallpaperEngine::Core::Objects
+{
+    class CEffect;
+}
+
 namespace WallpaperEngine::Core
 {
     using json = nlohmann::json;
@@ -14,12 +19,24 @@ 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> bool Is () { return this->m_type == T::Type; }
+
         std::vector<Objects::CEffect*>* getEffects ();
+        int getId ();
+
+        irr::core::vector3df* getOrigin ();
+        irr::core::vector3df* getScale ();
+        irr::core::vector3df* getAngles ();
+
     protected:
         CObject (
             bool visible,
             irr::u32 id,
             std::string name,
+            std::string type,
             const irr::core::vector3df& origin,
             const irr::core::vector3df& scale,
             const irr::core::vector3df& angles
@@ -27,6 +44,8 @@ namespace WallpaperEngine::Core
 
         void insertEffect (Objects::CEffect* effect);
     private:
+        std::string m_type;
+
         bool m_visible;
         irr::u32 m_id;
         std::string m_name;

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

@@ -41,12 +41,12 @@ namespace WallpaperEngine::Core
         const irr::video::SColorf &getClearColor() const;
         Scenes::CProjection *getOrthogonalProjection() const;
         const irr::video::SColorf &getSkylightColor() const;
+        Scenes::CCamera* getCamera ();
 
     protected:
         friend class CProject;
 
         void setProject (CProject* project);
-        Scenes::CCamera* getCamera ();
 
         CScene (
                 Scenes::CCamera* camera,

+ 65 - 4
src/WallpaperEngine/Core/Objects/CEffect.cpp

@@ -2,25 +2,30 @@
 
 #include <utility>
 
+#include "WallpaperEngine/Core/Objects/CImage.h"
 #include "WallpaperEngine/FileSystem/FileSystem.h"
 
+using namespace WallpaperEngine;
 using namespace WallpaperEngine::Core::Objects;
 
 CEffect::CEffect (
         std::string name,
         std::string description,
         std::string group,
-        std::string preview):
+        std::string preview,
+        Core::CObject* object):
     m_name (std::move(name)),
     m_description (std::move(description)),
     m_group (std::move(group)),
-    m_preview (std::move(preview))
+    m_preview (std::move(preview)),
+    m_object (object)
 {
 }
 
-CEffect* CEffect::fromJSON (json data)
+CEffect* CEffect::fromJSON (json data, Core::CObject* object)
 {
     json::const_iterator file_it = data.find ("file");
+    json::const_iterator effectpasses_it = data.find ("passes");
 
     if (file_it == data.end ())
     {
@@ -70,7 +75,8 @@ CEffect* CEffect::fromJSON (json data)
         *name_it,
         *description_it,
         *group_it,
-        *preview_it
+        *preview_it,
+        object
     );
 
     json::const_iterator cur = (*passes_it).begin ();
@@ -98,6 +104,61 @@ CEffect* CEffect::fromJSON (json data)
         effect->insertDependency (*cur);
     }
 
+    if (effectpasses_it != data.end ())
+    {
+        cur = (*effectpasses_it).begin ();
+        end = (*effectpasses_it).end ();
+
+        for (int passNumber = 0; cur != end; cur ++, passNumber ++)
+        {
+            json::const_iterator 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 ();
+
+            for (; materialCur != materialEnd; materialCur ++)
+            {
+                json::const_iterator texturesCur = (*textures_it).begin ();
+                json::const_iterator texturesEnd = (*textures_it).end ();
+
+                for (int textureNumber = 0; texturesCur != texturesEnd; texturesCur ++)
+                {
+                    std::string texture;
+
+                    if ((*texturesCur).is_null () == true)
+                    {
+                        if (object->Is <CImage> () == false)
+                        {
+                            throw std::runtime_error ("unexpected null texture for non-image object");
+                        }
+
+                        CImage* image = object->As <CImage> ();
+
+                        texture = (*(*image->getMaterial ()->getPasses ()->begin ())->getTextures ()->begin ());
+                    }
+                    else
+                    {
+                        texture = *texturesCur;
+                    }
+
+                    std::vector<std::string>* passTextures = (*materialCur)->getTextures ();
+
+                    if (textureNumber < passTextures->size ())
+                        passTextures->at (textureNumber) = texture;
+                    else
+                        passTextures->push_back (texture);
+
+                    textureNumber ++;
+                }
+            }
+
+        }
+    }
+
     return effect;
 }
 

+ 10 - 2
src/WallpaperEngine/Core/Objects/CEffect.h

@@ -3,8 +3,14 @@
 #include <nlohmann/json.hpp>
 #include <irrlicht/irrlicht.h>
 
+#include "WallpaperEngine/Core/CObject.h"
 #include "WallpaperEngine/Core/Objects/Images/CMaterial.h"
 
+namespace WallpaperEngine::Core
+{
+    class CObject;
+};
+
 namespace WallpaperEngine::Core::Objects
 {
     using json = nlohmann::json;
@@ -16,10 +22,11 @@ namespace WallpaperEngine::Core::Objects
             std::string name,
             std::string description,
             std::string group,
-            std::string preview
+            std::string preview,
+            Core::CObject* object
         );
 
-        static CEffect* fromJSON (json data);
+        static CEffect* fromJSON (json data, Core::CObject* object);
 
         std::vector<std::string>* getDependencies ();
         std::vector<Images::CMaterial*>* getMaterials ();
@@ -31,6 +38,7 @@ namespace WallpaperEngine::Core::Objects
         std::string m_description;
         std::string m_group;
         std::string m_preview;
+        Core::CObject* m_object;
 
         std::vector<std::string> m_dependencies;
         std::vector<Images::CMaterial*> m_materials;

+ 19 - 12
src/WallpaperEngine/Core/Objects/CImage.cpp

@@ -15,10 +15,10 @@ CImage::CImage (
         const irr::core::vector3df& scale,
         const irr::core::vector3df& angles,
         const irr::core::vector2df& size) :
-        CObject (visible, id, std::move(name), origin, scale, angles),
-        m_size (size)
+        CObject (visible, id, std::move(name), Type, origin, scale, angles),
+        m_size (size),
+        m_material (material)
 {
-
 }
 
 WallpaperEngine::Core::CObject* CImage::fromJSON (
@@ -48,13 +48,20 @@ WallpaperEngine::Core::CObject* CImage::fromJSON (
     }
 
     return new CImage (
-            Images::CMaterial::fromFile ((*material_it).get <std::string> ().c_str ()),
-            visible,
-            id,
-            name,
-            origin,
-            scale,
-            angles,
-            WallpaperEngine::Core::ato2vf (*size_it)
+        Images::CMaterial::fromFile ((*material_it).get <std::string> ().c_str ()),
+        visible,
+        id,
+        name,
+        origin,
+        scale,
+        angles,
+        WallpaperEngine::Core::ato2vf (*size_it)
     );
-}
+}
+
+Images::CMaterial* CImage::getMaterial ()
+{
+    return this->m_material;
+}
+
+const std::string CImage::Type = "image";

+ 15 - 9
src/WallpaperEngine/Core/Objects/CImage.h

@@ -11,21 +11,24 @@ namespace WallpaperEngine::Core::Objects
 {
     using json = nlohmann::json;
 
-    class CImage : CObject
+    class CImage : public CObject
     {
-    protected:
         friend class CObject;
 
+    public:
         static CObject* fromJSON (
-            json data,
-            bool visible,
-            irr::u32 id,
-            std::string name,
-            const irr::core::vector3df& origin,
-            const irr::core::vector3df& scale,
-            const irr::core::vector3df& angles
+                json data,
+                bool visible,
+                irr::u32 id,
+                std::string name,
+                const irr::core::vector3df& origin,
+                const irr::core::vector3df& scale,
+                const irr::core::vector3df& angles
         );
 
+        Images::CMaterial* getMaterial ();
+
+    protected:
         CImage (
                 Images::CMaterial* material,
                 bool visible,
@@ -37,7 +40,10 @@ namespace WallpaperEngine::Core::Objects
                 const irr::core::vector2df& size
         );
 
+        static const std::string Type;
+
     private:
         irr::core::vector2df m_size;
+        Images::CMaterial* m_material;
     };
 };

+ 14 - 12
src/WallpaperEngine/Core/Objects/Particles/CParticle.cpp → src/WallpaperEngine/Core/Objects/CParticle.cpp

@@ -3,7 +3,7 @@
 
 #include <irrlicht/irrlicht.h>
 
-using namespace WallpaperEngine::Core::Objects::Particles;
+using namespace WallpaperEngine::Core::Objects;
 
 CParticle* CParticle::fromFile (
     const irr::io::path& filename,
@@ -56,7 +56,7 @@ CParticle* CParticle::fromFile (
         for (; cur != end; cur ++)
         {
             particle->insertControlPoint (
-                    CControlPoint::fromJSON (*cur)
+                    Particles::CControlPoint::fromJSON (*cur)
             );
         }
     }
@@ -67,7 +67,7 @@ CParticle* CParticle::fromFile (
     for (; cur != end; cur ++)
     {
         particle->insertEmitter (
-                CEmitter::fromJSON (*cur)
+                Particles::CEmitter::fromJSON (*cur)
         );
     }
 
@@ -77,7 +77,7 @@ CParticle* CParticle::fromFile (
     for (; cur != end; cur ++)
     {
         particle->insertInitializer (
-                CInitializer::fromJSON (*cur)
+                Particles::CInitializer::fromJSON (*cur)
         );
     }
 
@@ -91,38 +91,40 @@ CParticle::CParticle (
         std::string name,
         const irr::core::vector3df& origin,
         const irr::core::vector3df& scale):
-        CObject (true, id, std::move(name), origin, scale, irr::core::vector3df ()),
+        CObject (true, id, std::move(name), Type, origin, scale, irr::core::vector3df ()),
         m_starttime (starttime),
         m_maxcount (maxcount)
 {
 }
 
-std::vector<CEmitter*>* CParticle::getEmitters ()
+std::vector<Particles::CEmitter*>* CParticle::getEmitters ()
 {
     return &this->m_emitters;
 }
 
-std::vector<CControlPoint*>* CParticle::getControlPoints ()
+std::vector<Particles::CControlPoint*>* CParticle::getControlPoints ()
 {
     return &this->m_controlpoints;
 }
 
-std::vector<CInitializer*>* CParticle::getInitializers ()
+std::vector<Particles::CInitializer*>* CParticle::getInitializers ()
 {
     return &this->m_initializers;
 }
 
-void CParticle::insertControlPoint (CControlPoint* controlpoint)
+void CParticle::insertControlPoint (Particles::CControlPoint* controlpoint)
 {
     this->m_controlpoints.push_back (controlpoint);
 }
 
-void CParticle::insertEmitter (CEmitter* emitter)
+void CParticle::insertEmitter (Particles::CEmitter* emitter)
 {
     this->m_emitters.push_back (emitter);
 }
 
-void CParticle::insertInitializer (CInitializer* initializer)
+void CParticle::insertInitializer (Particles::CInitializer* initializer)
 {
     this->m_initializers.push_back (initializer);
-}
+}
+
+const std::string CParticle::Type = "particle";

+ 54 - 0
src/WallpaperEngine/Core/Objects/CParticle.h

@@ -0,0 +1,54 @@
+#pragma once
+
+#include <irrlicht/irrlicht.h>
+#include <nlohmann/json.hpp>
+
+#include "WallpaperEngine/Core/Objects/Particles/CControlPoint.h"
+#include "WallpaperEngine/Core/Objects/Particles/CEmitter.h"
+#include "WallpaperEngine/Core/Objects/Particles/CInitializer.h"
+
+#include "WallpaperEngine/Core/CObject.h"
+
+namespace WallpaperEngine::Core::Objects
+{
+    using json = nlohmann::json;
+
+    class CParticle : public CObject
+    {
+        friend class CObject;
+
+    public:
+        static CParticle* fromFile (
+                const irr::io::path& filename,
+                irr::u32 id,
+                std::string name,
+                const irr::core::vector3df& origin,
+                const irr::core::vector3df& scale
+        );
+
+        std::vector<Particles::CEmitter*>* getEmitters ();
+        std::vector<Particles::CControlPoint*>* getControlPoints ();
+        std::vector<Particles::CInitializer*>* getInitializers ();
+
+    protected:
+        CParticle (
+            irr::u32 starttime,
+            irr::u32 maxcount,
+            irr::u32 id,
+            std::string name,
+            const irr::core::vector3df& origin,
+            const irr::core::vector3df& scale
+        );
+        void insertControlPoint (Particles::CControlPoint* controlpoint);
+        void insertEmitter (Particles::CEmitter* emitter);
+        void insertInitializer (Particles::CInitializer* initializer);
+
+        static const std::string Type;
+    private:
+        irr::u32 m_starttime;
+        irr::u32 m_maxcount;
+        std::vector<Particles::CControlPoint*> m_controlpoints;
+        std::vector<Particles::CEmitter*> m_emitters;
+        std::vector<Particles::CInitializer*> m_initializers;
+    };
+};

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

@@ -4,6 +4,7 @@
 #include "CSound.h"
 
 using namespace WallpaperEngine::Core::Objects;
+
 CSound::CSound (
         bool visible,
         irr::u32 id,
@@ -11,7 +12,7 @@ CSound::CSound (
         const irr::core::vector3df& origin,
         const irr::core::vector3df& scale,
         const irr::core::vector3df& angles) :
-        CObject (visible, id, std::move(name), origin, scale, angles)
+        CObject (visible, id, std::move(name), Type, origin, scale, angles)
 {
 }
 
@@ -64,4 +65,6 @@ void CSound::insertSound (std::string filename)
 std::vector<std::string>* CSound::getSounds ()
 {
     return &this->m_sounds;
-}
+}
+
+const std::string CSound::Type = "sound";

+ 6 - 2
src/WallpaperEngine/Core/Objects/CSound.h

@@ -9,8 +9,10 @@ namespace WallpaperEngine::Core::Objects
 {
     using json = nlohmann::json;
 
-    class CSound : CObject
+    class CSound : public CObject
     {
+        friend class CObject;
+
     public:
         static CObject* fromJSON (
             json data,
@@ -24,8 +26,8 @@ namespace WallpaperEngine::Core::Objects
 
         void insertSound (std::string filename);
         std::vector<std::string>* getSounds ();
-    protected:
 
+    protected:
         CSound (
             bool visible,
             irr::u32 id,
@@ -34,6 +36,8 @@ namespace WallpaperEngine::Core::Objects
             const irr::core::vector3df& scale,
             const irr::core::vector3df& angles
         );
+
+        static const std::string Type;
     private:
         std::vector<std::string> m_sounds;
     };

+ 37 - 0
src/WallpaperEngine/Core/Objects/Images/Materials/CPassess.cpp

@@ -24,6 +24,7 @@ CPassess* CPassess::fromJSON (json data)
     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");
 
     if (blending_it == data.end ())
     {
@@ -52,6 +53,7 @@ CPassess* CPassess::fromJSON (json data)
 
     if (textures_it != data.end ())
     {
+        // TODO: FETCH THIS FROM CImage TO MAKE IT COMPATIBLE WITH OLDER WALLPAPERS
         if ((*textures_it).is_array () == false)
         {
             throw std::runtime_error ("Textures for material must be a list");
@@ -84,6 +86,26 @@ CPassess* CPassess::fromJSON (json data)
         }
     }
 
+    if (combos_it != data.end ())
+    {
+        json::const_iterator cur = (*combos_it).begin ();
+        json::const_iterator end = (*combos_it).end ();
+
+        for (; cur != end; cur ++)
+        {
+            std::string name = cur.key ();
+
+            if ((*cur).is_number_integer () == true)
+            {
+                pass->insertCombo (name, *cur);
+            }
+            else
+            {
+                throw std::runtime_error ("unexpected non-integer combo");
+            }
+        }
+    }
+
     return pass;
 }
 
@@ -91,4 +113,19 @@ CPassess* CPassess::fromJSON (json data)
 void CPassess::insertTexture (const std::string& texture)
 {
     this->m_textures.push_back (texture);
+}
+
+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 ()
+{
+    return &this->m_combos;
+}
+
+std::string CPassess::getShader ()
+{
+    return this->m_shader;
 }

+ 5 - 0
src/WallpaperEngine/Core/Objects/Images/Materials/CPassess.h

@@ -12,10 +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 ();
     protected:
         CPassess (std::string blending, std::string cullmode, std::string depthtest, std::string depthwrite, std::string shader);
 
         void insertTexture (const std::string& texture);
+        void insertCombo (const std::string& name, int value);
+
     private:
         std::string m_blending;
         std::string m_cullmode;
@@ -23,5 +27,6 @@ namespace WallpaperEngine::Core::Objects::Images::Materials
         std::string m_depthwrite;
         std::string m_shader;
         std::vector<std::string> m_textures;
+        std::map<std::string, int> m_combos;
     };
 }

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

@@ -10,13 +10,11 @@ namespace WallpaperEngine::Core::Objects::Particles
     class CControlPoint
     {
     public:
+        static CControlPoint* fromJSON (json data);
+
         irr::core::vector3df* getOffset ();
         irr::u32 getFlags ();
     protected:
-        friend class CParticle;
-
-        static CControlPoint* fromJSON (json data);
-
         CControlPoint (irr::u32 id, irr::u32 flags = 0);
 
         void setOffset (const irr::core::vector3df& offset);

+ 2 - 4
src/WallpaperEngine/Core/Objects/Particles/CEmitter.h

@@ -10,6 +10,8 @@ namespace WallpaperEngine::Core::Objects::Particles
     class CEmitter
     {
     public:
+        static CEmitter* fromJSON (json data);
+
         const std::string& getName () const;
         irr::u32 getDistanceMax () const;
         irr::u32 getDistanceMin () const;
@@ -17,10 +19,6 @@ namespace WallpaperEngine::Core::Objects::Particles
         irr::core::vector3df* getOrigin ();
         irr::f64 getRate () const;
     protected:
-        friend class CParticle;
-
-        static CEmitter* fromJSON (json data);
-
         CEmitter (
             const irr::core::vector3df& directions,
             irr::u32 distancemax,

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

@@ -10,13 +10,11 @@ namespace WallpaperEngine::Core::Objects::Particles
     class CInitializer
     {
     public:
+        static CInitializer* fromJSON (json data);
+
         std::string& getName ();
         irr::u32 getId ();
     protected:
-        friend class CParticle;
-
-        static CInitializer* fromJSON (json data);
-
         CInitializer (irr::u32 id, std::string name);
     private:
         irr::u32 m_id;

+ 0 - 51
src/WallpaperEngine/Core/Objects/Particles/CParticle.h

@@ -1,51 +0,0 @@
-#pragma once
-
-#include <irrlicht/irrlicht.h>
-#include <nlohmann/json.hpp>
-
-#include "CControlPoint.h"
-#include "CEmitter.h"
-#include "CInitializer.h"
-
-#include "WallpaperEngine/Core/CObject.h"
-
-namespace WallpaperEngine::Core::Objects::Particles
-{
-    using json = nlohmann::json;
-
-    class CParticle : CObject
-    {
-    public:
-        std::vector<CEmitter*>* getEmitters ();
-        std::vector<CControlPoint*>* getControlPoints ();
-        std::vector<CInitializer*>* getInitializers ();
-    protected:
-        friend class CObject;
-
-        static CParticle* fromFile (
-                const irr::io::path& filename,
-                irr::u32 id,
-                std::string name,
-                const irr::core::vector3df& origin,
-                const irr::core::vector3df& scale
-        );
-
-        CParticle (
-            irr::u32 starttime,
-            irr::u32 maxcount,
-            irr::u32 id,
-            std::string name,
-            const irr::core::vector3df& origin,
-            const irr::core::vector3df& scale
-        );
-        void insertControlPoint (CControlPoint* controlpoint);
-        void insertEmitter (CEmitter* emitter);
-        void insertInitializer (CInitializer* initializer);
-    private:
-        irr::u32 m_starttime;
-        irr::u32 m_maxcount;
-        std::vector<CControlPoint*> m_controlpoints;
-        std::vector<CEmitter*> m_emitters;
-        std::vector<CInitializer*> m_initializers;
-    };
-};

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

@@ -13,8 +13,8 @@ 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; }
 

+ 21 - 22
src/WallpaperEngine/Core/Projects/CPropertyColor.cpp

@@ -1,30 +1,29 @@
 #include "CPropertyColor.h"
 #include "WallpaperEngine/Core/Core.h"
 
-namespace WallpaperEngine::Core::Projects
+using namespace WallpaperEngine::Core::Projects;
+
+CPropertyColor* CPropertyColor::fromJSON (json data, const std::string& name)
 {
-    CPropertyColor* CPropertyColor::fromJSON (json data, const std::string& name)
-    {
-        json::const_iterator value = data.find ("value");
-        json::const_iterator text = data.find ("type");
+    json::const_iterator value = data.find ("value");
+    json::const_iterator text = data.find ("type");
 
-        return new CPropertyColor (
-            WallpaperEngine::Core::atoSColor (*value),
-            name,
-            *text
-        );
-    }
+    return new CPropertyColor (
+        WallpaperEngine::Core::atoSColor (*value),
+        name,
+        *text
+    );
+}
 
-    irr::video::SColor* CPropertyColor::getValue ()
-    {
-        return &this->m_color;
-    }
+irr::video::SColor* CPropertyColor::getValue ()
+{
+    return &this->m_color;
+}
 
-    CPropertyColor::CPropertyColor (irr::video::SColor color, const std::string& name, const std::string& text) :
-        CProperty (name, Type, text),
-        m_color (color)
-    {
-    }
+CPropertyColor::CPropertyColor (irr::video::SColor color, const std::string& name, const std::string& text) :
+    CProperty (name, Type, text),
+    m_color (color)
+{
+}
 
-    const std::string CPropertyColor::Type = "color";
-};
+const std::string CPropertyColor::Type = "color";

+ 48 - 0
src/WallpaperEngine/Render/CCamera.cpp

@@ -0,0 +1,48 @@
+#include "CCamera.h"
+
+using namespace WallpaperEngine;
+using namespace WallpaperEngine::Render;
+
+CCamera::CCamera (CScene* scene, Core::Scenes::CCamera* camera) :
+    m_camera (camera),
+    m_scene (scene)
+{
+    this->m_sceneCamera = scene->getContext ()->getDevice ()->getSceneManager ()->addCameraSceneNode (
+        scene, *this->m_camera->getCenter (), *this->m_camera->getEye (), scene->nextId ()
+    );
+}
+
+CCamera::~CCamera ()
+{
+    this->m_sceneCamera->remove ();
+}
+
+irr::core::vector3df* CCamera::getCenter ()
+{
+    return this->m_camera->getCenter ();
+}
+
+irr::core::vector3df* CCamera::getEye ()
+{
+    return this->m_camera->getEye ();
+}
+
+irr::core::vector3df* CCamera::getUp ()
+{
+    return this->m_camera->getUp ();
+}
+
+void CCamera::setOrthogonalProjection (irr::u32 width, irr::u32 height)
+{
+    irr::core::matrix4 identity; identity.makeIdentity ();
+    irr::core::matrix4 orthogonalProjection; orthogonalProjection.buildProjectionMatrixOrthoLH (
+            width, height,
+            this->m_camera->getUp ()->X,
+            this->m_camera->getUp ()->Y
+    );
+
+    this->m_sceneCamera->setProjectionMatrix (orthogonalProjection);
+    this->m_scene->getContext ()->getDevice ()->getVideoDriver ()->setTransform (irr::video::ETS_PROJECTION, orthogonalProjection);
+    this->m_scene->getContext ()->getDevice ()->getVideoDriver ()->setTransform (irr::video::ETS_VIEW, orthogonalProjection);
+    this->m_scene->getContext ()->getDevice ()->getVideoDriver ()->setTransform (irr::video::ETS_WORLD, orthogonalProjection);
+}

+ 28 - 0
src/WallpaperEngine/Render/CCamera.h

@@ -0,0 +1,28 @@
+#pragma once
+
+#include "CScene.h"
+
+#include "WallpaperEngine/Core/Scenes/CCamera.h"
+
+namespace WallpaperEngine::Render
+{
+    class CScene;
+
+    class CCamera
+    {
+    public:
+        CCamera (CScene* scene, Core::Scenes::CCamera* camera);
+        ~CCamera ();
+
+        void setOrthogonalProjection (irr::u32 width, irr::u32 height);
+
+        irr::core::vector3df* getCenter ();
+        irr::core::vector3df* getEye ();
+        irr::core::vector3df* getUp ();
+
+    private:
+        Core::Scenes::CCamera* m_camera;
+        irr::scene::ICameraSceneNode* m_sceneCamera;
+        CScene* m_scene;
+    };
+}

+ 25 - 0
src/WallpaperEngine/Render/CObject.cpp

@@ -0,0 +1,25 @@
+#include "CObject.h"
+
+using namespace WallpaperEngine;
+using namespace WallpaperEngine::Render;
+
+CObject::CObject(CScene* scene, std::string type, Core::CObject *object) :
+    irr::scene::ISceneNode (
+        scene,
+        scene->getContext ()->getDevice ()->getSceneManager (),
+        object->getId ()
+    ),
+    m_scene (scene),
+    m_object (object),
+    m_type (type)
+{
+}
+
+CObject::~CObject()
+{
+}
+
+CScene* CObject::getScene ()
+{
+    return this->m_scene;
+}

+ 34 - 0
src/WallpaperEngine/Render/CObject.h

@@ -0,0 +1,34 @@
+#pragma once
+
+#include <string>
+#include <irrlicht/irrlicht.h>
+
+#include "WallpaperEngine/Core/CObject.h"
+
+#include "CScene.h"
+
+namespace WallpaperEngine::Render
+{
+    class CScene;
+
+    class CObject : public irr::scene::ISceneNode
+    {
+    public:
+        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; }
+
+    protected:
+        CObject (CScene* scene, std::string type, Core::CObject *object);
+        ~CObject ();
+
+        CScene* getScene ();
+
+    private:
+        std::string m_type;
+
+        CScene* m_scene;
+        Core::CObject* m_object;
+    };
+}

+ 81 - 0
src/WallpaperEngine/Render/CScene.cpp

@@ -0,0 +1,81 @@
+#include "WallpaperEngine/Core/Objects/CImage.h"
+#include "WallpaperEngine/Render/Objects/CImage.h"
+#include "CScene.h"
+
+using namespace WallpaperEngine;
+using namespace WallpaperEngine::Render;
+
+CScene::CScene (Core::CProject* project, Irrlicht::CContext* context) :
+    irr::scene::ISceneNode (
+        context->getDevice ()->getSceneManager ()->getRootSceneNode (),
+        context->getDevice ()->getSceneManager ()
+    ),
+    m_project (project),
+    m_scene (project->getScene ()),
+    m_context (context)
+{
+    std::vector<Core::CObject*>::const_iterator cur = this->m_scene->getObjects ()->begin ();
+    std::vector<Core::CObject*>::const_iterator end = this->m_scene->getObjects ()->end ();
+
+    int highestId = 0;
+
+    for (; cur != end; cur ++)
+    {
+        if ((*cur)->getId () > highestId)
+            highestId = (*cur)->getId ();
+
+        if ((*cur)->Is <Core::Objects::CImage> () == true)
+        {
+            new Objects::CImage (this, (*cur)->As <Core::Objects::CImage> ());
+        }
+    }
+
+    this->m_nextId = ++highestId;
+    this->setAutomaticCulling (irr::scene::EAC_OFF);
+    this->m_boundingBox = irr::core::aabbox3d<irr::f32>(0, 0, 0, 0, 0, 0);
+
+    this->m_camera = new CCamera (this, this->m_project->getScene ()->getCamera ());
+    this->m_camera->setOrthogonalProjection (
+        this->m_scene->getOrthogonalProjection ()->getWidth (),
+        this->m_scene->getOrthogonalProjection ()->getHeight ()
+    );
+}
+
+CScene::~CScene ()
+{
+}
+
+Irrlicht::CContext* CScene::getContext ()
+{
+    return this->m_context;
+}
+
+Core::CScene* CScene::getScene ()
+{
+    return this->m_scene;
+}
+
+CCamera* CScene::getCamera ()
+{
+    return this->m_camera;
+}
+
+int CScene::nextId ()
+{
+    return this->m_nextId ++;
+}
+
+void CScene::render ()
+{
+}
+
+const irr::core::aabbox3d<irr::f32>& CScene::getBoundingBox() const
+{
+    return this->m_boundingBox;
+}
+void CScene::OnRegisterSceneNode ()
+{
+    SceneManager->registerNodeForRendering (this);
+
+    ISceneNode::OnRegisterSceneNode ();
+}

+ 36 - 0
src/WallpaperEngine/Render/CScene.h

@@ -0,0 +1,36 @@
+#pragma once
+
+#include "CCamera.h"
+
+#include "WallpaperEngine/Core/CProject.h"
+#include "WallpaperEngine/Core/CScene.h"
+
+#include "WallpaperEngine/Irrlicht/CContext.h"
+
+namespace WallpaperEngine::Render
+{
+    class CCamera;
+
+    class CScene : public irr::scene::ISceneNode
+    {
+    public:
+        CScene (Core::CProject* project, Irrlicht::CContext* context);
+        ~CScene ();
+
+        Irrlicht::CContext* getContext ();
+        Core::CScene* getScene ();
+        CCamera* getCamera ();
+        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;
+        CCamera* m_camera;
+        Irrlicht::CContext* m_context;
+        irr::u32 m_nextId;
+        irr::core::aabbox3d<irr::f32> m_boundingBox;
+    };
+}

+ 118 - 0
src/WallpaperEngine/Render/Objects/CImage.cpp

@@ -0,0 +1,118 @@
+#include "CImage.h"
+
+#include "WallpaperEngine/Render/Shaders/Compiler.h"
+
+using namespace WallpaperEngine;
+using namespace WallpaperEngine::Render::Objects;
+
+CImage::CImage (CScene* scene, Core::Objects::CImage* image) :
+    Render::CObject (scene, Type, image),
+    m_image (image)
+{
+    // 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->getScene ()->getCamera ()->getEye ()->Z;
+
+    // top left
+    this->m_vertex [0].Pos = irr::core::vector3df (xleft,  ztop,    z);
+    // top right
+    this->m_vertex [1].Pos = irr::core::vector3df (xright, ztop,    z);
+    // bottom right
+    this->m_vertex [2].Pos = irr::core::vector3df (xright, zbottom, z);
+    // bottom left
+    this->m_vertex [3].Pos = irr::core::vector3df (xleft,  zbottom, z);
+
+    this->m_vertex [0].TCoords = irr::core::vector2df (1.0f, 0.0f);
+    this->m_vertex [1].TCoords = irr::core::vector2df (0.0f, 0.0f);
+    this->m_vertex [2].TCoords = irr::core::vector2df (0.0f, 1.0f);
+    this->m_vertex [3].TCoords = irr::core::vector2df (1.0f, 1.0f);
+
+    this->m_vertex [0].Color = irr::video::SColor (255, 255, 255, 255);
+    this->m_vertex [1].Color = irr::video::SColor (255, 255, 255, 255);
+    this->m_vertex [2].Color = irr::video::SColor (255, 255, 255, 255);
+    this->m_vertex [3].Color = irr::video::SColor (255, 255, 255, 255);
+
+    this->generateMaterial ();
+    this->setAutomaticCulling (irr::scene::EAC_OFF);
+    this->m_boundingBox = irr::core::aabbox3d<irr::f32>(0, 0, 0, 0, 0, 0);
+}
+
+void CImage::render()
+{
+    uint16_t indices [] =
+    {
+            0, 1, 2, 3
+    };
+
+    irr::video::IVideoDriver* driver = SceneManager->getVideoDriver ();
+
+    driver->setMaterial (this->m_material);
+    driver->drawVertexPrimitiveList (
+        this->m_vertex, 4, indices, 1,
+        irr::video::EVT_STANDARD, irr::scene::EPT_QUADS, irr::video::EIT_16BIT
+    );
+}
+
+void CImage::generateMaterial ()
+{
+    if (this->m_image->getMaterial ()->getPasses ()->empty () == true)
+        return;
+
+    // TODO: SUPPORT OBJECT EFFECTS AND MULTIPLE MATERIAL PASSES
+    Core::Objects::Images::Materials::CPassess* pass = *this->m_image->getMaterial ()->getPasses ()->begin ();
+    std::string shader = pass->getShader ();
+    std::vector<std::string>* textures = pass->getTextures ();
+
+    std::vector<std::string>::const_iterator cur = textures->begin ();
+    std::vector<std::string>::const_iterator end = textures->end ();
+
+    for (int textureNumber = 0; cur != end; cur ++, textureNumber ++)
+    {
+        // TODO: LOOK THIS UP PROPERLY
+        irr::io::path texturepath = std::string ("materials/" + (*cur) + ".tex").c_str ();
+
+        irr::video::ITexture* texture = this->getScene ()->getContext ()->getDevice ()->getVideoDriver ()->getTexture (texturepath);
+
+        this->m_material.setTexture (textureNumber, texture);
+    }
+
+    // TODO: MOVE SHADER INITIALIZATION ELSEWHERE
+    irr::io::path vertpath = std::string ("shaders/" + shader + ".vert").c_str ();
+    irr::io::path fragpath = std::string ("shaders/" + shader + ".frag").c_str ();
+    Render::Shaders::Compiler* vertshader = new Render::Shaders::Compiler (vertpath, Render::Shaders::Compiler::Type::Type_Vertex, pass->getCombos (), false);
+    Render::Shaders::Compiler* fragshader = new Render::Shaders::Compiler (fragpath, Render::Shaders::Compiler::Type::Type_Pixel, pass->getCombos (), false);
+
+    this->m_material.MaterialType = (irr::video::E_MATERIAL_TYPE)
+            this->getScene ()->getContext ()->getDevice ()->getVideoDriver ()->getGPUProgrammingServices ()->addHighLevelShaderMaterial (
+                vertshader->precompile ().c_str (), "main", irr::video::EVST_VS_2_0,
+                fragshader->precompile ().c_str (), "main", irr::video::EPST_PS_2_0,
+                this, irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL, 0, irr::video::EGSL_DEFAULT
+            );
+
+    this->m_material.MaterialType = irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL;
+    this->m_material.setFlag (irr::video::EMF_LIGHTING, false);
+    this->m_material.setFlag (irr::video::EMF_BLEND_OPERATION, true);
+}
+
+
+const irr::core::aabbox3d<irr::f32>& CImage::getBoundingBox() const
+{
+    return this->m_boundingBox;
+}
+
+void CImage::OnRegisterSceneNode ()
+{
+    SceneManager->registerNodeForRendering (this);
+
+    ISceneNode::OnRegisterSceneNode ();
+}
+
+void CImage::OnSetConstants (irr::video::IMaterialRendererServices *services, int32_t userData)
+{
+    // TODO: SUPPORT SHADER PARAMETERS HERE
+}
+
+const std::string CImage::Type = "image";

+ 36 - 0
src/WallpaperEngine/Render/Objects/CImage.h

@@ -0,0 +1,36 @@
+#pragma once
+
+#include "WallpaperEngine/Core/Objects/CImage.h"
+
+#include "WallpaperEngine/Render/CObject.h"
+#include "WallpaperEngine/Render/CScene.h"
+
+using namespace WallpaperEngine;
+
+namespace WallpaperEngine::Render::Objects
+{
+    // TODO: MOVE IShaderConstantSetCallBack TO IT'S OWN CLASS OR ORGANIZE THIS BETTER
+    class CImage : public CObject, public irr::video::IShaderConstantSetCallBack
+    {
+    public:
+        CImage (CScene* scene, Core::Objects::CImage* image);
+
+        virtual void OnSetConstants (irr::video::IMaterialRendererServices* services, int32_t userData);
+
+        void render () override;
+        const irr::core::aabbox3d<irr::f32>& getBoundingBox() const override;
+        void OnRegisterSceneNode () override;
+
+    protected:
+        static const std::string Type;
+
+    private:
+        void generateMaterial ();
+
+        irr::video::S3DVertex m_vertex [4];
+        irr::video::SMaterial m_material;
+
+        Core::Objects::CImage* m_image;
+        irr::core::aabbox3d<irr::f32> m_boundingBox;
+    };
+}

+ 0 - 49
src/WallpaperEngine/camera.cpp

@@ -1,49 +0,0 @@
-#include "camera.h"
-#include "WallpaperEngine/Core/Core.h"
-
-namespace WallpaperEngine
-{
-    camera::camera (json json_data)
-    {
-        json::const_iterator center_it = json_data.find ("center");
-        json::const_iterator eye_it = json_data.find ("eye");
-        json::const_iterator up_it = json_data .find ("up");
-
-        if (center_it != json_data.end ())
-        {
-            // get center value first
-            std::string center = *center_it;
-
-            this->m_center = Core::ato3vf(center.c_str());
-        }
-
-        if (eye_it != json_data.end ())
-        {
-            std::string eye = *eye_it;
-
-            this->m_eye = Core::ato3vf(eye.c_str());
-        }
-
-        if (up_it != json_data.end ())
-        {
-            std::string up = *up_it;
-
-            this->m_up = Core::ato3vf(up.c_str());
-        }
-    }
-
-    irr::core::vector3df camera::getCenter ()
-    {
-        return this->m_center;
-    }
-
-    irr::core::vector3df camera::getEye ()
-    {
-        return this->m_eye;
-    }
-
-    irr::core::vector3df camera::getUp ()
-    {
-        return this->m_up;
-    }
-}

+ 0 - 24
src/WallpaperEngine/camera.h

@@ -1,24 +0,0 @@
-#ifndef WALLENGINE_CAMERA_H
-#define WALLENGINE_CAMERA_H
-
-#include <irrlicht/irrlicht.h>
-#include <nlohmann/json.hpp>
-
-namespace WallpaperEngine
-{
-    using json = nlohmann::json;
-
-    class camera
-    {
-    public:
-        camera (json json_data);
-
-        irr::core::vector3df getCenter ();
-        irr::core::vector3df getEye ();
-        irr::core::vector3df getUp ();
-    private:
-        irr::core::vector3df m_center, m_eye, m_up;
-    };
-};
-
-#endif //WALLENGINE_CAMERA_H

+ 0 - 548
src/WallpaperEngine/effect.cpp

@@ -1,548 +0,0 @@
-#include <WallpaperEngine/FileSystem/FileSystem.h>
-
-#include "WallpaperEngine/Irrlicht/CContext.h"
-#include "WallpaperEngine/Render/Shaders/Compiler.h"
-#include "effect.h"
-#include "WallpaperEngine/Core/Core.h"
-
-extern irr::f32 g_Time;
-extern WallpaperEngine::Irrlicht::CContext* IrrlichtContext;
-
-namespace WallpaperEngine
-{
-    effect::effect (json json_data, WallpaperEngine::object* parent)
-    {
-        this->m_parent = parent;
-
-        json::const_iterator file = json_data.find ("file");
-        json::const_iterator pass = json_data.find ("passes");
-
-        if (file != json_data.end () && (*file).is_string () == true)
-        {
-            this->m_file = (*file).get <std::string> ().c_str ();
-        }
-
-        // passes list is optional
-        if (pass == json_data.end () || (*pass).is_array () == false)
-            return;
-
-        json::const_iterator curpass = (*pass).begin ();
-        json::const_iterator endpass = (*pass).end ();
-
-        if (curpass == endpass)
-            return;
-
-        json::const_iterator textures = (*curpass).find ("textures");
-        json::const_iterator combos = (*curpass).find ("combos");
-
-        if (textures == (*curpass).end () || (*textures).is_array () == false)
-            return;
-
-        if (combos != (*curpass).end ())
-            this->parseCombos (*combos);
-
-        json::const_iterator curtex = (*textures).begin ();
-        json::const_iterator endtex = (*textures).end ();
-
-        for (; curtex != endtex; curtex ++)
-        {
-            if ((*curtex).is_null () == true)
-            {
-                this->m_textures.push_back (nullptr);
-            }
-            else if ((*curtex).is_string () == true)
-            {
-                irr::io::path texturepath = ("materials/" + (*curtex).get <std::string> () + ".tex").c_str ();
-
-                this->m_textures.push_back (new WallpaperEngine::texture (texturepath));
-            }
-        }
-
-        this->m_content = WallpaperEngine::FileSystem::loadFullFile (this->m_file);
-        this->m_json = json::parse (this->m_content);
-
-        json::const_iterator passes = this->m_json.find ("passes");
-
-        if (passes == this->m_json.end () || (*passes).is_array () == false)
-            return;
-
-        json::const_iterator curpassmaterial = (*passes).begin ();
-        json::const_iterator endpassmaterial = (*passes).end ();
-
-        for (; curpassmaterial != endpassmaterial; curpassmaterial ++)
-        {
-            json::const_iterator material_it = (*curpassmaterial).find ("material");
-
-            if (material_it == (*curpassmaterial).end () || (*material_it).is_string () == false)
-                continue;
-
-            irr::io::path material = (*material_it).get <std::string> ().c_str ();
-            std::string content = WallpaperEngine::FileSystem::loadFullFile (material);
-            json material_json = json::parse (content);
-
-            json::const_iterator shader_passes = material_json.find ("passes");
-
-            if (shader_passes == material_json.end () || (*shader_passes).is_array () == false)
-                continue;
-
-            json::const_iterator shaderpasscur = (*shader_passes).begin ();
-            json::const_iterator shader = (*shaderpasscur).find ("shader");
-
-            if (shader == (*shaderpasscur).end () || (*shader).is_string () == false)
-                continue;
-
-            irr::io::path shaderpath = ("shaders/" + (*shader).get <std::string> ()).c_str ();
-            irr::io::path fragpath = shaderpath + ".frag";
-            irr::io::path vertpath = shaderpath + ".vert";
-
-            this->m_fragShader = new WallpaperEngine::Render::Shaders::Compiler (fragpath, WallpaperEngine::Render::Shaders::Compiler::Type::Type_Pixel, &this->m_combos, false);
-            this->m_vertShader = new WallpaperEngine::Render::Shaders::Compiler (vertpath, WallpaperEngine::Render::Shaders::Compiler::Type::Type_Vertex, &this->m_combos, false);
-
-            this->m_materialType = IrrlichtContext->getDevice ()->getVideoDriver ()->getGPUProgrammingServices ()
-                ->addHighLevelShaderMaterial (
-                    this->m_vertShader->precompile ().c_str (), "main", irr::video::EVST_VS_2_0,
-                    this->m_fragShader->precompile ().c_str (), "main", irr::video::EPST_PS_2_0,
-                    this, irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL, 0, irr::video::EGSL_DEFAULT
-                );
-        }
-
-        json::const_iterator constantvalues = (*curpass).find ("constantshadervalues");
-
-        if (constantvalues != (*curpass).end () && (*constantvalues).is_object () == true)
-            this->parseConstantValues ((*constantvalues));
-
-        // last step is creating the actual variables for the shaders
-        std::vector <Render::Shaders::Compiler::ShaderParameter*>::const_iterator cur;
-        std::vector <Render::Shaders::Compiler::ShaderParameter*>::const_iterator end;
-
-        cur = this->m_fragShader->getParameters ().begin ();
-        end = this->m_fragShader->getParameters ().end ();
-
-        // first do fragment shaders
-        for (; cur != end; cur ++)
-        {
-            WallpaperEngine::Render::Shaders::Compiler::ShaderParameter* param = (*cur);
-            ShaderParameter* parameter = new ShaderParameter;
-            void* defaultValue = param->defaultValue;
-
-            std::map<std::string,void*>::const_iterator constant = this->m_constants.find (param->identifierName);
-
-            if (constant != this->m_constants.end ())
-                defaultValue = (*constant).second;
-
-            parameter->value = nullptr;
-
-            if (param->type == "vec4")
-            {
-                irr::core::vector3df* vec = (irr::core::vector3df*) defaultValue;
-                irr::f32* val = new irr::f32 [4];
-
-                val [0] = vec->X;
-                val [1] = vec->Y;
-                val [2] = vec->Z;
-                val [3] = 0.0f;
-
-                parameter->value = val;
-                parameter->type = ParameterType::TYPE_VEC4;
-            }
-            else if (param->type == "vec3")
-            {
-                irr::core::vector3df* vec = (irr::core::vector3df*) defaultValue;
-                irr::f32* val = new irr::f32 [3];
-
-                val [0] = vec->X;
-                val [1] = vec->Y;
-                val [2] = vec->Z;
-
-                parameter->value = val;
-                parameter->type = ParameterType::TYPE_VEC3;
-            }
-            else if (param->type == "vec2")
-            {
-                irr::core::vector2df* vec = (irr::core::vector2df*) defaultValue;
-                irr::f32* val = new irr::f32 [2];
-
-                val [0] = vec->X;
-                val [1] = vec->Y;
-
-                parameter->value = val;
-                parameter->type = ParameterType::TYPE_VEC2;
-            }
-            else if (param->type == "float")
-            {
-                irr::f32* org = (irr::f32*) defaultValue;
-                irr::f32* val = new irr::f32;
-
-                *val = *org;
-
-                parameter->value = val;
-                parameter->type = ParameterType::TYPE_FLOAT;
-            }
-            else if (param->type == "int")
-            {
-                irr::s32* org = (irr::s32*) defaultValue;
-                irr::s32* val = new irr::s32;
-
-                *val = *org;
-
-                parameter->value = val;
-                parameter->type = ParameterType::TYPE_INT;
-            }
-            else if (param->type == "sampler2D")
-            {
-                // sampler2D are textures from wallpaper engine
-                // so these can be ignored as they are later on defined
-                continue;
-            }
-
-            this->m_pixelVariables.insert (std::pair <std::string, ShaderParameter*> (param->variableName, parameter));
-        }
-
-        cur = this->m_vertShader->getParameters ().begin ();
-        end = this->m_vertShader->getParameters ().end ();
-
-        // second do vertex shaders
-        for (;cur != end; cur ++)
-        {
-            WallpaperEngine::Render::Shaders::Compiler::ShaderParameter* param = (*cur);
-
-            if (param == nullptr)
-                continue;
-
-            void* defaultValue = param->defaultValue;
-
-            std::map<std::string,void*>::const_iterator constant = this->m_constants.find (param->identifierName);
-
-            if (constant != this->m_constants.end ())
-                defaultValue = (*constant).second;
-
-            ShaderParameter* parameter = new ShaderParameter;
-
-            parameter->value = nullptr;
-
-            if (param->type == "vec4")
-            {
-                irr::core::vector3df* vec = (irr::core::vector3df*) defaultValue;
-                irr::f32* val = new irr::f32 [4];
-
-                val [0] = vec->X;
-                val [1] = vec->Y;
-                val [2] = vec->Z;
-                val [3] = 0.0f;
-
-                parameter->value = val;
-                parameter->type = ParameterType::TYPE_VEC4;
-            }
-            else if (param->type == "vec3")
-            {
-                irr::core::vector3df* vec = (irr::core::vector3df*) defaultValue;
-                irr::f32* val = new irr::f32 [3];
-
-                val [0] = vec->X;
-                val [1] = vec->Y;
-                val [2] = vec->Z;
-
-                parameter->value = val;
-                parameter->type = ParameterType::TYPE_VEC3;
-            }
-            else if (param->type == "vec2")
-            {
-                irr::core::vector2df* vec = (irr::core::vector2df*) defaultValue;
-                irr::f32* val = new irr::f32 [2];
-
-                val [0] = vec->X;
-                val [1] = vec->Y;
-
-                parameter->value = val;
-                parameter->type = ParameterType::TYPE_VEC2;
-            }
-            else if (param->type == "float")
-            {
-                irr::f32* org = (irr::f32*) defaultValue;
-                irr::f32* val = new irr::f32;
-
-                *val = *org;
-
-                parameter->value = val;
-                parameter->type = ParameterType::TYPE_FLOAT;
-            }
-            else if (param->type == "int")
-            {
-                irr::s32* org = (irr::s32*) defaultValue;
-                irr::s32* val = new irr::s32;
-
-                *val = *org;
-
-                parameter->value = val;
-                parameter->type = ParameterType::TYPE_INT;
-            }
-            else if (param->type == "sampler2D")
-            {
-                // sampler2D are textures from wallpaper engine
-                // so these can be ignored as they are later on defined
-                continue;
-            }
-
-            this->m_vertexVariables.insert (std::pair <std::string, ShaderParameter*> (param->variableName, parameter));
-        }
-    }
-
-    void effect::parseConstantValues (json data)
-    {
-/*
-								"ui_editor_properties_animation_speed" : 0.10000000149011612,
-								"ui_editor_properties_ripple_scale" : 2.5,
-								"ui_editor_properties_ripple_strength" : 0.070000000298023224
-*/
-        json::const_iterator cur = data.begin ();
-        json::const_iterator end = data.end ();
-
-        for (; cur != end; cur ++)
-        {
-            std::string name = cur.key ();
-            void* value = nullptr;
-
-            if ((*cur).is_number_float () == true)
-            {
-                value = new irr::f32;
-                *(irr::f32*) value = (*cur).get <irr::f32> ();
-            }
-            else if ((*cur).is_number_integer () == true)
-            {
-                value = new irr::s32;
-                *(irr::s32*) value = (*cur).get <irr::s32> ();
-            }
-            else if ((*cur).is_string () == true)
-            {
-                value = new irr::core::vector3df;
-                *(irr::core::vector3df*) value = Core::ato3vf ((*cur).get <std::string> ().c_str ());
-            }
-
-            this->m_constants.insert (std::pair <std::string, void*> (name, value));
-        }
-    }
-
-    void effect::parseCombos (json data)
-    {
-        json::const_iterator cur = data.begin ();
-        json::const_iterator end = data.end ();
-
-        for (; cur != end; cur ++)
-        {
-            std::string name = cur.key ();
-
-            if ((*cur).is_number_integer () == true)
-            {
-                this->m_combos.insert (std::pair <std::string, int> (name, (*cur).get <int> ()));
-            }
-            else
-            {
-                IrrlichtContext->getDevice ()->getLogger ()->log ("Unknown type for combo value", name.c_str (), irr::ELL_ERROR);
-            }
-        }
-    }
-
-    std::vector<WallpaperEngine::texture*>& effect::getTextureList ()
-    {
-        return this->m_textures;
-    }
-
-    irr::s32 effect::getMaterialType ()
-    {
-        return this->m_materialType;
-    }
-
-    void effect::OnSetConstants (irr::video::IMaterialRendererServices* services, int32_t userData)
-    {
-        irr::f32 g_Texture0 = 0;
-        irr::f32 g_Texture1 = 1;
-        irr::f32 g_Texture2 = 2;
-        irr::f32 g_Texture3 = 3;
-        irr::f32 g_Texture4 = 4;
-        irr::f32 g_Texture5 = 5;
-        irr::f32 g_Texture6 = 6;
-        irr::f32 g_Texture7 = 7;
-
-        irr::f32 g_Texture0Rotation [4] = { this->m_parent->getAngles ().X, this->m_parent->getAngles ().Y, this->m_parent->getAngles ().Z, this->m_parent->getAngles ().Z};
-        irr::f32 g_Texture1Rotation [4] = { this->m_parent->getAngles ().X, this->m_parent->getAngles ().Y, this->m_parent->getAngles ().Z, this->m_parent->getAngles ().Z};
-        irr::f32 g_Texture2Rotation [4] = { this->m_parent->getAngles ().X, this->m_parent->getAngles ().Y, this->m_parent->getAngles ().Z, this->m_parent->getAngles ().Z};
-        irr::f32 g_Texture3Rotation [4] = { this->m_parent->getAngles ().X, this->m_parent->getAngles ().Y, this->m_parent->getAngles ().Z, this->m_parent->getAngles ().Z};
-        irr::f32 g_Texture4Rotation [4] = { this->m_parent->getAngles ().X, this->m_parent->getAngles ().Y, this->m_parent->getAngles ().Z, this->m_parent->getAngles ().Z};
-        irr::f32 g_Texture5Rotation [4] = { this->m_parent->getAngles ().X, this->m_parent->getAngles ().Y, this->m_parent->getAngles ().Z, this->m_parent->getAngles ().Z};
-        irr::f32 g_Texture6Rotation [4] = { this->m_parent->getAngles ().X, this->m_parent->getAngles ().Y, this->m_parent->getAngles ().Z, this->m_parent->getAngles ().Z};
-        irr::f32 g_Texture7Rotation [4] = { this->m_parent->getAngles ().X, this->m_parent->getAngles ().Y, this->m_parent->getAngles ().Z, this->m_parent->getAngles ().Z};
-
-        irr::f32 g_Texture0Resolution [4] = { this->m_parent->getSize ().X, this->m_parent->getSize ().Y, this->m_parent->getSize ().X, this->m_parent->getSize ().Y};
-        irr::f32 g_Texture1Resolution [4] = { this->m_parent->getSize ().X, this->m_parent->getSize ().Y, this->m_parent->getSize ().X, this->m_parent->getSize ().Y};
-        irr::f32 g_Texture2Resolution [4] = { this->m_parent->getSize ().X, this->m_parent->getSize ().Y, this->m_parent->getSize ().X, this->m_parent->getSize ().Y};
-        irr::f32 g_Texture3Resolution [4] = { this->m_parent->getSize ().X, this->m_parent->getSize ().Y, this->m_parent->getSize ().X, this->m_parent->getSize ().Y};
-        irr::f32 g_Texture4Resolution [4] = { this->m_parent->getSize ().X, this->m_parent->getSize ().Y, this->m_parent->getSize ().X, this->m_parent->getSize ().Y};
-        irr::f32 g_Texture5Resolution [4] = { this->m_parent->getSize ().X, this->m_parent->getSize ().Y, this->m_parent->getSize ().X, this->m_parent->getSize ().Y};
-        irr::f32 g_Texture6Resolution [4] = { this->m_parent->getSize ().X, this->m_parent->getSize ().Y, this->m_parent->getSize ().X, this->m_parent->getSize ().Y};
-        irr::f32 g_Texture7Resolution [4] = { this->m_parent->getSize ().X, this->m_parent->getSize ().Y, this->m_parent->getSize ().X, this->m_parent->getSize ().Y};
-
-        irr::video::IVideoDriver* driver = services->getVideoDriver ();
-
-        irr::core::matrix4 worldViewProj;
-        worldViewProj = driver->getTransform(irr::video::ETS_PROJECTION);
-        worldViewProj *= driver->getTransform(irr::video::ETS_VIEW);
-        worldViewProj *= driver->getTransform(irr::video::ETS_WORLD);
-
-        /*
-            THESE ARE THE VARIABLES AVAILABLE ON SHADERS
-
-            uniform float g_Alpha;
-
-            uniform vec3 g_Color;
-
-            // Application time, starts with 0
-            uniform float g_Time;
-
-            // Maps 24 hrs to [0, 1]
-            uniform float g_Daytime;
-
-            uniform vec2 g_TexelSize;
-            uniform vec2 g_TexelSizeHalf;
-
-            uniform mat4 g_ModelMatrix;
-            uniform mat4 g_ViewProjectionMatrix;
-            uniform mat4 g_ModelViewProjectionMatrix;
-            uniform mat4 g_ModelViewProjectionMatrixInverse;
-
-            uniform vec3 g_EyePosition;
-            uniform vec3 g_ViewUp;
-            uniform vec3 g_ViewRight;
-
-            // Samplers that map to the textures[] array in the material
-            uniform sampler2D g_Texture0;
-            uniform sampler2D g_Texture1;
-            uniform sampler2D g_Texture2;
-            uniform sampler2D g_Texture3;
-            uniform sampler2D g_Texture4;
-            uniform sampler2D g_Texture5;
-            uniform sampler2D g_Texture6;
-            uniform sampler2D g_Texture7;
-
-            // For sprite sheets (GIFs)
-            uniform vec4 g_Texture0Rotation;
-            uniform vec4 g_Texture1Rotation;
-            uniform vec4 g_Texture2Rotation;
-            uniform vec4 g_Texture3Rotation;
-            uniform vec4 g_Texture4Rotation;
-            uniform vec4 g_Texture5Rotation;
-            uniform vec4 g_Texture6Rotation;
-            uniform vec4 g_Texture7Rotation;
-
-            uniform vec2 g_Texture0Translation;
-            uniform vec2 g_Texture1Translation;
-            uniform vec2 g_Texture2Translation;
-            uniform vec2 g_Texture3Translation;
-            uniform vec2 g_Texture4Translation;
-            uniform vec2 g_Texture5Translation;
-            uniform vec2 g_Texture6Translation;
-            uniform vec2 g_Texture7Translation;
-
-            uniform vec4 g_LightsColorRadius[4]; // color in XYZ, radius in W
-            uniform vec3 g_LightsPosition[4];
-
-            uniform vec3 g_LightAmbientColor;
-            uniform vec3 g_LightSkylightColor;
-
-            // lower frequencies at lower indices
-            uniform float g_AudioSpectrum16Left[16];
-            uniform float g_AudioSpectrum16Right[16];
-            uniform float g_AudioSpectrum32Left[32];
-            uniform float g_AudioSpectrum32Right[32];
-            uniform float g_AudioSpectrum64Left[64];
-            uniform float g_AudioSpectrum64Right[64];
-
-            // Normalized in UV space [0, 1]
-            uniform vec2 g_PointerPosition;
-
-        */
-
-        services->setVertexShaderConstant ("g_Time", &g_Time, 1);
-        services->setPixelShaderConstant  ("g_Time", &g_Time, 1);
-
-        std::map<std::string, ShaderParameter*>::const_iterator vertcur = this->m_vertexVariables.begin ();
-        std::map<std::string, ShaderParameter*>::const_iterator vertend = this->m_vertexVariables.end ();
-
-        for (; vertcur != vertend; vertcur ++)
-        {
-            switch ((*vertcur).second->type)
-            {
-                case ParameterType::TYPE_FLOAT:
-                    services->setVertexShaderConstant ((*vertcur).first.c_str (), (irr::f32*) (*vertcur).second->value, 1);
-                    break;
-                case ParameterType::TYPE_VEC2:
-                    services->setVertexShaderConstant ((*vertcur).first.c_str (), (irr::f32*) (*vertcur).second->value, 2);
-                    break;
-                case ParameterType::TYPE_VEC3:
-                    services->setVertexShaderConstant ((*vertcur).first.c_str (), (irr::f32*) (*vertcur).second->value, 3);
-                    break;
-                case ParameterType::TYPE_VEC4:
-                    services->setVertexShaderConstant ((*vertcur).first.c_str (), (irr::f32*) (*vertcur).second->value, 4);
-                    break;
-                case ParameterType::TYPE_INT:
-                    services->setVertexShaderConstant ((*vertcur).first.c_str (), (irr::s32*) (*vertcur).second->value, 1);
-                    break;
-
-            }
-        }
-
-        std::map<std::string, ShaderParameter*>::const_iterator pixelcur = this->m_pixelVariables.begin ();
-        std::map<std::string, ShaderParameter*>::const_iterator pixelend = this->m_pixelVariables.end ();
-
-        for (; pixelcur != pixelend; pixelcur ++)
-        {
-            switch ((*pixelcur).second->type)
-            {
-                case ParameterType::TYPE_FLOAT:
-                    services->setPixelShaderConstant ((*pixelcur).first.c_str (), (irr::f32*) (*pixelcur).second->value, 1);
-                    break;
-                case ParameterType::TYPE_VEC2:
-                    services->setPixelShaderConstant ((*pixelcur).first.c_str (), (irr::f32*) (*pixelcur).second->value, 2);
-                    break;
-                case ParameterType::TYPE_VEC3:
-                    services->setPixelShaderConstant ((*pixelcur).first.c_str (), (irr::f32*) (*pixelcur).second->value, 3);
-                    break;
-                case ParameterType::TYPE_VEC4:
-                    services->setPixelShaderConstant ((*pixelcur).first.c_str (), (irr::f32*) (*pixelcur).second->value, 4);
-                    break;
-                case ParameterType::TYPE_INT:
-                    services->setPixelShaderConstant ((*pixelcur).first.c_str (), (irr::s32*) (*pixelcur).second->value, 1);
-                    break;
-
-            }
-        }
-
-        services->setVertexShaderConstant ("g_ModelViewProjectionMatrix", worldViewProj.pointer(), 16);
-
-        services->setVertexShaderConstant ("g_Texture0Resolution", g_Texture0Resolution, 4);
-        services->setVertexShaderConstant ("g_Texture1Resolution", g_Texture1Resolution, 4);
-        services->setVertexShaderConstant ("g_Texture2Resolution", g_Texture2Resolution, 4);
-        services->setVertexShaderConstant ("g_Texture3Resolution", g_Texture3Resolution, 4);
-        services->setVertexShaderConstant ("g_Texture4Resolution", g_Texture4Resolution, 4);
-        services->setVertexShaderConstant ("g_Texture5Resolution", g_Texture5Resolution, 4);
-        services->setVertexShaderConstant ("g_Texture6Resolution", g_Texture6Resolution, 4);
-        services->setVertexShaderConstant ("g_Texture7Resolution", g_Texture7Resolution, 4);
-
-        services->setVertexShaderConstant ("g_Texture0Rotation", g_Texture0Rotation, 4);
-        services->setVertexShaderConstant ("g_Texture1Rotation", g_Texture1Rotation, 4);
-        services->setVertexShaderConstant ("g_Texture2Rotation", g_Texture2Rotation, 4);
-        services->setVertexShaderConstant ("g_Texture3Rotation", g_Texture3Rotation, 4);
-        services->setVertexShaderConstant ("g_Texture4Rotation", g_Texture4Rotation, 4);
-        services->setVertexShaderConstant ("g_Texture5Rotation", g_Texture5Rotation, 4);
-        services->setVertexShaderConstant ("g_Texture6Rotation", g_Texture6Rotation, 4);
-        services->setVertexShaderConstant ("g_Texture7Rotation", g_Texture7Rotation, 4);
-
-        services->setPixelShaderConstant ("g_Texture0", &g_Texture0, 1);
-        services->setPixelShaderConstant ("g_Texture1", &g_Texture1, 1);
-        services->setPixelShaderConstant ("g_Texture2", &g_Texture2, 1);
-        services->setPixelShaderConstant ("g_Texture3", &g_Texture3, 1);
-        services->setPixelShaderConstant ("g_Texture4", &g_Texture4, 1);
-        services->setPixelShaderConstant ("g_Texture5", &g_Texture5, 1);
-        services->setPixelShaderConstant ("g_Texture6", &g_Texture6, 1);
-        services->setPixelShaderConstant ("g_Texture7", &g_Texture7, 1);
-    }
-};

+ 0 - 64
src/WallpaperEngine/effect.h

@@ -1,64 +0,0 @@
-#ifndef WALLENGINE_EFFECT_H
-#define WALLENGINE_EFFECT_H
-
-#include <nlohmann/json.hpp>
-#include <irrlicht/irrlicht.h>
-
-#include "texture.h"
-#include "object.h"
-#include "WallpaperEngine/Render/Shaders/Compiler.h"
-
-namespace WallpaperEngine
-{
-    using json = nlohmann::json;
-
-    class object;
-
-    class effect : public irr::video::IShaderConstantSetCallBack
-    {
-    public:
-        effect (json json_data, WallpaperEngine::object* parent);
-
-        virtual void OnSetConstants (irr::video::IMaterialRendererServices* services, int32_t userData);
-
-        std::vector <WallpaperEngine::texture*>& getTextureList ();
-        irr::s32 getMaterialType ();
-    private:
-        enum ParameterType
-        {
-            TYPE_VEC4,
-            TYPE_VEC3,
-            TYPE_VEC2,
-            TYPE_FLOAT,
-            TYPE_INT
-        };
-
-        struct ShaderParameter
-        {
-            void* value;
-            ParameterType type;
-        };
-
-        void parseConstantValues (json data);
-        void parseCombos (json data);
-
-        WallpaperEngine::Render::Shaders::Compiler* m_fragShader;
-        WallpaperEngine::Render::Shaders::Compiler* m_vertShader;
-
-        std::map <std::string, ShaderParameter*> m_vertexVariables;
-        std::map <std::string, ShaderParameter*> m_pixelVariables;
-        std::map <std::string, int> m_combos;
-
-        std::map <std::string, void*> m_constants;
-        std::vector <WallpaperEngine::texture*> m_textures;
-        std::string m_content;
-        json m_json;
-        irr::io::path m_file;
-        irr::s32 m_materialType;
-        std::vector<void*> m_passes;
-        WallpaperEngine::object* m_parent;
-    };
-}
-
-
-#endif //WALLENGINE_EFFECT_H

+ 0 - 162
src/WallpaperEngine/image.cpp

@@ -1,162 +0,0 @@
-#include <irrlicht/irrlicht.h>
-#include <fstream>
-
-#include <WallpaperEngine/FileSystem/FileSystem.h>
-#include <WallpaperEngine/object3d.h>
-#include <WallpaperEngine/image.h>
-
-#include <WallpaperEngine/Irrlicht/CContext.h>
-#include <WallpaperEngine/Core/Core.h>
-
-extern WallpaperEngine::Irrlicht::CContext* IrrlichtContext;
-
-namespace WallpaperEngine
-{
-    image::image (json json_data, WallpaperEngine::object* parent) : object3d (object3d::Type::Type_Material, parent)
-    {
-        this->m_parent = parent;
-
-        json::const_iterator visible_it = json_data.find ("visible");
-        json::const_iterator file_it = json_data.find ("image");
-        json::const_iterator origin_it = json_data.find ("origin");
-
-        if (visible_it != json_data.end () && (*visible_it).is_boolean () == true)
-        {
-            this->m_visible = *visible_it;
-        }
-
-        // basic texture, main thing to assign first
-        if (file_it != json_data.end () && (*file_it).is_string () == true)
-        {
-            this->m_file = (*file_it).get <std::string> ().c_str ();
-            this->m_content = WallpaperEngine::FileSystem::loadFullFile (this->m_file);
-
-            json content = json::parse (this->m_content);
-            json::const_iterator it = content.find ("material");
-
-            if (it != content.end () && (*it).is_string () == true)
-            {
-                irr::io::path materialfile = (*it).get <std::string> ().c_str ();
-                std::string texturejson_content = WallpaperEngine::FileSystem::loadFullFile (materialfile);
-                json materialcontent = json::parse (texturejson_content);
-
-                // now try to read the texture if any
-                json::const_iterator it = materialcontent.find ("passes");
-
-                if (it != materialcontent.end () && (*it).is_array() == true)
-                {
-                    json::const_iterator passesCur = (*it).begin ();
-                    json::const_iterator passesEnd = (*it).end ();
-
-                    for (; passesCur != passesEnd; passesCur ++)
-                    {
-                        json::const_iterator texture = (*passesCur).find ("textures");
-
-                        if (texture != (*passesCur).end () && (*texture).is_array () == true)
-                        {
-                            json::const_iterator texturesCur = (*texture).begin ();
-                            json::const_iterator texturesEnd = (*texture).end ();
-
-                            for (; texturesCur != texturesEnd; texturesCur ++)
-                            {
-                                irr::io::path texturepath = ("materials/" + (*texturesCur).get <std::string> () + ".tex").c_str ();
-
-                                this->m_textures.push_back (new WallpaperEngine::texture (texturepath));
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        // initialize actual material properties
-        irr::f32 xright = this->m_parent->getOrigin ().X;
-        irr::f32 xleft = -this->m_parent->getOrigin ().X;
-        irr::f32 ztop = this->m_parent->getOrigin ().Y;
-        irr::f32 zbottom = -this->m_parent->getOrigin ().Y;
-        irr::f32 z = this->m_parent->getScene ()->getCamera ()->getEye ().Z;
-
-        m_vertices [0].Pos = irr::core::vector3df (xleft,   ztop,    z); // top left
-        m_vertices [1].Pos = irr::core::vector3df (xright,  ztop,    z); // top right
-        m_vertices [2].Pos = irr::core::vector3df (xright,  zbottom, z); // bottom right
-        m_vertices [3].Pos = irr::core::vector3df (xleft,   zbottom, z); // bottom left
-
-        m_vertices [0].TCoords = irr::core::vector2df (1.0f, 0.0f);
-        m_vertices [1].TCoords = irr::core::vector2df (0.0f, 0.0f);
-        m_vertices [2].TCoords = irr::core::vector2df (0.0f, 1.0f);
-        m_vertices [3].TCoords = irr::core::vector2df (1.0f, 1.0f);
-
-        m_vertices [0].Color = irr::video::SColor (255, 255, 255, 255);
-        m_vertices [1].Color = irr::video::SColor (255, 255, 255, 255);
-        m_vertices [2].Color = irr::video::SColor (255, 255, 255, 255);
-        m_vertices [3].Color = irr::video::SColor (255, 255, 255, 255);
-
-        // once textures are defined, prepare them to be displayed
-        std::vector<WallpaperEngine::texture*>::const_iterator cur = this->m_textures.begin ();
-        std::vector<WallpaperEngine::texture*>::const_iterator end = this->m_textures.end ();
-
-        for (irr::u32 i = 0; cur != end; cur ++, i ++)
-        {
-            this->getMaterial ().setTexture (i, (*cur)->getIrrTexture ());
-        }
-
-        std::vector<WallpaperEngine::effect*>::const_iterator effect = this->m_parent->getEffects ().begin ();
-
-        if (effect != this->m_parent->getEffects ().end ())
-        {
-            // loop through the textures the effect is using
-            std::vector<WallpaperEngine::texture*> list = (*effect)->getTextureList ();
-
-            std::vector<WallpaperEngine::texture*>::const_iterator curtex = list.begin ();
-            std::vector<WallpaperEngine::texture*>::const_iterator endtex = list.end ();
-
-            for (int current = 0; curtex != endtex; curtex ++, current ++)
-            {
-                if ((*curtex) == nullptr)
-                    continue;
-
-                this->getMaterial ().setTexture (current, (*curtex)->getIrrTexture ());
-            }
-
-            this->setType ((irr::video::E_MATERIAL_TYPE) (*effect)->getMaterialType ());
-        }
-        else
-        {
-            this->setType (irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
-        }
-
-        // set basic material flags
-        this->setFlag (irr::video::EMF_LIGHTING, false);
-        this->setFlag (irr::video::EMF_BLEND_OPERATION, true);
-    }
-
-
-    void image::setFlag(irr::video::E_MATERIAL_FLAG flag, bool newvalue)
-    {
-        this->getMaterial ().setFlag (flag, newvalue);
-    }
-
-    void image::setType(irr::video::E_MATERIAL_TYPE newType)
-    {
-        this->getMaterial ().MaterialType = newType;
-    }
-
-    irr::video::SMaterial& image::getMaterial ()
-    {
-        return this->m_material;
-    }
-
-    void image::render ()
-    {
-        if (this->m_visible == false) return;
-
-        uint16_t indices[] =
-        {
-                0, 1, 2, 3
-        };
-
-        IrrlichtContext->getDevice ()->getVideoDriver ()->setMaterial (this->getMaterial ());
-        IrrlichtContext->getDevice ()->getVideoDriver ()->drawVertexPrimitiveList (this->m_vertices, 4, indices, 1, irr::video::EVT_STANDARD, irr::scene::EPT_QUADS, irr::video::EIT_16BIT);
-    }
-
-}

+ 0 - 36
src/WallpaperEngine/image.h

@@ -1,36 +0,0 @@
-#ifndef WALLENGINE_MODEL_H
-#define WALLENGINE_MODEL_H
-
-#include <nlohmann/json.hpp>
-#include <irrlicht/irrlicht.h>
-
-#include <WallpaperEngine/FileSystem/FileSystem.h>
-#include <WallpaperEngine/texture.h>
-
-namespace WallpaperEngine
-{
-    using json = nlohmann::json;
-
-    class image : public object3d
-    {
-    public:
-        image(json json_data, WallpaperEngine::object* parent);
-        irr::video::SMaterial& getMaterial ();
-        void setFlag(irr::video::E_MATERIAL_FLAG flag, bool newvalue);
-        void setType(irr::video::E_MATERIAL_TYPE newType);
-        void render ();
-
-    private:
-        bool m_visible;
-
-        irr::video::S3DVertex m_vertices [4];
-        irr::video::SMaterial m_material;
-
-        irr::io::path m_file;
-        std::string m_content;
-
-        std::vector<WallpaperEngine::texture*> m_textures;
-    };
-};
-
-#endif //WALLENGINE_MODEL_H

+ 0 - 171
src/WallpaperEngine/object.cpp

@@ -1,171 +0,0 @@
-#include <irrlicht/irrlicht.h>
-#include <iostream>
-#include <fstream>
-#include <nlohmann/json.hpp>
-
-#include <WallpaperEngine/object.h>
-#include <WallpaperEngine/Core/Core.h>
-#include <WallpaperEngine/object3d.h>
-#include <WallpaperEngine/image.h>
-#include <WallpaperEngine/sound.h>
-
-namespace WallpaperEngine
-{
-    using json = nlohmann::json;
-
-    object::object (json json_data, WallpaperEngine::scene* scene) : m_object3d (nullptr)
-    {
-        this->m_scene = scene;
-
-        json::const_iterator size = json_data.find ("size");
-        json::const_iterator scale = json_data.find ("scale");
-        json::const_iterator origin = json_data.find ("origin");
-
-        if (size != json_data.end () && size.value ().is_string () == true)
-        {
-            std::string size_s = *size;
-
-            this->m_size = Core::ato2vf (size_s.c_str ());
-        }
-
-        if (scale != json_data.end () && scale.value ().is_string () == true)
-        {
-            std::string scale_s = *scale;
-
-            this->m_scale = Core::ato3vf (scale_s.c_str ());
-        }
-
-        if (origin != json_data.end () && origin.value ().is_string () == true)
-        {
-            std::string origin_s = *origin;
-
-            this->m_origin = Core::ato3vf (origin_s.c_str ());
-        }
-
-        json::const_iterator angles = json_data.find ("angles");
-        json::const_iterator id = json_data.find ("id");
-        json::const_iterator name = json_data.find ("name");
-
-        if (angles != json_data.end () && (*angles).is_string () == true)
-        {
-            std::string angles_s = *angles;
-
-            this->m_angles = Core::ato3vf (angles_s.c_str ());
-        }
-
-        if (id != json_data.end () && (*id).is_null () == false)
-        {
-            this->m_id = *id;
-        }
-
-        if (name != json_data.end () && (*name).is_string () == true)
-        {
-            this->m_name = *name;
-        }
-
-        json::const_iterator image = json_data.find ("image");
-        json::const_iterator model = json_data.find ("model");
-        json::const_iterator particle = json_data.find ("particle");
-        json::const_iterator sound = json_data.find ("sound");
-
-        object3d::Type _type = object3d::Type::Type_None;
-
-        if (image != json_data.end () && (*image).is_null () == false)
-        {
-            _type = object3d::Type::Type_Material;
-        }
-
-        if (model != json_data.end () && (*model).is_null () == false)
-        {
-            _type = object3d::Type::Type_Model;
-        }
-
-        if (particle != json_data.end () && (*particle).is_null () == false)
-        {
-            _type = object3d::Type::Type_Particle;
-        }
-
-        if (sound != json_data.end () && (*sound).is_null () == false)
-        {
-            _type = object3d::Type::Type_Sound;
-        }
-
-        // load the effects first so we have access to the textures needed
-        json::const_iterator effects = json_data.find ("effects");
-
-        if (effects != json_data.end () && (*effects).is_array () == true)
-        {
-            json::const_iterator cur = (*effects).begin ();
-            json::const_iterator end = (*effects).end ();
-
-            for (; cur != end; cur ++)
-            {
-                this->m_effects.push_back (new effect (*cur, this));
-            }
-        }
-
-        switch (_type)
-        {
-            case object3d::Type::Type_Material:
-                this->m_object3d = new WallpaperEngine::image (json_data, this);
-                break;
-
-            case object3d::Type::Type_Model:
-                break;
-
-            case object3d::Type::Type_Particle:
-                break;
-
-            case object3d::Type::Type_Sound:
-                this->m_object3d = new WallpaperEngine::sound ((*sound), this);
-                break;
-        }
-    }
-
-    object::~object ()
-    {
-        if (this->m_object3d != nullptr)
-        {
-            delete this->m_object3d;
-        }
-    }
-
-    void object::render ()
-    {
-        if (this->m_object3d != nullptr)
-        {
-            this->m_object3d->render ();
-        }
-    }
-
-
-    irr::core::vector2df& object::getSize ()
-    {
-        return this->m_size;
-    }
-
-    irr::core::vector3df& object::getScale ()
-    {
-        return this->m_scale;
-    }
-
-    irr::core::vector3df& object::getOrigin ()
-    {
-        return this->m_origin;
-    }
-
-    irr::core::vector3df& object::getAngles ()
-    {
-        return this->m_angles;
-    }
-
-    std::vector<effect*>& object::getEffects ()
-    {
-        return this->m_effects;
-    }
-
-    WallpaperEngine::scene* object::getScene ()
-    {
-        return this->m_scene;
-    }
-}

+ 0 - 54
src/WallpaperEngine/object.h

@@ -1,54 +0,0 @@
-#ifndef WALLENGINE_OBJECT_H
-#define WALLENGINE_OBJECT_H
-
-#include <iostream>
-#include <irrlicht/irrlicht.h>
-#include <nlohmann/json.hpp>
-#include <WallpaperEngine/video/node.h>
-#include <WallpaperEngine/effect.h>
-#include <WallpaperEngine/scene.h>
-
-namespace WallpaperEngine
-{
-    using json = nlohmann::json;
-
-    class object3d;
-    class scene;
-    class effect;
-
-    class object : public WallpaperEngine::video::node
-    {
-    public:
-
-        object (json json_data, WallpaperEngine::scene* scene);
-        ~object ();
-
-        irr::core::vector2df& getSize ();
-        irr::core::vector3df& getScale ();
-        irr::core::vector3df& getOrigin ();
-
-        irr::core::vector3df& getAngles ();
-
-        std::vector<effect*>& getEffects ();
-
-        WallpaperEngine::scene* getScene ();
-
-        void render ();
-    private:
-        int m_id;
-
-        WallpaperEngine::scene* m_scene;
-
-        std::string m_name;
-
-        irr::core::vector2df m_size;
-        irr::core::vector3df m_scale;
-        irr::core::vector3df m_origin;
-
-        irr::core::vector3df m_angles;
-        WallpaperEngine::object3d* m_object3d;
-        std::vector<effect*> m_effects;
-    };
-};
-
-#endif //WALLENGINE_OBJECT_H

+ 0 - 30
src/WallpaperEngine/object3d.cpp

@@ -1,30 +0,0 @@
-#include <WallpaperEngine/object3d.h>
-#include <WallpaperEngine/image.h>
-
-namespace WallpaperEngine
-{
-    object3d::object3d (object3d::Type type, WallpaperEngine::object* parent)
-    {
-        this->m_type = type;
-    }
-
-    template <class T> T* object3d::as()
-    {
-        return (T*) this;
-    }
-
-    template <class T> bool object3d::is()
-    {
-        return false;
-    }
-
-    template <> bool object3d::is<image>()
-    {
-        return this->m_type == Type::Type_Material;
-    }
-
-    void object3d::render ()
-    {
-
-    }
-}

+ 0 - 37
src/WallpaperEngine/object3d.h

@@ -1,37 +0,0 @@
-#ifndef WALLENGINE_OBJECT3D_H
-#define WALLENGINE_OBJECT3D_H
-
-#include <WallpaperEngine/video/node.h>
-
-#include <WallpaperEngine/scene.h>
-
-namespace WallpaperEngine
-{
-    class object3d : WallpaperEngine::video::node
-    {
-    public:
-        enum Type
-        {
-            Type_Material = 0,
-            Type_Model = 1,
-            Type_Particle = 2,
-            Type_Sound = 3,
-            Type_None = 4
-        };
-
-        object3d (Type type, WallpaperEngine::object* parent);
-
-        virtual void render ();
-
-        template <class T> T* as();
-        template <class T> bool is();
-
-    protected:
-        WallpaperEngine::object* m_parent;
-
-    private:
-        Type m_type;
-    };
-};
-
-#endif //WALLENGINE_OBJECT3D_H

+ 0 - 48
src/WallpaperEngine/project.cpp

@@ -1,48 +0,0 @@
-#include <irrlicht/irrlicht.h>
-#include <iostream>
-#include <fstream>
-#include <stdexcept>
-
-#include "WallpaperEngine/FileSystem/FileSystem.h"
-
-#include "project.h"
-
-namespace WallpaperEngine
-{
-    project::project (irr::io::path& jsonfile_path)
-    {
-        this->m_content = WallpaperEngine::FileSystem::loadFullFile (jsonfile_path);
-        this->m_projectFile = json::parse (this->m_content);
-
-        json::const_iterator file_it = this->m_projectFile.find ("file");
-        json::const_iterator name_it = this->m_projectFile.find ("title");
-        json::const_iterator type_it = this->m_projectFile.find ("type");
-
-        if (file_it != this->m_projectFile.end ())
-        {
-            // load scene file
-            this->m_file = (*file_it).get <std::string> ().c_str ();
-            this->m_scene = new scene (this->m_file);
-        }
-
-        if (type_it != this->m_projectFile.end ())
-        {
-            this->m_type = type_it.value ();
-        }
-
-        if (name_it != this->m_projectFile.end ())
-        {
-            this->m_title = name_it.value ();
-        }
-
-        if (this->m_type != "scene")
-        {
-            throw std::runtime_error ("Only scene wallpapers are supported");
-        }
-    }
-
-    scene* project::getScene ()
-    {
-        return this->m_scene;
-    }
-}

+ 0 - 30
src/WallpaperEngine/project.h

@@ -1,30 +0,0 @@
-#ifndef WALLENGINE_PROJECT_H
-#define WALLENGINE_PROJECT_H
-
-#include <irrlicht/irrlicht.h>
-#include <nlohmann/json.hpp>
-#include "scene.h"
-
-namespace WallpaperEngine
-{
-    using json = nlohmann::json;
-
-    class project
-    {
-    public:
-        project (irr::io::path& jsonfile_path);
-
-        scene* getScene ();
-
-    private:
-        json m_projectFile;
-        std::string m_content;
-
-        std::string m_title;
-        std::string m_type;
-        irr::io::path m_file;
-        scene* m_scene;
-    };
-};
-
-#endif //WALLENGINE_PROJECT_H

+ 0 - 110
src/WallpaperEngine/scene.cpp

@@ -1,110 +0,0 @@
-#include <irrlicht/irrlicht.h>
-#include <iostream>
-#include <fstream>
-#include <nlohmann/json.hpp>
-
-#include <WallpaperEngine/scene.h>
-#include <WallpaperEngine/camera.h>
-
-#include "WallpaperEngine/FileSystem/FileSystem.h"
-
-namespace WallpaperEngine
-{
-    using json = nlohmann::json;
-
-    scene::scene (irr::io::path& file)
-    {
-        this->m_content = WallpaperEngine::FileSystem::loadFullFile (file);
-        this->m_json = json::parse (this->m_content);
-
-        // check basic elements
-        json::const_iterator camera_it =    this->m_json.find ("camera");
-        json::const_iterator general_it =   this->m_json.find ("general");
-        json::const_iterator objects_it =   this->m_json.find ("objects");
-
-        if (camera_it != this->m_json.end () && objects_it.value ().is_array () == true)
-        {
-            this->m_camera = new camera (*camera_it);
-        }
-
-        if (objects_it != this->m_json.end () && objects_it.value ().is_array () == true)
-        {
-            json::const_iterator cur = this->m_json ["objects"].begin ();
-            json::const_iterator end = this->m_json ["objects"].end ();
-
-            for (; cur != end; cur ++)
-            {
-                this->m_objects.push_back (new object (*cur, this));
-            }
-        }
-
-        json::const_iterator orthogonalprojection = (*general_it).find ("orthogonalprojection");
-
-        if (orthogonalprojection != (*general_it).end () && (*orthogonalprojection).is_object () == true)
-        {
-            json::const_iterator width = (*orthogonalprojection).find ("width");
-            json::const_iterator height = (*orthogonalprojection).find ("height");
-
-            if (width != (*orthogonalprojection).end () && (*width).is_number () == true)
-            {
-                this->m_width = *width;
-            }
-
-            if (height != (*orthogonalprojection).end () && (*height).is_number () == true)
-            {
-                this->m_height= *height;
-            }
-
-            this->m_isOrthogonal = true;
-        }
-    }
-
-    scene::~scene ()
-    {
-        // free memory used by the objects
-        std::vector<object*>::const_iterator cur = this->m_objects.begin ();
-        std::vector<object*>::const_iterator end = this->m_objects.end ();
-
-        for (; cur != end; cur ++)
-        {
-            delete *cur;
-        }
-
-        // remove elements from the vector
-        this->m_objects.erase (this->m_objects.begin (), this->m_objects.end ());
-
-        // free camera
-        delete this->m_camera;
-    }
-
-    camera* scene::getCamera ()
-    {
-        return this->m_camera;
-    }
-
-    bool scene::isOrthogonal ()
-    {
-        return this->m_isOrthogonal;
-    }
-
-    float scene::getProjectionWidth ()
-    {
-        return this->m_width;
-    }
-
-    float scene::getProjectionHeight ()
-    {
-        return this->m_height;
-    }
-
-    void scene::render ()
-    {
-        std::vector<object*>::const_iterator cur = this->m_objects.begin ();
-        std::vector<object*>::const_iterator end = this->m_objects.end ();
-
-        for (; cur != end; cur ++)
-        {
-            (*cur)->render ();
-        }
-    }
-}

+ 0 - 41
src/WallpaperEngine/scene.h

@@ -1,41 +0,0 @@
-#ifndef WALLENGINE_SCENE_H
-#define WALLENGINE_SCENE_H
-
-#include <iostream>
-#include <irrlicht/irrlicht.h>
-#include <nlohmann/json.hpp>
-#include <WallpaperEngine/object.h>
-#include <WallpaperEngine/camera.h>
-#include <WallpaperEngine/video/node.h>
-
-namespace WallpaperEngine
-{
-    using json = nlohmann::json;
-
-    class object;
-    class scene : public WallpaperEngine::video::node
-    {
-    public:
-        scene (irr::io::path& file);
-        ~scene ();
-
-        camera* getCamera ();
-        bool isOrthogonal ();
-        float getProjectionWidth ();
-        float getProjectionHeight ();
-        void render ();
-
-    private:
-        float m_width;
-        float m_height;
-        bool m_isOrthogonal;
-
-        irr::io::path m_file;
-        std::string m_content;
-        camera* m_camera;
-        std::vector<object*> m_objects;
-        json m_json;
-    };
-};
-
-#endif //WALLENGINE_SCENE_H

+ 0 - 63
src/WallpaperEngine/sound.cpp

@@ -1,63 +0,0 @@
-#include <SDL_rwops.h>
-#include <SDL_mixer.h>
-#include "sound.h"
-#include "WallpaperEngine/Irrlicht/CContext.h"
-
-extern WallpaperEngine::Irrlicht::CContext* IrrlichtContext;
-
-namespace WallpaperEngine
-{
-    sound::sound (json json_data, WallpaperEngine::object* parent) : object3d (object3d::Type::Type_Material, parent)
-    {
-        json::const_iterator cur = json_data.begin ();
-        json::const_iterator end = json_data.end ();
-
-        for (; cur != end; cur ++)
-        {
-            this->m_filenames.push_back ((*cur).get <std::string> ());
-        }
-
-        this->play ();
-    }
-
-    void sound::play ()
-    {
-        std::vector<std::string>::const_iterator cur = this->m_filenames.begin ();
-        std::vector<std::string>::const_iterator end = this->m_filenames.end ();
-
-        for (; cur != end; cur ++)
-        {
-            SDL_RWops* sdlRwops = nullptr;
-            Mix_Music* music = nullptr;
-            irr::io::IReadFile* readfile = IrrlichtContext->getDevice ()->getFileSystem ()->createAndOpenFile ((*cur).c_str ());
-            int filesize = readfile->getSize ();
-            char* filebuffer = new char [filesize];
-
-            readfile->read (filebuffer, filesize);
-
-            sdlRwops = SDL_RWFromConstMem(filebuffer, filesize);
-            music = Mix_LoadMUS_RW (sdlRwops);
-            readfile->drop ();
-
-            if (music == nullptr)
-            {
-                IrrlichtContext->getDevice ()->getLogger ()->log ("Cannot load audio", Mix_GetError (), irr::ELL_ERROR);
-            }
-
-            this->m_bufferReader.push_back (sdlRwops);
-            this->m_soundBuffer.push_back (filebuffer);
-            this->m_sdl.push_back (music);
-        }
-
-        std::vector<Mix_Music*>::const_iterator mixcur = this->m_sdl.begin ();
-        std::vector<Mix_Music*>::const_iterator mixend = this->m_sdl.end ();
-
-        for (; mixcur != mixend; mixcur ++)
-        {
-            if (Mix_PlayMusic ((*mixcur), -1) == -1)
-            {
-                IrrlichtContext->getDevice ()->getLogger ()->log ("Cannot play audio", Mix_GetError (), irr::ELL_ERROR);
-            }
-        }
-    }
-}

+ 0 - 31
src/WallpaperEngine/sound.h

@@ -1,31 +0,0 @@
-#ifndef WALLENGINE_SOUND_H
-#define WALLENGINE_SOUND_H
-
-#include <nlohmann/json.hpp>
-#include <irrlicht/irrlicht.h>
-#include <SDL_mixer.h>
-
-#include <WallpaperEngine/object3d.h>
-#include <WallpaperEngine/object.h>
-
-namespace WallpaperEngine
-{
-    using json = nlohmann::json;
-
-    class sound : public WallpaperEngine::object3d
-    {
-    public:
-        sound (json json_data, WallpaperEngine::object* parent);
-
-        void play ();
-
-    private:
-        std::vector<std::string> m_filenames;
-        std::vector <Mix_Music*> m_sdl;
-        std::vector <SDL_RWops*> m_bufferReader;
-        std::vector <void*> m_soundBuffer;
-    };
-};
-
-
-#endif //WALLENGINE_SOUND_H

+ 0 - 20
src/WallpaperEngine/texture.cpp

@@ -1,20 +0,0 @@
-#include <WallpaperEngine/texture.h>
-#include <stdexcept>
-#include <lz4.h>
-
-#include <WallpaperEngine/Irrlicht/CContext.h>
-
-extern WallpaperEngine::Irrlicht::CContext* IrrlichtContext;
-
-namespace WallpaperEngine
-{
-    texture::texture (irr::io::path& file)
-    {
-        this->m_texture = IrrlichtContext->getDevice ()->getVideoDriver ()->getTexture (file);
-    }
-
-    irr::video::ITexture* texture::getIrrTexture ()
-    {
-        return this->m_texture;
-    }
-}

+ 0 - 21
src/WallpaperEngine/texture.h

@@ -1,21 +0,0 @@
-#ifndef WALLENGINE_TEXTURE_H
-#define WALLENGINE_TEXTURE_H
-
-#include <irrlicht/irrlicht.h>
-
-namespace WallpaperEngine
-{
-    class texture
-    {
-    public:
-        texture (irr::io::path& file);
-
-        irr::video::ITexture* getIrrTexture ();
-
-    private:
-        irr::video::ITexture* m_texture;
-    };
-}
-
-
-#endif //WALLENGINE_TEXTURE_H

+ 0 - 67
src/WallpaperEngine/video/material.cpp

@@ -1,67 +0,0 @@
-#include <WallpaperEngine/video/material.h>
-#include <WallpaperEngine/Irrlicht/CContext.h>
-
-extern WallpaperEngine::Irrlicht::CContext* IrrlichtContext;
-
-namespace WallpaperEngine
-{
-    namespace video
-    {
-        material::material (irr::core::vector3df origin, WallpaperEngine::scene *scene)
-        {
-            m_origin = origin;
-            m_scene = scene;
-            m_material.Wireframe = false;
-            m_material.Lighting = false;
-
-            irr::f32 xright = this->m_origin.X;
-            irr::f32 xleft = -this->m_origin.X;
-            irr::f32 ztop = this->m_origin.Y;
-            irr::f32 zbottom = -this->m_origin.Y;
-            irr::f32 z = this->m_scene->getCamera ()->getEye ().Z;
-
-            m_vertices [0].Pos = irr::core::vector3df (xleft,   ztop,    z); // top left
-            m_vertices [1].Pos = irr::core::vector3df (xright,  ztop,    z); // top right
-            m_vertices [2].Pos = irr::core::vector3df (xright,  zbottom, z); // bottom right
-            m_vertices [3].Pos = irr::core::vector3df (xleft,   zbottom, z); // bottom left
-
-            m_vertices [0].TCoords = irr::core::vector2df (1.0f, 0.0f);
-            m_vertices [1].TCoords = irr::core::vector2df (0.0f, 0.0f);
-            m_vertices [2].TCoords = irr::core::vector2df (0.0f, 1.0f);
-            m_vertices [3].TCoords = irr::core::vector2df (1.0f, 1.0f);
-
-            m_vertices [0].Color = irr::video::SColor (255, 255, 255, 255);
-            m_vertices [1].Color = irr::video::SColor (255, 255, 255, 255);
-            m_vertices [2].Color = irr::video::SColor (255, 255, 255, 255);
-            m_vertices [3].Color = irr::video::SColor (255, 255, 255, 255);
-        }
-
-        void material::setFlag(irr::video::E_MATERIAL_FLAG flag, bool newvalue)
-        {
-            this->getMaterial ().setFlag (flag, newvalue);
-        }
-
-        void material::setType(irr::video::E_MATERIAL_TYPE newType)
-        {
-            this->getMaterial ().MaterialType = newType;
-        }
-
-        irr::video::SMaterial& material::getMaterial ()
-        {
-            return this->m_material;
-        }
-
-        void material::render ()
-        {
-            uint16_t indices[] =
-            {
-                    0, 1, 2, 3
-            };
-
-            IrrlichtContext->getDevice ()->getVideoDriver ()->setMaterial (m_material);
-            IrrlichtContext->getDevice ()->getVideoDriver ()->drawVertexPrimitiveList (
-                m_vertices, 4, indices, 1, irr::video::EVT_STANDARD, irr::scene::EPT_QUADS, irr::video::EIT_16BIT
-            );
-        }
-    }
-}

+ 0 - 32
src/WallpaperEngine/video/material.h

@@ -1,32 +0,0 @@
-#ifndef WALLENGINE_MATERIAL_H
-#define WALLENGINE_MATERIAL_H
-
-
-#include <irrlicht/vector3d.h>
-#include <WallpaperEngine/scene.h>
-#include <WallpaperEngine/video/node.h>
-
-namespace WallpaperEngine
-{
-    namespace video
-    {
-        class material : public node
-        {
-        public:
-            material (irr::core::vector3df origin, WallpaperEngine::scene* scene);
-            void render ();
-            irr::video::SMaterial& getMaterial ();
-            void setFlag(irr::video::E_MATERIAL_FLAG flag, bool newvalue);
-            void setType(irr::video::E_MATERIAL_TYPE newType);
-
-        private:
-            irr::video::S3DVertex m_vertices [4];
-            irr::video::SMaterial m_material;
-            irr::core::vector3df m_origin;
-            WallpaperEngine::scene* m_scene;
-        };
-    }
-}
-
-
-#endif //WALLENGINE_MATERIAL_H

+ 0 - 12
src/WallpaperEngine/video/node.cpp

@@ -1,12 +0,0 @@
-#include <WallpaperEngine/video/node.h>
-
-namespace WallpaperEngine
-{
-    namespace video
-    {
-        void node::render ()
-        {
-
-        }
-    }
-}

+ 0 - 17
src/WallpaperEngine/video/node.h

@@ -1,17 +0,0 @@
-#ifndef WALLENGINE_NODE_H
-#define WALLENGINE_NODE_H
-
-namespace WallpaperEngine
-{
-    namespace video
-    {
-        class node
-        {
-        public:
-            virtual void render ();
-        };
-    }
-}
-
-
-#endif //WALLENGINE_NODE_H

+ 0 - 65
src/WallpaperEngine/video/renderer.cpp

@@ -1,65 +0,0 @@
-#include <WallpaperEngine/video/renderer.h>
-#include <WallpaperEngine/Irrlicht/CContext.h>
-
-extern WallpaperEngine::Irrlicht::CContext* IrrlichtContext;
-
-namespace WallpaperEngine
-{
-    namespace video
-    {
-        void renderer::queueNode (node* node)
-        {
-            s_nodes.push_back (node);
-        }
-
-        void renderer::setupOrthographicCamera (WallpaperEngine::scene* scene)
-        {
-            setupOrthographicCamera (
-                    scene->getProjectionWidth (),
-                    scene->getProjectionHeight (),
-                    scene->getCamera ()->getCenter (),
-                    scene->getCamera ()->getEye (),
-                    scene->getCamera ()->getUp ().X,
-                    scene->getCamera ()->getUp ().Y
-            );
-        }
-
-        void renderer::setupOrthographicCamera (irr::f32 width, irr::f32 height, irr::core::vector3df position, irr::core::vector3df lookat, irr::f32 znear, irr::f32 zfar)
-        {
-            irr::core::matrix4 identity; identity.makeIdentity ();
-            irr::core::matrix4 orthoProjection; orthoProjection.buildProjectionMatrixOrthoLH(
-                    width,
-                    height,
-                    znear,
-                    zfar
-            );
-            s_camera = IrrlichtContext->getDevice ()->getSceneManager ()->addCameraSceneNode (0, position, lookat);
-            s_camera->setProjectionMatrix (orthoProjection);
-
-            IrrlichtContext->getDevice ()->getVideoDriver ()->setTransform (irr::video::ETS_PROJECTION, orthoProjection);
-            IrrlichtContext->getDevice ()->getVideoDriver ()->setTransform (irr::video::ETS_VIEW, identity);
-            IrrlichtContext->getDevice ()->getVideoDriver ()->setTransform (irr::video::ETS_WORLD, identity);
-        }
-
-        void renderer::render ()
-        {
-            if (IrrlichtContext->getDevice ()->getVideoDriver () == nullptr)
-                return;
-
-            IrrlichtContext->getDevice ()->getVideoDriver ()->beginScene(false, true, irr::video::SColor(0, 0, 0, 0));
-
-            std::vector<node*>::const_iterator cur = s_nodes.begin ();
-            std::vector<node*>::const_iterator end = s_nodes.end ();
-
-            for(; cur != end; cur ++)
-            {
-                (*cur)->render ();
-            }
-
-            IrrlichtContext->getDevice ()->getVideoDriver ()->endScene ();
-        }
-
-        std::vector<node*> renderer::s_nodes;
-        irr::scene::ICameraSceneNode* renderer::s_camera;
-    }
-};

+ 0 - 29
src/WallpaperEngine/video/renderer.h

@@ -1,29 +0,0 @@
-#ifndef WALLENGINE_RENDER_H
-#define WALLENGINE_RENDER_H
-
-#include <vector>
-
-#include <WallpaperEngine/video/node.h>
-#include <WallpaperEngine/scene.h>
-
-namespace WallpaperEngine
-{
-    namespace video
-    {
-        class renderer
-        {
-        public:
-            static void queueNode (node* node);
-            static void setupOrthographicCamera (WallpaperEngine::scene* scene);
-            static void setupOrthographicCamera (irr::f32 width, irr::f32 height, irr::core::vector3df position, irr::core::vector3df lookat, irr::f32 znear, irr::f32 zfar);
-            static void render ();
-
-        private:
-            static std::vector<node*> s_nodes;
-            static irr::scene::ICameraSceneNode* s_camera;
-        };
-    }
-}
-
-
-#endif //WALLENGINE_RENDER_H