Prechádzať zdrojové kódy

- Removed all the contents of the res folder as those weren't needed anymore
+ Added basic, single-pass-effects parsing
- Removed duplicated code for effect parsing
+ Added support for shader loading and applying to materials (might not work with every shader, still needs some more investigation)
+ Added support for TEXB0001 containers to be able to load images from the wallpaperengine original files

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

Alexis Maiquez 7 rokov pred
rodič
commit
2be1bffb6f

+ 1 - 0
.gitignore

@@ -1 +1,2 @@
 cmake-build-debug
+assets

+ 6 - 4
main.cpp

@@ -45,9 +45,9 @@ class MyShaderCallback : public irr::video::IShaderConstantSetCallBack
         services->setVertexShaderConstant ("g_Direction", &g_Direction, 1);
         services->setVertexShaderConstant ("g_Time", &g_Time, 1);
         services->setVertexShaderConstant ("g_ModelViewProjectionMatrix", worldViewProj.pointer(), 16);
-        services->setVertexShaderConstant ("g_Texture0Resolution", g_Texture1Resolution, 4);
-        services->setVertexShaderConstant ("g_Texture1Resolution", g_Texture1Resolution, 4);
-        services->setVertexShaderConstant ("g_Texture2Resolution", g_Texture1Resolution, 4);
+        services->setVertexShaderConstant ("g_Texture0Resolution", &g_Texture1Resolution [0], 4);
+        services->setVertexShaderConstant ("g_Texture1Resolution", &g_Texture1Resolution [1], 4);
+        services->setVertexShaderConstant ("g_Texture2Resolution", &g_Texture1Resolution [2], 4);
 
         // TODO: Support up to 7 materials (as wallpaper engine)
         services->setPixelShaderConstant ("g_Strength", &g_Strength, 1);
@@ -124,13 +124,15 @@ int main (int argc, char* argv[])
     irr::io::path _wp_engine_folder = "/home/almamu/Development/tmp/nier__automata_-_become_as_gods_edition/";
     irr::io::path _wp_project_file = _wp_engine_folder + "project.json";
 
+    // load the assets folder from wallpaper engine
+    wp::irrlicht::device->getFileSystem ()->addFileArchive ("../assets.zip", true, false);
+
     // set our working directory
     wp::irrlicht::device->getFileSystem ()->changeWorkingDirectoryTo (_wp_engine_folder);
 
     // register custom loader
     wp::irrlicht::driver->addExternalImageLoader (new irr::video::CImageLoaderTex ());
     wp::irrlicht::device->getFileSystem ()->addArchiveLoader (new CArchiveLoaderPkg (wp::irrlicht::device->getFileSystem ()));
-    // wp::irrlicht::device->getFileSystem ()->addFileArchive ("./", true, false, irr::io::E_FILE_ARCHIVE_TYPE::EFAT_FOLDER);
     // wp::irrlicht::device->getFileSystem ()->addFileArchive (_wp_engine_folder + "scene.pkg", true, false); // add the pkg file to the lookup list
 
     wp::project* wp_project = new wp::project (_wp_project_file);

BIN
res/2b.png


BIN
res/materials/bIW3uM3.jpg


BIN
res/materials/effects/waterripplenormal.png


BIN
res/materials/plant-on-water.png


BIN
res/materials/top-part.png


BIN
res/materials/water-intact.png


BIN
res/materials/white.png


+ 0 - 40
res/shaders/common.h

@@ -1,40 +0,0 @@
-#define M_PI 3.14159265359
-#define M_PI_HALF 1.57079632679
-#define M_PI_2 6.28318530718
-
-#define SQRT_2 1.41421356237
-#define SQRT_3 1.73205080756
-
-///////////////////////////////////////////
-// Color conversion
-///////////////////////////////////////////
-vec3 hsv2rgb(vec3 c)
-{
-    vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
-    vec3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www);
-    return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
-}
-
-vec3 rgb2hsv(vec3 RGB)
-{
-    vec4 P = (RGB.g < RGB.b) ? vec4(RGB.bg, -1.0, 2.0/3.0) : vec4(RGB.gb, 0.0, -1.0/3.0);
-    vec4 Q = (RGB.r < P.x) ? vec4(P.xyw, RGB.r) : vec4(RGB.r, P.yzx);
-    float C = Q.x - min(Q.w, Q.y);
-    float H = abs((Q.w - Q.y) / (6 * C + 1e-10) + Q.z);
-
-    vec3 HCV = vec3(H, C, Q.x);
-    float S = HCV.y / (HCV.z + 1e-10);
-    return vec3(HCV.x, S, HCV.z);
-}
-
-vec2 rotateVec2(vec2 v, float r)
-{
-    vec2 cs = vec2(cos(r), sin(r));
-    return vec2(v.x * cs.x - v.y * cs.y,
-                v.x * cs.y + v.y * cs.x);
-}
-
-float greyscale(vec3 color)
-{
-    return dot(color, vec3(0.11, 0.59, 0.3));
-}

+ 0 - 39
res/shaders/effects/waterripple_opengl.frag

@@ -1,39 +0,0 @@
-
-// [COMBO_OFF] {"material":"ui_editor_properties_specular","combo":"SPECULAR","type":"options","default":0}
-
-varying vec4 v_TexCoord;
-varying vec2 v_Scroll;
-
-uniform sampler2D g_Texture0; // {"material":"ui_editor_properties_framebuffer","hidden":true}
-uniform sampler2D g_Texture1; // {"material":"ui_editor_properties_water_normal"}
-uniform sampler2D g_Texture2; // {"material":"ui_editor_properties_opacity_mask","mode":"opacitymask","default":"util/white"}
-
-uniform float g_Strength; // {"material":"ui_editor_properties_ripple_strength","default":0.1,"range":[0,1]}
-uniform float g_SpecularPower; // {"material":"ui_editor_properties_ripple_specular_power","default":1.0,"range":[0,100]}
-uniform float g_SpecularStrength; // {"material":"ui_editor_properties_ripple_specular_strength","default":1.0,"range":[0,10]}
-uniform vec3 g_SpecularColor; // {"material":"ui_editor_properties_ripple_specular_color","default":"1 1 1","type":"color"}
-
-varying vec4 v_TexCoordRipple;
-
-void main() {
-	vec2 texCoord = v_TexCoord.xy;
-
-	float mask = texSample2D(g_Texture2, v_TexCoord.zw).r;
-
-	vec3 n1 = texSample2D(g_Texture1, v_TexCoordRipple.xy).xyz * 2 - 1;
-	vec3 n2 = texSample2D(g_Texture1, v_TexCoordRipple.zw).xyz * 2 - 1;
-	vec3 normal = normalize(vec3(n1.xy + n2.xy, n1.z));
-
-	texCoord.xy += normal.xy * g_Strength * g_Strength * mask;
-
-	gl_FragColor = texSample2D(g_Texture0, texCoord);
-
-#if SPECULAR == 1
-	vec2 direction = vec2(0.5, 0.0) - v_TexCoord.xy;
-	direction = normalize(direction);
-	float specular = max(0.0, dot(normal.xy, direction)) * max(0.0, dot(direction, vec2(0.0, -1.0)));
-	
-	specular = pow(specular, g_SpecularPower) * g_SpecularStrength;
-	gl_FragColor.rgb += specular * g_SpecularColor * gl_FragColor.a;
-#endif
-}

+ 0 - 40
res/shaders/effects/waterripple_opengl.vert

@@ -1,40 +0,0 @@
-#include "common.h"
-
-uniform mat4 g_ModelViewProjectionMatrix;
-uniform float g_Time;
-uniform vec4 g_Texture0Resolution;
-uniform vec4 g_Texture2Resolution;
-
-uniform float g_AnimationSpeed; // {"material":"ui_editor_properties_animation_speed","default":0.15,"range":[0,0.5]}
-uniform float g_Scale; // {"material":"ui_editor_properties_ripple_scale","default":1,"range":[0,10]}
-uniform float g_ScrollSpeed; // {"material":"ui_editor_properties_scroll_speed","default":0,"range":[0,0.5]}
-uniform float g_Direction; // {"material":"ui_editor_properties_scroll_direction","default":0,"range":[0,6.28]}
-
-attribute vec3 a_Position;
-attribute vec2 a_TexCoord;
-
-varying vec4 v_TexCoord;
-varying vec4 v_TexCoordRipple;
-
-void main() {
-	gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
-	v_TexCoord.xy = a_TexCoord;
-
-	float piFrac = 0.78539816339744830961566084581988 * 0.5;
-	float pi = 3.141;
-
-	vec2 coordsRotated = v_TexCoord.xy;
-	vec2 coordsRotated2 = v_TexCoord.xy * 1.333;
-
-	vec2 scroll = rotateVec2(vec2(0, -1), g_Direction) * g_ScrollSpeed * g_ScrollSpeed * g_Time;
-
-	v_TexCoordRipple.xy = coordsRotated + g_Time * g_AnimationSpeed * g_AnimationSpeed + scroll;
-	v_TexCoordRipple.zw = coordsRotated2 - g_Time * g_AnimationSpeed * g_AnimationSpeed + scroll;
-	v_TexCoordRipple *= g_Scale;
-
-	float rippleTextureAdjustment = (g_Texture0Resolution.x / g_Texture0Resolution.y);
-	v_TexCoordRipple.xz *= rippleTextureAdjustment;
-
-	v_TexCoord.zw = vec2(v_TexCoord.x * g_Texture2Resolution.z / g_Texture2Resolution.x,
-						 v_TexCoord.y * g_Texture2Resolution.w / g_Texture2Resolution.y);
-}

+ 142 - 1
wallpaperengine/effect.cpp

@@ -1,5 +1,10 @@
 #include <wallpaperengine/fs/utils.h>
+
+#include "shaders/compiler.h"
 #include "effect.h"
+#include "irrlicht.h"
+
+extern irr::f32 g_Time;
 
 namespace wp
 {
@@ -10,7 +15,143 @@ namespace wp
 
         if (file != json_data.end () && (*file).is_string () == true)
         {
-            this->m_file = ("effects/" + (*file).get <std::string> ()).c_str ();
+            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");
+
+        if (textures == (*curpass).end () || (*textures).is_array () == false)
+            return;
+
+        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 wp::texture (texturepath));
+            }
+        }
+
+        this->m_content = wp::fs::utils::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 = wp::fs::utils::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";
+
+            wp::shaders::compiler* fragcompiler = new wp::shaders::compiler (fragpath, wp::shaders::compiler::Type::Type_Pixel, false);
+            wp::shaders::compiler* vertcompiler = new wp::shaders::compiler (vertpath, wp::shaders::compiler::Type::Type_Vertex, false);
+
+            wp::irrlicht::driver->getGPUProgrammingServices ()
+                ->addHighLevelShaderMaterial (
+                    fragcompiler->precompile ().c_str (), "main", irr::video::EVST_VS_2_0,
+                    vertcompiler->precompile ().c_str (), "main", irr::video::EPST_PS_2_0,
+                    this, irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL, 0, irr::video::EGSL_DEFAULT
+                );
+
+            delete fragcompiler;
+            delete vertcompiler;
         }
     }
+
+    std::vector<wp::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)
+    {
+        // TODO: IMPLEMENT PROPER SHADER CODE
+        irr::f32 g_AnimationSpeed = 0.1f;
+        irr::f32 g_Scale = 2.5f;
+        irr::f32 g_ScrollSpeed = 0.0f;
+        irr::f32 g_Direction = 0.0f;
+        irr::f32 g_Strength = 0.07f;
+        irr::f32 g_SpecularPower = 1.0f;
+        irr::f32 g_SpecularStrength = 1.0f;
+        irr::f32 g_SpecularColor [3] = {1.0f, 1.0f, 1.0f};
+        irr::f32 g_Texture1Resolution [4] = {1.0f, 1.0f, 1.0f, 1.0f};
+        irr::f32 g_Texture0 = 0;
+        irr::f32 g_Texture1 = 1;
+        irr::f32 g_Texture2 = 2;
+
+        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);
+
+        services->setVertexShaderConstant ("g_AnimationSpeed", &g_AnimationSpeed, 1);
+        services->setVertexShaderConstant ("g_Scale", &g_Scale, 1);
+        services->setVertexShaderConstant ("g_ScrollSpeed", &g_ScrollSpeed, 1);
+        services->setVertexShaderConstant ("g_Direction", &g_Direction, 1);
+        services->setVertexShaderConstant ("g_Time", &g_Time, 1);
+        services->setVertexShaderConstant ("g_ModelViewProjectionMatrix", worldViewProj.pointer(), 16);
+        services->setVertexShaderConstant ("g_Texture0Resolution", g_Texture1Resolution, 4);
+        services->setVertexShaderConstant ("g_Texture1Resolution", g_Texture1Resolution, 4);
+        services->setVertexShaderConstant ("g_Texture2Resolution", g_Texture1Resolution, 4);
+
+        // TODO: Support up to 7 materials (as wallpaper engine)
+        services->setPixelShaderConstant ("g_Strength", &g_Strength, 1);
+        services->setPixelShaderConstant ("g_SpecularPower", &g_SpecularPower, 1);
+        services->setPixelShaderConstant ("g_SpecularStrength", &g_SpecularStrength, 1);
+        services->setPixelShaderConstant ("g_SpecularColor", g_SpecularColor, 3);
+        services->setPixelShaderConstant ("g_Texture0", &g_Texture0, 1);
+        services->setPixelShaderConstant ("g_Texture1", &g_Texture1, 1);
+        services->setPixelShaderConstant ("g_Texture2", &g_Texture2, 1);
+    }
 };

+ 12 - 2
wallpaperengine/effect.h

@@ -2,19 +2,29 @@
 #define WALLENGINE_EFFECT_H
 
 #include <nlohmann/json.hpp>
-#include <irrlicht/path.h>
+#include <irrlicht/irrlicht.h>
+
+#include "texture.h"
 
 namespace wp
 {
     using json = nlohmann::json;
 
-    class effect
+    class effect : public irr::video::IShaderConstantSetCallBack
     {
     public:
         effect (json json_data);
 
+        virtual void OnSetConstants (irr::video::IMaterialRendererServices* services, int32_t userData);
+
+        std::vector <wp::texture*>& getTextureList ();
+        irr::s32 getMaterialType ();
     private:
+        std::vector <wp::texture*> m_textures;
+        std::string m_content;
+        json m_json;
         irr::io::path m_file;
+        irr::s32 m_materialType;
         std::vector<void*> m_passes;
     };
 }

+ 33 - 34
wallpaperengine/image.cpp

@@ -10,8 +10,10 @@
 
 namespace wp
 {
-    image::image (json json_data, wp::scene* scene) : object3d (object3d::Type::Type_Material, scene)
+    image::image (json json_data, wp::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");
@@ -65,39 +67,12 @@ namespace wp
             }
         }
 
-        // TODO: CHECK EFFECT PASSES HERE SO WE CAN TAKE IN ACCOUNT THE EXTRA TEXTURES FOR SHADERS, ETC
-        json::const_iterator effects = json_data.find ("effects");
-
-        if (effects != json_data.end ())
-        {
-            // TODO: SUPPORT MULTIPLE EFFECTS
-            json::const_iterator effectsItem = (*effects).begin ();
-
-            if (effectsItem != (*effects).end ())
-            {
-                // TODO: SUPPORT MULTIPLE PASSES FOR EFFECTS
-                json::const_iterator passes = (*effectsItem).find ("passes");
-                json::const_iterator file = (*effectsItem).find ("file");
-            }
-        }
-
-        if (origin_it != json_data.end ())
-        {
-            std::string origin = *origin_it;
-            this->m_origin = wp::core::ato3vf (origin.c_str ());
-        }
-        else
-        {
-            // TOOD: CHANGE TO CENTER?
-            this->m_origin = irr::core::vector3df (0.0f, 0.0f, 0.0f);
-        }
-
         // initialize actual material properties
-        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;
+        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
@@ -123,8 +98,32 @@ namespace wp
             this->getMaterial ().setTexture (i, (*cur)->getIrrTexture ());
         }
 
+        std::vector<wp::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<wp::texture*> list = (*effect)->getTextureList ();
+
+            std::vector<wp::texture*>::const_iterator curtex = list.begin ();
+            std::vector<wp::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->setType (irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL);
         this->setFlag (irr::video::EMF_LIGHTING, false);
         this->setFlag (irr::video::EMF_BLEND_OPERATION, true);
     }

+ 1 - 2
wallpaperengine/image.h

@@ -14,7 +14,7 @@ namespace wp
     class image : public object3d
     {
     public:
-        image(json json_data, wp::scene* scene);
+        image(json json_data, wp::object* parent);
         irr::video::SMaterial& getMaterial ();
         void setFlag(irr::video::E_MATERIAL_FLAG flag, bool newvalue);
         void setType(irr::video::E_MATERIAL_TYPE newType);
@@ -26,7 +26,6 @@ namespace wp
         irr::video::S3DVertex m_vertices [4];
         irr::video::SMaterial m_material;
 
-        irr::core::vector3df m_origin;
         irr::io::path m_file;
         std::string m_content;
 

+ 13 - 3
wallpaperengine/irr/CImageLoaderTEX.cpp

@@ -87,6 +87,11 @@ namespace irr {
 
                 input->seek (4, true);
             }
+            else if (memcmp (buffer, "TEXB0001", 9) == 0)
+            {
+                containerVersion = 1;
+                input->seek (4, true);
+            }
             else
             {
                 wp::irrlicht::device->getLogger ()->log ("LOAD TEX: Unknown container type\n", input->getFileName ().c_str (), irr::ELL_ERROR);
@@ -117,8 +122,13 @@ namespace irr {
 
             input->read (&mipmap_width, 4);
             input->read (&mipmap_height, 4);
-            input->read (&mipmap_compression, 4);
-            input->read (&mipmap_uncompressed_size, 4);
+
+            if (containerVersion > 1)
+            {
+                input->read (&mipmap_compression, 4);
+                input->read (&mipmap_uncompressed_size, 4);
+            }
+
             input->read (&mipmap_compressed_size, 4);
 
             char *decompressedBuffer = new char [mipmap_uncompressed_size];
@@ -146,7 +156,7 @@ namespace irr {
                 input->read (decompressedBuffer, mipmap_uncompressed_size);
             }
 
-            if (containerVersion == 2)
+            if (containerVersion == 2 || containerVersion == 1)
             {
                 image = wp::irrlicht::driver->createImage (ECF_A8R8G8B8, irr::core::dimension2d<u32> (width, height));
 

+ 45 - 13
wallpaperengine/object.cpp

@@ -83,19 +83,7 @@ namespace wp
             _type = object3d::Type::Type_Particle;
         }
 
-        switch (_type)
-        {
-            case object3d::Type::Type_Material:
-                this->m_object3d = new wp::image (json_data, this->m_scene);
-                break;
-
-            case object3d::Type::Type_Model:
-                break;
-
-            case object3d::Type::Type_Particle:
-                break;
-        }
-
+        // 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)
@@ -108,6 +96,19 @@ namespace wp
                 this->m_effects.push_back (new effect (*cur));
             }
         }
+
+        switch (_type)
+        {
+            case object3d::Type::Type_Material:
+                this->m_object3d = new wp::image (json_data, this);
+                break;
+
+            case object3d::Type::Type_Model:
+                break;
+
+            case object3d::Type::Type_Particle:
+                break;
+        }
     }
 
     object::~object ()
@@ -125,4 +126,35 @@ namespace wp
             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;
+    }
+
+    wp::scene* object::getScene ()
+    {
+        return this->m_scene;
+    }
 }

+ 10 - 0
wallpaperengine/object.h

@@ -22,6 +22,16 @@ namespace wp
         object (json json_data, wp::scene* scene);
         ~object ();
 
+        irr::core::vector2df& getSize ();
+        irr::core::vector3df& getScale ();
+        irr::core::vector3df& getOrigin ();
+
+        irr::core::vector3df& getAngles ();
+
+        std::vector<effect*>& getEffects ();
+
+        wp::scene* getScene ();
+
         void render ();
     private:
         int m_id;

+ 1 - 2
wallpaperengine/object3d.cpp

@@ -3,10 +3,9 @@
 
 namespace wp
 {
-    object3d::object3d (object3d::Type type, wp::scene* scene)
+    object3d::object3d (object3d::Type type, wp::object* parent)
     {
         this->m_type = type;
-        this->m_scene = scene;
     }
 
     template <class T> T* object3d::as()

+ 2 - 2
wallpaperengine/object3d.h

@@ -18,7 +18,7 @@ namespace wp
             Type_None = 3
         };
 
-        object3d (Type type, wp::scene* scene);
+        object3d (Type type, wp::object* parent);
 
         virtual void render ();
 
@@ -26,7 +26,7 @@ namespace wp
         template <class T> bool is();
 
     protected:
-        wp::scene* m_scene;
+        wp::object* m_parent;
 
     private:
         Type m_type;

+ 2 - 0
wallpaperengine/scene.cpp

@@ -54,6 +54,8 @@ namespace wp
             {
                 this->m_height= *height;
             }
+
+            this->m_isOrthogonal = true;
         }
     }