diff --git a/.gitignore b/.gitignore index 2dff2f0..986415c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ cmake-build-debug +assets \ No newline at end of file diff --git a/main.cpp b/main.cpp index 6897d6a..ee03328 100644 --- a/main.cpp +++ b/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); diff --git a/res/2b.png b/res/2b.png deleted file mode 100644 index 36098d5..0000000 Binary files a/res/2b.png and /dev/null differ diff --git a/res/materials/bIW3uM3.jpg b/res/materials/bIW3uM3.jpg deleted file mode 100644 index dbad78e..0000000 Binary files a/res/materials/bIW3uM3.jpg and /dev/null differ diff --git a/res/materials/effects/waterripplenormal.png b/res/materials/effects/waterripplenormal.png deleted file mode 100644 index 0f8a365..0000000 Binary files a/res/materials/effects/waterripplenormal.png and /dev/null differ diff --git a/res/materials/plant-on-water.png b/res/materials/plant-on-water.png deleted file mode 100644 index a4e7af4..0000000 Binary files a/res/materials/plant-on-water.png and /dev/null differ diff --git a/res/materials/top-part.png b/res/materials/top-part.png deleted file mode 100644 index 74b787c..0000000 Binary files a/res/materials/top-part.png and /dev/null differ diff --git a/res/materials/water-intact.png b/res/materials/water-intact.png deleted file mode 100644 index 5402c77..0000000 Binary files a/res/materials/water-intact.png and /dev/null differ diff --git a/res/materials/white.png b/res/materials/white.png deleted file mode 100644 index 4d48cc3..0000000 Binary files a/res/materials/white.png and /dev/null differ diff --git a/res/shaders/common.h b/res/shaders/common.h deleted file mode 100644 index 6ed99ed..0000000 --- a/res/shaders/common.h +++ /dev/null @@ -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)); -} \ No newline at end of file diff --git a/res/shaders/effects/waterripple_opengl.frag b/res/shaders/effects/waterripple_opengl.frag deleted file mode 100644 index 5536e62..0000000 --- a/res/shaders/effects/waterripple_opengl.frag +++ /dev/null @@ -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 -} diff --git a/res/shaders/effects/waterripple_opengl.vert b/res/shaders/effects/waterripple_opengl.vert deleted file mode 100644 index 00c5b11..0000000 --- a/res/shaders/effects/waterripple_opengl.vert +++ /dev/null @@ -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); -} diff --git a/wallpaperengine/effect.cpp b/wallpaperengine/effect.cpp index 1b7480a..7493853 100644 --- a/wallpaperengine/effect.cpp +++ b/wallpaperengine/effect.cpp @@ -1,5 +1,10 @@ #include + +#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 ()).c_str (); + this->m_file = (*file).get ().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 () + ".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 ().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 ()).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& 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); + } }; \ No newline at end of file diff --git a/wallpaperengine/effect.h b/wallpaperengine/effect.h index b5ba63c..bcbc270 100644 --- a/wallpaperengine/effect.h +++ b/wallpaperengine/effect.h @@ -2,19 +2,29 @@ #define WALLENGINE_EFFECT_H #include -#include +#include + +#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 & getTextureList (); + irr::s32 getMaterialType (); private: + std::vector m_textures; + std::string m_content; + json m_json; irr::io::path m_file; + irr::s32 m_materialType; std::vector m_passes; }; } diff --git a/wallpaperengine/image.cpp b/wallpaperengine/image.cpp index a8ea5ba..85c9d02 100644 --- a/wallpaperengine/image.cpp +++ b/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::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 list = (*effect)->getTextureList (); + + std::vector::const_iterator curtex = list.begin (); + std::vector::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); } diff --git a/wallpaperengine/image.h b/wallpaperengine/image.h index 5e110e7..bdec15c 100644 --- a/wallpaperengine/image.h +++ b/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; diff --git a/wallpaperengine/irr/CImageLoaderTEX.cpp b/wallpaperengine/irr/CImageLoaderTEX.cpp index 0d683c7..291e860 100644 --- a/wallpaperengine/irr/CImageLoaderTEX.cpp +++ b/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 (width, height)); diff --git a/wallpaperengine/object.cpp b/wallpaperengine/object.cpp index f8067aa..c6a453a 100644 --- a/wallpaperengine/object.cpp +++ b/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& object::getEffects () + { + return this->m_effects; + } + + wp::scene* object::getScene () + { + return this->m_scene; + } } \ No newline at end of file diff --git a/wallpaperengine/object.h b/wallpaperengine/object.h index 3a5366f..97e6c18 100644 --- a/wallpaperengine/object.h +++ b/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& getEffects (); + + wp::scene* getScene (); + void render (); private: int m_id; diff --git a/wallpaperengine/object3d.cpp b/wallpaperengine/object3d.cpp index 86d954d..73c15f8 100644 --- a/wallpaperengine/object3d.cpp +++ b/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 T* object3d::as() diff --git a/wallpaperengine/object3d.h b/wallpaperengine/object3d.h index 5f04750..828d027 100644 --- a/wallpaperengine/object3d.h +++ b/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 bool is(); protected: - wp::scene* m_scene; + wp::object* m_parent; private: Type m_type; diff --git a/wallpaperengine/scene.cpp b/wallpaperengine/scene.cpp index 2540a1a..5a3dbfb 100644 --- a/wallpaperengine/scene.cpp +++ b/wallpaperengine/scene.cpp @@ -54,6 +54,8 @@ namespace wp { this->m_height= *height; } + + this->m_isOrthogonal = true; } }