Pārlūkot izejas kodu

Merge pull request #46 from Almamu/opengl-port

Rewrite using OpenGL
Alexis Maiquez 5 gadi atpakaļ
vecāks
revīzija
0328dbad92
100 mainītis faili ar 1971 papildinājumiem un 3218 dzēšanām
  1. 1 1
      .gitignore
  2. 3 0
      .gitmodules
  3. 0 1
      .idea/.name
  4. 0 7
      .idea/misc.xml
  5. 0 8
      .idea/modules.xml
  6. 0 2
      .idea/temp.iml
  7. 0 6
      .idea/vcs.xml
  8. 0 774
      .idea/workspace.xml
  9. 50 19
      CMakeLists.txt
  10. 83 0
      CMakeModules/FindFreeImage.cmake
  11. 0 25
      CMakeModules/FindIrrlicht.cmake
  12. 11 9
      README.md
  13. 21 6
      docs/textures/TEXTURE_FORMAT.md
  14. 1 0
      lib/glfw
  15. 155 65
      main.cpp
  16. 31 0
      src/WallpaperEngine/Assets/CCombinedContainer.cpp
  17. 32 0
      src/WallpaperEngine/Assets/CCombinedContainer.h
  18. 52 0
      src/WallpaperEngine/Assets/CContainer.cpp
  19. 72 0
      src/WallpaperEngine/Assets/CContainer.h
  20. 59 0
      src/WallpaperEngine/Assets/CDirectory.cpp
  21. 26 0
      src/WallpaperEngine/Assets/CDirectory.h
  22. 19 0
      src/WallpaperEngine/Assets/CFileEntry.h
  23. 170 0
      src/WallpaperEngine/Assets/CPackage.cpp
  24. 68 0
      src/WallpaperEngine/Assets/CPackage.h
  25. 356 0
      src/WallpaperEngine/Assets/CTexture.cpp
  26. 117 0
      src/WallpaperEngine/Assets/CTexture.h
  27. 29 24
      src/WallpaperEngine/Core/CObject.cpp
  28. 18 18
      src/WallpaperEngine/Core/CObject.h
  29. 15 6
      src/WallpaperEngine/Core/CProject.cpp
  30. 8 4
      src/WallpaperEngine/Core/CProject.h
  31. 45 35
      src/WallpaperEngine/Core/CScene.cpp
  32. 40 36
      src/WallpaperEngine/Core/CScene.h
  33. 5 3
      src/WallpaperEngine/Core/CVideo.cpp
  34. 3 5
      src/WallpaperEngine/Core/CVideo.h
  35. 51 38
      src/WallpaperEngine/Core/Core.cpp
  36. 18 9
      src/WallpaperEngine/Core/Core.h
  37. 8 8
      src/WallpaperEngine/Core/Objects/CEffect.cpp
  38. 4 4
      src/WallpaperEngine/Core/Objects/CEffect.h
  39. 26 14
      src/WallpaperEngine/Core/Objects/CImage.cpp
  40. 18 13
      src/WallpaperEngine/Core/Objects/CImage.h
  41. 12 13
      src/WallpaperEngine/Core/Objects/CParticle.cpp
  42. 12 13
      src/WallpaperEngine/Core/Objects/CParticle.h
  43. 8 10
      src/WallpaperEngine/Core/Objects/CSound.cpp
  44. 8 10
      src/WallpaperEngine/Core/Objects/CSound.h
  45. 2 2
      src/WallpaperEngine/Core/Objects/Effects/CBind.cpp
  46. 3 5
      src/WallpaperEngine/Core/Objects/Effects/CBind.h
  47. 2 2
      src/WallpaperEngine/Core/Objects/Effects/CFBO.cpp
  48. 3 4
      src/WallpaperEngine/Core/Objects/Effects/CFBO.h
  49. 6 1
      src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.cpp
  50. 1 0
      src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.h
  51. 2 2
      src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.cpp
  52. 3 4
      src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.h
  53. 3 3
      src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantInteger.cpp
  54. 3 4
      src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantInteger.h
  55. 3 3
      src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector3.cpp
  56. 4 4
      src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector3.h
  57. 6 5
      src/WallpaperEngine/Core/Objects/Images/CMaterial.cpp
  58. 4 4
      src/WallpaperEngine/Core/Objects/Images/CMaterial.h
  59. 7 7
      src/WallpaperEngine/Core/Objects/Particles/CControlPoint.cpp
  60. 8 10
      src/WallpaperEngine/Core/Objects/Particles/CControlPoint.h
  61. 14 14
      src/WallpaperEngine/Core/Objects/Particles/CEmitter.cpp
  62. 17 19
      src/WallpaperEngine/Core/Objects/Particles/CEmitter.h
  63. 3 3
      src/WallpaperEngine/Core/Objects/Particles/CInitializer.cpp
  64. 3 5
      src/WallpaperEngine/Core/Objects/Particles/CInitializer.h
  65. 4 4
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CAlphaRandom.cpp
  66. 6 8
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CAlphaRandom.h
  67. 6 6
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CAngularVelocityRandom.cpp
  68. 6 8
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CAngularVelocityRandom.h
  69. 6 6
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CColorRandom.cpp
  70. 8 8
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CColorRandom.h
  71. 4 4
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.cpp
  72. 6 8
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.h
  73. 16 16
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.cpp
  74. 14 15
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.h
  75. 4 4
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.cpp
  76. 6 8
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.h
  77. 8 8
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CTurbulentVelocityRandom.cpp
  78. 13 14
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CTurbulentVelocityRandom.h
  79. 6 6
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CVelocityRandom.cpp
  80. 6 8
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CVelocityRandom.h
  81. 0 2
      src/WallpaperEngine/Core/Projects/CPropertyBoolean.h
  82. 3 3
      src/WallpaperEngine/Core/Projects/CPropertyColor.cpp
  83. 4 5
      src/WallpaperEngine/Core/Projects/CPropertyColor.h
  84. 8 7
      src/WallpaperEngine/Core/Scenes/CCamera.cpp
  85. 7 9
      src/WallpaperEngine/Core/Scenes/CCamera.h
  86. 3 3
      src/WallpaperEngine/Core/Scenes/CProjection.cpp
  87. 5 7
      src/WallpaperEngine/Core/Scenes/CProjection.h
  88. 28 0
      src/WallpaperEngine/Core/Types/FloatColor.h
  89. 28 0
      src/WallpaperEngine/Core/Types/IntegerColor.h
  90. 11 17
      src/WallpaperEngine/FileSystem/FileSystem.cpp
  91. 3 1
      src/WallpaperEngine/FileSystem/FileSystem.h
  92. 0 239
      src/WallpaperEngine/Irrlicht/CContext.cpp
  93. 0 57
      src/WallpaperEngine/Irrlicht/CContext.h
  94. 0 20
      src/WallpaperEngine/Irrlicht/CEventReceiver.cpp
  95. 0 18
      src/WallpaperEngine/Irrlicht/CEventReceiver.h
  96. 0 134
      src/WallpaperEngine/Irrlicht/CFileList.cpp
  97. 0 121
      src/WallpaperEngine/Irrlicht/CFileList.h
  98. 0 780
      src/WallpaperEngine/Irrlicht/CImageLoaderTEX.cpp
  99. 0 183
      src/WallpaperEngine/Irrlicht/CImageLoaderTEX.h
  100. 0 194
      src/WallpaperEngine/Irrlicht/CPkgReader.cpp

+ 1 - 1
.gitignore

@@ -1,4 +1,4 @@
 cmake-build-debug
 assets.zip
 .idea
-assets/
+assets/

+ 3 - 0
.gitmodules

@@ -0,0 +1,3 @@
+[submodule "glfw"]
+	path = lib/glfw
+	url = git@github.com:Almamu/glfw.git

+ 0 - 1
.idea/.name

@@ -1 +0,0 @@
-wallengine

+ 0 - 7
.idea/misc.xml

@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
-  <component name="JavaScriptSettings">
-    <option name="languageLevel" value="ES6" />
-  </component>
-</project>

+ 0 - 8
.idea/modules.xml

@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="ProjectModuleManager">
-    <modules>
-      <module fileurl="file://$PROJECT_DIR$/.idea/temp.iml" filepath="$PROJECT_DIR$/.idea/temp.iml" />
-    </modules>
-  </component>
-</project>

+ 0 - 2
.idea/temp.iml

@@ -1,2 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module classpath="CMake" type="CPP_MODULE" version="4" />

+ 0 - 6
.idea/vcs.xml

@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="VcsDirectoryMappings">
-    <mapping directory="$PROJECT_DIR$" vcs="Git" />
-  </component>
-</project>

+ 0 - 774
.idea/workspace.xml

@@ -1,774 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="CMakeRunConfigurationManager" shouldGenerate="true" shouldDeleteObsolete="true" buildAllGenerated="true">
-    <generated>
-      <config projectName="wallengine" targetName="wallengine" />
-      <config projectName="wallengine" targetName="temp" />
-    </generated>
-  </component>
-  <component name="CMakeSettings">
-    <configurations>
-      <configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
-    </configurations>
-  </component>
-  <component name="ChangeListManager">
-    <list default="true" id="18bb2960-e23f-4286-86eb-946e53957973" name="Default" comment="">
-      <change beforePath="$PROJECT_DIR$/wallpaperengine/image.cpp" afterPath="$PROJECT_DIR$/wallpaperengine/image.cpp" />
-      <change beforePath="$PROJECT_DIR$/wallpaperengine/texture.cpp" afterPath="$PROJECT_DIR$/wallpaperengine/texture.cpp" />
-    </list>
-    <ignored path="$PROJECT_DIR$/cmake-build-debug/" />
-    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
-    <option name="TRACKING_ENABLED" value="true" />
-    <option name="SHOW_DIALOG" value="false" />
-    <option name="HIGHLIGHT_CONFLICTS" value="true" />
-    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
-    <option name="LAST_RESOLUTION" value="IGNORE" />
-  </component>
-  <component name="ExecutionTargetManager" SELECTED_TARGET="CMakeBuildProfile:Debug" />
-  <component name="FileEditorManager">
-    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
-      <file leaf-file-name="main.cpp" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/main.cpp">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="880">
-              <caret line="155" column="0" lean-forward="false" selection-start-line="155" selection-start-column="0" selection-end-line="155" selection-end-column="0" />
-              <folding>
-                <element signature="e#0#19#0" expanded="true" />
-              </folding>
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="renderer.cpp" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/wallpaperengine/video/renderer.cpp">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="476">
-              <caret line="52" column="0" lean-forward="false" selection-start-line="52" selection-start-column="0" selection-end-line="52" selection-end-column="0" />
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="texture.h" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/wallpaperengine/texture.h">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="120">
-              <caret line="10" column="37" lean-forward="false" selection-start-line="10" selection-start-column="37" selection-end-line="10" selection-end-column="37" />
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="texture.cpp" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/wallpaperengine/texture.cpp">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="168">
-              <caret line="14" column="30" lean-forward="false" selection-start-line="14" selection-start-column="30" selection-end-line="14" selection-end-column="30" />
-              <folding>
-                <element signature="e#0#36#0" expanded="true" />
-              </folding>
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="image.h" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/wallpaperengine/image.h">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="312">
-              <caret line="26" column="40" lean-forward="false" selection-start-line="26" selection-start-column="30" selection-end-line="26" selection-end-column="40" />
-              <folding>
-                <element signature="e#55#83#0" expanded="true" />
-              </folding>
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="image.cpp" pinned="false" current-in-tab="true">
-        <entry file="file://$PROJECT_DIR$/wallpaperengine/image.cpp">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="492">
-              <caret line="88" column="103" lean-forward="true" selection-start-line="88" selection-start-column="103" selection-end-line="88" selection-end-column="103" />
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="scene.cpp" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/wallpaperengine/scene.cpp">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="536">
-              <caret line="104" column="0" lean-forward="false" selection-start-line="104" selection-start-column="0" selection-end-line="104" selection-end-column="0" />
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="object.cpp" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/wallpaperengine/object.cpp">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="530">
-              <caret line="124" column="0" lean-forward="false" selection-start-line="124" selection-start-column="0" selection-end-line="124" selection-end-column="0" />
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="object3d.h" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/wallpaperengine/object3d.h">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="288">
-              <caret line="26" column="0" lean-forward="false" selection-start-line="26" selection-start-column="0" selection-end-line="26" selection-end-column="0" />
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="fileResolver.cpp" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/wallpaperengine/fs/fileResolver.cpp">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="224">
-              <caret line="106" column="0" lean-forward="false" selection-start-line="106" selection-start-column="0" selection-end-line="106" selection-end-column="0" />
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-    </leaf>
-  </component>
-  <component name="FindInProjectRecents">
-    <findStrings>
-      <find>GL_INVA</find>
-      <find>GLSL TEST</find>
-      <find>arb</find>
-      <find>include</find>
-      <find>if</find>
-      <find>version</find>
-      <find>define</find>
-      <find>main</find>
-      <find>#</find>
-      <find>preproces</find>
-      <find>m_token</find>
-      <find>device</find>
-      <find>getAb</find>
-      <find>Compiled shader output for</find>
-      <find>getFileSystem</find>
-      <find>string</find>
-      <find>::resolve</find>
-      <find>append</find>
-      <find>new wp::image</find>
-      <find>new wp::object</find>
-      <find>mater</find>
-      <find>do_decompres</find>
-      <find>nier_</find>
-      <find>IShaderConstantSetCallBack</find>
-      <find>Failed reso</find>
-      <find>changeWorkingDirectory</find>
-      <find>::fileResolver</find>
-      <find>&quot;.&quot;</find>
-      <find>-&gt;render</find>
-      <find>Failed</find>
-    </findStrings>
-  </component>
-  <component name="Git.Settings">
-    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
-  </component>
-  <component name="IdeDocumentHistory">
-    <option name="CHANGED_PATHS">
-      <list>
-        <option value="$PROJECT_DIR$/compiler.cpp" />
-        <option value="$PROJECT_DIR$/wallpaperengine/camera.h" />
-        <option value="$PROJECT_DIR$/wallpaperengine/irrlicht.h" />
-        <option value="$PROJECT_DIR$/wallpaperengine/render/render.h" />
-        <option value="$PROJECT_DIR$/wallpaperengine/render/render.cpp" />
-        <option value="$PROJECT_DIR$/wallpaperengine/render/node.h" />
-        <option value="$PROJECT_DIR$/wallpaperengine/render/node.cpp" />
-        <option value="$PROJECT_DIR$/wallpaperengine/render/material.h" />
-        <option value="$PROJECT_DIR$/wallpaperengine/video/render.cpp" />
-        <option value="$PROJECT_DIR$/wallpaperengine/video/node.h" />
-        <option value="$PROJECT_DIR$/wallpaperengine/video/render.h" />
-        <option value="$PROJECT_DIR$/wallpaperengine/fs/pkg.cpp" />
-        <option value="$PROJECT_DIR$/wallpaperengine/fs/pkg.h" />
-        <option value="$PROJECT_DIR$/wallpaperengine/video/material.cpp" />
-        <option value="$PROJECT_DIR$/wallpaperengine/video/material.h" />
-        <option value="$PROJECT_DIR$/wallpaperengine/video/node.cpp" />
-        <option value="$PROJECT_DIR$/wallpaperengine/camera.cpp" />
-        <option value="$PROJECT_DIR$/wallpaperengine/config.cpp" />
-        <option value="$PROJECT_DIR$/wallpaperengine/config.h" />
-        <option value="$PROJECT_DIR$/wallpaperengine/core.cpp" />
-        <option value="$PROJECT_DIR$/wallpaperengine/core.h" />
-        <option value="$PROJECT_DIR$/wallpaperengine/effect.cpp" />
-        <option value="$PROJECT_DIR$/wallpaperengine/irrlicht.cpp" />
-        <option value="$PROJECT_DIR$/wallpaperengine/project.cpp" />
-        <option value="$PROJECT_DIR$/wallpaperengine/project.h" />
-        <option value="$PROJECT_DIR$/wallpaperengine/effect.h" />
-        <option value="$PROJECT_DIR$/wallpaperengine/fs/file.h" />
-        <option value="$PROJECT_DIR$/wallpaperengine/fs/file.cpp" />
-        <option value="$PROJECT_DIR$/wallpaperengine/material.cpp" />
-        <option value="$PROJECT_DIR$/wallpaperengine/shaders/compiler.h" />
-        <option value="$PROJECT_DIR$/wallpaperengine/shaders/compiler.cpp" />
-        <option value="$PROJECT_DIR$/wallpaperengine/material.h" />
-        <option value="$PROJECT_DIR$/wallpaperengine/fs/fileResolver.h" />
-        <option value="$PROJECT_DIR$/wallpaperengine/object3d.cpp" />
-        <option value="$PROJECT_DIR$/wallpaperengine/scene.cpp" />
-        <option value="$PROJECT_DIR$/wallpaperengine/object3d.h" />
-        <option value="$PROJECT_DIR$/wallpaperengine/scene.h" />
-        <option value="$PROJECT_DIR$/wallpaperengine/object.h" />
-        <option value="$PROJECT_DIR$/wallpaperengine/object.cpp" />
-        <option value="$PROJECT_DIR$/wallpaperengine/texture.h" />
-        <option value="$PROJECT_DIR$/wallpaperengine/image.h" />
-        <option value="$PROJECT_DIR$/nier_test.h" />
-        <option value="$PROJECT_DIR$/s3tc.cpp" />
-        <option value="$PROJECT_DIR$/wallpaperengine/video/renderer.h" />
-        <option value="$PROJECT_DIR$/wallpaperengine/video/renderer.cpp" />
-        <option value="$PROJECT_DIR$/nier_test.cpp" />
-        <option value="$PROJECT_DIR$/CMakeLists.txt" />
-        <option value="$PROJECT_DIR$/main.cpp" />
-        <option value="$PROJECT_DIR$/wallpaperengine/fs/fileResolver.cpp" />
-        <option value="$PROJECT_DIR$/wallpaperengine/texture.cpp" />
-        <option value="$PROJECT_DIR$/wallpaperengine/image.cpp" />
-      </list>
-    </option>
-  </component>
-  <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
-  <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
-  <component name="JsGulpfileManager">
-    <detection-done>true</detection-done>
-    <sorting>DEFINITION_ORDER</sorting>
-  </component>
-  <component name="NodePackageJsonFileManager">
-    <packageJsonPaths />
-  </component>
-  <component name="OCFindUsagesOptions" text="false" ivars="false" properties="true" derivedClasses="false" />
-  <component name="ProjectFrameBounds">
-    <option name="x" value="1099" />
-    <option name="y" value="309" />
-    <option name="width" value="1882" />
-    <option name="height" value="1032" />
-  </component>
-  <component name="ProjectView">
-    <navigator currentView="ProjectPane" proportions="" version="1">
-      <flattenPackages />
-      <showMembers />
-      <showModules />
-      <showLibraryContents />
-      <hideEmptyPackages />
-      <abbreviatePackageNames />
-      <autoscrollToSource />
-      <autoscrollFromSource />
-      <sortByType />
-      <manualOrder />
-      <foldersAlwaysOnTop value="true" />
-    </navigator>
-    <panes>
-      <pane id="ProjectPane">
-        <subPane>
-          <expand>
-            <path>
-              <item name="wallengine" type="dad4c3:CidrFilesViewHelper$MyProjectTreeStructure$1" />
-              <item name="linux-wallpaperengine" type="462c0819:PsiDirectoryNode" />
-            </path>
-            <path>
-              <item name="wallengine" type="dad4c3:CidrFilesViewHelper$MyProjectTreeStructure$1" />
-              <item name="linux-wallpaperengine" type="462c0819:PsiDirectoryNode" />
-              <item name="wallpaperengine" type="462c0819:PsiDirectoryNode" />
-            </path>
-          </expand>
-          <select />
-        </subPane>
-      </pane>
-    </panes>
-  </component>
-  <component name="PropertiesComponent">
-    <property name="WebServerToolWindowFactoryState" value="false" />
-    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
-    <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
-    <property name="nodejs_npm_path_reset_for_default_project" value="true" />
-    <property name="settings.editor.selected.configurable" value="editor.preferences.fonts.default" />
-  </component>
-  <component name="RecentsManager">
-    <key name="CopyFile.RECENT_KEYS">
-      <recent name="$PROJECT_DIR$" />
-      <recent name="$PROJECT_DIR$/res/materials/effects" />
-    </key>
-    <key name="MoveFile.RECENT_KEYS">
-      <recent name="$PROJECT_DIR$/res/shaders" />
-      <recent name="$PROJECT_DIR$/wallpaperengine/shaders" />
-      <recent name="$PROJECT_DIR$/res/shaders/effects" />
-      <recent name="$PROJECT_DIR$/CMakeModules" />
-      <recent name="$PROJECT_DIR$" />
-    </key>
-  </component>
-  <component name="RunDashboard">
-    <option name="ruleStates">
-      <list>
-        <RuleState>
-          <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
-        </RuleState>
-        <RuleState>
-          <option name="name" value="StatusDashboardGroupingRule" />
-        </RuleState>
-      </list>
-    </option>
-  </component>
-  <component name="RunManager">
-    <configuration name="Unnamed" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" PROJECT_NAME="wallengine" TARGET_NAME="wallengine" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="wallengine" RUN_TARGET_NAME="wallengine">
-      <envs />
-    </configuration>
-  </component>
-  <component name="ShelveChangesManager" show_recycled="false">
-    <option name="remove_strategy" value="false" />
-  </component>
-  <component name="SvnConfiguration">
-    <configuration />
-  </component>
-  <component name="TaskManager">
-    <task active="true" id="Default" summary="Default task">
-      <changelist id="18bb2960-e23f-4286-86eb-946e53957973" name="Default" comment="" />
-      <created>1530110193995</created>
-      <option name="number" value="Default" />
-      <option name="presentableId" value="Default" />
-      <updated>1530110193995</updated>
-      <workItem from="1530110195092" duration="9917000" />
-      <workItem from="1530613581741" duration="10035000" />
-      <workItem from="1530722346579" duration="9407000" />
-      <workItem from="1530742969892" duration="462000" />
-      <workItem from="1530736243286" duration="1301000" />
-      <workItem from="1530737554957" duration="12285000" />
-      <workItem from="1530778987650" duration="8899000" />
-      <workItem from="1530803672753" duration="4042000" />
-      <workItem from="1530808421701" duration="4380000" />
-      <workItem from="1530835045303" duration="119000" />
-      <workItem from="1530857868147" duration="24030000" />
-      <workItem from="1530906949920" duration="14611000" />
-      <workItem from="1531002668909" duration="7171000" />
-      <workItem from="1531833563019" duration="18910000" />
-      <workItem from="1535381505231" duration="2647000" />
-      <workItem from="1537556584820" duration="4148000" />
-    </task>
-    <servers />
-  </component>
-  <component name="TimeTrackingManager">
-    <option name="totallyTimeSpent" value="132364000" />
-  </component>
-  <component name="ToolWindowManager">
-    <frame x="1099" y="309" width="1882" height="1032" extended-state="0" />
-    <editor active="true" />
-    <layout>
-      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.15045674" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
-      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
-      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3242655" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
-      <window_info id="CMake" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32861805" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
-      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="true" content_ui="tabs" />
-      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32752994" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
-      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
-      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.33841133" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
-      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
-      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3297062" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
-      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
-      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.27312297" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
-      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
-      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
-      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
-      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
-      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
-      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
-    </layout>
-    <layout-to-restore>
-      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
-      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
-      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3242655" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
-      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
-      <window_info id="CMake" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32861805" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
-      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
-      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="true" content_ui="tabs" />
-      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
-      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33841133" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
-      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
-      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3297062" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
-      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.36165577" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
-      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
-      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32752994" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
-      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
-      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
-      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.27312297" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
-      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
-    </layout-to-restore>
-  </component>
-  <component name="TypeScriptGeneratedFilesManager">
-    <option name="version" value="1" />
-  </component>
-  <component name="VcsContentAnnotationSettings">
-    <option name="myLimit" value="2678400000" />
-  </component>
-  <component name="XDebuggerManager">
-    <breakpoint-manager>
-      <breakpoints>
-        <line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
-          <url>file://$PROJECT_DIR$/glsl/parser.cpp</url>
-          <line>310</line>
-          <option name="timeStamp" value="33" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
-          <url>file://$PROJECT_DIR$/glsl/parser.cpp</url>
-          <line>317</line>
-          <option name="timeStamp" value="39" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
-          <url>file://$PROJECT_DIR$/glsl/parser.cpp</url>
-          <line>641</line>
-          <option name="timeStamp" value="44" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
-          <url>file://$PROJECT_DIR$/glsl/parser.cpp</url>
-          <line>309</line>
-          <option name="timeStamp" value="45" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
-          <url>file://$PROJECT_DIR$/wallpaperengine/video/renderer.cpp</url>
-          <line>52</line>
-          <option name="timeStamp" value="137" />
-        </line-breakpoint>
-      </breakpoints>
-      <option name="time" value="140" />
-    </breakpoint-manager>
-    <watches-manager />
-  </component>
-  <component name="editorHistoryManager">
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/fs/pkg.cpp" />
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/fs/pkg.h" />
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/camera.h">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="168">
-          <caret line="14" column="0" lean-forward="false" selection-start-line="14" selection-start-column="0" selection-end-line="17" selection-end-column="38" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/config.cpp">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="0">
-          <caret line="0" column="35" lean-forward="false" selection-start-line="0" selection-start-column="35" selection-end-line="0" selection-end-column="35" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/config.h">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="48">
-          <caret line="4" column="27" lean-forward="false" selection-start-line="4" selection-start-column="27" selection-end-line="4" selection-end-column="27" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/core.cpp">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="252">
-          <caret line="21" column="1" lean-forward="true" selection-start-line="21" selection-start-column="1" selection-end-line="21" selection-end-column="1" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/core.h">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="48">
-          <caret line="4" column="30" lean-forward="false" selection-start-line="4" selection-start-column="30" selection-end-line="4" selection-end-column="30" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/irrlicht.h">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="132">
-          <caret line="11" column="43" lean-forward="false" selection-start-line="11" selection-start-column="43" selection-end-line="12" selection-end-column="52" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/project.h">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="60">
-          <caret line="5" column="34" lean-forward="false" selection-start-line="5" selection-start-column="34" selection-end-line="5" selection-end-column="34" />
-          <folding>
-            <element signature="e#59#89#0" expanded="false" />
-          </folding>
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/effect.h">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="72">
-          <caret line="6" column="12" lean-forward="false" selection-start-line="6" selection-start-column="12" selection-end-line="6" selection-end-column="12" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/effect.cpp">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="0">
-          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/fs/file.cpp" />
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/fs/file.h" />
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/shaders/compiler.h">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="432">
-          <caret line="41" column="35" lean-forward="false" selection-start-line="41" selection-start-column="35" selection-end-line="41" selection-end-column="35" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/nlohmann/detail/input/json_sax.hpp">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="208">
-          <caret line="246" column="0" lean-forward="false" selection-start-line="246" selection-start-column="0" selection-end-line="246" selection-end-column="0" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/fs/fileResolver.h">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="420">
-          <caret line="38" column="15" lean-forward="false" selection-start-line="38" selection-start-column="15" selection-end-line="38" selection-end-column="15" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/project.cpp">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="96">
-          <caret line="15" column="0" lean-forward="false" selection-start-line="15" selection-start-column="0" selection-end-line="15" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/material.h" />
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/material.cpp" />
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/scene.h">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="168">
-          <caret line="14" column="17" lean-forward="false" selection-start-line="14" selection-start-column="17" selection-end-line="14" selection-end-column="17" />
-          <folding>
-            <element signature="e#55#74#0" expanded="false" />
-          </folding>
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/object.h">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="336">
-          <caret line="28" column="27" lean-forward="false" selection-start-line="28" selection-start-column="27" selection-end-line="28" selection-end-column="27" />
-          <folding>
-            <element signature="e#57#76#0" expanded="false" />
-          </folding>
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/camera.cpp">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="156">
-          <caret line="14" column="12" lean-forward="false" selection-start-line="14" selection-start-column="12" selection-end-line="14" selection-end-column="44" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file:///usr/include/c++/8.1.1/bits/stl_iterator.h" />
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/video/node.h">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="0">
-          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/object3d.cpp">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="12">
-          <caret line="1" column="0" lean-forward="false" selection-start-line="1" selection-start-column="0" selection-end-line="1" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/s3tc.cpp" />
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/video/node.cpp">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="0">
-          <caret line="0" column="39" lean-forward="false" selection-start-line="0" selection-start-column="39" selection-end-line="0" selection-end-column="39" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/video/renderer.h">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="192">
-          <caret line="16" column="12" lean-forward="false" selection-start-line="16" selection-start-column="12" selection-end-line="16" selection-end-column="67" />
-          <folding>
-            <element signature="e#57#74#0" expanded="false" />
-          </folding>
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/video/material.h">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="276">
-          <caret line="25" column="31" lean-forward="false" selection-start-line="25" selection-start-column="31" selection-end-line="25" selection-end-column="31" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/irrlicht.cpp">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="0">
-          <caret line="0" column="37" lean-forward="false" selection-start-line="0" selection-start-column="37" selection-end-line="0" selection-end-column="37" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/nier_test.cpp" />
-    <entry file="file://$PROJECT_DIR$/nier_test.h" />
-    <entry file="file://$PROJECT_DIR$/CMakeLists.txt">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="180">
-          <caret line="15" column="116" lean-forward="false" selection-start-line="15" selection-start-column="116" selection-end-line="15" selection-end-column="116" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/video/material.cpp">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="84">
-          <caret line="7" column="20" lean-forward="false" selection-start-line="7" selection-start-column="20" selection-end-line="7" selection-end-column="20" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/shaders/compiler.cpp">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="1596">
-          <caret line="133" column="83" lean-forward="false" selection-start-line="133" selection-start-column="83" selection-end-line="133" selection-end-column="83" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/common.h" />
-    <entry file="file://$PROJECT_DIR$/res/shaders/effects/waterripple_opengl.vert">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="0">
-          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/res/shaders/effects/waterripple_opengl.frag">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="324">
-          <caret line="27" column="0" lean-forward="true" selection-start-line="27" selection-start-column="0" selection-end-line="27" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/res/shaders/common.h">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="0">
-          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file:///usr/include/irrlicht/irrAllocator.h">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="142">
-          <caret line="35" column="0" lean-forward="false" selection-start-line="35" selection-start-column="0" selection-end-line="35" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file:///usr/include/irrlicht/irrString.h">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="214">
-          <caret line="305" column="0" lean-forward="false" selection-start-line="305" selection-start-column="0" selection-end-line="305" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/object3d.h">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="288">
-          <caret line="26" column="0" lean-forward="false" selection-start-line="26" selection-start-column="0" selection-end-line="26" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/fs/fileResolver.cpp">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="224">
-          <caret line="106" column="0" lean-forward="false" selection-start-line="106" selection-start-column="0" selection-end-line="106" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/object.cpp">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="530">
-          <caret line="124" column="0" lean-forward="false" selection-start-line="124" selection-start-column="0" selection-end-line="124" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/scene.cpp">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="536">
-          <caret line="104" column="0" lean-forward="false" selection-start-line="104" selection-start-column="0" selection-end-line="104" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/main.cpp">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="880">
-          <caret line="155" column="0" lean-forward="false" selection-start-line="155" selection-start-column="0" selection-end-line="155" selection-end-column="0" />
-          <folding>
-            <element signature="e#0#19#0" expanded="true" />
-          </folding>
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/video/renderer.cpp">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="476">
-          <caret line="52" column="0" lean-forward="false" selection-start-line="52" selection-start-column="0" selection-end-line="52" selection-end-column="0" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/texture.h">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="120">
-          <caret line="10" column="37" lean-forward="false" selection-start-line="10" selection-start-column="37" selection-end-line="10" selection-end-column="37" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/image.h">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="312">
-          <caret line="26" column="40" lean-forward="false" selection-start-line="26" selection-start-column="30" selection-end-line="26" selection-end-column="40" />
-          <folding>
-            <element signature="e#55#83#0" expanded="true" />
-          </folding>
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/texture.cpp">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="168">
-          <caret line="14" column="30" lean-forward="false" selection-start-line="14" selection-start-column="30" selection-end-line="14" selection-end-column="30" />
-          <folding>
-            <element signature="e#0#36#0" expanded="true" />
-          </folding>
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/wallpaperengine/image.cpp">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="492">
-          <caret line="88" column="103" lean-forward="true" selection-start-line="88" selection-start-column="103" selection-end-line="88" selection-end-column="103" />
-          <folding />
-        </state>
-      </provider>
-    </entry>
-  </component>
-</project>

+ 50 - 19
CMakeLists.txt

@@ -6,23 +6,51 @@ set(CMAKE_CXX_FLAGS "-fpermissive")
 set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
 set(OpenGL_GL_PREFERENCE "LEGACY")
 
+# if you're developing you might find this debug option useful for shader output, although RenderDoc is encouraged
+add_compile_definitions(DEBUG=0)
+
+# add glfw3 customized version to the compilation
+add_subdirectory (lib/glfw)
+
 find_package(X11 REQUIRED)
 find_package(Xrandr REQUIRED)
 find_package(OpenGL REQUIRED)
+find_package(GLEW REQUIRED)
 find_package(GLUT REQUIRED)
 find_package(ZLIB REQUIRED)
-find_package(Irrlicht REQUIRED)
 find_package(SDL REQUIRED)
 find_package(SDL_mixer REQUIRED)
 find_package(LZ4 REQUIRED)
 find_package(FFmpeg REQUIRED)
-
-include_directories(${X11_INCLUDE_DIR} ${XRANDR_INCLUDE_DIR} ${IRRLICHT_INCLUDE_DIR} ${LZ4_INCLUDE_DIR} ${SDL_INCLUDE_DIRS} ${SDL_MIXER_INCLUDE_DIRS} ${FFMPEG_INCLUDE_DIR} src include)
+find_package(FreeImage REQUIRED)
+
+include_directories(
+    ${X11_INCLUDE_DIR}
+    ${XRANDR_INCLUDE_DIR}
+    ${GLEW_INCLUDE_DIR}
+    ${LZ4_INCLUDE_DIR}
+    ${SDL_INCLUDE_DIRS}
+    ${SDL_MIXER_INCLUDE_DIRS}
+    ${FFMPEG_INCLUDE_DIR}
+    ${FREEIMAGE_INCLUDE_DIR}
+    src
+    include)
 
 add_executable(
         wallengine
         main.cpp
 
+        src/WallpaperEngine/Assets/CContainer.h
+        src/WallpaperEngine/Assets/CContainer.cpp
+        src/WallpaperEngine/Assets/CCombinedContainer.h
+        src/WallpaperEngine/Assets/CCombinedContainer.cpp
+        src/WallpaperEngine/Assets/CDirectory.h
+        src/WallpaperEngine/Assets/CDirectory.cpp
+        src/WallpaperEngine/Assets/CPackage.h
+        src/WallpaperEngine/Assets/CPackage.cpp
+        src/WallpaperEngine/Assets/CTexture.h
+        src/WallpaperEngine/Assets/CTexture.cpp
+
         src/WallpaperEngine/Core/Core.h
         src/WallpaperEngine/Core/Core.cpp
 
@@ -39,14 +67,12 @@ add_executable(
         src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector4.h
         src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector4.cpp
 
-        src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableFloatPointer.h
-        src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableFloatPointer.cpp
-        src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector2Pointer.h
-        src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector2Pointer.cpp
-
         src/WallpaperEngine/Render/Shaders/Compiler.h
         src/WallpaperEngine/Render/Shaders/Compiler.cpp
 
+        src/WallpaperEngine/Render/CContext.h
+        src/WallpaperEngine/Render/CContext.cpp
+
         src/WallpaperEngine/Render/CWallpaper.h
         src/WallpaperEngine/Render/CWallpaper.cpp
         src/WallpaperEngine/Render/CScene.h
@@ -75,16 +101,8 @@ add_executable(
         src/WallpaperEngine/FileSystem/FileSystem.cpp
         src/WallpaperEngine/FileSystem/FileSystem.h
 
-        src/WallpaperEngine/Irrlicht/CEventReceiver.h
-        src/WallpaperEngine/Irrlicht/CEventReceiver.cpp
-        src/WallpaperEngine/Irrlicht/CContext.h
-        src/WallpaperEngine/Irrlicht/CContext.cpp
-        src/WallpaperEngine/Irrlicht/CImageLoaderTEX.h
-        src/WallpaperEngine/Irrlicht/CImageLoaderTEX.cpp
-        src/WallpaperEngine/Irrlicht/CPkgReader.h
-        src/WallpaperEngine/Irrlicht/CPkgReader.cpp
-        src/WallpaperEngine/Irrlicht/CFileList.h
-        src/WallpaperEngine/Irrlicht/CFileList.cpp
+        src/WallpaperEngine/Core/Types/FloatColor.h
+        src/WallpaperEngine/Core/Types/IntegerColor.h
 
         src/WallpaperEngine/Core/CProject.cpp
         src/WallpaperEngine/Core/CProject.h
@@ -163,4 +181,17 @@ add_executable(
         src/WallpaperEngine/Core/Objects/Images/Materials/CPass.h
 )
 
-target_link_libraries(wallengine ${X11_LIBRARIES} ${XRANDR_LIBRARIES} ${X11_Xxf86vm_LIB} ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${ZLIB_LIBRARIES} ${IRRLICHT_LIBRARY} ${LZ4_LIBRARY} ${SDL_LIBRARY} ${SDL_MIXER_LIBRARIES} ${FFMPEG_LIBRARIES})
+target_link_libraries(wallengine
+    ${X11_LIBRARIES}
+    ${XRANDR_LIBRARIES}
+    ${X11_Xxf86vm_LIB}
+    ${OPENGL_LIBRARIES}
+    ${GLEW_LIBRARIES}
+    ${GLUT_LIBRARIES}
+    ${ZLIB_LIBRARIES}
+    ${LZ4_LIBRARY}
+    ${SDL_LIBRARY}
+    ${SDL_MIXER_LIBRARIES}
+    ${FFMPEG_LIBRARIES}
+    ${FREEIMAGE_LIBRARIES}
+    glfw)

+ 83 - 0
CMakeModules/FindFreeImage.cmake

@@ -0,0 +1,83 @@
+# Find the FreeImage library.
+#
+# This module defines
+#  FREEIMAGE_FOUND             - True if FREEIMAGE was found.
+#  FREEIMAGE_INCLUDE_DIRS      - Include directories for FREEIMAGE headers.
+#  FREEIMAGE_LIBRARIES         - Libraries for FREEIMAGE.
+#
+# To specify an additional directory to search, set FREEIMAGE_ROOT.
+#
+# Copyright (c) 2010, Ewen Cheslack-Postava
+# Based on FindSQLite3.cmake by:
+#  Copyright (c) 2006, Jaroslaw Staniek, <js@iidea.pl>
+#  Extended by Siddhartha Chaudhuri, 2008.
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+#
+
+SET(FREEIMAGE_FOUND FALSE)
+SET(FREEIMAGE_INCLUDE_DIRS)
+SET(FREEIMAGE_LIBRARIES)
+
+SET(SEARCH_PATHS
+  $ENV{ProgramFiles}/freeimage/include
+  $ENV{SystemDrive}/freeimage/include
+  $ENV{ProgramFiles}/freeimage
+  $ENV{SystemDrive}/freeimage
+  )
+IF(FREEIMAGE_ROOT)
+  SET(SEARCH_PATHS
+    ${FREEIMAGE_ROOT}
+    ${FREEIMAGE_ROOT}/include
+    ${SEARCH_PATHS}
+    )
+ENDIF()
+
+FIND_PATH(FREEIMAGE_INCLUDE_DIRS
+  NAMES FreeImage.h
+  PATHS ${SEARCH_PATHS}
+  NO_DEFAULT_PATH)
+IF(NOT FREEIMAGE_INCLUDE_DIRS)  # now look in system locations
+  FIND_PATH(FREEIMAGE_INCLUDE_DIRS NAMES FreeImage.h)
+ENDIF(NOT FREEIMAGE_INCLUDE_DIRS)
+
+SET(FREEIMAGE_LIBRARY_DIRS)
+IF(FREEIMAGE_ROOT)
+  SET(FREEIMAGE_LIBRARY_DIRS ${FREEIMAGE_ROOT})
+  IF(EXISTS "${FREEIMAGE_ROOT}/lib")
+    SET(FREEIMAGE_LIBRARY_DIRS ${FREEIMAGE_LIBRARY_DIRS} ${FREEIMAGE_ROOT}/lib)
+  ENDIF()
+  IF(EXISTS "${FREEIMAGE_ROOT}/lib/static")
+    SET(FREEIMAGE_LIBRARY_DIRS ${FREEIMAGE_LIBRARY_DIRS} ${FREEIMAGE_ROOT}/lib/static)
+  ENDIF()
+ENDIF()
+
+# FREEIMAGE
+# Without system dirs
+FIND_LIBRARY(FREEIMAGE_LIBRARY
+  NAMES freeimage
+  PATHS ${FREEIMAGE_LIBRARY_DIRS}
+  NO_DEFAULT_PATH
+  )
+IF(NOT FREEIMAGE_LIBRARY)  # now look in system locations
+  FIND_LIBRARY(FREEIMAGE_LIBRARY NAMES freeimage)
+ENDIF(NOT FREEIMAGE_LIBRARY)
+
+SET(FREEIMAGE_LIBRARIES)
+IF(FREEIMAGE_LIBRARY)
+  SET(FREEIMAGE_LIBRARIES ${FREEIMAGE_LIBRARY})
+ENDIF()
+
+IF(FREEIMAGE_INCLUDE_DIRS AND FREEIMAGE_LIBRARIES)
+  SET(FREEIMAGE_FOUND TRUE)
+  IF(NOT FREEIMAGE_FIND_QUIETLY)
+    MESSAGE(STATUS "Found FreeImage: headers at ${FREEIMAGE_INCLUDE_DIRS}, libraries at ${FREEIMAGE_LIBRARY_DIRS} :: ${FREEIMAGE_LIBRARIES}")
+  ENDIF(NOT FREEIMAGE_FIND_QUIETLY)
+ELSE(FREEIMAGE_INCLUDE_DIRS AND FREEIMAGE_LIBRARIES)
+  SET(FREEIMAGE_FOUND FALSE)
+  IF(FREEIMAGE_FIND_REQUIRED)
+    MESSAGE(STATUS "FreeImage not found")
+  ENDIF(FREEIMAGE_FIND_REQUIRED)
+ENDIF(FREEIMAGE_INCLUDE_DIRS AND FREEIMAGE_LIBRARIES)
+
+MARK_AS_ADVANCED(FREEIMAGE_INCLUDE_DIRS FREEIMAGE_LIBRARIES)

+ 0 - 25
CMakeModules/FindIrrlicht.cmake

@@ -1,25 +0,0 @@
-FIND_PATH(IRRLICHT_INCLUDE_DIR irrlicht/irrlicht.h
-        PATHS $ENV{IRRDIR}/include
-        PATH_SUFFIXES irrlicht
-        )
-
-MESSAGE(STATUS "IRRLICHT_INCLUDE_DIR = ${IRRLICHT_INCLUDE_DIR}")
-
-FIND_LIBRARY(IRRLICHT_LIBRARY NAMES Irrlicht
-        PATHS $ENV{IRRDIR}/lib
-        )
-
-MESSAGE(STATUS "IRRLICHT_LIBRARY = ${IRRLICHT_LIBRARY}")
-
-# handle the QUIETLY and REQUIRED arguments and set IRRLICHT_FOUND to TRUE if
-# all listed variables are TRUE
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(IRRLICHT DEFAULT_MSG IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR)
-
-IF(IRRLICHT_FOUND)
-    SET(IRRLICHT_LIBRARIES ${IRRLICHT_LIBRARY})
-ELSE(IRRLICHT_FOUND)
-    SET(IRRLICHT_LIBRARIES)
-ENDIF(IRRLICHT_FOUND)
-
-MARK_AS_ADVANCED(IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR)

+ 11 - 9
README.md

@@ -1,5 +1,5 @@
 # 1. Disclaimer
-**This is an educational project**. Our main focus is to learn how Irrlicht Engine works and provide examples of usage of as much aspects of it as possible. We are not responsible for what others do with the source code downloaded from this project.
+**This is an educational project**. Although the project started as a learning exercise on the Irrlicht Engine, it has kind of turned into an OpenGL one instead due to limitations and issues with Irrlicht (most likely caused by my limited experience with graphics programming). Turns out working directly with OpenGL is not as hard as I thought. For more information on the project's license, check [LICENSE](LICENSE).
 
 # 2. What is this project all about?
 This projects aims to reproduce the background functionality of Wallpaper Engine on Linux systems. Simple as that.
@@ -10,7 +10,6 @@ Wallpaper Engine is a software designed by [Kristjan Skutta](https://store.steam
 # 4. Compilation requirements
 - OpenGL 2.1 support
 - CMake
-- Irrlicht
 - LZ4
 - ZLIB
 - SDL
@@ -18,6 +17,9 @@ Wallpaper Engine is a software designed by [Kristjan Skutta](https://store.steam
 - FFmpeg
 - X11
 - Xrandr
+- GLFW3
+- GLM
+- FreeImage
 
 # 5. How to use
 ## 5.1. Pre-requirements
@@ -29,11 +31,7 @@ Once Wallpaper Engine is downloaded open the installation folder (usually on C:\
 
 ![folder](docs/images/screenshot_folder.png)
 
-All the folders we see must be compressed in a single zip file for the project to load them:
-
-![compression](docs/images/zip.png)
-
-The zip must be named "assets.zip" and placed on the same folder as the directory where the project is going to be run from.
+The assets folder itself can be copied to the same folder where the binary lives.
 
 ## 5.3. Compilation steps
 The project is built on CMake as build engine. First we need to create the directory where the build will be stored and get into it:
@@ -54,7 +52,7 @@ Finally we can compile the project to generate the actual executable
 make
 ```
 
-**REMEMBER: The assets.zip file has to be at the same folder as the executable**
+**REMEMBER: The assets folder has to be at the same folder as the executable**
 
 ## 5.4. Running a background
 Currently both compressed and uncompressed backgrounds are supported.
@@ -88,4 +86,8 @@ To reduce the performance hit to your system you can reduce (or increase) the FP
 ###### Example background
 This was the first background to even be compatible with the software. And It's not 100% compatible yet. Both textures and shaders are properly loaded, but there are still particles missing.
 
-![example](docs/images/example.gif) 
+![example](docs/images/example.gif)
+
+# 6. Special thanks
+- [RePKG](https://github.com/notscuffed/repkg) for the information on texture flags
+- [RenderDoc](https://github.com/baldurk/renderdoc) for the so helpful OpenGL debugging tool that simplified finding issues on the new OpenGL code. Seriously this tool ROCKS

+ 21 - 6
docs/textures/TEXTURE_FORMAT.md

@@ -8,15 +8,30 @@ Wallpaper engine uses a custom texture storage format converted by resourcecompi
 | __Padding__ | 1 byte | Null terminator for string |
 | __Extra file type indicator?__ | 8 bytes | TEXI0001 |
 | __Padding__ | 1 byte | Null terminator for string |
-| __Texture type__ | 1 byte | 4 => DXT5? 0 => JPEG? |
-| __Unknown data__ | 15 bytes | To be reversed |
+| __Texture type__ | 4 bytes | 0 => ARGB8888, 4 => DXT5, 6 => DXT3, 7 => DXT1, 8 => RG88, 9 => R8 |
+| __Texture flags__ | 4 bytes | Flags for the texture (1 => Interpolation, 2 => ClampUVs, 4 => IsGif) |
+| __Texture Width__ | 4 bytes | Texture's full width |
+| __Texture Height__ | 4 bytes | Texture's full height |
 | __Width__ | 4 bytes | Image's width |
 | __Height__ | 4 bytes | Image's height |
-| __Unknown data__ | 5 bytes | To be reversed |
-| __Container version__ | 8 bytes | TEXB0003 |
+| __Unknown data__ | 4 bytes | To be reversed |
+| __Container version__ | 8 bytes | TEXB0003/TEXB0002/TEXB0001 |
 | __Padding__ | 1 byte | Null terminator for string |
-| __Unknown data__ | 8 bytes | To be reversed |
-| __Mip map levels__ | 4 bytes | The number of mipmaps stored for this texture |
+| __Texture information__ | x bytes | Varies depending on the container version |
+
+## TEXB0003
+| Information | Size | Default value |
+|---|---|---|
+| __Unknown data__ | 4 bytes | To be reversed |
+| __Free image format__ | 4 bytes | The type of file this texture is based off the FREEIMAGE library |
+| __Mip map levels__ | 4 bytes | The number of mipmap levels stored for this texture |
+| __Mipmap entry__ | x bytes | See Mipmap entries |
+
+## TEXB0002 and TEXB0001
+| Information | Size | Default value |
+|---|---|---|
+| __Unknown data__ | 4 bytes | To be reversed |
+| __Mip map levels__ | 4 bytes | The number of mipmap levels stored for this texture |
 | __Mipmap entry__ | x bytes | See Mipmap entries |
 
 ## Mipmap entries

+ 1 - 0
lib/glfw

@@ -0,0 +1 @@
+Subproject commit f4d5f760fdd69731c39d20c41a80945d61299778

+ 155 - 65
main.cpp

@@ -1,15 +1,29 @@
 #include <iostream>
-#include <irrlicht/irrlicht.h>
 #include <getopt.h>
+#include <unistd.h>
 #include <SDL_mixer.h>
 #include <SDL.h>
+#include <FreeImage.h>
+
+#include <GL/glew.h>
+#include <GL/glx.h>
+#include "GLFW/glfw3.h"
+
+#include <glm/glm.hpp>
+#include <glm/gtc/matrix_transform.hpp>
 
 #include "WallpaperEngine/Core/CProject.h"
-#include "WallpaperEngine/Irrlicht/CContext.h"
 #include "WallpaperEngine/Render/CWallpaper.h"
+#include "WallpaperEngine/Render/CContext.h"
 #include "WallpaperEngine/Render/CScene.h"
 #include "WallpaperEngine/Render/CVideo.h"
 
+#include "WallpaperEngine/Assets/CPackage.h"
+#include "WallpaperEngine/Assets/CDirectory.h"
+#include "WallpaperEngine/Assets/CCombinedContainer.h"
+
+#include "WallpaperEngine/Core/Types/FloatColor.h"
+
 enum BACKGROUND_RUN_MODE
 {
     RUN_MODE_UNKNOWN = 0,
@@ -18,8 +32,9 @@ enum BACKGROUND_RUN_MODE
     RUN_MODE_PACKAGE = 3
 };
 
-WallpaperEngine::Irrlicht::CContext* IrrlichtContext = nullptr;
-irr::f32 g_Time;
+float g_Time;
+
+using namespace WallpaperEngine::Core::Types;
 
 void print_help (const char* route)
 {
@@ -33,17 +48,24 @@ void print_help (const char* route)
         << "  --fps <maximum-fps>\tLimits the FPS to the given number, useful to keep battery consumption low" << std::endl;
 }
 
-std::string stringPathFixes(const std::string& s){
-    std::string str(s);
-    if(str.empty())
+std::string stringPathFixes(const std::string& s)
+{
+    if (s.empty () == true)
         return s;
-    if(str[0] == '\'' && str[str.size() - 1] == '\''){
-        str.erase(str.size() - 1, 1);
-        str.erase(0,1);
-    }
-    if(str[str.size() - 1] != '/')
+
+    std::string str (s);
+
+    // remove single-quotes from the arguments
+    if (str [0] == '\'' && str [str.size() - 1] == '\'')
+        str
+            .erase (str.size() - 1, 1)
+            .erase (0, 1);
+
+    // ensure there's a slash at the end of the path
+    if (str [str.size() - 1] != '/')
         str += '/';
-    return std::move(str);
+
+    return std::move (str);
 }
 
 int main (int argc, char* argv[])
@@ -85,13 +107,13 @@ int main (int argc, char* argv[])
             case 'p':
                 if (mode == RUN_MODE_UNKNOWN)
                     mode = RUN_MODE_PACKAGE;
-                path = optarg;
+                path = stringPathFixes (optarg);
                 break;
 
             case 'd':
                 if (mode == RUN_MODE_UNKNOWN)
                     mode = RUN_MODE_DIRECTORY;
-                path = optarg;
+                path = stringPathFixes (optarg);
                 break;
 
             case 's':
@@ -117,94 +139,162 @@ int main (int argc, char* argv[])
         return 0;
     }
 
-    try
+    // first of all, initialize the window
+    if (glfwInit () == GLFW_FALSE)
     {
-        IrrlichtContext = new WallpaperEngine::Irrlicht::CContext (screens, isRootWindow);
-        IrrlichtContext->initializeContext ();
-    }
-    catch (std::runtime_error& ex)
-    {
-        std::cerr << ex.what () << std::endl;
-
+        fprintf (stderr, "Failed to initialize GLFW\n");
         return 1;
     }
 
-    path = stringPathFixes (path);
+    // initialize freeimage
+    FreeImage_Initialise (TRUE);
 
-    irr::io::path wallpaper_path = IrrlichtContext->getDevice ()->getFileSystem ()->getAbsolutePath (path.c_str ());
-    irr::io::path project_path = wallpaper_path + "project.json";
+    // set some window hints (opengl version to be used)
+    glfwWindowHint (GLFW_SAMPLES, 4);
+    glfwWindowHint (GLFW_CONTEXT_VERSION_MAJOR, 2);
+    glfwWindowHint (GLFW_CONTEXT_VERSION_MINOR, 1);
+
+    std::string project_path = path + "project.json";
+    auto containers = new WallpaperEngine::Assets::CCombinedContainer ();
+
+    // add containers to the list
+    containers->add (new WallpaperEngine::Assets::CDirectory ("./assets/"));
+    // the background's path is required to load project.json regardless of the type of background we're using
+    containers->add (new WallpaperEngine::Assets::CDirectory (path));
 
     if (mode == RUN_MODE_PACKAGE)
     {
-        irr::io::path scene_path = wallpaper_path + "scene.pkg";
-        // add the package file to the lookup list
-        IrrlichtContext->getDevice ()->getFileSystem ()->addFileArchive (scene_path, true, false);
+        std::string scene_path = path + "scene.pkg";
+
+        // add the package to the list
+        containers->add (new WallpaperEngine::Assets::CPackage (scene_path));
     }
     else if (mode == RUN_MODE_DIRECTORY)
     {
-        project_path = wallpaper_path + "project.json";
-        // set the working directory to the project folder
-        IrrlichtContext->getDevice ()->getFileSystem ()->changeWorkingDirectoryTo (wallpaper_path);
+        // nothing to do here anymore
     }
 
-    if (shouldEnableAudio == true)
+    // parse the project.json file
+    auto project = WallpaperEngine::Core::CProject::fromFile ("project.json", containers);
+    WallpaperEngine::Render::CWallpaper* wallpaper;
+
+    // initialize custom context class
+    WallpaperEngine::Render::CContext* context = new WallpaperEngine::Render::CContext (screens);
+
+    // auto projection = project->getWallpaper ()->as <WallpaperEngine::Core::CScene> ()->getOrthogonalProjection ();
+    // create the window!
+    // TODO: DO WE NEED TO PASS MONITOR HERE OR ANYTHING?
+    // TODO: FIGURE OUT HOW TO PUT THIS WINDOW IN THE BACKGROUND
+    GLFWwindow* window = glfwCreateWindow (1920, 1080, "WallpaperEngine", NULL, NULL);
+
+    if (window == nullptr)
     {
-        int mixer_flags = MIX_INIT_MP3 | MIX_INIT_FLAC | MIX_INIT_OGG;
+        fprintf (stderr, "Failed to open a GLFW window");
+        glfwTerminate ();
+        return 2;
+    }
 
-        if (SDL_Init (SDL_INIT_AUDIO) < 0 || mixer_flags != Mix_Init (mixer_flags))
-        {
-            // Mix_GetError is an alias for SDL_GetError, so calling it directly will yield the correct result
-            // it doesn't matter if SDL_Init or Mix_Init failed, both report the errors through the same functions
-            IrrlichtContext->getDevice ()->getLogger ()->log ("Cannot initialize SDL audio system", SDL_GetError(),irr::ELL_ERROR);
-            return 2;
-        }
+    glfwMakeContextCurrent (window);
 
-        // initialize audio engine
-        Mix_OpenAudio (22050, AUDIO_S16SYS, 2, 640);
+    // TODO: FIGURE THESE OUT BASED ON THE SCREEN
+    int windowWidth = 1920;
+    int windowHeight = 1080;
+
+    // get the real framebuffer size
+    glfwGetFramebufferSize (window, &windowWidth, &windowHeight);
+    // set the default viewport
+    context->setDefaultViewport ({0, 0, windowWidth, windowHeight});
+
+    if (glewInit () != GLEW_OK)
+    {
+        fprintf (stderr, "Failed to initialize GLEW");
+        glfwTerminate ();
+        return 3;
     }
 
-    WallpaperEngine::Core::CProject* project = WallpaperEngine::Core::CProject::fromFile (project_path);
-    WallpaperEngine::Render::CWallpaper* wallpaper;
 
     if (project->getType () == "scene")
     {
         WallpaperEngine::Core::CScene* scene = project->getWallpaper ()->as <WallpaperEngine::Core::CScene> ();
-        wallpaper = new WallpaperEngine::Render::CScene (scene, IrrlichtContext);
-        IrrlichtContext->getDevice ()->getSceneManager ()->setAmbientLight (
-                    scene->getAmbientColor ().toSColor ()
-        );
+        wallpaper = new WallpaperEngine::Render::CScene (scene, containers);
     }
     else if (project->getType () == "video")
     {
-        wallpaper = new WallpaperEngine::Render::CVideo (
-                    project->getWallpaper ()->as <WallpaperEngine::Core::CVideo> (),
-                    IrrlichtContext
-        );
+        // special steps, running a video needs a root directory change, files are not loaded from the container classes
+        // as they're streamed from disk
+        chdir (path.c_str ());
+
+        WallpaperEngine::Core::CVideo* video = project->getWallpaper ()->as <WallpaperEngine::Core::CVideo> ();
+        wallpaper = new WallpaperEngine::Render::CVideo (video, containers);
     }
     else
     {
         throw std::runtime_error ("Unsupported wallpaper type");
     }
-    
-    irr::u32 minimumTime = 1000 / maximumFPS;
-    irr::u32 startTime = 0;
-    irr::u32 endTime = 0;
 
-    while (IrrlichtContext && IrrlichtContext->getDevice () && IrrlichtContext->getDevice ()->run ())
+    // ensure the context knows what wallpaper to render
+    context->setWallpaper (wallpaper);
+
+    if (shouldEnableAudio == true)
     {
-        if (IrrlichtContext->getDevice ()->getVideoDriver () == nullptr)
-            continue;
+        int mixer_flags = MIX_INIT_MP3 | MIX_INIT_FLAC | MIX_INIT_OGG;
 
-        startTime = IrrlichtContext->getDevice ()->getTimer ()->getTime ();
-        g_Time = startTime / 1000.0f;
+        if (SDL_Init (SDL_INIT_AUDIO) < 0 || mixer_flags != Mix_Init (mixer_flags))
+        {
+            // Mix_GetError is an alias for SDL_GetError, so calling it directly will yield the correct result
+            // it doesn't matter if SDL_Init or Mix_Init failed, both report the errors through the same functions
+            fprintf (stderr, "Cannot initialize SDL audio system, SDL_GetError: %s", SDL_GetError ());
+            return 2;
+        }
 
-        IrrlichtContext->renderFrame (wallpaper);
+        // initialize audio engine
+        Mix_OpenAudio (22050, AUDIO_S16SYS, 2, 640);
+    }
+
+    // TODO: FIGURE OUT THE REQUIRED INPUT MODE, AS SOME WALLPAPERS USE THINGS LIKE MOUSE POSITION
+    // glfwSetInputMode (window, GLFW_STICKY_KEYS, GL_TRUE);
+
+    // enable depth text
+    glEnable (GL_DEPTH_TEST);
+    glDepthFunc (GL_LESS);
 
-        endTime = IrrlichtContext->getDevice ()->getTimer ()->getTime ();
+    // cull anything that doesn't look at the camera (might be useful to disable in the future)
+    //glEnable (GL_CULL_FACE);
 
-        IrrlichtContext->getDevice ()->sleep (minimumTime - (endTime - startTime), false);
+    clock_t minimumTime = 1000 / maximumFPS;
+    clock_t startTime = 0;
+    clock_t endTime = 0;
+
+    while (glfwWindowShouldClose (window) == 0)
+    {
+        // get the real framebuffer size
+        glfwGetFramebufferSize (window, &windowWidth, &windowHeight);
+        // set the default viewport
+        context->setDefaultViewport ({0, 0, windowWidth, windowHeight});
+        // calculate the current time value
+        g_Time = (float) glfwGetTime ();
+        // get the start time of the frame
+        startTime = clock ();
+        // render the scene
+        context->render ();
+        // do buffer swapping
+        glfwSwapBuffers (window);
+        // poll for events (like closing the window)
+        glfwPollEvents ();
+        // get the end time of the frame
+        endTime = clock ();
+
+        // ensure the frame time is correct to not overrun FPS
+        if ((endTime - startTime) < minimumTime)
+            usleep (static_cast <unsigned int> ((static_cast <double> ((minimumTime - (endTime - startTime))) / CLOCKS_PER_SEC) * 1000));
     }
 
+    // terminate gl
+    glfwTerminate ();
+    // terminate SDL
     SDL_Quit ();
+    // terminate free image
+    FreeImage_DeInitialise ();
+
     return 0;
 }

+ 31 - 0
src/WallpaperEngine/Assets/CCombinedContainer.cpp

@@ -0,0 +1,31 @@
+#include "CCombinedContainer.h"
+
+using namespace WallpaperEngine::Assets;
+
+void CCombinedContainer::add (CContainer* container)
+{
+    this->m_containers.emplace_back (container);
+}
+
+void* CCombinedContainer::readFile (std::string filename, uint32_t* length)
+{
+    auto cur = this->m_containers.begin ();
+    auto end = this->m_containers.end ();
+
+    for (; cur != end; cur ++)
+    {
+        try
+        {
+            // try to read the file on the current container, if the file doesn't exists
+            // an exception will be thrown
+            return (*cur)->readFile (filename, length);
+        }
+        catch (std::exception& ex)
+        {
+            // not found in this container, next try
+        }
+    }
+
+    // no container was able to load the file, abort!
+    throw std::runtime_error ("Cannot find the file in any of the containers");
+}

+ 32 - 0
src/WallpaperEngine/Assets/CCombinedContainer.h

@@ -0,0 +1,32 @@
+//
+// Created by almamu on 8/8/21.
+//
+
+#pragma once
+
+#include <vector>
+#include <stdexcept>
+
+#include "CContainer.h"
+
+namespace WallpaperEngine::Assets
+{
+    class CCombinedContainer : public CContainer
+    {
+    public:
+        CCombinedContainer () {}
+        ~CCombinedContainer () {}
+
+        /**
+         * Adds a container to the list
+         *
+         * @param container
+         */
+        void add (CContainer* container);
+
+        void* readFile (std::string filename, uint32_t* length) override;
+
+    private:
+        std::vector<CContainer*> m_containers;
+    };
+};

+ 52 - 0
src/WallpaperEngine/Assets/CContainer.cpp

@@ -0,0 +1,52 @@
+#include "CContainer.h"
+
+#include <cstring>
+#include <utility>
+
+using namespace WallpaperEngine::Assets;
+
+CTexture* CContainer::readTexture (std::string filename)
+{
+    // get the texture's filename (usually .tex)
+    filename = "materials/" + filename + ".tex";
+
+    void* textureContents = this->readFile (filename, nullptr);
+
+    return new CTexture (textureContents);
+}
+
+std::string CContainer::readVertexShader (const std::string& filename)
+{
+    return this->readFileAsString ("shaders/" + filename + ".vert");
+}
+
+std::string CContainer::readFragmentShader (const std::string& filename)
+{
+    return this->readFileAsString ("shaders/" + filename + ".frag");
+}
+
+std::string CContainer::readIncludeShader (const std::string& filename)
+{
+    return this->readFileAsString ("shaders/" + filename);
+}
+
+std::string CContainer::readFileAsString (std::string filename)
+{
+    uint32_t length = 0;
+
+    // read file contents and allocate a buffer for a string
+    void* contents = this->readFile (std::move (filename), &length);
+    char* buffer = new char [length + 1];
+
+    // ensure there's a 0 at the end
+    memset (buffer, 0, length + 1);
+    // copy over the data
+    memcpy (buffer, contents, length);
+    // now build the std::string to use
+    std::string result = buffer;
+
+    // free the intermediate buffer used to generate the std::string
+    delete[] buffer;
+
+    return result;
+}

+ 72 - 0
src/WallpaperEngine/Assets/CContainer.h

@@ -0,0 +1,72 @@
+//
+// Created by almamu on 8/8/21.
+//
+
+#pragma once
+
+#include <string>
+#include "WallpaperEngine/Assets/CTexture.h"
+
+namespace WallpaperEngine::Assets
+{
+    class CContainer
+    {
+    public:
+        /**
+         * Reads the given file from the container and returns it's data
+         * Additionally sets a length parameter to return back the file's length
+         *
+         * @param filename The file to read
+         * @param length The file's length after it's been read, null for not getting anything back
+         *
+         * @return
+         */
+        virtual void* readFile (std::string filename, uint32_t* length = nullptr) = 0;
+
+        /**
+         * Wrapper for readFile, appends the texture extension at the end of the filename
+         *
+         * @param filename The texture name (without the .tex)
+         *
+         * @return
+         */
+        CTexture* readTexture (std::string filename);
+
+        /**
+         * Wrapper for readFile, appends the .vert extension at the end and opens the given shader file
+         *
+         * @param filename
+         *
+         * @return The shader code as an string to be used
+         */
+        std::string readVertexShader (const std::string& filename);
+
+        /**
+         * Wrapper for readFile, appends the .frag extension at the end and opens the given shader file
+         *
+         * @param filename
+         *
+         * @return The shader code as an string to be used
+         */
+        std::string readFragmentShader (const std::string& filename);
+
+        /**
+         * Wrapper for readFile, appends the .h extension at the end and opens the given shader file
+         *
+         * @param filename
+         *
+         * @return The shader code as an string to be used
+         */
+        std::string readIncludeShader (const std::string& filename);
+
+    private:
+        /**
+         * Reads a file as string
+         *
+         * @param filename
+         *
+         * @return The file's contents as string
+         */
+        std::string readFileAsString (std::string filename);
+    };
+}

+ 59 - 0
src/WallpaperEngine/Assets/CDirectory.cpp

@@ -0,0 +1,59 @@
+#include "CDirectory.h"
+
+using namespace WallpaperEngine::Assets;
+
+CDirectory::CDirectory (std::string basepath) :
+    m_basepath (std::move (basepath))
+{
+}
+
+CDirectory::~CDirectory ()
+{
+
+}
+
+void* CDirectory::readFile (std::string filename, uint32_t* length)
+{
+    std::string final = this->m_basepath + filename;
+
+    // first check the cache, if the file is there already just return the data in there
+    auto it = this->m_cache.find (final);
+
+    if (it != this->m_cache.end ())
+    {
+        if (length != nullptr)
+            *length = (*it).second.length;
+
+        return (*it).second.address;
+    }
+
+    FILE* fp = fopen (final.c_str (), "rb");
+
+    if (fp == nullptr)
+        throw std::runtime_error ("Cannot find requested file");
+
+    // go to the end, get the position and return to the beginning
+    fseek (fp, 0, SEEK_END);
+    long size = ftell (fp);
+    fseek (fp, 0, SEEK_SET);
+
+    // now read the whole file
+    char* contents = new char[size];
+
+    if (fread (contents, size, 1, fp) != 1)
+    {
+        delete[] contents;
+        throw std::runtime_error ("Unexpected error when reading the file");
+    }
+
+    // store it in the cache too
+    this->m_cache.insert (std::make_pair <std::string, CFileEntry> (
+        std::move (final),
+        CFileEntry (contents, size)
+    ));
+
+    if (length != nullptr)
+        *length = size;
+
+    return contents;
+}

+ 26 - 0
src/WallpaperEngine/Assets/CDirectory.h

@@ -0,0 +1,26 @@
+//
+// Created by almamu on 8/8/21.
+//
+#pragma once
+
+#include <string>
+#include <stdexcept>
+#include <map>
+
+#include "CContainer.h"
+#include "CFileEntry.h"
+
+namespace WallpaperEngine::Assets
+{
+    class CDirectory : public CContainer
+    {
+    public:
+        CDirectory (std::string basepath);
+        ~CDirectory ();
+
+        void* readFile (std::string filename, uint32_t* length) override;
+    private:
+        std::string m_basepath;
+        std::map <std::string, CFileEntry> m_cache;
+    };
+};

+ 19 - 0
src/WallpaperEngine/Assets/CFileEntry.h

@@ -0,0 +1,19 @@
+//
+// Created by almamu on 8/8/21.
+//
+
+#pragma once
+
+namespace WallpaperEngine::Assets
+{
+    class CFileEntry
+    {
+    public:
+        CFileEntry (void* address, uint32_t length) :
+            address (address),
+            length (length) { }
+
+        void* address;
+        uint32_t length;
+    };
+}

+ 170 - 0
src/WallpaperEngine/Assets/CPackage.cpp

@@ -0,0 +1,170 @@
+//
+// Created by almamu on 8/8/21.
+//
+
+#include "CPackage.h"
+
+#include <utility>
+
+using namespace WallpaperEngine::Assets;
+
+class CPackageEntry
+{
+public:
+    CPackageEntry (std::string filename, uint32_t offset, uint32_t length) :
+        filename (std::move(filename)),
+        offset (offset),
+        length (length) { }
+
+    std::string filename;
+    uint32_t offset;
+    uint32_t length;
+};
+
+CPackage::CPackage (const std::string& path) :
+    m_path (path),
+    m_contents ()
+{
+    this->init ();
+}
+
+CPackage::~CPackage()
+{
+
+}
+
+
+void* CPackage::readFile (std::string filename, uint32_t* length)
+{
+    auto it = this->m_contents.find (filename);
+
+    if (it == this->m_contents.end ())
+        throw std::runtime_error ("Cannot find file in file list");
+
+    // set file length if required
+    if (length != nullptr)
+        *length = (*it).second.length;
+
+    return (*it).second.address;
+}
+
+void CPackage::init ()
+{
+    FILE* fp = fopen (this->m_path.c_str (), "rb+");
+
+    if (fp == nullptr)
+        throw std::runtime_error ("Cannot find package file");
+
+    // first validate header
+    this->validateHeader (fp);
+    // header is okay, load everything into memory
+    this->loadFiles (fp);
+
+    fclose (fp);
+}
+
+char* CPackage::readSizedString (FILE* fp)
+{
+    unsigned int length = 0;
+
+    if (fread (&length, sizeof (unsigned int), 1, fp) != 1)
+        throw std::runtime_error ("Cannot read enough bytes from file");
+
+    // account for 0 termination of the string
+    length ++;
+
+    char* pointer = new char [length];
+    memset (pointer, 0, length);
+
+    // read only the string bytes so the last one in the memory is 0
+    length --;
+
+    // read data from file
+    if (fread (pointer, sizeof (char), length, fp) != length)
+        throw std::runtime_error ("Cannot read package version from file");
+
+    return pointer;
+}
+
+uint32_t CPackage::readInteger (FILE* fp)
+{
+    uint32_t output;
+
+    if (fread (&output, sizeof (uint32_t), 1, fp) != 1)
+        throw std::runtime_error ("Cannot read integer value from file");
+
+    return output;
+}
+
+void CPackage::validateHeader (FILE* fp)
+{
+    char* pointer = this->readSizedString (fp);
+
+    // finally validate the header version
+    if (strcmp ("PKGV0007", pointer) != 0 &&
+        strcmp ("PKGV0002", pointer) != 0 &&
+        strcmp ("PKGV0001", pointer) != 0 &&
+        strcmp ("PKGV0008", pointer) != 0 &&
+        strcmp ("PKGV0009", pointer) != 0 &&
+        strcmp ("PKGV0004", pointer) != 0 &&
+        strcmp ("PKGV0005", pointer) != 0 &&
+        strcmp ("PKGV0006", pointer) != 0)
+    {
+        delete[] pointer;
+        throw std::runtime_error ("Unsupported package version");
+    }
+
+    // free memory
+    delete[] pointer;
+}
+
+void CPackage::loadFiles (FILE* fp)
+{
+    uint32_t count = this->readInteger (fp);
+    std::vector<CPackageEntry> list;
+
+    for (uint32_t index = 0; index < count; index ++)
+    {
+        // first read the filename
+        char* filename = this->readSizedString (fp);
+        uint32_t offset = this->readInteger (fp);
+        uint32_t length = this->readInteger (fp);
+
+        // add the file to the list
+        list.emplace_back(filename, offset, length);
+        // only free filename, the file's contents are stored in a map for a later use
+        delete[] filename;
+    }
+
+    // get current baseOffset, this is where the files start
+    long baseOffset = ftell (fp);
+
+    // read file contents now
+    auto cur = list.begin ();
+    auto end = list.end ();
+
+    for (; cur != end; cur ++)
+    {
+        long offset = (*cur).offset + baseOffset;
+
+        // with all the data we can jump to the offset and read the content
+        if (fseek (fp, offset, SEEK_SET) != 0)
+            throw std::runtime_error ("Cannot find file in package");
+
+        // allocate memory for the file's contents and read it from the file
+        char* fileContents = new char [(*cur).length];
+
+        if (fread (fileContents, (*cur).length, 1, fp) != 1)
+        {
+            delete[] fileContents;
+
+            throw std::runtime_error ("Cannot read file contents from package");
+        }
+
+        // add the file to the map
+        this->m_contents.insert (std::make_pair <std::string, CFileEntry> (
+            std::move((*cur).filename),
+            CFileEntry (fileContents, (*cur).length))
+        );
+    }
+}

+ 68 - 0
src/WallpaperEngine/Assets/CPackage.h

@@ -0,0 +1,68 @@
+//
+// Created by almamu on 8/8/21.
+//
+
+#pragma once
+
+#include <string>
+#include <vector>
+#include <map>
+#include <exception>
+#include <stdexcept>
+#include <cstring>
+
+#include "CContainer.h"
+#include "CFileEntry.h"
+
+namespace WallpaperEngine::Assets
+{
+    class CPackage : public CContainer
+    {
+    public:
+        CPackage (const std::string& path);
+        ~CPackage ();
+
+        void* readFile (std::string filename, uint32_t* length) override;
+
+    protected:
+        /**
+         * Loads the current package file and loads all it's contents to memory
+         */
+        void init ();
+
+        /**
+         * Reads the header from the current position and ensures it's a compatible version
+         *
+         * @param fp The file where to read from
+         */
+        void validateHeader (FILE* fp);
+
+        /**
+         * Loads the files in the package into memory
+         *
+         * @param fp The file where to read from
+         */
+        void loadFiles (FILE* fp);
+
+        /**
+         * Reads a size-prefixed string
+         *
+         * @param fp File to read from
+         *
+         * @return The read data, important to free it
+         */
+        char* readSizedString (FILE* fp);
+        /**
+         * Reads a simple unsigned of 32 bits
+         *
+         * @param fp File to read from
+         *
+         * @return The read value
+         */
+        uint32_t readInteger (FILE* fp);
+
+    private:
+        std::string m_path;
+        std::map <std::string, CFileEntry> m_contents;
+    };
+}

+ 356 - 0
src/WallpaperEngine/Assets/CTexture.cpp

@@ -0,0 +1,356 @@
+#include "CTexture.h"
+
+#include <string>
+#include <cstring>
+#include <lz4.h>
+
+using namespace WallpaperEngine::Assets;
+
+CTexture::CTexture (void* fileData)
+{
+    // ensure the header is parsed
+    this->parseHeader (static_cast <char*> (fileData));
+
+    GLint internalFormat;
+
+    if (this->m_header->freeImageFormat != FREE_IMAGE_FORMAT::FIF_UNKNOWN)
+    {
+        internalFormat = GL_RGBA8;
+        // set some extra information too as it's used for image sizing
+        // this ensures that a_TexCoord uses the full image instead of just part of it
+        this->m_header->width = this->m_header->mipmaps [0]->width;
+        this->m_header->height = this->m_header->mipmaps [0]->height;
+        this->m_header->textureWidth = this->m_header->mipmaps [0]->width;
+        this->m_header->textureHeight = this->m_header->mipmaps [0]->height;
+        // TODO: MAYBE IT'S BETTER TO CREATE A TEXTURE OF THE GIVEN SIZE AND COPY OVER WHAT WE READ FROM THE FILE?
+    }
+    else
+    {
+        // detect the image format and hand it to openGL to be used
+        switch (this->m_header->format)
+        {
+            case TextureFormat::DXT5:
+                internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
+                break;
+            case TextureFormat::DXT3:
+                internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
+                break;
+            case TextureFormat::DXT1:
+                internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
+                break;
+            case TextureFormat::ARGB8888:
+                internalFormat = GL_RGBA8;
+                break;
+            case TextureFormat::R8:
+                internalFormat = GL_R8;
+                break;
+            case TextureFormat::RG88:
+                internalFormat = GL_RG8;
+                break;
+            default:
+                delete this->m_header;
+                throw std::runtime_error ("Cannot determine the texture format");
+        }
+    }
+
+    // set the texture resolution
+    // TODO: SUPPORT SPRITES
+    this->m_resolution = {
+        this->m_header->textureWidth, this->m_header->textureHeight,
+        this->m_header->width, this->m_header->height
+    };
+
+    // reserve a texture
+    glGenTextures (1, &this->m_textureID);
+
+    // bind the texture to assign information to it
+    glBindTexture (GL_TEXTURE_2D, this->m_textureID);
+    // set mipmap levels
+    glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
+    glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, this->m_header->mipmapCount - 1);
+
+    // TODO: ADD SUPPORT FOR .tex-json FILES AS THEY ALSO HAVE FLAGS LIKE THESE ONES
+    // setup texture wrapping and filtering
+    if (this->m_header->flags & TextureFlags::ClampUVs)
+    {
+        glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+        glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+    }
+    else
+    {
+        glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+        glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+    }
+
+    if (this->m_header->flags & TextureFlags::NoInterpolation)
+    {
+        glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+        glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+    }
+    else
+    {
+        glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+        glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+    }
+
+    // TODO: USE THIS ONE
+    // uint32_t blockSize = (internalFormat == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) ? 8 : 16;
+
+    auto cur = this->m_header->mipmaps.begin ();
+    auto end = this->m_header->mipmaps.end ();
+
+    for (int32_t level = 0; cur != end; cur ++, level ++)
+    {
+        FIBITMAP* bitmap = nullptr;
+        FIBITMAP* converted = nullptr;
+        FIMEMORY* memory = nullptr;
+        void* dataptr = (*cur)->uncompressedData;
+        uint32_t width = (*cur)->width;
+        uint32_t height = (*cur)->height;
+        GLenum textureFormat = GL_RGBA;
+
+        if (this->m_header->freeImageFormat != FREE_IMAGE_FORMAT::FIF_UNKNOWN)
+        {
+            memory = FreeImage_OpenMemory (reinterpret_cast <BYTE *> ((*cur)->uncompressedData), (*cur)->uncompressedSize);
+
+            // load the image and setup pointers so they can be used
+            bitmap = FreeImage_LoadFromMemory (this->m_header->freeImageFormat, memory);
+            // flip the image vertically
+            FreeImage_FlipVertical (bitmap);
+            // convert to a 32bits bytearray
+            converted = FreeImage_ConvertTo32Bits (bitmap);
+
+            dataptr = FreeImage_GetBits (converted);
+            width = FreeImage_GetWidth (converted);
+            height = FreeImage_GetHeight (converted);
+            textureFormat = GL_BGRA;
+        }
+        else
+        {
+            if (this->m_header->format == TextureFormat::RG88)
+                textureFormat = GL_RG;
+            else if (this->m_header->format == TextureFormat::R8)
+                textureFormat = GL_R;
+        }
+
+        switch (internalFormat)
+        {
+            case GL_RGBA8:
+                glTexImage2D (GL_TEXTURE_2D, level, internalFormat,
+                    width, height, 0,
+                    textureFormat, GL_UNSIGNED_BYTE,
+                    dataptr
+                );
+                break;
+            case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+            case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
+            case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
+                glCompressedTexImage2D (
+                        GL_TEXTURE_2D, level, internalFormat,
+                        (*cur)->width, (*cur)->height, 0,
+                        (*cur)->uncompressedSize, dataptr
+                );
+                break;
+        }
+
+        // freeimage buffer won't be used anymore, so free memory
+        if (this->m_header->freeImageFormat != FREE_IMAGE_FORMAT::FIF_UNKNOWN)
+        {
+            FreeImage_Unload (bitmap);
+            FreeImage_Unload (converted);
+            FreeImage_CloseMemory (memory);
+        }
+    }
+}
+
+CTexture::~CTexture ()
+{
+    if (this->getHeader () == nullptr)
+        return;
+
+    // free the header if it was allocated
+    delete this->getHeader ();
+}
+
+const GLuint CTexture::getTextureID () const
+{
+    return this->m_textureID;
+}
+
+const CTexture::TextureHeader* CTexture::getHeader () const
+{
+    return this->m_header;
+}
+
+const glm::vec4* CTexture::getResolution () const
+{
+    return &this->m_resolution;
+}
+
+CTexture::TextureMipmap::TextureMipmap ()
+{
+}
+
+CTexture::TextureMipmap::~TextureMipmap ()
+{
+    if (this->compression == 1)
+        delete this->compressedData;
+
+    delete this->uncompressedData;
+}
+
+void CTexture::TextureMipmap::decompressData ()
+{
+    if (this->compression == 1)
+    {
+        this->uncompressedData = new char [this->uncompressedSize];
+
+        int result = LZ4_decompress_safe (
+            this->compressedData, this->uncompressedData,
+            this->compressedSize, this->uncompressedSize
+        );
+
+        if (!result)
+            throw std::runtime_error ("Cannot decompress texture data");
+    }
+}
+
+CTexture::TextureHeader::TextureHeader ()
+{
+}
+
+CTexture::TextureHeader::~TextureHeader ()
+{
+    auto cur = this->mipmaps.begin ();
+    auto end = this->mipmaps.end ();
+
+    for (; cur != end; cur ++)
+        delete *cur;
+}
+
+void CTexture::parseHeader (char* fileData)
+{
+    // check the magic value on the header first
+    if (memcmp (fileData, "TEXV0005", 9) != 0)
+        throw std::runtime_error ("unexpected texture container type");
+    // jump to the next value
+    fileData += 9;
+    // check the sub-magic value on the header
+    if (memcmp (fileData, "TEXI0001", 9) != 0)
+        throw std::runtime_error ("unexpected texture sub-container type");
+    // jump through the string again
+    fileData += 9;
+
+    this->m_header = new TextureHeader;
+
+    uint32_t* pointer = reinterpret_cast <uint32_t*> (fileData);
+
+    this->m_header->format = static_cast <TextureFormat>(*pointer ++);
+    this->m_header->flags = static_cast <TextureFlags> (*pointer ++);
+    this->m_header->textureWidth = *pointer ++;
+    this->m_header->textureHeight = *pointer ++;
+    this->m_header->width = *pointer ++;
+    this->m_header->height = *pointer ++;
+    pointer ++; // ignore some more bytes
+
+    // now we're going to parse some more data that is string
+    // so get the current position back as string
+    fileData = reinterpret_cast <char*> (pointer);
+    // get the position of what comes after the texture data
+    pointer = reinterpret_cast <uint32_t*> (fileData + 9);
+
+    if (memcmp (fileData, "TEXB0003", 9) == 0)
+    {
+        this->m_header->containerVersion = ContainerVersion::TEXB0003;
+
+        // get back the pointer and use it
+        pointer ++;
+        this->m_header->freeImageFormat = static_cast <FREE_IMAGE_FORMAT> (*pointer++);
+    }
+    else if(memcmp (fileData, "TEXB0002", 9) == 0)
+    {
+        this->m_header->containerVersion = ContainerVersion::TEXB0002;
+
+        // skip 4 bytes
+        pointer ++;
+    }
+    else if (memcmp (fileData, "TEXB0001", 9) == 0)
+    {
+        this->m_header->containerVersion = ContainerVersion::TEXB0001;
+
+        // skip 4 bytes
+        pointer ++;
+    }
+    else
+    {
+        delete this->m_header;
+        this->m_header = nullptr;
+        throw std::runtime_error ("unknown texture format type");
+    }
+
+    // read the number of mipmaps available
+    this->m_header->mipmapCount = *pointer ++;
+
+    fileData = reinterpret_cast <char*> (pointer);
+
+    for (uint32_t i = 0; i < this->m_header->mipmapCount; i ++)
+        this->m_header->mipmaps.emplace_back (this->parseMipmap (this->m_header, &fileData));
+}
+
+
+CTexture::TextureMipmap* CTexture::parseMipmap (TextureHeader* header, char** originalFileData)
+{
+    TextureMipmap* mipmap = new TextureMipmap ();
+
+    // get the current position
+    char* fileData = *originalFileData;
+
+    // get an integer pointer
+    uint32_t* pointer = reinterpret_cast <uint32_t*> (fileData);
+
+    mipmap->width = *pointer++;
+    mipmap->height = *pointer++;
+
+    if (header->containerVersion == ContainerVersion::TEXB0002 ||
+        header->containerVersion == ContainerVersion::TEXB0003)
+    {
+        mipmap->compression = *pointer++;
+        mipmap->uncompressedSize = *pointer++;
+    }
+
+    mipmap->compressedSize = *pointer++;
+
+    // get back a normal char pointer
+    fileData = reinterpret_cast <char*> (pointer);
+
+    if (mipmap->compression == 0)
+    {
+        // this might be better named as mipmap_bytes_size instead of compressedSize
+        // as in uncompressed files this variable actually holds the file length
+        mipmap->uncompressedSize = mipmap->compressedSize;
+    }
+
+    mipmap->uncompressedData = new char [mipmap->uncompressedSize];
+
+    if (mipmap->compression == 1)
+    {
+        mipmap->compressedData = new char [mipmap->compressedSize];
+
+        memcpy (mipmap->compressedData, fileData, mipmap->compressedSize);
+
+        mipmap->decompressData ();
+        // advance to the end of the mipmap
+        fileData += mipmap->compressedSize;
+    }
+    else
+    {
+        memcpy (mipmap->uncompressedData, fileData, mipmap->uncompressedSize);
+        // advance to the end of the mipmap
+        fileData += mipmap->uncompressedSize;
+    }
+
+    // ensure the pointer is updated with the latest position when reading the data
+    *originalFileData = fileData;
+
+    return mipmap;
+}

+ 117 - 0
src/WallpaperEngine/Assets/CTexture.h

@@ -0,0 +1,117 @@
+#pragma once
+
+#include <string>
+#include <vector>
+#include <stdexcept>
+
+#include <GL/glew.h>
+#include <glm/vec4.hpp>
+
+#include <FreeImage.h>
+
+namespace WallpaperEngine::Assets
+{
+    class CTexture
+    {
+        struct TextureHeader;
+
+    public:
+        CTexture (void* fileData);
+        ~CTexture ();
+
+        const GLuint getTextureID () const;
+        const TextureHeader* getHeader () const;
+        const glm::vec4* getResolution () const;
+
+
+        enum TextureFormat : uint32_t
+        {
+            ARGB8888 = 0,
+            DXT5 = 4,
+            DXT3 = 6,
+            DXT1 = 7,
+            RG88 = 8,
+            R8 = 9,
+        };
+    private:
+        enum ContainerVersion : int
+        {
+            UNKNOWN = -1,
+            TEXB0003 = 3,
+            TEXB0002 = 2,
+            TEXB0001 = 1
+        };
+
+        class TextureMipmap
+        {
+        public:
+            TextureMipmap ();
+            ~TextureMipmap ();
+
+            /** Width of the mipmap */
+            uint32_t width = 0;
+            /** Height of the mipmap */
+            uint32_t height = 0;
+            /** If the mipmap data is compressed */
+            uint32_t compression = 0;
+            /** Uncompressed size of the mipmap */
+            uint32_t uncompressedSize = 0;
+            /** Compress size of the mipmap */
+            uint32_t compressedSize = 0;
+            /** Pointer to the compressed data */
+            char* compressedData = nullptr;
+            /** Pointer to the uncompressed data */
+            char* uncompressedData = nullptr;
+            /**
+             * Performs actual decompression of the compressed data
+             */
+            void decompressData ();
+        };
+
+        /**
+         * Configures how the texture will be handled by the background
+         */
+        enum TextureFlags : uint32_t
+        {
+            NoFlags = 0,
+            NoInterpolation = 1,
+            ClampUVs = 2,
+            IsGif = 4,
+        };
+
+        class TextureHeader
+        {
+        public:
+            TextureHeader ();
+            ~TextureHeader ();
+
+            /** The version of the texture container */
+            ContainerVersion containerVersion = ContainerVersion::UNKNOWN;
+            /** Flags with extra texture information */
+            TextureFlags flags;
+            /** Real width of the texture */
+            uint32_t width;
+            /** Real height of the texture */
+            uint32_t height;
+            /** Texture width in memory (power of 2) */
+            uint32_t textureWidth;
+            /** Texture height in memory (power of 2) */
+            uint32_t textureHeight;
+            /** Texture data format */
+            TextureFormat format;
+            /** Free Image format */
+            FREE_IMAGE_FORMAT freeImageFormat = FREE_IMAGE_FORMAT::FIF_UNKNOWN;
+            /** Number of mipmap levels on the texture */
+            uint32_t mipmapCount;
+            /** List of mipmaps */
+            std::vector <TextureMipmap*> mipmaps;
+        };
+    private:
+        void parseHeader (char* fileData);
+        TextureMipmap* parseMipmap (TextureHeader* header, char** fileData);
+
+        TextureHeader* m_header;
+        GLuint m_textureID;
+        glm::vec4 m_resolution;
+    };
+}

+ 29 - 24
src/WallpaperEngine/Core/CObject.cpp

@@ -5,27 +5,30 @@
 #include "WallpaperEngine/Core/Objects/CSound.h"
 #include "WallpaperEngine/Core/Objects/CParticle.h"
 
+#include "WallpaperEngine/Assets/CContainer.h"
+
 using namespace WallpaperEngine::Core;
+using namespace WallpaperEngine::Assets;
 
 CObject::CObject (
         bool visible,
-        irr::u32 id,
+        uint32_t id,
         std::string name,
         std::string type,
-        const irr::core::vector3df& origin,
-        const irr::core::vector3df& scale,
-        const irr::core::vector3df& angles) :
+        const glm::vec3& origin,
+        const glm::vec3& scale,
+        const glm::vec3& angles) :
     m_visible (visible),
     m_id (id),
     m_name (std::move(name)),
-    m_type (type),
+    m_type (std::move(type)),
     m_origin (origin),
     m_scale (scale),
     m_angles (angles)
 {
 }
 
-CObject* CObject::fromJSON (json data)
+CObject* CObject::fromJSON (json data, CContainer* container)
 {
     std::string json = data.dump ();
 
@@ -67,12 +70,13 @@ CObject* CObject::fromJSON (json data)
     {
         object = Objects::CImage::fromJSON (
                 data,
+                container,
                 visible,
                 *id_it,
                 *name_it,
-                WallpaperEngine::Core::ato3vf (*origin_it),
-                WallpaperEngine::Core::ato3vf (*scale_it),
-                WallpaperEngine::Core::ato3vf (*angles_it)
+                WallpaperEngine::Core::aToVector3 (*origin_it),
+                WallpaperEngine::Core::aToVector3 (*scale_it),
+                WallpaperEngine::Core::aToVector3 (*angles_it)
         );
     }
     else if (sound_it != data.end () && (*sound_it).is_null () == false)
@@ -82,9 +86,9 @@ CObject* CObject::fromJSON (json data)
                 visible,
                 *id_it,
                 *name_it,
-                WallpaperEngine::Core::ato3vf (*origin_it),
-                WallpaperEngine::Core::ato3vf (*scale_it),
-                WallpaperEngine::Core::ato3vf (*angles_it)
+                WallpaperEngine::Core::aToVector3 (*origin_it),
+                WallpaperEngine::Core::aToVector3 (*scale_it),
+                WallpaperEngine::Core::aToVector3 (*angles_it)
         );
     }
     else if (particle_it != data.end () && (*particle_it).is_null () == false)
@@ -93,11 +97,12 @@ CObject* CObject::fromJSON (json data)
         try
         {
             object = Objects::CParticle::fromFile (
-                    (*particle_it).get <std::string> ().c_str (),
-                    *id_it,
-                    *name_it,
-                    WallpaperEngine::Core::ato3vf (*origin_it),
-                    WallpaperEngine::Core::ato3vf (*scale_it)
+                (*particle_it).get <std::string> (),
+                container,
+                *id_it,
+                *name_it,
+                WallpaperEngine::Core::aToVector3 (*origin_it),
+                WallpaperEngine::Core::aToVector3 (*scale_it)
             );
         }
         catch (std::runtime_error ex)
@@ -128,7 +133,7 @@ CObject* CObject::fromJSON (json data)
         for (; cur != end; cur ++)
         {
             object->insertEffect (
-                    Objects::CEffect::fromJSON (*cur, object)
+                    Objects::CEffect::fromJSON (*cur, object, container)
             );
         }
     }
@@ -147,17 +152,17 @@ CObject* CObject::fromJSON (json data)
     return object;
 }
 
-const irr::core::vector3df& CObject::getOrigin () const
+const glm::vec3& CObject::getOrigin () const
 {
     return this->m_origin;
 }
 
-const irr::core::vector3df& CObject::getScale () const
+const glm::vec3& CObject::getScale () const
 {
     return this->m_scale;
 }
 
-const irr::core::vector3df& CObject::getAngles () const
+const glm::vec3& CObject::getAngles () const
 {
     return this->m_angles;
 }
@@ -172,12 +177,12 @@ const std::vector<Objects::CEffect*>& CObject::getEffects () const
     return this->m_effects;
 }
 
-const std::vector<irr::u32>& CObject::getDependencies () const
+const std::vector<uint32_t>& CObject::getDependencies () const
 {
     return this->m_dependencies;
 }
 
-bool CObject::isVisible ()
+const bool CObject::isVisible () const
 {
     return this->m_visible;
 }
@@ -191,7 +196,7 @@ void CObject::insertEffect (Objects::CEffect* effect)
 {
     this->m_effects.push_back (effect);
 }
-void CObject::insertDependency (irr::u32 dependency)
+void CObject::insertDependency (uint32_t dependency)
 {
     this->m_dependencies.push_back (dependency);
 }

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

@@ -1,10 +1,9 @@
 #pragma once
 
-#include <irrlicht/irrlicht.h>
-
 #include "Core.h"
 
 #include "WallpaperEngine/Core/Objects/CEffect.h"
+#include "WallpaperEngine/Assets/CContainer.h"
 
 namespace WallpaperEngine::Core::Objects
 {
@@ -14,11 +13,12 @@ namespace WallpaperEngine::Core::Objects
 namespace WallpaperEngine::Core
 {
     using json = nlohmann::json;
+    using namespace WallpaperEngine::Assets;
 
     class CObject
     {
     public:
-        static CObject* fromJSON (json data);
+        static CObject* fromJSON (json data, CContainer* container);
 
         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; }
@@ -26,39 +26,39 @@ namespace WallpaperEngine::Core
         template<class T> bool is () { return this->m_type == T::Type; }
 
         const std::vector<Objects::CEffect*>& getEffects () const;
-        const std::vector<irr::u32>& getDependencies () const;
+        const std::vector<uint32_t>& getDependencies () const;
         const int getId () const;
 
-        const irr::core::vector3df& getOrigin () const;
-        const irr::core::vector3df& getScale () const;
-        const irr::core::vector3df& getAngles () const;
+        const glm::vec3& getOrigin () const;
+        const glm::vec3& getScale () const;
+        const glm::vec3& getAngles () const;
         const std::string& getName () const;
 
-        bool isVisible ();
+        const bool isVisible () const;
     protected:
         CObject (
             bool visible,
-            irr::u32 id,
+            uint32_t id,
             std::string name,
             std::string type,
-            const irr::core::vector3df& origin,
-            const irr::core::vector3df& scale,
-            const irr::core::vector3df& angles
+            const glm::vec3& origin,
+            const glm::vec3& scale,
+            const glm::vec3& angles
         );
 
         void insertEffect (Objects::CEffect* effect);
-        void insertDependency (irr::u32 dependency);
+        void insertDependency (uint32_t dependency);
     private:
         std::string m_type;
 
         bool m_visible;
-        irr::u32 m_id;
+        uint32_t m_id;
         std::string m_name;
-        irr::core::vector3df m_origin;
-        irr::core::vector3df m_scale;
-        irr::core::vector3df m_angles;
+        glm::vec3 m_origin;
+        glm::vec3 m_scale;
+        glm::vec3 m_angles;
 
         std::vector<Objects::CEffect*> m_effects;
-        std::vector<irr::u32> m_dependencies;
+        std::vector<uint32_t> m_dependencies;
     };
 };

+ 15 - 6
src/WallpaperEngine/Core/CProject.cpp

@@ -1,3 +1,4 @@
+#include <WallpaperEngine/Assets/CContainer.h>
 #include <WallpaperEngine/FileSystem/FileSystem.h>
 
 #include "CProject.h"
@@ -5,18 +6,20 @@
 #include "CVideo.h"
 
 using namespace WallpaperEngine::Core;
+using namespace WallpaperEngine::Assets;
 
-CProject::CProject (std::string title, std::string type, CWallpaper* wallpaper) :
+CProject::CProject (std::string title, std::string type, CWallpaper* wallpaper, CContainer* container) :
     m_title (std::move (title)),
     m_type (std::move (type)),
-    m_wallpaper (wallpaper)
+    m_wallpaper (wallpaper),
+    m_container (container)
 {
     this->m_wallpaper->setProject (this);
 }
 
-CProject* CProject::fromFile (const irr::io::path& filename)
+CProject* CProject::fromFile (const std::string& filename, CContainer* container)
 {
-    json content = json::parse (WallpaperEngine::FileSystem::loadFullFile (filename));
+    json content = json::parse (WallpaperEngine::FileSystem::loadFullFile (filename, container));
 
     std::string title = *jsonFindRequired (content, "title", "Project title missing");
     std::string type = *jsonFindRequired (content, "type", "Project type missing");
@@ -28,7 +31,7 @@ CProject* CProject::fromFile (const irr::io::path& filename)
 
     if (type == "scene")
     {
-        wallpaper = CScene::fromFile (file.c_str ());
+        wallpaper = CScene::fromFile (file, container);
     }
     else if (type == "video")
     {
@@ -40,7 +43,8 @@ CProject* CProject::fromFile (const irr::io::path& filename)
     CProject* project = new CProject (
         title,
         type,
-        wallpaper
+        wallpaper,
+        container
     );
 
     if (general != content.end ())
@@ -84,6 +88,11 @@ const std::vector<Projects::CProperty*>& CProject::getProperties () const
     return this->m_properties;
 }
 
+CContainer* CProject::getContainer ()
+{
+    return this->m_container;
+}
+
 void CProject::insertProperty (Projects::CProperty* property)
 {
     this->m_properties.push_back (property);

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

@@ -1,21 +1,22 @@
 #pragma once
 
-#include <irrlicht/irrlicht.h>
-
 #include "CWallpaper.h"
 #include "WallpaperEngine/Core/Core.h"
 #include "WallpaperEngine/Core/Projects/CProperty.h"
 
+#include "WallpaperEngine/Assets/CContainer.h"
+
 namespace WallpaperEngine::Core
 {
     using json = nlohmann::json;
+    using namespace WallpaperEngine::Assets;
 
     class CWallpaper;
 
     class CProject
     {
     public:
-        static CProject* fromFile (const irr::io::path& filename);
+        static CProject* fromFile (const std::string& filename, CContainer* container);
 
         CWallpaper* getWallpaper () const;
 
@@ -23,8 +24,10 @@ namespace WallpaperEngine::Core
         const std::string& getType () const;
         const std::vector<Projects::CProperty*>& getProperties () const;
 
+        CContainer* getContainer ();
+
     protected:
-        CProject (std::string title, std::string type, CWallpaper* wallpaper);
+        CProject (std::string title, std::string type, CWallpaper* wallpaper, CContainer* container);
 
         void insertProperty (Projects::CProperty* property);
     private:
@@ -33,5 +36,6 @@ namespace WallpaperEngine::Core
         std::string m_title;
         std::string m_type;
         CWallpaper* m_wallpaper;
+        CContainer* m_container;
     };
 };

+ 45 - 35
src/WallpaperEngine/Core/CScene.cpp

@@ -2,29 +2,33 @@
 #include "CProject.h"
 
 #include "WallpaperEngine/FileSystem/FileSystem.h"
+#include "WallpaperEngine/Core/Types/FloatColor.h"
 
 using namespace WallpaperEngine::Core;
+using namespace WallpaperEngine::Core::Types;
 
 CScene::CScene (
+        CContainer* container,
         Scenes::CCamera* camera,
-        irr::video::SColorf ambientColor,
+        FloatColor ambientColor,
         bool bloom,
-        irr::f64 bloomStrength,
-        irr::f64 bloomThreshold,
+        double bloomStrength,
+        double bloomThreshold,
         bool cameraFade,
         bool cameraParallax,
-        irr::f64 cameraParallaxAmount,
-        irr::f64 cameraParallaxDelay,
-        irr::f64 cameraParallaxMouseInfluence,
+        double cameraParallaxAmount,
+        double cameraParallaxDelay,
+        double cameraParallaxMouseInfluence,
         bool cameraPreview,
         bool cameraShake,
-        irr::f64 cameraShakeAmplitude,
-        irr::f64 cameraShakeRoughness,
-        irr::f64 cameraShakeSpeed,
-        irr::video::SColorf clearColor,
+        double cameraShakeAmplitude,
+        double cameraShakeRoughness,
+        double cameraShakeSpeed,
+        FloatColor clearColor,
         Scenes::CProjection* orthogonalProjection,
-        irr::video::SColorf skylightColor) :
+        FloatColor skylightColor) :
     CWallpaper (Type),
+    m_container (container),
     m_camera (camera),
     m_ambientColor (ambientColor),
     m_bloom (bloom),
@@ -46,10 +50,10 @@ CScene::CScene (
 {
 }
 
-CScene* CScene::fromFile (const irr::io::path& filename)
+CScene* CScene::fromFile (const std::string& filename, CContainer* container)
 {
-    std::string stringContent = WallpaperEngine::FileSystem::loadFullFile (filename);
-    json content = json::parse (WallpaperEngine::FileSystem::loadFullFile (filename));
+    std::string stringContent = WallpaperEngine::FileSystem::loadFullFile (filename, container);
+    json content = json::parse (WallpaperEngine::FileSystem::loadFullFile (filename, container));
 
     auto camera_it = jsonFindRequired (content, "camera", "Scenes must have a defined camera");
     auto general_it = jsonFindRequired (content, "general", "Scenes must have a general section");
@@ -62,21 +66,22 @@ CScene* CScene::fromFile (const irr::io::path& filename)
     auto bloomthreshold_it = jsonFindRequired (*general_it, "bloomthreshold", "General section must have bloom threshold");
     auto camerafade_it = jsonFindRequired (*general_it, "camerafade", "General section must have camera fade");
     auto cameraparallax = jsonFindDefault <bool> (*general_it, "cameraparallax", true);
-    auto cameraparallaxamount = jsonFindDefault <irr::f64> (*general_it, "cameraparallaxamount", 1.0f);
-    auto cameraparallaxdelay = jsonFindDefault <irr::f64> (*general_it, "cameraparallaxdelay", 0.0f);
-    auto cameraparallaxmouseinfluence = jsonFindDefault <irr::f64> (*general_it, "cameraparallaxmouseinfluence", 1.0f);
+    auto cameraparallaxamount = jsonFindDefault <double> (*general_it, "cameraparallaxamount", 1.0f);
+    auto cameraparallaxdelay = jsonFindDefault <double> (*general_it, "cameraparallaxdelay", 0.0f);
+    auto cameraparallaxmouseinfluence = jsonFindDefault <double> (*general_it, "cameraparallaxmouseinfluence", 1.0f);
     auto camerapreview = jsonFindDefault <bool> (*general_it, "camerapreview", false);
     auto camerashake = jsonFindDefault <bool> (*general_it, "camerashake", false);
-    auto camerashakeamplitude = jsonFindDefault <irr::f64> (*general_it, "camerashakeamplitude", 0.0f);
-    auto camerashakeroughness = jsonFindDefault <irr::f64> (*general_it, "camerashakeroughness", 0.0f);
-    auto camerashakespeed = jsonFindDefault <irr::f64> (*general_it, "camerashakespeed", 0.0f);
+    auto camerashakeamplitude = jsonFindDefault <double> (*general_it, "camerashakeamplitude", 0.0f);
+    auto camerashakeroughness = jsonFindDefault <double> (*general_it, "camerashakeroughness", 0.0f);
+    auto camerashakespeed = jsonFindDefault <double> (*general_it, "camerashakespeed", 0.0f);
     auto clearcolor_it = jsonFindRequired (*general_it, "clearcolor", "General section must have clear color");
     auto orthogonalprojection_it = jsonFindRequired (*general_it, "orthogonalprojection", "General section must have orthogonal projection info");
     auto skylightcolor_it = jsonFindRequired (*general_it, "skylightcolor", "General section must have skylight color");
 
     CScene* scene = new CScene (
+            container,
             Scenes::CCamera::fromJSON (*camera_it),
-            WallpaperEngine::Core::atoSColorf (*ambientcolor_it),
+            WallpaperEngine::Core::aToColorf(*ambientcolor_it),
             *bloom_it,
             *bloomstrength_it,
             *bloomthreshold_it,
@@ -90,9 +95,9 @@ CScene* CScene::fromFile (const irr::io::path& filename)
             camerashakeamplitude,
             camerashakeroughness,
             camerashakespeed,
-            WallpaperEngine::Core::atoSColorf (*clearcolor_it),
+            WallpaperEngine::Core::aToColorf(*clearcolor_it),
             Scenes::CProjection::fromJSON (*orthogonalprojection_it),
-            WallpaperEngine::Core::atoSColorf (*skylightcolor_it)
+            WallpaperEngine::Core::aToColorf(*skylightcolor_it)
     );
 
     auto cur = (*objects_it).begin ();
@@ -101,7 +106,7 @@ CScene* CScene::fromFile (const irr::io::path& filename)
     for (; cur != end; cur ++)
     {
         scene->insertObject (
-                CObject::fromJSON (*cur)
+                CObject::fromJSON (*cur, container)
         );
     }
 
@@ -120,12 +125,17 @@ void CScene::insertObject (CObject* object)
         this->m_objects.push_back (object);
 }
 
+CContainer* CScene::getContainer ()
+{
+    return this->m_container;
+}
+
 const Scenes::CCamera* CScene::getCamera () const
 {
     return this->m_camera;
 }
 
-const irr::video::SColorf &CScene::getAmbientColor() const
+const FloatColor &CScene::getAmbientColor() const
 {
     return this->m_ambientColor;
 }
@@ -135,12 +145,12 @@ const bool CScene::isBloom () const
     return this->m_bloom;
 }
 
-const irr::f64 CScene::getBloomStrength () const
+const double CScene::getBloomStrength () const
 {
     return this->m_bloomStrength;
 }
 
-const irr::f64 CScene::getBloomThreshold () const
+const double CScene::getBloomThreshold () const
 {
     return this->m_bloomThreshold;
 }
@@ -155,17 +165,17 @@ const bool CScene::isCameraParallax () const
     return this->m_cameraParallax;
 }
 
-const irr::f64 CScene::getCameraParallaxAmount () const
+const double CScene::getCameraParallaxAmount () const
 {
     return this->m_cameraParallaxAmount;
 }
 
-const irr::f64 CScene::getCameraParallaxDelay () const
+const double CScene::getCameraParallaxDelay () const
 {
     return this->m_cameraParallaxDelay;
 }
 
-const irr::f64 CScene::getCameraParallaxMouseInfluence () const
+const double CScene::getCameraParallaxMouseInfluence () const
 {
     return this->m_cameraParallaxMouseInfluence;
 }
@@ -180,22 +190,22 @@ const bool CScene::isCameraShake () const
     return this->m_cameraShake;
 }
 
-const irr::f64 CScene::getCameraShakeAmplitude () const
+const double CScene::getCameraShakeAmplitude () const
 {
     return this->m_cameraShakeAmplitude;
 }
 
-const irr::f64 CScene::getCameraShakeRoughness () const
+const double CScene::getCameraShakeRoughness () const
 {
     return this->m_cameraShakeRoughness;
 }
 
-const irr::f64 CScene::getCameraShakeSpeed () const
+const double CScene::getCameraShakeSpeed () const
 {
     return this->m_cameraShakeSpeed;
 }
 
-const irr::video::SColorf& CScene::getClearColor () const
+const FloatColor& CScene::getClearColor () const
 {
     return this->m_clearColor;
 }
@@ -205,7 +215,7 @@ const Scenes::CProjection* CScene::getOrthogonalProjection () const
     return this->m_orthogonalProjection;
 }
 
-const irr::video::SColorf& CScene::getSkylightColor () const
+const FloatColor& CScene::getSkylightColor () const
 {
     return this->m_skylightColor;
 }

+ 40 - 36
src/WallpaperEngine/Core/CScene.h

@@ -1,7 +1,5 @@
 #pragma once
 
-#include <irrlicht/irrlicht.h>
-
 #include "CObject.h"
 #include "CWallpaper.h"
 
@@ -9,87 +7,93 @@
 
 #include "WallpaperEngine/Core/Scenes/CCamera.h"
 #include "WallpaperEngine/Core/Scenes/CProjection.h"
+#include "WallpaperEngine/Core/Types/FloatColor.h"
 
 namespace WallpaperEngine::Core
 {
     using json = nlohmann::json;
+    using namespace WallpaperEngine::Core::Types;
 
     class CObject;
 
     class CScene : public CWallpaper
     {
     public:
-        static CScene* fromFile (const irr::io::path& filename);
+        static CScene* fromFile (const std::string& filename, CContainer* container);
 
         const std::vector<CObject*>& getObjects () const;
 
-        const irr::video::SColorf& getAmbientColor() const;
+        const FloatColor& getAmbientColor() const;
         const bool isBloom() const;
-        const irr::f64 getBloomStrength() const;
-        const irr::f64 getBloomThreshold() const;
+        const double getBloomStrength() const;
+        const double getBloomThreshold() const;
         const bool isCameraFade() const;
         const bool isCameraParallax() const;
-        const irr::f64 getCameraParallaxAmount() const;
-        const irr::f64 getCameraParallaxDelay() const;
-        const irr::f64 getCameraParallaxMouseInfluence() const;
+        const double getCameraParallaxAmount() const;
+        const double getCameraParallaxDelay() const;
+        const double getCameraParallaxMouseInfluence() const;
         const bool isCameraPreview() const;
         const bool isCameraShake() const;
-        const irr::f64 getCameraShakeAmplitude() const;
-        const irr::f64 getCameraShakeRoughness() const;
-        const irr::f64 getCameraShakeSpeed() const;
-        const irr::video::SColorf& getClearColor() const;
+        const double getCameraShakeAmplitude() const;
+        const double getCameraShakeRoughness() const;
+        const double getCameraShakeSpeed() const;
+        const FloatColor& getClearColor() const;
         const Scenes::CProjection* getOrthogonalProjection() const;
-        const irr::video::SColorf& getSkylightColor() const;
+        const FloatColor& getSkylightColor() const;
         const Scenes::CCamera* getCamera () const;
 
     protected:
         friend class CWallpaper;
 
         CScene (
+                CContainer* container,
                 Scenes::CCamera* camera,
-                irr::video::SColorf ambientColor,
+                FloatColor ambientColor,
                 bool bloom,
-                irr::f64 bloomStrength,
-                irr::f64 bloomThreshold,
+                double bloomStrength,
+                double bloomThreshold,
                 bool cameraFade,
                 bool cameraParallax,
-                irr::f64 cameraParallaxAmount,
-                irr::f64 cameraParallaxDelay,
-                irr::f64 cameraParallaxMouseInfluence,
+                double cameraParallaxAmount,
+                double cameraParallaxDelay,
+                double cameraParallaxMouseInfluence,
                 bool cameraPreview,
                 bool cameraShake,
-                irr::f64 cameraShakeAmplitude,
-                irr::f64 cameraShakeRoughness,
-                irr::f64 cameraShakeSpeed,
-                irr::video::SColorf clearColor,
+                double cameraShakeAmplitude,
+                double cameraShakeRoughness,
+                double cameraShakeSpeed,
+                FloatColor clearColor,
                 Scenes::CProjection* orthogonalProjection,
-                irr::video::SColorf skylightColor
+                FloatColor skylightColor
         );
 
         static const std::string Type;
 
         void insertObject (CObject* object);
+
+        CContainer* getContainer ();
     private:
+        CContainer* m_container;
         Scenes::CCamera* m_camera;
 
         // data from general section on the json
-        irr::video::SColorf m_ambientColor;
+        FloatColor m_ambientColor;
         bool m_bloom;
-        irr::f64 m_bloomStrength;
-        irr::f64 m_bloomThreshold;
+        double m_bloomStrength;
+        double m_bloomThreshold;
         bool m_cameraFade;
         bool m_cameraParallax;
-        irr::f64 m_cameraParallaxAmount;
-        irr::f64 m_cameraParallaxDelay;
-        irr::f64 m_cameraParallaxMouseInfluence;
+        double m_cameraParallaxAmount;
+        double m_cameraParallaxDelay;
+        double m_cameraParallaxMouseInfluence;
         bool m_cameraPreview;
         bool m_cameraShake;
-        irr::f64 m_cameraShakeAmplitude;
-        irr::f64 m_cameraShakeRoughness;
-        irr::f64 m_cameraShakeSpeed;
-        irr::video::SColorf m_clearColor;
+        double m_cameraShakeAmplitude;
+        double m_cameraShakeRoughness;
+        double m_cameraShakeSpeed;
+        FloatColor m_clearColor;
         Scenes::CProjection* m_orthogonalProjection;
-        irr::video::SColorf m_skylightColor;
+        FloatColor m_skylightColor;
 
         std::vector<CObject*> m_objects;
     };

+ 5 - 3
src/WallpaperEngine/Core/CVideo.cpp

@@ -1,15 +1,17 @@
 #include "CVideo.h"
 
+#include <utility>
+
 using namespace WallpaperEngine::Core;
 
 CVideo::CVideo (
-        const irr::io::path& filename) :
+        std::string  filename) :
         CWallpaper (Type),
-        m_filename (filename)
+        m_filename (std::move(filename))
 {
 }
 
-const irr::io::path CVideo::getFilename ()
+const std::string& CVideo::getFilename ()
 {
     return this->m_filename;
 }

+ 3 - 5
src/WallpaperEngine/Core/CVideo.h

@@ -1,7 +1,5 @@
 #pragma once
 
-#include <irrlicht/irrlicht.h>
-
 #include "Core.h"
 #include "CWallpaper.h"
 
@@ -19,15 +17,15 @@ namespace WallpaperEngine::Core
     {
     public:
         CVideo (
-                const irr::io::path& filename
+                std::string  filename
         );
 
-        const irr::io::path getFilename ();
+        const std::string& getFilename ();
 
     protected:
         friend class CWallpaper;
 
-        const irr::io::path m_filename;
+        const std::string m_filename;
 
         static const std::string Type;
 

+ 51 - 38
src/WallpaperEngine/Core/Core.cpp

@@ -1,63 +1,76 @@
-#include <irrlicht/irrlicht.h>
 #include "Core.h"
 
 using namespace WallpaperEngine;
+using namespace WallpaperEngine::Core::Types;
 
-irr::core::vector3df Core::ato3vf(const char *str)
+glm::vec4 Core::aToVector4 (const char* str)
 {
-    irr::f32 x = irr::core::fast_atof (str, &str); while (*str == ' ') str ++;
-    irr::f32 y = irr::core::fast_atof (str, &str); while (*str == ' ') str ++;
-    irr::f32 z = irr::core::fast_atof (str, &str);
+    float x = strtof (str, const_cast <char**> (&str)); while (*str == ' ') str ++;
+    float y = strtof (str, const_cast <char**> (&str)); while (*str == ' ') str ++;
+    float z = strtof (str, const_cast <char**> (&str)); while (*str == ' ') str ++;
+    float w = strtof (str, const_cast <char**> (&str));
 
-    return irr::core::vector3df (x, y, z);
+    return {x, y, z, w};
 }
 
-irr::core::vector2df Core::ato2vf (const char *str)
+glm::vec3 Core::aToVector3 (const char* str)
 {
-    irr::f32 x = irr::core::fast_atof (str, &str); while (*str == ' ') str ++;
-    irr::f32 y = irr::core::fast_atof (str, &str);
+    float x = strtof (str, const_cast <char**> (&str)); while (*str == ' ') str ++;
+    float y = strtof (str, const_cast <char**> (&str)); while (*str == ' ') str ++;
+    float z = strtof (str, const_cast <char**> (&str));
 
-    return irr::core::vector2df (x, y);
+    return {x, y, z};
 }
 
-irr::core::vector3df Core::ato3vf (const std::string& str)
+glm::vec2 Core::aToVector2 (const char* str)
 {
-    return Core::ato3vf (str.c_str ());
+    float x = strtof (str, const_cast <char**> (&str)); while (*str == ' ') str ++;
+    float y = strtof (str, const_cast <char**> (&str));
+
+    return {x, y};
+}
+
+glm::vec4 Core::aToVector4 (const std::string& str)
+{
+    return Core::aToVector4 (str.c_str ());
+}
+
+glm::vec3 Core::aToVector3 (const std::string& str)
+{
+    return Core::aToVector3 (str.c_str ());
 }
 
-irr::core::vector2df Core::ato2vf (const std::string& str)
+glm::vec2 Core::aToVector2 (const std::string& str)
 {
-    return Core::ato2vf (str.c_str ());
+    return Core::aToVector2 (str.c_str ());
 }
 
-irr::video::SColorf Core::atoSColorf (const char *str)
+FloatColor Core::aToColorf (const char* str)
 {
-    irr::core::vector3df vector = Core::ato3vf (str);
+    float r = strtof (str, const_cast<char **>(&str)); while (*str == ' ') str ++;
+    float g = strtof (str, const_cast<char **>(&str)); while (*str == ' ') str ++;
+    float b = strtof (str, const_cast<char **>(&str));
 
-    return irr::video::SColorf (
-            vector.X,
-            vector.Y,
-            vector.Z
-    );
+    return {r, g, b, 1.0f};
 }
 
-irr::video::SColorf Core::atoSColorf (const std::string& str)
+FloatColor Core::aToColorf (const std::string& str)
 {
-    return Core::atoSColorf (str.c_str ());
+    return aToColorf(str.c_str());
 }
 
-irr::video::SColor Core::atoSColor (const char *str)
+IntegerColor Core::aToColori (const char* str)
 {
-    irr::f32 r = irr::core::strtoul10 (str, &str); while (*str == ' ') str ++;
-    irr::f32 g = irr::core::strtoul10 (str, &str); while (*str == ' ') str ++;
-    irr::f32 b = irr::core::strtoul10 (str, &str);
+    uint8_t r = static_cast <uint8_t> (strtol (str, const_cast<char **>(&str), 10)); while (*str == ' ') str ++;
+    uint8_t g = static_cast <uint8_t> (strtol (str, const_cast<char **>(&str), 10)); while (*str == ' ') str ++;
+    uint8_t b = static_cast <uint8_t> (strtol (str, const_cast<char **>(&str), 10));
 
-    return irr::video::SColor (255, r, g, b);
+    return {r, g, b, 255};
 }
 
-irr::video::SColor Core::atoSColor (const std::string& str)
+IntegerColor Core::aToColori (const std::string& str)
 {
-    return Core::atoSColor (str.c_str ());
+    return aToColori(str.c_str());
 }
 
 nlohmann::json::iterator Core::jsonFindRequired (nlohmann::json& data, const char *key, const char *notFoundMsg)
@@ -86,11 +99,11 @@ template <typename T> T Core::jsonFindDefault (nlohmann::json& data, const char
 
 template bool Core::jsonFindDefault (nlohmann::json& data, const char *key, bool defaultValue);
 template std::string Core::jsonFindDefault (nlohmann::json& data, const char *key, std::string defaultValue);
-template irr::s16 Core::jsonFindDefault (nlohmann::json& data, const char *key, irr::s16 defaultValue);
-template irr::u16 Core::jsonFindDefault (nlohmann::json& data, const char *key, irr::u16 defaultValue);
-template irr::s32 Core::jsonFindDefault (nlohmann::json& data, const char *key, irr::s32 defaultValue);
-template irr::u32 Core::jsonFindDefault (nlohmann::json& data, const char *key, irr::u32 defaultValue);
-template irr::s64 Core::jsonFindDefault (nlohmann::json& data, const char *key, irr::s64 defaultValue);
-template irr::u64 Core::jsonFindDefault (nlohmann::json& data, const char *key, irr::u64 defaultValue);
-template irr::f32 Core::jsonFindDefault (nlohmann::json& data, const char *key, irr::f32 defaultValue);
-template irr::f64 Core::jsonFindDefault (nlohmann::json& data, const char *key, irr::f64 defaultValue);
+template int16_t Core::jsonFindDefault (nlohmann::json& data, const char *key, int16_t defaultValue);
+template uint16_t Core::jsonFindDefault (nlohmann::json& data, const char *key, uint16_t defaultValue);
+template int32_t Core::jsonFindDefault (nlohmann::json& data, const char *key, int32_t defaultValue);
+template uint32_t Core::jsonFindDefault (nlohmann::json& data, const char *key, uint32_t defaultValue);
+template int64_t Core::jsonFindDefault (nlohmann::json& data, const char *key, int64_t defaultValue);
+template uint64_t Core::jsonFindDefault (nlohmann::json& data, const char *key, uint64_t defaultValue);
+template float Core::jsonFindDefault (nlohmann::json& data, const char *key, float defaultValue);
+template double Core::jsonFindDefault (nlohmann::json& data, const char *key, double defaultValue);

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

@@ -1,22 +1,31 @@
 #pragma once
 
 #include <string>
-#include <irrlicht/irrlicht.h>
 #include <nlohmann/json.hpp>
+#include <glm/vec3.hpp>
+#include <glm/vec2.hpp>
+#include <glm/mat4x4.hpp>
+
+#include "WallpaperEngine/Core/Types/FloatColor.h"
+#include "WallpaperEngine/Core/Types/IntegerColor.h"
 
 namespace WallpaperEngine::Core
 {
-    irr::core::vector3df ato3vf (const char *str);
-    irr::core::vector2df ato2vf (const char *str);
+    using namespace WallpaperEngine::Core::Types;
+
+    glm::vec4 aToVector4 (const char* str);
+    glm::vec3 aToVector3 (const char* str);
+    glm::vec2 aToVector2 (const char* str);
 
-    irr::core::vector3df ato3vf (const std::string& str);
-    irr::core::vector2df ato2vf (const std::string& str);
+    glm::vec4 aToVector4 (const std::string& str);
+    glm::vec3 aToVector3 (const std::string& str);
+    glm::vec2 aToVector2 (const std::string& str);
 
-    irr::video::SColorf atoSColorf (const char *str);
-    irr::video::SColorf atoSColorf (const std::string& str);
+    FloatColor aToColorf (const char* str);
+    FloatColor aToColorf (const std::string& str);
 
-    irr::video::SColor atoSColor (const char *str);
-    irr::video::SColor atoSColor (const std::string& str);
+    IntegerColor aToColori (const char* str);
+    IntegerColor aToColori (const std::string& str);
 
     nlohmann::json::iterator jsonFindRequired (nlohmann::json& data, const char *key, const char *notFoundMsg);
     template <typename T> T jsonFindDefault (nlohmann::json& data, const char *key, T defaultValue);

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

@@ -27,12 +27,12 @@ CEffect::CEffect (
 {
 }
 
-CEffect* CEffect::fromJSON (json data, Core::CObject* object)
+CEffect* CEffect::fromJSON (json data, Core::CObject* object, CContainer* container)
 {
     auto file_it = jsonFindRequired (data, "file", "Object effect must have a file");
     auto effectpasses_it = data.find ("passes");
 
-    json content = json::parse (WallpaperEngine::FileSystem::loadFullFile ((*file_it).get <std::string> ().c_str ()));
+    json content = json::parse (WallpaperEngine::FileSystem::loadFullFile ((*file_it).get <std::string> (), container));
 
     auto name_it = jsonFindRequired (content, "name", "Effect must have a name");
     auto description_it = jsonFindRequired (content, "description", "Effect must have a description");
@@ -50,7 +50,7 @@ CEffect* CEffect::fromJSON (json data, Core::CObject* object)
         object
     );
 
-    CEffect::materialsFromJSON (passes_it, effect);
+    CEffect::materialsFromJSON (passes_it, effect, container);
     CEffect::dependencyFromJSON (dependencies_it, effect);
 
     if (fbos_it != content.end ())
@@ -153,7 +153,7 @@ void CEffect::constantsFromJSON (json::const_iterator constants_it, Core::Object
 
         if ((*cur).is_number_float () == true)
         {
-            constant = new Effects::Constants::CShaderConstantFloat ((*cur).get <irr::f32> ());
+            constant = new Effects::Constants::CShaderConstantFloat ((*cur).get <float> ());
         }
         else if ((*cur).is_number_integer () == true)
         {
@@ -161,7 +161,7 @@ void CEffect::constantsFromJSON (json::const_iterator constants_it, Core::Object
         }
         else if ((*cur).is_string () == true)
         {
-            constant = new Effects::Constants::CShaderConstantVector3 (WallpaperEngine::Core::ato3vf (*cur));
+            constant = new Effects::Constants::CShaderConstantVector3 (WallpaperEngine::Core::aToVector3 (*cur));
         }
         else
         {
@@ -196,7 +196,7 @@ void CEffect::dependencyFromJSON (json::const_iterator dependencies_it, CEffect*
     }
 }
 
-void CEffect::materialsFromJSON (json::const_iterator passes_it, CEffect* effect)
+void CEffect::materialsFromJSON (json::const_iterator passes_it, CEffect* effect, CContainer* container)
 {
     auto cur = (*passes_it).begin ();
     auto end = (*passes_it).end ();
@@ -216,11 +216,11 @@ void CEffect::materialsFromJSON (json::const_iterator passes_it, CEffect* effect
 
         if (target == (*cur).end ())
         {
-            material = Images::CMaterial::fromFile ((*materialfile).get <std::string> ().c_str ());
+            material = Images::CMaterial::fromFile ((*materialfile).get <std::string> (), container);
         }
         else
         {
-            material = Images::CMaterial::fromFile ((*materialfile).get <std::string> ().c_str (), *target);
+            material = Images::CMaterial::fromFile ((*materialfile).get <std::string> (), *target, container);
         }
 
         if (bind != (*cur).end ())

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

@@ -1,12 +1,11 @@
 #pragma once
 
-#include <irrlicht/irrlicht.h>
-
 #include "WallpaperEngine/Core/Core.h"
 #include "WallpaperEngine/Core/Objects/Effects/CFBO.h"
 #include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.h"
 #include "WallpaperEngine/Core/CObject.h"
 #include "WallpaperEngine/Core/Objects/Images/CMaterial.h"
+#include "WallpaperEngine/Assets/CContainer.h"
 
 namespace WallpaperEngine::Core
 {
@@ -16,6 +15,7 @@ namespace WallpaperEngine::Core
 namespace WallpaperEngine::Core::Objects
 {
     using json = nlohmann::json;
+    using namespace WallpaperEngine::Assets;
 
     class CEffect
     {
@@ -28,7 +28,7 @@ namespace WallpaperEngine::Core::Objects
             Core::CObject* object
         );
 
-        static CEffect* fromJSON (json data, Core::CObject* object);
+        static CEffect* fromJSON (json data, Core::CObject* object, CContainer* container);
 
         const std::vector<std::string>& getDependencies () const;
         const std::vector<Images::CMaterial*>& getMaterials () const;
@@ -40,7 +40,7 @@ namespace WallpaperEngine::Core::Objects
         static void combosFromJSON (json::const_iterator combos_it, Core::Objects::Images::Materials::CPass* pass);
         static void fbosFromJSON (json::const_iterator fbos_it, CEffect* effect);
         static void dependencyFromJSON (json::const_iterator dependencies_it, CEffect* effect);
-        static void materialsFromJSON (json::const_iterator passes_it, CEffect* effect);
+        static void materialsFromJSON (json::const_iterator passes_it, CEffect* effect, CContainer* container);
 
         void insertDependency (const std::string& dep);
         void insertMaterial (Images::CMaterial* material);

+ 26 - 14
src/WallpaperEngine/Core/Objects/CImage.cpp

@@ -1,4 +1,6 @@
 #include "CImage.h"
+
+#include <utility>
 #include "WallpaperEngine/Core/Objects/Images/CMaterial.h"
 
 #include "WallpaperEngine/FileSystem/FileSystem.h"
@@ -8,43 +10,48 @@ using namespace WallpaperEngine::Core::Objects;
 CImage::CImage (
         Images::CMaterial* material,
         bool visible,
-        irr::u32 id,
+        uint32_t id,
         std::string name,
-        const irr::core::vector3df& origin,
-        const irr::core::vector3df& scale,
-        const irr::core::vector3df& angles,
-        const irr::core::vector2df& size) :
+        const glm::vec3& origin,
+        const glm::vec3& scale,
+        const glm::vec3& angles,
+        const glm::vec2& size,
+        std::string alignment) :
         CObject (visible, id, std::move(name), Type, origin, scale, angles),
         m_size (size),
-        m_material (material)
+        m_material (material),
+        m_alignment (std::move(alignment))
 {
 }
 
 WallpaperEngine::Core::CObject* CImage::fromJSON (
     json data,
+    CContainer* container,
     bool visible,
-    irr::u32 id,
+    uint32_t id,
     std::string name,
-    const irr::core::vector3df& origin,
-    const irr::core::vector3df& scale,
-    const irr::core::vector3df& angles)
+    const glm::vec3& origin,
+    const glm::vec3& scale,
+    const glm::vec3& angles)
 {
     auto image_it = data.find ("image");
     auto size_it = jsonFindRequired (data, "size", "Images must have size");
+    auto alignment = jsonFindDefault <std::string> (data, "alignment", "center");
 
-    json content = json::parse (WallpaperEngine::FileSystem::loadFullFile ((*image_it).get <std::string> ().c_str ()));
+    json content = json::parse (WallpaperEngine::FileSystem::loadFullFile ((*image_it).get <std::string> (), container));
 
     auto material_it = jsonFindRequired (content, "material", "Image must have a material");
 
     return new CImage (
-        Images::CMaterial::fromFile ((*material_it).get <std::string> ().c_str ()),
+        Images::CMaterial::fromFile ((*material_it).get <std::string> (), container),
         visible,
         id,
         name,
         origin,
         scale,
         angles,
-        WallpaperEngine::Core::ato2vf (*size_it)
+        WallpaperEngine::Core::aToVector2 (*size_it),
+        alignment
     );
 }
 
@@ -53,10 +60,15 @@ const Images::CMaterial* CImage::getMaterial () const
     return this->m_material;
 }
 
-const irr::core::vector2df& CImage::getSize () const
+const glm::vec2& CImage::getSize () const
 {
     return this->m_size;
 }
 
+const std::string& CImage::getAlignment () const
+{
+    return this->m_alignment;
+}
+
 
 const std::string CImage::Type = "image";

+ 18 - 13
src/WallpaperEngine/Core/Objects/CImage.h

@@ -1,15 +1,16 @@
 #pragma once
 
-#include <irrlicht/irrlicht.h>
-
 #include "WallpaperEngine/Core/Objects/Images/CMaterial.h"
 
 #include "WallpaperEngine/Core/Core.h"
 #include "WallpaperEngine/Core/CObject.h"
 
+#include "WallpaperEngine/Assets/CContainer.h"
+
 namespace WallpaperEngine::Core::Objects
 {
     using json = nlohmann::json;
+    using namespace WallpaperEngine::Assets;
 
     class CImage : public CObject
     {
@@ -18,33 +19,37 @@ namespace WallpaperEngine::Core::Objects
     public:
         static CObject* fromJSON (
                 json data,
+                CContainer* container,
                 bool visible,
-                irr::u32 id,
+                uint32_t id,
                 std::string name,
-                const irr::core::vector3df& origin,
-                const irr::core::vector3df& scale,
-                const irr::core::vector3df& angles
+                const glm::vec3& origin,
+                const glm::vec3& scale,
+                const glm::vec3& angles
         );
 
         const Images::CMaterial* getMaterial () const;
-        const irr::core::vector2df& getSize () const;
+        const glm::vec2& getSize () const;
+        const std::string& getAlignment () const;
 
     protected:
         CImage (
                 Images::CMaterial* material,
                 bool visible,
-                irr::u32 id,
+                uint32_t id,
                 std::string name,
-                const irr::core::vector3df& origin,
-                const irr::core::vector3df& scale,
-                const irr::core::vector3df& angles,
-                const irr::core::vector2df& size
+                const glm::vec3& origin,
+                const glm::vec3& scale,
+                const glm::vec3& angles,
+                const glm::vec2& size,
+                std::string alignment
         );
 
         static const std::string Type;
 
     private:
-        irr::core::vector2df m_size;
+        glm::vec2 m_size;
         Images::CMaterial* m_material;
+        std::string m_alignment;
     };
 };

+ 12 - 13
src/WallpaperEngine/Core/Objects/CParticle.cpp

@@ -1,18 +1,17 @@
 #include "CParticle.h"
 #include "WallpaperEngine/FileSystem/FileSystem.h"
 
-#include <irrlicht/irrlicht.h>
-
 using namespace WallpaperEngine::Core::Objects;
 
 CParticle* CParticle::fromFile (
-    const irr::io::path& filename,
-    irr::u32 id,
+    const std::string& filename,
+    CContainer* container,
+    uint32_t id,
     std::string name,
-    const irr::core::vector3df& origin,
-    const irr::core::vector3df& scale)
+    const glm::vec3& origin,
+    const glm::vec3& scale)
 {
-    json data = json::parse (WallpaperEngine::FileSystem::loadFullFile (filename));
+    json data = json::parse (WallpaperEngine::FileSystem::loadFullFile (filename, container));
     auto controlpoint_it = data.find ("controlpoint");
     auto starttime_it = jsonFindRequired (data, "starttime", "Particles must have start time");
     auto maxcount_it = jsonFindRequired (data, "maxcount", "Particles must have maximum count");
@@ -65,13 +64,13 @@ CParticle* CParticle::fromFile (
 }
 
 CParticle::CParticle (
-        irr::u32 starttime,
-        irr::u32 maxcount,
-        irr::u32 id,
+        uint32_t starttime,
+        uint32_t maxcount,
+        uint32_t id,
         std::string name,
-        const irr::core::vector3df& origin,
-        const irr::core::vector3df& scale):
-        CObject (true, id, std::move(name), Type, origin, scale, irr::core::vector3df ()),
+        const glm::vec3& origin,
+        const glm::vec3& scale):
+        CObject (true, id, std::move(name), Type, origin, scale, glm::vec3 ()),
         m_starttime (starttime),
         m_maxcount (maxcount)
 {

+ 12 - 13
src/WallpaperEngine/Core/Objects/CParticle.h

@@ -1,7 +1,5 @@
 #pragma once
 
-#include <irrlicht/irrlicht.h>
-
 #include "WallpaperEngine/Core/Objects/Particles/CControlPoint.h"
 #include "WallpaperEngine/Core/Objects/Particles/CEmitter.h"
 #include "WallpaperEngine/Core/Objects/Particles/CInitializer.h"
@@ -19,11 +17,12 @@ namespace WallpaperEngine::Core::Objects
 
     public:
         static CParticle* fromFile (
-                const irr::io::path& filename,
-                irr::u32 id,
+                const std::string& filename,
+                CContainer* container,
+                uint32_t id,
                 std::string name,
-                const irr::core::vector3df& origin,
-                const irr::core::vector3df& scale
+                const glm::vec3& origin,
+                const glm::vec3& scale
         );
 
         const std::vector<Particles::CEmitter*>& getEmitters () const;
@@ -32,12 +31,12 @@ namespace WallpaperEngine::Core::Objects
 
     protected:
         CParticle (
-            irr::u32 starttime,
-            irr::u32 maxcount,
-            irr::u32 id,
+            uint32_t starttime,
+            uint32_t maxcount,
+            uint32_t id,
             std::string name,
-            const irr::core::vector3df& origin,
-            const irr::core::vector3df& scale
+            const glm::vec3& origin,
+            const glm::vec3& scale
         );
         void insertControlPoint (Particles::CControlPoint* controlpoint);
         void insertEmitter (Particles::CEmitter* emitter);
@@ -45,8 +44,8 @@ namespace WallpaperEngine::Core::Objects
 
         static const std::string Type;
     private:
-        irr::u32 m_starttime;
-        irr::u32 m_maxcount;
+        uint32_t m_starttime;
+        uint32_t m_maxcount;
         std::vector<Particles::CControlPoint*> m_controlpoints;
         std::vector<Particles::CEmitter*> m_emitters;
         std::vector<Particles::CInitializer*> m_initializers;

+ 8 - 10
src/WallpaperEngine/Core/Objects/CSound.cpp

@@ -1,5 +1,3 @@
-#include <irrlicht/irrlicht.h>
-
 #include "WallpaperEngine/Core/CObject.h"
 #include "CSound.h"
 
@@ -7,11 +5,11 @@ using namespace WallpaperEngine::Core::Objects;
 
 CSound::CSound (
         bool visible,
-        irr::u32 id,
+        uint32_t id,
         std::string name,
-        const irr::core::vector3df& origin,
-        const irr::core::vector3df& scale,
-        const irr::core::vector3df& angles) :
+        const glm::vec3& origin,
+        const glm::vec3& scale,
+        const glm::vec3& angles) :
         CObject (visible, id, std::move(name), Type, origin, scale, angles)
 {
 }
@@ -19,11 +17,11 @@ CSound::CSound (
 WallpaperEngine::Core::CObject* CSound::fromJSON (
         json data,
         bool visible,
-        irr::u32 id,
+        uint32_t id,
         std::string name,
-        const irr::core::vector3df& origin,
-        const irr::core::vector3df& scale,
-        const irr::core::vector3df& angles)
+        const glm::vec3& origin,
+        const glm::vec3& scale,
+        const glm::vec3& angles)
 {
     auto sound_it = jsonFindRequired (data, "sound", "Sound information not present");
 

+ 8 - 10
src/WallpaperEngine/Core/Objects/CSound.h

@@ -1,7 +1,5 @@
 #pragma once
 
-#include <irrlicht/irrlicht.h>
-
 #include "WallpaperEngine/Core/Core.h"
 #include "WallpaperEngine/Core/CObject.h"
 
@@ -17,11 +15,11 @@ namespace WallpaperEngine::Core::Objects
         static CObject* fromJSON (
             json data,
             bool visible,
-            irr::u32 id,
+            uint32_t id,
             std::string name,
-            const irr::core::vector3df& origin,
-            const irr::core::vector3df& scale,
-            const irr::core::vector3df& angles
+            const glm::vec3& origin,
+            const glm::vec3& scale,
+            const glm::vec3& angles
         );
 
         void insertSound (std::string filename);
@@ -30,11 +28,11 @@ namespace WallpaperEngine::Core::Objects
     protected:
         CSound (
             bool visible,
-            irr::u32 id,
+            uint32_t id,
             std::string name,
-            const irr::core::vector3df& origin,
-            const irr::core::vector3df& scale,
-            const irr::core::vector3df& angles
+            const glm::vec3& origin,
+            const glm::vec3& scale,
+            const glm::vec3& angles
         );
 
         static const std::string Type;

+ 2 - 2
src/WallpaperEngine/Core/Objects/Effects/CBind.cpp

@@ -4,7 +4,7 @@
 
 using namespace WallpaperEngine::Core::Objects::Effects;
 
-CBind::CBind (std::string name, irr::u32 index) :
+CBind::CBind (std::string name, uint32_t index) :
     m_name (std::move(name)),
     m_index (index)
 {
@@ -23,7 +23,7 @@ const std::string& CBind::getName () const
     return this->m_name;
 }
 
-const irr::u32& CBind::getIndex () const
+const uint32_t& CBind::getIndex () const
 {
     return this->m_index;
 }

+ 3 - 5
src/WallpaperEngine/Core/Objects/Effects/CBind.h

@@ -2,8 +2,6 @@
 
 #include <string>
 
-#include <irrlicht/irrlicht.h>
-
 #include "WallpaperEngine/Core/Core.h"
 
 namespace WallpaperEngine::Core::Objects::Effects
@@ -15,13 +13,13 @@ namespace WallpaperEngine::Core::Objects::Effects
     public:
         static CBind* fromJSON (json data);
 
-        CBind (std::string name, irr::u32 index);
+        CBind (std::string name, uint32_t index);
 
         const std::string& getName () const;
-        const irr::u32& getIndex () const;
+        const uint32_t& getIndex () const;
 
     private:
         std::string m_name;
-        irr::u32 m_index;
+        uint32_t m_index;
     };
 }

+ 2 - 2
src/WallpaperEngine/Core/Objects/Effects/CFBO.cpp

@@ -4,7 +4,7 @@
 
 using namespace WallpaperEngine::Core::Objects::Effects;
 
-CFBO::CFBO (std::string name, irr::f32 scale, std::string format) :
+CFBO::CFBO (std::string name, float scale, std::string format) :
     m_name (std::move(name)),
     m_scale (scale),
     m_format(std::move(format))
@@ -29,7 +29,7 @@ const std::string& CFBO::getName () const
     return this->m_name;
 }
 
-const irr::f32& CFBO::getScale () const
+const float& CFBO::getScale () const
 {
     return this->m_scale;
 }

+ 3 - 4
src/WallpaperEngine/Core/Objects/Effects/CFBO.h

@@ -2,7 +2,6 @@
 
 #include <string>
 
-#include <irrlicht/irrlicht.h>
 #include <nlohmann/json.hpp>
 
 namespace WallpaperEngine::Core::Objects::Effects
@@ -12,17 +11,17 @@ namespace WallpaperEngine::Core::Objects::Effects
     class CFBO
     {
     public:
-        CFBO (std::string name, irr::f32 scale, std::string format);
+        CFBO (std::string name, float scale, std::string format);
 
         static CFBO* fromJSON (json data);
 
         const std::string& getName () const;
-        const irr::f32& getScale () const;
+        const float& getScale () const;
         const std::string& getFormat () const;
 
     private:
         std::string m_name;
-        irr::f32 m_scale;
+        float m_scale;
         std::string m_format;
     };
 }

+ 6 - 1
src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.cpp

@@ -5,4 +5,9 @@ using namespace WallpaperEngine::Core::Objects::Effects::Constants;
 CShaderConstant::CShaderConstant (std::string type) :
     m_type (std::move(type))
 {
-}
+}
+
+const std::string& CShaderConstant::getType () const
+{
+    return this->m_type;
+}

+ 1 - 0
src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.h

@@ -13,6 +13,7 @@ namespace WallpaperEngine::Core::Objects::Effects::Constants
         template<class T> T* as () { assert (is <T> ()); return (T*) this; }
 
         template<class T> bool is () { return this->m_type == T::Type; }
+        const std::string& getType () const;
 
     private:
         std::string m_type;

+ 2 - 2
src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.cpp

@@ -3,13 +3,13 @@
 using namespace WallpaperEngine::Core::Objects::Effects::Constants;
 
 
-CShaderConstantFloat::CShaderConstantFloat (irr::f32 value) :
+CShaderConstantFloat::CShaderConstantFloat (float value) :
     CShaderConstant (Type),
     m_value (value)
 {
 }
 
-irr::f32* CShaderConstantFloat::getValue ()
+float* CShaderConstantFloat::getValue ()
 {
     return &this->m_value;
 }

+ 3 - 4
src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.h

@@ -3,19 +3,18 @@
 #include "CShaderConstant.h"
 
 #include <string>
-#include <irrlicht/irrlicht.h>
 
 namespace WallpaperEngine::Core::Objects::Effects::Constants
 {
     class CShaderConstantFloat : public CShaderConstant
     {
     public:
-        CShaderConstantFloat (irr::f32 value);
+        CShaderConstantFloat (float value);
 
-        irr::f32* getValue ();
+        float* getValue ();
 
         static const std::string Type;
     protected:
-        irr::f32 m_value;
+        float m_value;
     };
 }

+ 3 - 3
src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantInteger.cpp

@@ -3,15 +3,15 @@
 using namespace WallpaperEngine::Core::Objects::Effects::Constants;
 
 
-CShaderConstantInteger::CShaderConstantInteger (irr::s32 value) :
+CShaderConstantInteger::CShaderConstantInteger (int32_t value) :
     CShaderConstant (Type),
     m_value (value)
 {
 }
 
-irr::u32* CShaderConstantInteger::getValue ()
+int32_t* CShaderConstantInteger::getValue ()
 {
     return &this->m_value;
 }
 
-const std::string CShaderConstantInteger::Type = "integer";
+const std::string CShaderConstantInteger::Type = "int";

+ 3 - 4
src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantInteger.h

@@ -3,19 +3,18 @@
 #include "CShaderConstant.h"
 
 #include <string>
-#include <irrlicht/irrlicht.h>
 
 namespace WallpaperEngine::Core::Objects::Effects::Constants
 {
     class CShaderConstantInteger : public CShaderConstant
     {
     public:
-        CShaderConstantInteger (irr::s32 value);
+        CShaderConstantInteger (int32_t value);
 
-        irr::u32* getValue ();
+        int32_t* getValue ();
 
         static const std::string Type;
     protected:
-        irr::u32 m_value;
+        int32_t m_value;
     };
 }

+ 3 - 3
src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector3.cpp

@@ -3,15 +3,15 @@
 using namespace WallpaperEngine::Core::Objects::Effects::Constants;
 
 
-CShaderConstantVector3::CShaderConstantVector3 (irr::core::vector3df value) :
+CShaderConstantVector3::CShaderConstantVector3 (glm::vec3 value) :
     CShaderConstant (Type),
     m_value (value)
 {
 }
 
-irr::core::vector3df* CShaderConstantVector3::getValue ()
+glm::vec3* CShaderConstantVector3::getValue ()
 {
     return &this->m_value;
 }
 
-const std::string CShaderConstantVector3::Type = "vector3";
+const std::string CShaderConstantVector3::Type = "vec3";

+ 4 - 4
src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector3.h

@@ -3,19 +3,19 @@
 #include "CShaderConstant.h"
 
 #include <string>
-#include <irrlicht/irrlicht.h>
+#include <glm/vec3.hpp>
 
 namespace WallpaperEngine::Core::Objects::Effects::Constants
 {
     class CShaderConstantVector3 : public CShaderConstant
     {
     public:
-        CShaderConstantVector3 (irr::core::vector3df value);
+        CShaderConstantVector3 (glm::vec3 value);
 
-        irr::core::vector3df* getValue ();
+        glm::vec3* getValue ();
 
         static const std::string Type;
     protected:
-        irr::core::vector3df m_value;
+        glm::vec3 m_value;
     };
 }

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

@@ -1,10 +1,11 @@
 #include "CMaterial.h"
 
-#include <irrlicht/irrlicht.h>
 #include <nlohmann/json.hpp>
 
 #include "WallpaperEngine/FileSystem/FileSystem.h"
 
+using namespace WallpaperEngine::Assets;
+
 using namespace WallpaperEngine::Core::Objects;
 using namespace WallpaperEngine::Core::Objects::Images;
 
@@ -13,16 +14,16 @@ CMaterial::CMaterial () :
 {
 }
 
-CMaterial* CMaterial::fromFile (const irr::io::path& filename)
+CMaterial* CMaterial::fromFile (const std::string& filename, CContainer* container)
 {
     return fromJSON (
-        json::parse (WallpaperEngine::FileSystem::loadFullFile (filename))
+        json::parse (WallpaperEngine::FileSystem::loadFullFile (filename, container))
     );
 }
-CMaterial* CMaterial::fromFile (const irr::io::path& filename, const std::string& target)
+CMaterial* CMaterial::fromFile (const std::string& filename, const std::string& target, CContainer* container)
 {
     return fromJSON (
-        json::parse (WallpaperEngine::FileSystem::loadFullFile (filename)), target
+        json::parse (WallpaperEngine::FileSystem::loadFullFile (filename, container)), target
     );
 }
 

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

@@ -1,22 +1,22 @@
 #pragma once
 
-#include <irrlicht/irrlicht.h>
-
 #include "WallpaperEngine/Core/Objects/Images/Materials/CPass.h"
 #include "WallpaperEngine/Core/Objects/Effects/CBind.h"
 
 #include "WallpaperEngine/Core/Core.h"
+#include "WallpaperEngine/Assets/CContainer.h"
 
 namespace WallpaperEngine::Core::Objects::Images
 {
     using json = nlohmann::json;
+    using namespace WallpaperEngine::Assets;
 
     class CMaterial
     {
     public:
-        static CMaterial* fromFile (const irr::io::path& filename);
+        static CMaterial* fromFile (const std::string& filename, CContainer* container);
         static CMaterial* fromJSON (json data);
-        static CMaterial* fromFile (const irr::io::path& filename, const std::string& target);
+        static CMaterial* fromFile (const std::string& filename, const std::string& target, CContainer* container);
         static CMaterial* fromJSON (json data, const std::string& target);
 
         void insertPass (Materials::CPass* mass);

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

@@ -12,7 +12,7 @@ CControlPoint* CControlPoint::fromJSON (json data)
 
     if (offset_it != data.end ())
     {
-        controlpoint->setOffset (WallpaperEngine::Core::ato3vf (*offset_it));
+        controlpoint->setOffset (WallpaperEngine::Core::aToVector3 (*offset_it));
     }
 
     if (flags_it != data.end ())
@@ -23,29 +23,29 @@ CControlPoint* CControlPoint::fromJSON (json data)
     return controlpoint;
 }
 
-CControlPoint::CControlPoint (irr::u32 id, irr::u32 flags) :
+CControlPoint::CControlPoint (uint32_t id, uint32_t flags) :
     m_id (id),
     m_flags (flags),
-    m_offset (irr::core::vector3df ())
+    m_offset (glm::vec3 ())
 {
 }
 
-void CControlPoint::setOffset (const irr::core::vector3df& offset)
+void CControlPoint::setOffset (const glm::vec3& offset)
 {
     this->m_offset = offset;
 }
 
-void CControlPoint::setFlags (irr::u32 flags)
+void CControlPoint::setFlags (uint32_t flags)
 {
     this->m_flags = flags;
 }
 
-const irr::core::vector3df& CControlPoint::getOffset () const
+const glm::vec3& CControlPoint::getOffset () const
 {
     return this->m_offset;
 }
 
-const irr::u32 CControlPoint::getFlags () const
+const uint32_t CControlPoint::getFlags () const
 {
     return this->m_flags;
 }

+ 8 - 10
src/WallpaperEngine/Core/Objects/Particles/CControlPoint.h

@@ -1,7 +1,5 @@
 #pragma once
 
-#include <irrlicht/irrlicht.h>
-
 #include "WallpaperEngine/Core/Core.h"
 
 namespace WallpaperEngine::Core::Objects::Particles
@@ -13,16 +11,16 @@ namespace WallpaperEngine::Core::Objects::Particles
     public:
         static CControlPoint* fromJSON (json data);
 
-        const irr::core::vector3df& getOffset () const;
-        const irr::u32 getFlags () const;
+        const glm::vec3& getOffset () const;
+        const uint32_t getFlags () const;
     protected:
-        CControlPoint (irr::u32 id, irr::u32 flags = 0);
+        CControlPoint (uint32_t id, uint32_t flags = 0);
 
-        void setOffset (const irr::core::vector3df& offset);
-        void setFlags (irr::u32 flags);
+        void setOffset (const glm::vec3& offset);
+        void setFlags (uint32_t flags);
     private:
-        irr::u32 m_id;
-        irr::u32 m_flags;
-        irr::core::vector3df m_offset;
+        uint32_t m_id;
+        uint32_t m_flags;
+        glm::vec3 m_offset;
     };
 };

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

@@ -13,24 +13,24 @@ CEmitter* CEmitter::fromJSON (json data)
     auto rate_it = jsonFindRequired (data, "rate", "Particle emitter must have a rate");
 
     return new CEmitter (
-            WallpaperEngine::Core::ato3vf (*directions_it),
+            WallpaperEngine::Core::aToVector3 (*directions_it),
             *distancemax_it,
             *distancemin_it,
-            (id_it == data.end () ? 0 : (irr::u32) (*id_it)),
+            (id_it == data.end () ? 0 : (uint32_t) (*id_it)),
             *name_it,
-            WallpaperEngine::Core::ato3vf (*origin_it),
+            WallpaperEngine::Core::aToVector3 (*origin_it),
             *rate_it
     );
 }
 
 CEmitter::CEmitter (
-        const irr::core::vector3df& directions,
-        irr::u32 distancemax,
-        irr::u32 distancemin,
-        irr::u32 id,
+        const glm::vec3& directions,
+        uint32_t distancemax,
+        uint32_t distancemin,
+        uint32_t id,
         std::string name,
-        const irr::core::vector3df& origin,
-        irr::f64 rate):
+        const glm::vec3& origin,
+        double rate):
     m_directions (directions),
     m_distancemax (distancemax),
     m_distancemin (distancemin),
@@ -47,27 +47,27 @@ const std::string& CEmitter::getName () const
     return this->m_name;
 }
 
-const irr::u32 CEmitter::getDistanceMax () const
+const uint32_t CEmitter::getDistanceMax () const
 {
     return this->m_distancemax;
 }
 
-const irr::u32 CEmitter::getDistanceMin () const
+const uint32_t CEmitter::getDistanceMin () const
 {
     return this->m_distancemin;
 }
 
-const irr::core::vector3df& CEmitter::getDirections () const
+const glm::vec3& CEmitter::getDirections () const
 {
     return this->m_directions;
 }
 
-const irr::core::vector3df& CEmitter::getOrigin () const
+const glm::vec3& CEmitter::getOrigin () const
 {
     return this->m_origin;
 }
 
-const irr::f64 CEmitter::getRate () const
+const double CEmitter::getRate () const
 {
     return this->m_rate;
 }

+ 17 - 19
src/WallpaperEngine/Core/Objects/Particles/CEmitter.h

@@ -1,7 +1,5 @@
 #pragma once
 
-#include <irrlicht/irrlicht.h>
-
 #include "WallpaperEngine/Core/Core.h"
 
 namespace WallpaperEngine::Core::Objects::Particles
@@ -14,28 +12,28 @@ namespace WallpaperEngine::Core::Objects::Particles
         static CEmitter* fromJSON (json data);
 
         const std::string& getName () const;
-        const irr::u32 getDistanceMax () const;
-        const irr::u32 getDistanceMin () const;
-        const irr::core::vector3df& getDirections () const;
-        const irr::core::vector3df& getOrigin () const;
-        const irr::f64 getRate () const;
+        const uint32_t getDistanceMax () const;
+        const uint32_t getDistanceMin () const;
+        const glm::vec3& getDirections () const;
+        const glm::vec3& getOrigin () const;
+        const double getRate () const;
     protected:
         CEmitter (
-            const irr::core::vector3df& directions,
-            irr::u32 distancemax,
-            irr::u32 distancemin,
-            irr::u32 id,
+            const glm::vec3& directions,
+            uint32_t distancemax,
+            uint32_t distancemin,
+            uint32_t id,
             std::string name,
-            const irr::core::vector3df& origin,
-            irr::f64 rate
+            const glm::vec3& origin,
+            double rate
         );
     private:
-        irr::core::vector3df m_directions;
-        irr::u32 m_distancemax;
-        irr::u32 m_distancemin;
-        irr::u32 m_id;
+        glm::vec3 m_directions;
+        uint32_t m_distancemax;
+        uint32_t m_distancemin;
+        uint32_t m_id;
         std::string m_name;
-        irr::core::vector3df m_origin;
-        irr::f64 m_rate;
+        glm::vec3 m_origin;
+        double m_rate;
     };
 };

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

@@ -15,7 +15,7 @@ CInitializer* CInitializer::fromJSON (json data)
 {
     auto id_it = data.find ("id");
     auto name_it = jsonFindRequired (data, "name", "Particle's initializer must have a name");
-    irr::u32 id = ((id_it == data.end ()) ? 0 : (irr::u32) (*id_it));
+    uint32_t id = ((id_it == data.end ()) ? 0 : (uint32_t) (*id_it));
 
     if (*name_it == "lifetimerandom")
     {
@@ -56,7 +56,7 @@ CInitializer* CInitializer::fromJSON (json data)
 }
 
 
-CInitializer::CInitializer (irr::u32 id, std::string name) :
+CInitializer::CInitializer (uint32_t id, std::string name) :
     m_id (id),
     m_name (std::move(name))
 {
@@ -68,7 +68,7 @@ const std::string& CInitializer::getName () const
     return this->m_name;
 }
 
-const irr::u32 CInitializer::getId () const
+const uint32_t CInitializer::getId () const
 {
     return this->m_id;
 }

+ 3 - 5
src/WallpaperEngine/Core/Objects/Particles/CInitializer.h

@@ -1,7 +1,5 @@
 #pragma once
 
-#include <irrlicht/irrlicht.h>
-
 #include "WallpaperEngine/Core/Core.h"
 
 namespace WallpaperEngine::Core::Objects::Particles
@@ -14,11 +12,11 @@ namespace WallpaperEngine::Core::Objects::Particles
         static CInitializer* fromJSON (json data);
 
         const std::string& getName () const;
-        const irr::u32 getId () const;
+        const uint32_t getId () const;
     protected:
-        CInitializer (irr::u32 id, std::string name);
+        CInitializer (uint32_t id, std::string name);
     private:
-        irr::u32 m_id;
+        uint32_t m_id;
         std::string m_name;
     };
 };

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

@@ -2,7 +2,7 @@
 
 using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
 
-CAlphaRandom* CAlphaRandom::fromJSON (json data, irr::u32 id)
+CAlphaRandom* CAlphaRandom::fromJSON (json data, uint32_t id)
 {
     auto min_it = jsonFindRequired (data, "min", "Alpharandom initializer must have a minimum value");
     auto max_it = jsonFindRequired (data, "max", "Alpharandom initializer must have a maximum value");
@@ -10,19 +10,19 @@ CAlphaRandom* CAlphaRandom::fromJSON (json data, irr::u32 id)
     return new CAlphaRandom (id, *min_it, *max_it);
 }
 
-CAlphaRandom::CAlphaRandom (irr::u32 id, irr::f64 min, irr::f64 max) :
+CAlphaRandom::CAlphaRandom (uint32_t id, double min, double max) :
         CInitializer (id, "alpharandom"),
         m_min (min),
         m_max (max)
 {
 }
 
-const irr::f64 CAlphaRandom::getMinimum () const
+const double CAlphaRandom::getMinimum () const
 {
     return this->m_min;
 }
 
-const irr::f64 CAlphaRandom::getMaximum () const
+const double CAlphaRandom::getMaximum () const
 {
     return this->m_max;
 }

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

@@ -4,23 +4,21 @@
 
 #include "WallpaperEngine/Core/Core.h"
 
-#include <irrlicht/irrlicht.h>
-
 namespace WallpaperEngine::Core::Objects::Particles::Initializers
 {
     class CAlphaRandom : CInitializer
     {
     public:
-        const irr::f64 getMinimum () const;
-        const irr::f64 getMaximum () const;
+        const double getMinimum () const;
+        const double getMaximum () const;
     protected:
         friend class CInitializer;
 
-        static CAlphaRandom* fromJSON (json data, irr::u32 id);
+        static CAlphaRandom* fromJSON (json data, uint32_t id);
 
-        CAlphaRandom (irr::u32 id, irr::f64 min, irr::f64 max);
+        CAlphaRandom (uint32_t id, double min, double max);
     private:
-        irr::f64 m_max;
-        irr::f64 m_min;
+        double m_max;
+        double m_min;
     };
 };

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

@@ -2,32 +2,32 @@
 
 using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
 
-CAngularVelocityRandom* CAngularVelocityRandom::fromJSON (json data, irr::u32 id)
+CAngularVelocityRandom* CAngularVelocityRandom::fromJSON (json data, uint32_t id)
 {
     auto min_it = jsonFindRequired (data, "min", "Angularvelocityrandom initializer must have a minimum value");
     auto max_it = jsonFindRequired (data, "max", "Angularvelocityrandom initializer must have a maximum value");
 
     return new CAngularVelocityRandom (
             id,
-            WallpaperEngine::Core::ato3vf (*min_it),
-            WallpaperEngine::Core::ato3vf (*max_it)
+            WallpaperEngine::Core::aToVector3 (*min_it),
+            WallpaperEngine::Core::aToVector3 (*max_it)
     );
 }
 
 
-CAngularVelocityRandom::CAngularVelocityRandom (irr::u32 id, irr::core::vector3df min, irr::core::vector3df max) :
+CAngularVelocityRandom::CAngularVelocityRandom (uint32_t id, glm::vec3 min, glm::vec3 max) :
         CInitializer (id, "angularvelocityrandom"),
         m_min (min),
         m_max (max)
 {
 }
 
-const irr::core::vector3df& CAngularVelocityRandom::getMinimum () const
+const glm::vec3& CAngularVelocityRandom::getMinimum () const
 {
     return this->m_min;
 }
 
-const irr::core::vector3df& CAngularVelocityRandom::getMaximum () const
+const glm::vec3& CAngularVelocityRandom::getMaximum () const
 {
     return this->m_max;
 }

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

@@ -4,23 +4,21 @@
 
 #include "WallpaperEngine/Core/Core.h"
 
-#include <irrlicht/irrlicht.h>
-
 namespace WallpaperEngine::Core::Objects::Particles::Initializers
 {
     class CAngularVelocityRandom : CInitializer
     {
     public:
-        const irr::core::vector3df& getMinimum () const;
-        const irr::core::vector3df& getMaximum () const;
+        const glm::vec3& getMinimum () const;
+        const glm::vec3& getMaximum () const;
     protected:
         friend class CInitializer;
 
-        static CAngularVelocityRandom* fromJSON (json data, irr::u32 id);
+        static CAngularVelocityRandom* fromJSON (json data, uint32_t id);
 
-        CAngularVelocityRandom (irr::u32 id, irr::core::vector3df min, irr::core::vector3df max);
+        CAngularVelocityRandom (uint32_t id, glm::vec3 min, glm::vec3 max);
     private:
-        irr::core::vector3df m_max;
-        irr::core::vector3df m_min;
+        glm::vec3 m_max;
+        glm::vec3 m_min;
     };
 };

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

@@ -2,32 +2,32 @@
 
 using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
 
-CColorRandom* CColorRandom::fromJSON (json data, irr::u32 id)
+CColorRandom* CColorRandom::fromJSON (json data, uint32_t id)
 {
     auto min_it = jsonFindRequired (data, "min", "Colorrandom initializer must have a minimum value");
     auto max_it = jsonFindRequired (data, "max", "Colorrandom initializer must have a maximum value");
 
     return new CColorRandom (
             id,
-            WallpaperEngine::Core::atoSColor (*min_it),
-            WallpaperEngine::Core::atoSColor (*max_it)
+            WallpaperEngine::Core::aToColori (*min_it),
+            WallpaperEngine::Core::aToColori (*max_it)
     );
 }
 
 
-CColorRandom::CColorRandom (irr::u32 id, irr::video::SColor min, irr::video::SColor max) :
+CColorRandom::CColorRandom (uint32_t id, IntegerColor min, IntegerColor max) :
         CInitializer (id, "colorrandom"),
         m_min (min),
         m_max (max)
 {
 }
 
-const irr::video::SColor& CColorRandom::getMinimum () const
+const IntegerColor& CColorRandom::getMinimum () const
 {
     return this->m_min;
 }
 
-const irr::video::SColor& CColorRandom::getMaximum () const
+const IntegerColor& CColorRandom::getMaximum () const
 {
     return this->m_max;
 }

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

@@ -4,23 +4,23 @@
 
 #include "WallpaperEngine/Core/Core.h"
 
-#include <irrlicht/irrlicht.h>
-
 namespace WallpaperEngine::Core::Objects::Particles::Initializers
 {
+    using namespace WallpaperEngine::Core::Types;
+
     class CColorRandom : CInitializer
     {
     public:
-        const irr::video::SColor& getMinimum () const;
-        const irr::video::SColor& getMaximum () const;
+        const IntegerColor& getMinimum () const;
+        const IntegerColor& getMaximum () const;
     protected:
         friend class CInitializer;
 
-        static CColorRandom* fromJSON (json data, irr::u32 id);
+        static CColorRandom* fromJSON (json data, uint32_t id);
 
-        CColorRandom (irr::u32 id, irr::video::SColor min, irr::video::SColor max);
+        CColorRandom (uint32_t id, IntegerColor min, IntegerColor max);
     private:
-        irr::video::SColor m_max;
-        irr::video::SColor m_min;
+        IntegerColor m_max;
+        IntegerColor m_min;
     };
 };

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

@@ -2,7 +2,7 @@
 
 using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
 
-CLifeTimeRandom* CLifeTimeRandom::fromJSON (json data, irr::u32 id)
+CLifeTimeRandom* CLifeTimeRandom::fromJSON (json data, uint32_t id)
 {
     auto min_it = jsonFindRequired (data, "min", "Lifetimerandom initializer must have a minimum value");
     auto max_it = jsonFindRequired (data, "max", "Lifetimerandom initializer must have a maximum value");
@@ -11,19 +11,19 @@ CLifeTimeRandom* CLifeTimeRandom::fromJSON (json data, irr::u32 id)
 }
 
 
-CLifeTimeRandom::CLifeTimeRandom (irr::u32 id, irr::u32 min, irr::u32 max) :
+CLifeTimeRandom::CLifeTimeRandom (uint32_t id, uint32_t min, uint32_t max) :
         CInitializer (id, "lifetimerandom"),
         m_min (min),
         m_max (max)
 {
 }
 
-const irr::u32 CLifeTimeRandom::getMinimum () const
+const uint32_t CLifeTimeRandom::getMinimum () const
 {
     return this->m_min;
 }
 
-const irr::u32 CLifeTimeRandom::getMaximum () const
+const uint32_t CLifeTimeRandom::getMaximum () const
 {
     return this->m_max;
 }

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

@@ -4,23 +4,21 @@
 
 #include "WallpaperEngine/Core/Core.h"
 
-#include <irrlicht/irrlicht.h>
-
 namespace WallpaperEngine::Core::Objects::Particles::Initializers
 {
     class CLifeTimeRandom : CInitializer
     {
     public:
-        const irr::u32 getMinimum () const;
-        const irr::u32 getMaximum () const;
+        const uint32_t getMinimum () const;
+        const uint32_t getMaximum () const;
     protected:
         friend class CInitializer;
 
-        static CLifeTimeRandom* fromJSON (json data, irr::u32 id);
+        static CLifeTimeRandom* fromJSON (json data, uint32_t id);
 
-        CLifeTimeRandom (irr::u32 id, irr::u32 min, irr::u32 max);
+        CLifeTimeRandom (uint32_t id, uint32_t min, uint32_t max);
     private:
-        irr::u32 m_max;
-        irr::u32 m_min;
+        uint32_t m_max;
+        uint32_t m_min;
     };
 };

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

@@ -4,21 +4,21 @@
 
 using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
 
-CRotationRandom* CRotationRandom::fromJSON (json data, irr::u32 id)
+CRotationRandom* CRotationRandom::fromJSON (json data, uint32_t id)
 {
     auto min_it = data.find ("minVector");
     auto max_it = data.find ("max");
 
-    irr::core::vector3df minVector = irr::core::vector3df ();
-    irr::core::vector3df maxVector = irr::core::vector3df ();
-    irr::f64 minNumber = 0.0f;
-    irr::f64 maxNumber = 0.0f;
+    glm::vec3 minVector = glm::vec3 ();
+    glm::vec3 maxVector = glm::vec3 ();
+    double minNumber = 0.0f;
+    double maxNumber = 0.0f;
     bool isMinVector = false;
     bool isMaxVector = false;
 
     if (min_it != data.end () && min_it->is_string ())
     {
-        minVector = WallpaperEngine::Core::ato3vf (*min_it);
+        minVector = WallpaperEngine::Core::aToVector3 (*min_it);
         isMinVector = true;
     }
     else if (min_it != data.end () && min_it->is_number ())
@@ -29,7 +29,7 @@ CRotationRandom* CRotationRandom::fromJSON (json data, irr::u32 id)
 
     if (max_it != data.end () && max_it->is_string ())
     {
-        maxVector = WallpaperEngine::Core::ato3vf (*max_it);
+        maxVector = WallpaperEngine::Core::aToVector3 (*max_it);
         isMaxVector = true;
     }
     else if(max_it != data.end () && max_it->is_number ())
@@ -42,12 +42,12 @@ CRotationRandom* CRotationRandom::fromJSON (json data, irr::u32 id)
 }
 
 CRotationRandom::CRotationRandom (
-    irr::u32 id,
-    irr::core::vector3df minVector,
-    irr::f64 minNumber,
+    uint32_t id,
+    glm::vec3 minVector,
+    double minNumber,
     bool isMinimumVector,
-    irr::core::vector3df maxVector,
-    irr::f64 maxNumber,
+    glm::vec3 maxVector,
+    double maxNumber,
     bool isMaximumVector
 ) :
         CInitializer (id, "rotationrandom"),
@@ -60,22 +60,22 @@ CRotationRandom::CRotationRandom (
 {
 }
 
-const irr::core::vector3df CRotationRandom::getMinimumVector () const
+const glm::vec3 CRotationRandom::getMinimumVector () const
 {
     return this->m_minVector;
 }
 
-const irr::core::vector3df CRotationRandom::getMaximumVector () const
+const glm::vec3 CRotationRandom::getMaximumVector () const
 {
     return this->m_maxVector;
 }
 
-const irr::f64 CRotationRandom::getMinimumNumber () const
+const double CRotationRandom::getMinimumNumber () const
 {
     return this->m_minNumber;
 }
 
-const irr::f64 CRotationRandom::getMaximumNumber () const
+const double CRotationRandom::getMaximumNumber () const
 {
     return this->m_maxNumber;
 }

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

@@ -3,17 +3,16 @@
 #include "WallpaperEngine/Core/Objects/Particles/CInitializer.h"
 
 #include <nlohmann/json.hpp>
-#include <irrlicht/irrlicht.h>
 
 namespace WallpaperEngine::Core::Objects::Particles::Initializers
 {
     class CRotationRandom : CInitializer
     {
     public:
-        const irr::core::vector3df getMinimumVector () const;
-        const irr::core::vector3df getMaximumVector () const;
-        const irr::f64             getMinimumNumber () const;
-        const irr::f64             getMaximumNumber () const;
+        const glm::vec3 getMinimumVector () const;
+        const glm::vec3 getMaximumVector () const;
+        const double             getMinimumNumber () const;
+        const double             getMaximumNumber () const;
 
         const bool isMinimumVector () const;
         const bool isMinimumNumber () const;
@@ -23,22 +22,22 @@ namespace WallpaperEngine::Core::Objects::Particles::Initializers
     protected:
         friend class CInitializer;
 
-        static CRotationRandom* fromJSON (json data, irr::u32 id);
+        static CRotationRandom* fromJSON (json data, uint32_t id);
 
         CRotationRandom (
-            irr::u32 id,
-            irr::core::vector3df minVector,
-            irr::f64 minNumber,
+            uint32_t id,
+            glm::vec3 minVector,
+            double minNumber,
             bool isMinimumVector,
-            irr::core::vector3df maxVector,
-            irr::f64 maxNumber,
+            glm::vec3 maxVector,
+            double maxNumber,
             bool isMaximumVector
         );
     private:
-        irr::core::vector3df m_maxVector;
-        irr::f64             m_maxNumber;
-        irr::core::vector3df m_minVector;
-        irr::f64             m_minNumber;
+        glm::vec3 m_maxVector;
+        double             m_maxNumber;
+        glm::vec3 m_minVector;
+        double             m_minNumber;
 
         bool m_isMinimumVector;
         bool m_isMaximumVector;

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

@@ -2,7 +2,7 @@
 
 using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
 
-CSizeRandom* CSizeRandom::fromJSON (json data, irr::u32 id)
+CSizeRandom* CSizeRandom::fromJSON (json data, uint32_t id)
 {
     auto min_it = jsonFindRequired (data, "min", "Sizerandom initializer must have a minimum value");
     auto max_it = jsonFindRequired (data, "max", "Sizerandom initializer must have a maximum value");
@@ -10,19 +10,19 @@ CSizeRandom* CSizeRandom::fromJSON (json data, irr::u32 id)
     return new CSizeRandom (id, *min_it, *max_it);
 }
 
-CSizeRandom::CSizeRandom (irr::u32 id, irr::u32 min, irr::u32 max) :
+CSizeRandom::CSizeRandom (uint32_t id, uint32_t min, uint32_t max) :
         CInitializer (id, "sizerandom"),
         m_min (min),
         m_max (max)
 {
 }
 
-const irr::u32 CSizeRandom::getMinimum () const
+const uint32_t CSizeRandom::getMinimum () const
 {
     return this->m_min;
 }
 
-const irr::u32 CSizeRandom::getMaximum () const
+const uint32_t CSizeRandom::getMaximum () const
 {
     return this->m_max;
 }

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

@@ -4,23 +4,21 @@
 
 #include "WallpaperEngine/Core/Core.h"
 
-#include <irrlicht/irrlicht.h>
-
 namespace WallpaperEngine::Core::Objects::Particles::Initializers
 {
     class CSizeRandom : CInitializer
     {
     public:
-        const irr::u32 getMinimum () const;
-        const irr::u32 getMaximum () const;
+        const uint32_t getMinimum () const;
+        const uint32_t getMaximum () const;
     protected:
         friend class CInitializer;
 
-        static CSizeRandom* fromJSON (json data, irr::u32 id);
+        static CSizeRandom* fromJSON (json data, uint32_t id);
 
-        CSizeRandom (irr::u32 id, irr::u32 min, irr::u32 max);
+        CSizeRandom (uint32_t id, uint32_t min, uint32_t max);
     private:
-        irr::u32 m_max;
-        irr::u32 m_min;
+        uint32_t m_max;
+        uint32_t m_min;
     };
 };

+ 8 - 8
src/WallpaperEngine/Core/Objects/Particles/Initializers/CTurbulentVelocityRandom.cpp

@@ -4,7 +4,7 @@
 
 using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
 
-CTurbulentVelocityRandom* CTurbulentVelocityRandom::fromJSON (json data, irr::u32 id)
+CTurbulentVelocityRandom* CTurbulentVelocityRandom::fromJSON (json data, uint32_t id)
 {
     json::const_iterator phasemax_it = data.find ("phasemax");
     json::const_iterator scale_it = data.find ("scale");
@@ -48,8 +48,8 @@ CTurbulentVelocityRandom* CTurbulentVelocityRandom::fromJSON (json data, irr::u3
 }
 
 
-CTurbulentVelocityRandom::CTurbulentVelocityRandom (irr::u32 id,
-                          irr::f64 phasemax, irr::f64 scale, irr::f64 timescale, irr::u32 speedmin, irr::u32 speedmax) :
+CTurbulentVelocityRandom::CTurbulentVelocityRandom (uint32_t id,
+                          double phasemax, double scale, double timescale, uint32_t speedmin, uint32_t speedmax) :
         CInitializer (id, "turbulentvelocityrandom"),
         m_phasemax (phasemax),
         m_scale (scale),
@@ -60,27 +60,27 @@ CTurbulentVelocityRandom::CTurbulentVelocityRandom (irr::u32 id,
 }
 
 
-irr::f64 CTurbulentVelocityRandom::getPhaseMax ()
+double CTurbulentVelocityRandom::getPhaseMax ()
 {
     return this->m_phasemax;
 }
 
-irr::f64 CTurbulentVelocityRandom::getScale ()
+double CTurbulentVelocityRandom::getScale ()
 {
     return this->m_scale;
 }
 
-irr::f64 CTurbulentVelocityRandom::getTimeScale ()
+double CTurbulentVelocityRandom::getTimeScale ()
 {
     return this->m_timescale;
 }
 
-irr::u32 CTurbulentVelocityRandom::getMinimumSpeed ()
+uint32_t CTurbulentVelocityRandom::getMinimumSpeed ()
 {
     return this->m_speedmin;
 }
 
-irr::u32 CTurbulentVelocityRandom::getMaximumSpeed ()
+uint32_t CTurbulentVelocityRandom::getMaximumSpeed ()
 {
     return this->m_speedmax;
 }

+ 13 - 14
src/WallpaperEngine/Core/Objects/Particles/Initializers/CTurbulentVelocityRandom.h

@@ -3,31 +3,30 @@
 #include "WallpaperEngine/Core/Objects/Particles/CInitializer.h"
 
 #include <nlohmann/json.hpp>
-#include <irrlicht/irrlicht.h>
 
 namespace WallpaperEngine::Core::Objects::Particles::Initializers
 {
     class CTurbulentVelocityRandom : CInitializer
     {
     public:
-        irr::f64 getPhaseMax ();
-        irr::f64 getScale ();
-        irr::f64 getTimeScale ();
-        irr::u32 getMinimumSpeed ();
-        irr::u32 getMaximumSpeed ();
+        double getPhaseMax ();
+        double getScale ();
+        double getTimeScale ();
+        uint32_t getMinimumSpeed ();
+        uint32_t getMaximumSpeed ();
 
     protected:
         friend class CInitializer;
 
-        static CTurbulentVelocityRandom* fromJSON (json data, irr::u32 id);
+        static CTurbulentVelocityRandom* fromJSON (json data, uint32_t id);
 
-        CTurbulentVelocityRandom (irr::u32 id,
-                irr::f64 phasemax, irr::f64 scale, irr::f64 timescale, irr::u32 speedmin, irr::u32 speedmax);
+        CTurbulentVelocityRandom (uint32_t id,
+                double phasemax, double scale, double timescale, uint32_t speedmin, uint32_t speedmax);
     private:
-        irr::f64 m_phasemax;
-        irr::f64 m_scale;
-        irr::f64 m_timescale;
-        irr::u32 m_speedmin;
-        irr::u32 m_speedmax;
+        double m_phasemax;
+        double m_scale;
+        double m_timescale;
+        uint32_t m_speedmin;
+        uint32_t m_speedmax;
     };
 };

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

@@ -2,32 +2,32 @@
 
 using namespace WallpaperEngine::Core::Objects::Particles::Initializers;
 
-CVelocityRandom* CVelocityRandom::fromJSON (json data, irr::u32 id)
+CVelocityRandom* CVelocityRandom::fromJSON (json data, uint32_t id)
 {
     auto min_it = jsonFindRequired (data, "min", "Velocityrandom initializer must have a minimum value");
     auto max_it = jsonFindRequired (data, "max", "Velocityrandom initializer must have a maximum value");
 
     return new CVelocityRandom (
             id,
-            WallpaperEngine::Core::ato3vf (*min_it),
-            WallpaperEngine::Core::ato3vf (*max_it)
+            WallpaperEngine::Core::aToVector3 (*min_it),
+            WallpaperEngine::Core::aToVector3 (*max_it)
     );
 }
 
 
-CVelocityRandom::CVelocityRandom (irr::u32 id, irr::core::vector3df min, irr::core::vector3df max) :
+CVelocityRandom::CVelocityRandom (uint32_t id, glm::vec3 min, glm::vec3 max) :
         CInitializer (id, "velocityrandom"),
         m_min (min),
         m_max (max)
 {
 }
 
-const irr::core::vector3df& CVelocityRandom::getMinimum () const
+const glm::vec3& CVelocityRandom::getMinimum () const
 {
     return this->m_min;
 }
 
-const irr::core::vector3df& CVelocityRandom::getMaximum () const
+const glm::vec3& CVelocityRandom::getMaximum () const
 {
     return this->m_max;
 }

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

@@ -4,23 +4,21 @@
 
 #include "WallpaperEngine/Core/Core.h"
 
-#include <irrlicht/irrlicht.h>
-
 namespace WallpaperEngine::Core::Objects::Particles::Initializers
 {
     class CVelocityRandom : CInitializer
     {
     public:
-        const irr::core::vector3df& getMinimum () const;
-        const irr::core::vector3df& getMaximum () const;
+        const glm::vec3& getMinimum () const;
+        const glm::vec3& getMaximum () const;
     protected:
         friend class CInitializer;
 
-        static CVelocityRandom* fromJSON (json data, irr::u32 id);
+        static CVelocityRandom* fromJSON (json data, uint32_t id);
 
-        CVelocityRandom (irr::u32 id, irr::core::vector3df min, irr::core::vector3df max);
+        CVelocityRandom (uint32_t id, glm::vec3 min, glm::vec3 max);
     private:
-        irr::core::vector3df m_max;
-        irr::core::vector3df m_min;
+        glm::vec3 m_max;
+        glm::vec3 m_min;
     };
 };

+ 0 - 2
src/WallpaperEngine/Core/Projects/CPropertyBoolean.h

@@ -1,7 +1,5 @@
 #pragma once
 
-#include <irrlicht/irrlicht.h>
-
 #include "CProperty.h"
 
 namespace WallpaperEngine::Core::Projects

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

@@ -8,18 +8,18 @@ CPropertyColor* CPropertyColor::fromJSON (json data, const std::string& name)
     auto text = data.find ("type");
 
     return new CPropertyColor (
-        WallpaperEngine::Core::atoSColor (*value),
+        WallpaperEngine::Core::aToColori (*value),
         name,
         *text
     );
 }
 
-const irr::video::SColor& CPropertyColor::getValue () const
+const IntegerColor& CPropertyColor::getValue () const
 {
     return this->m_color;
 }
 
-CPropertyColor::CPropertyColor (irr::video::SColor color, const std::string& name, const std::string& text) :
+CPropertyColor::CPropertyColor (IntegerColor color, const std::string& name, const std::string& text) :
     CProperty (name, Type, text),
     m_color (color)
 {

+ 4 - 5
src/WallpaperEngine/Core/Projects/CPropertyColor.h

@@ -1,7 +1,5 @@
 #pragma once
 
-#include <irrlicht/irrlicht.h>
-
 #include "CProperty.h"
 
 #include "WallpaperEngine/Core/Core.h"
@@ -9,19 +7,20 @@
 namespace WallpaperEngine::Core::Projects
 {
     using json = nlohmann::json;
+    using namespace WallpaperEngine::Core::Types;
 
     class CPropertyColor : public CProperty
     {
     public:
         static CPropertyColor* fromJSON (json data, const std::string& name);
 
-        const irr::video::SColor& getValue () const;
+        const IntegerColor& getValue () const;
 
         static const std::string Type;
 
     private:
-        CPropertyColor (irr::video::SColor color, const std::string& name, const std::string& text);
+        CPropertyColor (IntegerColor color, const std::string& name, const std::string& text);
 
-        irr::video::SColor m_color;
+        IntegerColor m_color;
     };
 };

+ 8 - 7
src/WallpaperEngine/Core/Scenes/CCamera.cpp

@@ -1,25 +1,26 @@
 #include "CCamera.h"
 
 using namespace WallpaperEngine::Core::Scenes;
+using namespace WallpaperEngine::Core::Types;
 
-CCamera::CCamera (irr::core::vector3df center, irr::core::vector3df eye, irr::core::vector3df up) :
+CCamera::CCamera (glm::vec3 center, glm::vec3 eye, glm::vec3 up) :
     m_center (center),
     m_eye (eye),
     m_up (up)
 {
 }
 
-const irr::core::vector3df& CCamera::getCenter () const
+const glm::vec3& CCamera::getCenter () const
 {
     return this->m_center;
 }
 
-const irr::core::vector3df& CCamera::getEye () const
+const glm::vec3& CCamera::getEye () const
 {
     return this->m_eye;
 }
 
-const irr::core::vector3df& CCamera::getUp () const
+const glm::vec3& CCamera::getUp () const
 {
     return this->m_up;
 }
@@ -31,8 +32,8 @@ CCamera* CCamera::fromJSON (json data)
     auto up_it = jsonFindRequired (data, "up", "Camera must have a up position");
 
     return new CCamera (
-        WallpaperEngine::Core::ato3vf (*center_it),
-        WallpaperEngine::Core::ato3vf (*eye_it),
-        WallpaperEngine::Core::ato3vf (*up_it)
+        WallpaperEngine::Core::aToVector3 (*center_it),
+        WallpaperEngine::Core::aToVector3 (*eye_it),
+        WallpaperEngine::Core::aToVector3 (*up_it)
     );
 }

+ 7 - 9
src/WallpaperEngine/Core/Scenes/CCamera.h

@@ -1,7 +1,5 @@
 #pragma once
 
-#include <irrlicht/irrlicht.h>
-
 #include "WallpaperEngine/Core/Core.h"
 
 namespace WallpaperEngine::Core::Scenes
@@ -13,14 +11,14 @@ namespace WallpaperEngine::Core::Scenes
     public:
         static CCamera* fromJSON (json data);
 
-        const irr::core::vector3df& getCenter () const;
-        const irr::core::vector3df& getEye () const;
-        const irr::core::vector3df& getUp () const;
+        const glm::vec3& getCenter () const;
+        const glm::vec3& getEye () const;
+        const glm::vec3& getUp () const;
     protected:
-        CCamera (irr::core::vector3df center, irr::core::vector3df eye, irr::core::vector3df up);
+        CCamera (glm::vec3 center, glm::vec3 eye, glm::vec3 up);
     private:
-        irr::core::vector3df m_center;
-        irr::core::vector3df m_eye;
-        irr::core::vector3df m_up;
+        glm::vec3 m_center;
+        glm::vec3 m_eye;
+        glm::vec3 m_up;
     };
 };

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

@@ -2,18 +2,18 @@
 
 using namespace WallpaperEngine::Core::Scenes;
 
-CProjection::CProjection (irr::u32 width, irr::u32 height) :
+CProjection::CProjection (uint32_t width, uint32_t height) :
     m_width (width),
     m_height (height)
 {
 }
 
-const irr::u32& CProjection::getWidth () const
+const uint32_t& CProjection::getWidth () const
 {
     return this->m_width;
 }
 
-const irr::u32& CProjection::getHeight () const
+const uint32_t& CProjection::getHeight () const
 {
     return this->m_height;
 }

+ 5 - 7
src/WallpaperEngine/Core/Scenes/CProjection.h

@@ -1,7 +1,5 @@
 #pragma once
 
-#include <irrlicht/irrlicht.h>
-
 #include "WallpaperEngine/Core/Core.h"
 
 namespace WallpaperEngine::Core::Scenes
@@ -13,12 +11,12 @@ namespace WallpaperEngine::Core::Scenes
     public:
         static CProjection* fromJSON (json data);
 
-        const irr::u32& getWidth () const;
-        const irr::u32& getHeight () const;
+        const uint32_t& getWidth () const;
+        const uint32_t& getHeight () const;
     protected:
-        CProjection (irr::u32 width, irr::u32 height);
+        CProjection (uint32_t width, uint32_t height);
     private:
-        irr::u32 m_width;
-        irr::u32 m_height;
+        uint32_t m_width;
+        uint32_t m_height;
     };
 };

+ 28 - 0
src/WallpaperEngine/Core/Types/FloatColor.h

@@ -0,0 +1,28 @@
+#pragma once
+
+namespace WallpaperEngine::Core::Types
+{
+    class FloatColor
+    {
+    public:
+        FloatColor (float r, float g, float b, float a) :
+            r(r), g(g), b(b), a(a) { }
+
+        /**
+         * The red color
+         */
+        float r;
+        /**
+         * The green color
+         */
+        float g;
+        /**
+         * The blue color
+         */
+        float b;
+        /**
+         * The alpha
+         */
+        float a;
+    };
+}

+ 28 - 0
src/WallpaperEngine/Core/Types/IntegerColor.h

@@ -0,0 +1,28 @@
+#pragma once
+
+namespace WallpaperEngine::Core::Types
+{
+    class IntegerColor
+    {
+    public:
+        IntegerColor (uint8_t r, uint8_t g, uint8_t b, uint8_t a) :
+            r(r), g(g), b(b), a(a) { }
+
+        /**
+         * The red color
+         */
+        uint8_t r;
+        /**
+         * The green color
+         */
+        uint8_t g;
+        /**
+         * The blue color
+         */
+        uint8_t b;
+        /**
+         * The alpha
+         */
+        uint8_t a;
+    };
+}

+ 11 - 17
src/WallpaperEngine/FileSystem/FileSystem.cpp

@@ -3,29 +3,23 @@
 
 #include <iostream>
 
-// engine includes
-#include "WallpaperEngine/Irrlicht/CContext.h"
-
-extern WallpaperEngine::Irrlicht::CContext* IrrlichtContext;
-
 using namespace WallpaperEngine;
 
-std::string FileSystem::loadFullFile (const irr::io::path& file)
+std::string FileSystem::loadFullFile (const std::string& file, WallpaperEngine::Assets::CContainer* containers)
 {
-    std::cout << file.c_str() << std::endl;
-    irr::io::IReadFile* reader = IrrlichtContext->getDevice ()->getFileSystem ()->createAndOpenFile (file);
-
-    if (reader == nullptr)
-        throw std::runtime_error ("Cannot open file " + std::string (file.c_str ()) + " for reading");
+    uint32_t length = 0;
+    void* contents = containers->readFile (file, &length);
 
-    char* filedata = new char [reader->getSize () + 1];
-    memset (filedata, 0, reader->getSize () + 1);
-
-    reader->read (filedata, reader->getSize ());
-    reader->drop ();
+    // build a new buffer that can fit in the string
+    char* filedata = new char [length + 1];
+    // ensure there's a null termination at the end
+    memset (filedata, 0, length + 1);
+    // copy file contents over
+    memcpy (filedata, contents, length);
 
     std::string content = filedata;
+
     delete [] filedata;
 
     return content;
-}
+}

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

@@ -8,6 +8,8 @@
 #include <irrlicht/path.h>
 #include <nlohmann/json.hpp>
 
+#include "WallpaperEngine/Assets/CContainer.h"
+
 namespace WallpaperEngine::FileSystem
 {
     /**
@@ -16,5 +18,5 @@ namespace WallpaperEngine::FileSystem
      * @param file
      * @return
      */
-    std::string loadFullFile (const irr::io::path& file);
+    std::string loadFullFile (const std::string& file, WallpaperEngine::Assets::CContainer* containers);
 }

+ 0 - 239
src/WallpaperEngine/Irrlicht/CContext.cpp

@@ -1,239 +0,0 @@
-#include <iostream>
-#include <stdexcept>
-#include <utility>
-
-#include <X11/Xlib.h>
-#include <X11/extensions/Xrandr.h>
-
-#include "WallpaperEngine/Irrlicht/CImageLoaderTEX.h"
-#include "WallpaperEngine/Irrlicht/CPkgReader.h"
-
-#include "WallpaperEngine/Render/Shaders/Variables/CShaderVariableFloatPointer.h"
-#include "WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector2Pointer.h"
-
-#include "CContext.h"
-
-using namespace WallpaperEngine;
-using namespace WallpaperEngine::Irrlicht;
-
-CContext::CContext (std::vector<std::string>  screens, bool isRootWindow) :
-    m_screens (std::move(screens)),
-    m_isRootWindow (isRootWindow)
-{
-}
-
-void CContext::setDevice (irr::IrrlichtDevice* device)
-{
-    this->m_device = device;
-}
-
-void CContext::initializeContext ()
-{
-    irr::SIrrlichtCreationParameters irrlichtCreationParameters;
-
-    // initialize event receiver first
-    this->m_eventReceiver = new CEventReceiver ();
-
-    // prepare basic configuration for irrlicht
-    irrlichtCreationParameters.AntiAlias = 8;
-    irrlichtCreationParameters.Bits = 16;
-    // _irr_params.DeviceType = Irrlicht::EIDT_X11;
-    irrlichtCreationParameters.DriverType = irr::video::EDT_OPENGL;
-    irrlichtCreationParameters.Doublebuffer = false;
-    irrlichtCreationParameters.EventReceiver = this->m_eventReceiver;
-    irrlichtCreationParameters.Fullscreen = false;
-    irrlichtCreationParameters.HandleSRGB = false;
-    irrlichtCreationParameters.IgnoreInput = false;
-    irrlichtCreationParameters.Stencilbuffer = true;
-    irrlichtCreationParameters.UsePerformanceTimer = false;
-    irrlichtCreationParameters.Vsync = false;
-    irrlichtCreationParameters.WithAlphaChannel = false;
-    irrlichtCreationParameters.ZBufferBits = 24;
-    irrlichtCreationParameters.LoggingLevel = irr::ELL_DEBUG;
-
-    this->initializeViewports (irrlichtCreationParameters);
-
-    this->setDevice (irr::createDeviceEx (irrlichtCreationParameters));
-
-    if (this->getDevice () == nullptr)
-    {
-        throw std::runtime_error ("Cannot create irrlicht device");
-    }
-
-    this->getDevice ()->setWindowCaption (L"Test game");
-
-    // check for ps and vs support
-    if (
-        this->getDevice ()->getVideoDriver()->queryFeature (irr::video::EVDF_PIXEL_SHADER_2_0) == false &&
-        this->getDevice ()->getVideoDriver()->queryFeature (irr::video::EVDF_ARB_FRAGMENT_PROGRAM_1) == false)
-    {
-        throw std::runtime_error ("Pixel Shader 2.0 not supported by your video driver/hardware");
-    }
-
-    if (
-        this->getDevice ()->getVideoDriver()->queryFeature (irr::video::EVDF_VERTEX_SHADER_2_0) == false &&
-        this->getDevice ()->getVideoDriver()->queryFeature (irr::video::EVDF_ARB_VERTEX_PROGRAM_1) == false)
-    {
-        throw std::runtime_error ("Vertex Shader 2.0 not supported by your video driver/hardware");
-    }
-
-    if (this->getDevice ()->getVideoDriver ()->queryFeature (irr::video::EVDF_RENDER_TO_TARGET) == false)
-    {
-        throw std::runtime_error ("Render to texture not supported by your video driver/hardware");
-    }
-
-    // load the assets from wallpaper engine
-    this->getDevice ()->getFileSystem ()->addFileArchive ("assets.zip", true, false);
-
-    // register custom loaders
-    this->getDevice ()->getVideoDriver()->addExternalImageLoader (
-            new WallpaperEngine::Irrlicht::CImageLoaderTex (this)
-    );
-    this->getDevice ()->getFileSystem ()->addArchiveLoader (
-            new WallpaperEngine::Irrlicht::CArchiveLoaderPkg (this)
-    );
-    // register time shader variable
-    this->insertShaderVariable (
-        new Render::Shaders::Variables::CShaderVariableFloatPointer (&this->m_time, "g_Time")
-    );
-    // register normalized uv position for mouse
-    this->insertShaderVariable (
-        new Render::Shaders::Variables::CShaderVariableVector2Pointer (&this->m_pointerPosition, "g_PointerPosition")
-    );
-}
-
-void CContext::initializeViewports (irr::SIrrlichtCreationParameters &irrlichtCreationParameters)
-{
-    if (this->m_isRootWindow == false || this->m_screens.empty () == true)
-        return;
-
-    Display* display = XOpenDisplay (nullptr);
-    int xrandr_result, xrandr_error;
-
-    if (!XRRQueryExtension (display, &xrandr_result, &xrandr_error))
-    {
-        std::cerr << "XRandr is not present, cannot detect specified screens, running in window mode" << std::endl;
-        return;
-    }
-
-    XRRScreenResources* screenResources = XRRGetScreenResources (display, DefaultRootWindow (display));
-
-    // there are some situations where xrandr returns null (like screen not using the extension)
-    if (screenResources == nullptr)
-        return;
-
-    for (int i = 0; i < screenResources->noutput; i ++)
-    {
-        XRROutputInfo* info = XRRGetOutputInfo (display, screenResources, screenResources->outputs [i]);
-
-        // there are some situations where xrandr returns null (like screen not using the extension)
-        if (info == nullptr)
-            continue;
-
-        auto cur = this->m_screens.begin ();
-        auto end = this->m_screens.end ();
-
-        for (; cur != end; cur ++)
-        {
-            if (info->connection == RR_Connected && strcmp (info->name, (*cur).c_str ()) == 0)
-            {
-                XRRCrtcInfo* crtc = XRRGetCrtcInfo (display, screenResources, info->crtc);
-
-                std::cout << "Found requested screen: " << info->name << " -> " << crtc->x << "x" << crtc->y << ":" << crtc->width << "x" << crtc->height << std::endl;
-
-                irr::core::rect<irr::s32> viewport;
-
-                viewport.UpperLeftCorner.X = crtc->x;
-                viewport.UpperLeftCorner.Y = crtc->y;
-                viewport.LowerRightCorner.X = crtc->x + crtc->width;
-                viewport.LowerRightCorner.Y = crtc->y + crtc->height;
-
-                this->m_viewports.push_back (viewport);
-
-                XRRFreeCrtcInfo (crtc);
-            }
-        }
-
-        XRRFreeOutputInfo (info);
-    }
-
-    XRRFreeScreenResources (screenResources);
-
-    irrlichtCreationParameters.WindowId = reinterpret_cast<void*> (DefaultRootWindow (display));
-}
-
-void CContext::renderFrame (Render::CWallpaper* wallpaper)
-{
-    this->m_time = this->getDevice ()->getTimer ()->getTime () / 1000.0f;
-    this->m_pointerPosition.X = this->m_eventReceiver->getPosition ().X / (irr::f32) this->getDevice ()->getVideoDriver ()->getScreenSize ().Width;
-    this->m_pointerPosition.Y = this->m_eventReceiver->getPosition ().Y / (irr::f32) this->getDevice ()->getVideoDriver ()->getScreenSize ().Height;
-
-    if (this->m_viewports.empty () == true)
-    {
-        this->drawWallpaper (wallpaper, true);
-    }
-    else
-    {
-        auto cur = this->m_viewports.begin ();
-        auto end = this->m_viewports.end ();
-
-        for (; cur != end; cur ++)
-        {
-            // change viewport to render to the correct portion of the display
-            this->getDevice ()->getVideoDriver ()->setViewPort (*cur);
-            this->drawWallpaper (wallpaper, false);
-        }
-    }
-}
-
-void CContext::drawWallpaper (Render::CWallpaper* wallpaper, bool backBuffer)
-{
-    // TODO: Get scene clear color
-    this->getDevice ()->getVideoDriver ()->beginScene (backBuffer, true);
-    this->getDevice ()->getSceneManager ()->drawAll ();
-    this->getDevice ()->getVideoDriver ()->endScene ();
-}
-
-void CContext::insertShaderVariable (Render::Shaders::Variables::CShaderVariable* variable)
-{
-    this->m_globalShaderVariables.push_back (variable);
-}
-
-const std::vector<Render::Shaders::Variables::CShaderVariable*>& CContext::getShaderVariables () const
-{
-    return this->m_globalShaderVariables;
-}
-
-irr::IrrlichtDevice* CContext::getDevice ()
-{
-    return this->m_device;
-}
-
-irr::io::path CContext::resolveFile (const irr::io::path& file)
-{
-    if (this->getDevice ()->getFileSystem ()->existFile (file) == false)
-    {
-        throw std::runtime_error ("Cannot find file " + std::string (file.c_str ()));
-    }
-
-    return file;
-}
-
-irr::io::path CContext::resolveMaterials (const std::string& materialName)
-{
-    return this->resolveFile (std::string ("materials/" + materialName + ".tex").c_str ());
-}
-
-irr::io::path CContext::resolveVertexShader (const std::string& vertexShader)
-{
-    return this->resolveFile (std::string ("shaders/" + vertexShader + ".vert").c_str ());
-}
-irr::io::path CContext::resolveFragmentShader (const std::string& fragmentShader)
-{
-    return this->resolveFile (std::string ("shaders/" + fragmentShader + ".frag").c_str ());
-}
-
-irr::io::path CContext::resolveIncludeShader (const std::string& includeShader)
-{
-    return this->resolveFile (std::string ("shaders/" + includeShader).c_str ());
-}

+ 0 - 57
src/WallpaperEngine/Irrlicht/CContext.h

@@ -1,57 +0,0 @@
-#pragma once
-
-#include <vector>
-#include <string>
-
-#include <irrlicht/irrlicht.h>
-
-#include "WallpaperEngine/Render/CWallpaper.h"
-
-#include "WallpaperEngine/Render/Shaders/Variables/CShaderVariable.h"
-
-#include "CEventReceiver.h"
-
-namespace WallpaperEngine::Render
-{
-    class CWallpaper;
-};
-
-namespace WallpaperEngine::Irrlicht
-{
-    class CContext
-    {
-    public:
-        CContext (std::vector<std::string>  screens, bool isRootWindow = false);
-
-        void setDevice (irr::IrrlichtDevice* device);
-        void initializeContext ();
-
-        void insertShaderVariable (Render::Shaders::Variables::CShaderVariable* variable);
-        const std::vector<Render::Shaders::Variables::CShaderVariable*>& getShaderVariables () const;
-
-        void renderFrame (Render::CWallpaper* wallpaper);
-
-        irr::IrrlichtDevice* getDevice ();
-        irr::io::path resolveMaterials (const std::string& materialName);
-        irr::io::path resolveVertexShader (const std::string& vertexShader);
-        irr::io::path resolveFragmentShader (const std::string& fragmentShader);
-        irr::io::path resolveIncludeShader (const std::string& includeShader);
-    private:
-        void initializeViewports (irr::SIrrlichtCreationParameters& irrlichtCreationParameters);
-        void drawWallpaper (Render::CWallpaper* wallpaper, bool backBuffer);
-
-        irr::io::path resolveFile (const irr::io::path& file);
-
-        irr::IrrlichtDevice* m_device;
-        CEventReceiver* m_eventReceiver;
-
-        std::vector<Render::Shaders::Variables::CShaderVariable*> m_globalShaderVariables;
-
-        irr::f32 m_time;
-        irr::core::vector2df m_pointerPosition;
-
-        std::vector<std::string> m_screens;
-        std::vector<irr::core::recti> m_viewports;
-        bool m_isRootWindow;
-    };
-};

+ 0 - 20
src/WallpaperEngine/Irrlicht/CEventReceiver.cpp

@@ -1,20 +0,0 @@
-#include "CEventReceiver.h"
-
-using namespace WallpaperEngine::Irrlicht;
-
-bool CEventReceiver::OnEvent(const irr::SEvent &event)
-{
-    if (event.EventType == irr::EET_MOUSE_INPUT_EVENT && event.MouseInput.Event == irr::EMIE_MOUSE_MOVED)
-    {
-        this->m_position.X = event.MouseInput.X;
-        this->m_position.Y = event.MouseInput.Y;
-        return true;
-    }
-
-    return false;
-}
-
-const irr::core::position2di& CEventReceiver::getPosition () const
-{
-    return this->m_position;
-}

+ 0 - 18
src/WallpaperEngine/Irrlicht/CEventReceiver.h

@@ -1,18 +0,0 @@
-#pragma once
-
-#include <irrlicht/irrlicht.h>
-
-namespace WallpaperEngine::Irrlicht
-{
-    class CEventReceiver : public irr::IEventReceiver
-    {
-    public:
-        // This is the one method that we have to implement
-        bool OnEvent(const irr::SEvent& event) override;
-
-        const irr::core::position2di& getPosition () const;
-
-    private:
-        irr::core::position2di m_position;
-    };
-}

+ 0 - 134
src/WallpaperEngine/Irrlicht/CFileList.cpp

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

+ 0 - 121
src/WallpaperEngine/Irrlicht/CFileList.h

@@ -1,121 +0,0 @@
-#pragma once
-
-#include <irrlicht/irrlicht.h>
-
-namespace WallpaperEngine::Irrlicht
-{
-    //! An entry in a list of files, can be a folder or a file.
-    struct SFileListEntry
-    {
-        //! The name of the file
-        /** If this is a file or folder in the virtual filesystem and the archive
-        was created with the ignoreCase flag then the file name will be lower case. */
-        irr::io::path Name;
-
-        //! The name of the file including the path
-        /** If this is a file or folder in the virtual filesystem and the archive was
-        created with the ignoreDirs flag then it will be the same as Name. */
-        irr::io::path FullName;
-
-        //! The size of the file in bytes
-        irr::u32 Size;
-
-        //! The ID of the file in an archive
-        /** This is used to link the FileList entry to extra info held about this
-        file in an archive, which can hold things like data offset and CRC. */
-        irr::u32 ID;
-
-        //! FileOffset inside an archive
-        irr::u32 Offset;
-
-        //! True if this is a folder, false if not.
-        bool IsDirectory;
-
-        //! The == operator is provided so that CFileList can slowly search the list!
-        bool operator == (const struct SFileListEntry& other) const
-        {
-            if (IsDirectory != other.IsDirectory)
-                return false;
-
-            return FullName.equals_ignore_case (other.FullName);
-        }
-
-        //! The < operator is provided so that CFileList can sort and quickly search the list.
-        bool operator < (const struct SFileListEntry& other) const
-        {
-            if (IsDirectory != other.IsDirectory)
-                return IsDirectory;
-
-            return FullName.lower_ignore_case (other.FullName);
-        }
-    };
-
-
-    //! Implementation of a file list
-    class CFileList : public irr::io::IFileList
-    {
-    public:
-
-        // CFileList methods
-
-        //! Constructor
-        /** \param path The path of this file archive */
-        CFileList (const irr::io::path& path, bool ignoreCase, bool ignorePaths);
-
-        //! Destructor
-        virtual ~CFileList ();
-
-        //! Add as a file or folder to the list
-        /** \param fullPath The file name including path, up to the root of the file list.
-        \param isDirectory True if this is a directory rather than a file.
-        \param offset The offset where the file is stored in an archive
-        \param size The size of the file in bytes.
-        \param id The ID of the file in the archive which owns it */
-        virtual irr::u32 addItem (const irr::io::path& fullPath, irr::u32 offset, irr::u32 size, bool isDirectory, irr::u32 id=0);
-
-        //! Sorts the file list. You should call this after adding any items to the file list
-        virtual void sort ();
-
-        //! Returns the amount of files in the filelist.
-        virtual irr::u32 getFileCount () const;
-
-        //! Gets the name of a file in the list, based on an index.
-        virtual const irr::io::path& getFileName (irr::u32 index) const;
-
-        //! Gets the full name of a file in the list, path included, based on an index.
-        virtual const irr::io::path& getFullFileName (irr::u32 index) const;
-
-        //! Returns the ID of a file in the file list, based on an index.
-        virtual irr::u32 getID (irr::u32 index) const;
-
-        //! Returns true if the file is a directory
-        virtual bool isDirectory (irr::u32 index) const;
-
-        //! Returns the size of a file
-        virtual irr::u32 getFileSize (irr::u32 index) const;
-
-        //! Returns the offest of a file
-        virtual irr::u32 getFileOffset (irr::u32 index) const;
-
-        //! Searches for a file or folder within the list, returns the index
-        virtual irr::s32 findFile (const irr::io::path& filename, bool isFolder) const;
-
-        //! Returns the base path of the file list
-        virtual const irr::io::path& getPath () const;
-
-    protected:
-
-        //! Ignore paths when adding or searching for files
-        bool m_ignorePaths;
-
-        //! Ignore case when adding or searching for files
-        bool m_ignoreCase;
-
-        //! Path to the file list
-        irr::io::path m_path;
-
-        //! List of files
-        irr::core::array<SFileListEntry> m_files;
-    };
-}
-

+ 0 - 780
src/WallpaperEngine/Irrlicht/CImageLoaderTEX.cpp

@@ -1,780 +0,0 @@
-#include "CImageLoaderTEX.h"
-
-#include <irrlicht/irrlicht.h>
-#include <lz4.h>
-#include <string>
-#include <stdexcept>
-
-using namespace WallpaperEngine::Irrlicht;
-
-namespace WallpaperEngine::Irrlicht
-{
-    CImageLoaderTex::TextureMipmap::TextureMipmap ()
-    {
-    }
-
-    CImageLoaderTex::TextureMipmap::~TextureMipmap ()
-    {
-        if (this->compression == 1)
-            delete this->compressedData;
-
-        delete this->uncompressedData;
-    }
-
-    void CImageLoaderTex::TextureMipmap::decompressData ()
-    {
-        if (this->compression == 1)
-        {
-            this->uncompressedData = new char [this->uncompressedSize];
-
-            int result = LZ4_decompress_safe (
-                this->compressedData, this->uncompressedData,
-                this->compressedSize, this->uncompressedSize
-            );
-
-            if (!result)
-            {
-                throw std::runtime_error ("Cannot decompress texture data");
-            }
-        }
-    }
-
-    CImageLoaderTex::TextureContainer::TextureContainer () :
-        freeimageFormat (FREE_IMAGE_FORMAT::FIF_UNKNOWN)
-    {
-    }
-
-    CImageLoaderTex::TextureContainer::~TextureContainer ()
-    {
-        auto cur = this->mipmaps.begin ();
-        auto end = this->mipmaps.end ();
-
-        for (; cur != end; cur ++)
-        {
-            delete *cur;
-        }
-    }
-
-    CImageLoaderTex::CImageLoaderTex (CContext* context) :
-        m_context (context)
-    {
-    }
-
-    //! returns true if the file maybe is able to be loaded by this class
-    //! based on the file extension (e.g. ".tga")
-    bool CImageLoaderTex::isALoadableFileExtension (const irr::io::path &filename) const
-    {
-        return irr::core::hasFileExtension (filename, "tex");
-    }
-
-
-    //! returns true if the file maybe is able to be loaded by this class
-    bool CImageLoaderTex::isALoadableFileFormat (irr::io::IReadFile *file) const
-    {
-        return false;
-    }
-
-    CImageLoaderTex::TextureContainer* CImageLoaderTex::parseHeader (irr::io::IReadFile* input) const
-    {
-        char buffer [1024];
-
-        if (input->read (buffer, 9) != 9 || memcmp (buffer, "TEXV0005", 9) != 0)
-        {
-            throw std::runtime_error ("unexpected container type");
-        }
-
-        if (input->read (buffer, 9) != 9 || memcmp (buffer, "TEXI0001", 9) != 0)
-        {
-            throw std::runtime_error ("unexpected sub-container type");
-        }
-
-        TextureContainer* header = new TextureContainer;
-
-        input->read (&header->format, 4);
-        input->seek (4, true); // ignore bytes
-        input->read (&header->textureWidth, 4);
-        input->read (&header->textureHeight, 4);
-        input->read (&header->width, 4);
-        input->read (&header->height, 4);
-        input->seek (4, true); // ignore bytes
-        input->read (buffer, 9);
-
-        if (memcmp (buffer, "TEXB0003", 9) == 0)
-        {
-            header->containerVersion = ContainerVersion::TEXB0003;
-
-            input->seek (4, true);
-            input->read (&header->freeimageFormat, 4);
-        }
-        else if (memcmp (buffer, "TEXB0002", 9) == 0)
-        {
-            header->containerVersion = ContainerVersion::TEXB0002;
-
-            input->seek (4, true);
-        }
-        else if (memcmp (buffer, "TEXB0001", 9) == 0)
-        {
-            header->containerVersion = ContainerVersion::TEXB0001;
-
-            input->seek (4, true);
-        }
-        else
-        {
-            delete header;
-
-            throw std::runtime_error ("Unknown container type");
-        }
-
-        if (header->format == TextureFormat::A8)
-        {
-            delete header;
-
-            throw std::runtime_error ("A8 format not supported yet");
-        }
-
-        if (header->format == TextureFormat::RA88)
-        {
-            delete header;
-
-            throw std::runtime_error ("RA88 format not supported yet");
-        }
-
-        input->read (&header->mipmapCount, 4);
-
-        for (irr::u32 i = 0; i < header->mipmapCount; i ++)
-        {
-            header->mipmaps.push_back (
-                this->parseMipmap (header, input)
-            );
-        }
-
-        return header;
-    }
-
-    CImageLoaderTex::TextureMipmap* CImageLoaderTex::parseMipmap(TextureContainer* header, irr::io::IReadFile* input) const
-    {
-        TextureMipmap* mipmap = new TextureMipmap ();
-
-        input->read (&mipmap->width, 4);
-        input->read (&mipmap->height, 4);
-
-        if (header->containerVersion == ContainerVersion::TEXB0002 ||
-            header->containerVersion == ContainerVersion::TEXB0003)
-        {
-            input->read (&mipmap->compression, 4);
-            input->read (&mipmap->uncompressedSize, 4);
-        }
-
-        input->read (&mipmap->compressedSize, 4);
-
-        // TODO: BETTER POSITION FOR THIS
-        if (mipmap->compression == 0)
-        {
-            // this might be better named as mipmap_bytes_size instead of compressed_size
-            // as in uncompressed files this variable actually holds the file length
-            mipmap->uncompressedSize = mipmap->compressedSize;
-        }
-
-        mipmap->uncompressedData = new char [mipmap->uncompressedSize];
-
-        if (mipmap->compression == 1)
-        {
-            mipmap->compressedData = new char [mipmap->compressedSize];
-
-            input->read (mipmap->compressedData, mipmap->compressedSize);
-
-            mipmap->decompressData ();
-        }
-        else
-        {
-            input->read (mipmap->uncompressedData, mipmap->uncompressedSize);
-        }
-
-        return mipmap;
-    }
-
-    irr::video::IImage* CImageLoaderTex::parseFile (irr::io::IReadFile* input) const
-    {
-        irr::video::IImage *image = nullptr;
-        TextureContainer* header = nullptr;
-        TextureMipmap* mipmap = nullptr;
-
-        if (input == nullptr)
-            return nullptr;
-
-        header = this->parseHeader (input);
-        mipmap = *header->mipmaps.begin ();
-
-        if (header->freeimageFormat == FREE_IMAGE_FORMAT::FIF_UNKNOWN)
-        {
-            image = this->m_context->getDevice ()->getVideoDriver ()->createImage (
-                    irr::video::ECF_A8R8G8B8, irr::core::dimension2d<irr::u32> (header->width, header->height)
-            );
-
-            if (image == nullptr)
-            {
-                delete header;
-
-                throw std::runtime_error ("cannot create destination image");
-            }
-
-            switch (header->format)
-            {
-                case TextureFormat::ARGB8888:
-                    this->loadImageFromARGB8Data (
-                            image, mipmap->uncompressedData, header->width, header->height, mipmap->width
-                    );
-                    break;
-                case TextureFormat::DXT5:
-                    this->loadImageFromDXT5 (
-                            image, mipmap->uncompressedData, header->width, header->height, mipmap->width, mipmap->height
-                    );
-                    break;
-                case TextureFormat::DXT1:
-                    this->loadImageFromDXT1 (
-                            image, mipmap->uncompressedData, header->width, header->height, mipmap->width, mipmap->height
-                    );
-                    break;
-                case TextureFormat::DXT3:
-                    delete header;
-
-                    throw std::runtime_error ("DXT3 textures not supported yet");
-            }
-        }
-        else
-        {
-            // generate a memory file for irrlicht to load the proper one as free image files
-            // that are used by wallpaperengine are usually supported formats in irrlicht
-            // TODO: FIND A WAY TO CALL THE PROPER LOADER DIRECTLY INSTEAD OF GENERATING A FILE?
-            char tmpname [TMP_MAX];
-
-            std::tmpnam (tmpname);
-            std::string filename = tmpname;
-            irr::io::IReadFile* file = nullptr;
-
-            switch (header->freeimageFormat)
-            {
-                case FREE_IMAGE_FORMAT::FIF_BMP:
-                    filename += ".bmp";
-                    break;
-                case FREE_IMAGE_FORMAT::FIF_PNG:
-                    filename += ".png";
-                    break;
-                case FREE_IMAGE_FORMAT::FIF_JPEG:
-                    filename += ".jpg";
-                    break;
-                case FREE_IMAGE_FORMAT::FIF_GIF:
-                    filename += ".gif";
-                    break;
-                default:
-                    throw std::runtime_error ("Unsupported free image extension");
-            }
-
-            // create a copy of the file information for the filesystem module of irrlicht
-            // this will be freed automatically by irrlicht so we can freely delete the container
-            // data from memory without leaking memory
-            char* filebuffer = new char [mipmap->uncompressedSize];
-
-            memcpy (filebuffer, mipmap->uncompressedData, mipmap->uncompressedSize);
-
-            file = this->m_context->getDevice ()->getFileSystem ()->createMemoryReadFile (
-                    filebuffer, mipmap->uncompressedSize, filename.c_str (), true
-            );
-
-            if (file == nullptr)
-            {
-                delete [] filebuffer;
-                delete header;
-
-                throw std::runtime_error ("cannot create temporal memory file");
-            }
-
-            image = this->m_context->getDevice ()->getVideoDriver ()->createImageFromFile (file);
-
-            if (image == nullptr)
-            {
-                // this takes care of freeing filebuffer
-                file->drop ();
-
-                delete header;
-
-                throw std::runtime_error ("cannot create destination image");
-            }
-        }
-
-        // delete container info as it's not needed anymore
-        delete header;
-
-        return image;
-    }
-
-    // load in the image data
-    irr::video::IImage *CImageLoaderTex::loadImage (irr::io::IReadFile *input) const
-    {
-        try
-        {
-            return this->parseFile (input);
-        }
-        catch (std::runtime_error ex)
-        {
-            this->m_context->getDevice ()->getLogger ()->log (
-                ex.what (), input->getFileName ().c_str (), irr::ELL_ERROR
-            );
-
-            return nullptr;
-        }
-    }
-
-    void CImageLoaderTex::loadImageFromARGB8Data (irr::video::IImage* output, const char* input, irr::u32 width, irr::u32 height, irr::u32 mipmap_width) const
-    {
-        irr::u32 bytesPerPixel = output->getBytesPerPixel ();
-        char *imagedata = (char *) output->lock ();
-
-        for (irr::u32 y = 0; y < height; y ++)
-        {
-            irr::u32 baseDestination = y * output->getPitch ();
-            irr::u32 baseOrigin = y * (mipmap_width * 4);
-
-            for (irr::u32 x = 0; x < width; x ++)
-            {
-                imagedata [baseDestination + (x * bytesPerPixel) + 2] = input [baseOrigin + (x * 4) + 0]; // r
-                imagedata [baseDestination + (x * bytesPerPixel) + 1] = input [baseOrigin + (x * 4) + 1]; // g
-                imagedata [baseDestination + (x * bytesPerPixel) + 0] = input [baseOrigin + (x * 4) + 2]; // b
-                imagedata [baseDestination + (x * bytesPerPixel) + 3] = input [baseOrigin + (x * 4) + 3]; // a
-            }
-        }
-
-        output->unlock ();
-    }
-
-    void CImageLoaderTex::loadImageFromDXT1 (irr::video::IImage* output, const char* input, irr::u32 destination_width, irr::u32 destination_height, irr::u32 origin_width, irr::u32 origin_height) const
-    {
-        char* decompressedBuffer = new char [origin_width * origin_height * 4];
-
-        this->BlockDecompressImageDXT1 (origin_width, origin_height, (const unsigned char*) input, (unsigned long*) decompressedBuffer);
-        this->loadImageFromARGB8Data (output, decompressedBuffer, destination_width, destination_height, origin_width);
-
-        delete [] decompressedBuffer;
-    }
-
-    void CImageLoaderTex::loadImageFromDXT5 (irr::video::IImage* output, const char* input, irr::u32 destination_width, irr::u32 destination_height, irr::u32 origin_width, irr::u32 origin_height) const
-    {
-        char* decompressedBuffer = new char [origin_width * origin_height * 4];
-
-        this->BlockDecompressImageDXT5 (origin_width, origin_height, (const unsigned char*) input, (unsigned long*) decompressedBuffer);
-        this->loadImageFromARGB8Data (output, decompressedBuffer, destination_width, destination_height, origin_width);
-
-        delete [] decompressedBuffer;
-    }
-
-    void CImageLoaderTex::loadImageFromDXT3 (irr::video::IImage* output, const char* input, irr::u32 destination_width, irr::u32 destination_height, irr::u32 origin_width, irr::u32 origin_height) const
-    {
-        char* decompressedBuffer = new char [origin_width * origin_height * 4];
-
-        this->BlockDecompressImageDXT3 (origin_width, origin_height, (const unsigned char*) input, (unsigned long*) decompressedBuffer);
-        this->loadImageFromARGB8Data (output, decompressedBuffer, destination_width, destination_height, origin_width);
-
-        delete [] decompressedBuffer;
-    }
-
-    // ------------------------------------------------------------------------------------
-    // The following code is a slightly modified version of this repository
-    // https://github.com/Benjamin-Dobell/s3tc-dxt-decompression
-    // ------------------------------------------------------------------------------------
-
-    /*
-     * Copyright (c) 2009 Benjamin Dobell, Glass Echidna
-     *
-     * Permission is hereby granted, free of charge, to any person obtaining a copy
-     * of this software and associated documentation files (the "Software"), to deal
-     * in the Software without restriction, including without limitation the rights
-     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-     * copies of the Software, and to permit persons to whom the Software is
-     * furnished to do so, subject to the following conditions:
-     *
-     * The above copyright notice and this permission notice shall be included in
-     * all copies or substantial portions of the Software.
-     *
-     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-     * THE SOFTWARE.
-     */
-    
-    // unsigned long PackRGBA(): Helper method that packs RGBA channels into a single 4 byte pixel.
-    //
-    // unsigned char r:		red channel.
-    // unsigned char g:		green channel.
-    // unsigned char b:		blue channel.
-    // unsigned char a:		alpha channel.
-
-    unsigned long CImageLoaderTex::PackRGBA (unsigned char r, unsigned char g, unsigned char b, unsigned char a) const
-    {
-        return r | (g << 8) | (b << 16) | (a << 24);
-    }
-
-    // void DecompressBlockDXT1(): Decompresses one block of a DXT1 texture and stores the resulting pixels at the appropriate offset in 'image'.
-    //
-    // unsigned long x:						x-coordinate of the first pixel in the block.
-    // unsigned long y:						y-coordinate of the first pixel in the block.
-    // unsigned long width: 				width of the texture being decompressed.
-    // unsigned long height:				height of the texture being decompressed.
-    // const unsigned char *blockStorage:	pointer to the block to decompress.
-    // unsigned long *image:				pointer to image where the decompressed pixel data should be stored.
-
-    void CImageLoaderTex::DecompressBlockDXT1 (unsigned long x, unsigned long y, unsigned long width, const unsigned char *blockStorage, unsigned long *image) const
-    {
-        unsigned short color0 = *reinterpret_cast<const unsigned short *>(blockStorage);
-        unsigned short color1 = *reinterpret_cast<const unsigned short *>(blockStorage + 2);
-
-        unsigned long temp;
-
-        temp = (color0 >> 11) * 255 + 16;
-        unsigned char r0 = (unsigned char)((temp/32 + temp)/32);
-        temp = ((color0 & 0x07E0) >> 5) * 255 + 32;
-        unsigned char g0 = (unsigned char)((temp/64 + temp)/64);
-        temp = (color0 & 0x001F) * 255 + 16;
-        unsigned char b0 = (unsigned char)((temp/32 + temp)/32);
-
-        temp = (color1 >> 11) * 255 + 16;
-        unsigned char r1 = (unsigned char)((temp/32 + temp)/32);
-        temp = ((color1 & 0x07E0) >> 5) * 255 + 32;
-        unsigned char g1 = (unsigned char)((temp/64 + temp)/64);
-        temp = (color1 & 0x001F) * 255 + 16;
-        unsigned char b1 = (unsigned char)((temp/32 + temp)/32);
-
-        unsigned long code = *reinterpret_cast<const unsigned long *>(blockStorage + 4);
-
-        for (int j=0; j < 4; j++)
-        {
-            for (int i=0; i < 4; i++)
-            {
-                unsigned long finalColor = 0;
-                unsigned char positionCode = (code >> 2*(4*j+i)) & 0x03;
-
-                if (color0 > color1)
-                {
-                    switch (positionCode)
-                    {
-                        case 0:
-                            finalColor = PackRGBA (r0, g0, b0, 255);
-                            break;
-                        case 1:
-                            finalColor = PackRGBA (r1, g1, b1, 255);
-                            break;
-                        case 2:
-                            finalColor = PackRGBA ((2*r0+r1)/3, (2*g0+g1)/3, (2*b0+b1)/3, 255);
-                            break;
-                        case 3:
-                            finalColor = PackRGBA ((r0+2*r1)/3, (g0+2*g1)/3, (b0+2*b1)/3, 255);
-                            break;
-                    }
-                }
-                else
-                {
-                    switch (positionCode)
-                    {
-                        case 0:
-                            finalColor = PackRGBA (r0, g0, b0, 255);
-                            break;
-                        case 1:
-                            finalColor = PackRGBA (r1, g1, b1, 255);
-                            break;
-                        case 2:
-                            finalColor = PackRGBA ((r0+r1)/2, (g0+g1)/2, (b0+b1)/2, 255);
-                            break;
-                        case 3:
-                            finalColor = PackRGBA (0, 0, 0, 255);
-                            break;
-                    }
-                }
-
-                reinterpret_cast <irr::u32*> (image) [(y + j) * width + x + i] = finalColor;
-            }
-        }
-    }
-
-    // void BlockDecompressImageDXT1(): Decompresses all the blocks of a DXT1 compressed texture and stores the resulting pixels in 'image'.
-    //
-    // unsigned long width:					Texture width.
-    // unsigned long height:				Texture height.
-    // const unsigned char *blockStorage:	pointer to compressed DXT1 blocks.
-    // unsigned long *image:				pointer to the image where the decompressed pixels will be stored.
-
-    void CImageLoaderTex::BlockDecompressImageDXT1(unsigned long width, unsigned long height, const unsigned char *blockStorage, unsigned long *image) const
-    {
-        unsigned long blockCountX = (width + 3) / 4;
-        unsigned long blockCountY = (height + 3) / 4;
-        unsigned long blockWidth = (width < 4) ? width : 4;
-        unsigned long blockHeight = (height < 4) ? height : 4;
-
-        for (unsigned long j = 0; j < blockCountY; j++)
-        {
-            for (unsigned long i = 0; i < blockCountX; i++)
-                DecompressBlockDXT1(i*4, j*4, width, blockStorage + i * 8, image);
-
-            blockStorage += blockCountX * 8;
-        }
-    }
-
-    // void DecompressBlockDXT3(): Decompresses one block of a DXT3 texture and stores the resulting pixels at the appropriate offset in 'image'.
-    //
-    // unsigned long x:						x-coordinate of the first pixel in the block.
-    // unsigned long y:						y-coordinate of the first pixel in the block.
-    // unsigned long width: 				width of the texture being decompressed.
-    // unsigned long height:				height of the texture being decompressed.
-    // const unsigned char *blockStorage:	pointer to the block to decompress.
-    // unsigned long *image:				pointer to image where the decompressed pixel data should be stored.
-
-    void CImageLoaderTex::DecompressBlockDXT3(unsigned long x, unsigned long y, unsigned long width, const unsigned char *blockStorage, unsigned long *image) const
-    {
-        unsigned short color0 = *reinterpret_cast <const unsigned short *>(blockStorage + 8);
-        unsigned short color1 = *reinterpret_cast <const unsigned short *>(blockStorage + 10);
-
-        unsigned long temp;
-
-        temp = (color0 >> 11) * 255 + 16;
-        unsigned char r0 = (unsigned char)((temp/32 + temp)/32);
-        temp = ((color0 & 0x07E0) >> 5) * 255 + 32;
-        unsigned char g0 = (unsigned char)((temp/64 + temp)/64);
-        temp = (color0 & 0x001F) * 255 + 16;
-        unsigned char b0 = (unsigned char)((temp/32 + temp)/32);
-
-        temp = (color1 >> 11) * 255 + 16;
-        unsigned char r1 = (unsigned char)((temp/32 + temp)/32);
-        temp = ((color1 & 0x07E0) >> 5) * 255 + 32;
-        unsigned char g1 = (unsigned char)((temp/64 + temp)/64);
-        temp = (color1 & 0x001F) * 255 + 16;
-        unsigned char b1 = (unsigned char)((temp/32 + temp)/32);
-
-        unsigned long code = *reinterpret_cast <const unsigned long *>(blockStorage + 12);
-        unsigned long long alphaCode = *reinterpret_cast <const unsigned long long *>(blockStorage);
-
-        for (int j=0; j < 4; j++)
-        {
-            for (int i=0; i < 4; i++)
-            {
-                unsigned long finalColor = 0;
-                unsigned char positionCode = (code >> 2*(4*j+i)) & 0x03;
-                // per StackOverflow this creates an even distribution of alphas between 0 and 255
-                unsigned char finalAlpha = 17 * (alphaCode >> 4*(4*j+i) & 0x0F);
-
-                if (color0 > color1)
-                {
-                    switch (positionCode)
-                    {
-                        case 0:
-                            finalColor = PackRGBA (r0, g0, b0, finalAlpha);
-                            break;
-                        case 1:
-                            finalColor = PackRGBA (r1, g1, b1, finalAlpha);
-                            break;
-                        case 2:
-                            finalColor = PackRGBA ((2*r0+r1)/3, (2*g0+g1)/3, (2*b0+b1)/3, finalAlpha);
-                            break;
-                        case 3:
-                            finalColor = PackRGBA ((r0+2*r1)/3, (g0+2*g1)/3, (b0+2*b1)/3, finalAlpha);
-                            break;
-                    }
-                }
-                else
-                {
-                    switch (positionCode)
-                    {
-                        case 0:
-                            finalColor = PackRGBA (r0, g0, b0, finalAlpha);
-                            break;
-                        case 1:
-                            finalColor = PackRGBA (r1, g1, b1, finalAlpha);
-                            break;
-                        case 2:
-                            finalColor = PackRGBA ((r0+r1)/2, (g0+g1)/2, (b0+b1)/2, finalAlpha);
-                            break;
-                        case 3:
-                            finalColor = PackRGBA (0, 0, 0, finalAlpha);
-                            break;
-                    }
-                }
-
-                reinterpret_cast <irr::u32*>(image)[(y + j)*width + x + i] = finalColor;
-            }
-        }
-    }
-
-    // void BlockDecompressImageDXT3(): Decompresses all the blocks of a DXT3 compressed texture and stores the resulting pixels in 'image'.
-    //
-    // unsigned long width:					Texture width.
-    // unsigned long height:				Texture height.
-    // const unsigned char *blockStorage:	pointer to compressed DXT3 blocks.
-    // unsigned long *image:				pointer to the image where the decompressed pixels will be stored.
-
-    void CImageLoaderTex::BlockDecompressImageDXT3(unsigned long width, unsigned long height, const unsigned char *blockStorage, unsigned long *image) const
-    {
-        unsigned long blockCountX = (width + 3) / 4;
-        unsigned long blockCountY = (height + 3) / 4;
-        unsigned long blockWidth = (width < 4) ? width : 4;
-        unsigned long blockHeight = (height < 4) ? height : 4;
-        for (unsigned long j = 0; j < blockCountY; j++)
-        {
-            for (unsigned long i = 0; i < blockCountX; i++)
-                DecompressBlockDXT3 (i*4, j*4, width, blockStorage + i * 16, image);
-            blockStorage += blockCountX * 16;
-        }
-    }
-
-    // void DecompressBlockDXT5(): Decompresses one block of a DXT5 texture and stores the resulting pixels at the appropriate offset in 'image'.
-    //
-    // unsigned long x:						x-coordinate of the first pixel in the block.
-    // unsigned long y:						y-coordinate of the first pixel in the block.
-    // unsigned long width: 				width of the texture being decompressed.
-    // unsigned long height:				height of the texture being decompressed.
-    // const unsigned char *blockStorage:	pointer to the block to decompress.
-    // unsigned long *image:				pointer to image where the decompressed pixel data should be stored.
-
-    void CImageLoaderTex::DecompressBlockDXT5(unsigned long x, unsigned long y, unsigned long width, const unsigned char *blockStorage, unsigned long *image) const
-    {
-        unsigned char alpha0 = *reinterpret_cast<const unsigned char *>(blockStorage);
-        unsigned char alpha1 = *reinterpret_cast<const unsigned char *>(blockStorage + 1);
-
-        const unsigned char *bits = blockStorage + 2;
-        unsigned long alphaCode1 = bits[2] | (bits[3] << 8) | (bits[4] << 16) | (bits[5] << 24);
-        unsigned short alphaCode2 = bits[0] | (bits[1] << 8);
-
-        unsigned short color0 = *reinterpret_cast<const unsigned short *>(blockStorage + 8);
-        unsigned short color1 = *reinterpret_cast<const unsigned short *>(blockStorage + 10);
-
-        unsigned long temp;
-
-        temp = (color0 >> 11) * 255 + 16;
-        unsigned char r0 = (unsigned char)((temp/32 + temp)/32);
-        temp = ((color0 & 0x07E0) >> 5) * 255 + 32;
-        unsigned char g0 = (unsigned char)((temp/64 + temp)/64);
-        temp = (color0 & 0x001F) * 255 + 16;
-        unsigned char b0 = (unsigned char)((temp/32 + temp)/32);
-
-        temp = (color1 >> 11) * 255 + 16;
-        unsigned char r1 = (unsigned char)((temp/32 + temp)/32);
-        temp = ((color1 & 0x07E0) >> 5) * 255 + 32;
-        unsigned char g1 = (unsigned char)((temp/64 + temp)/64);
-        temp = (color1 & 0x001F) * 255 + 16;
-        unsigned char b1 = (unsigned char)((temp/32 + temp)/32);
-
-        unsigned long code = *reinterpret_cast<const unsigned long *>(blockStorage + 12);
-
-        for (int j=0; j < 4; j++)
-        {
-            for (int i=0; i < 4; i++)
-            {
-                int alphaCodeIndex = 3*(4*j+i);
-                int alphaCode;
-
-                if (alphaCodeIndex <= 12)
-                {
-                    alphaCode = (alphaCode2 >> alphaCodeIndex) & 0x07;
-                }
-                else if (alphaCodeIndex == 15)
-                {
-                    alphaCode = (alphaCode2 >> 15) | ((alphaCode1 << 1) & 0x06);
-                }
-                else // alphaCodeIndex >= 18 && alphaCodeIndex <= 45
-                {
-                    alphaCode = (alphaCode1 >> (alphaCodeIndex - 16)) & 0x07;
-                }
-
-                unsigned char finalAlpha;
-                if (alphaCode == 0)
-                {
-                    finalAlpha = alpha0;
-                }
-                else if (alphaCode == 1)
-                {
-                    finalAlpha = alpha1;
-                }
-                else
-                {
-                    if (alpha0 > alpha1)
-                    {
-                        finalAlpha = ((8-alphaCode)*alpha0 + (alphaCode-1)*alpha1)/7;
-                    }
-                    else
-                    {
-                        if (alphaCode == 6)
-                            finalAlpha = 0;
-                        else if (alphaCode == 7)
-                            finalAlpha = 255;
-                        else
-                            finalAlpha = ((6-alphaCode)*alpha0 + (alphaCode-1)*alpha1)/5;
-                    }
-                }
-
-                unsigned long finalColor = 0;
-                unsigned char positionCode = (code >> 2 * (4 * j + i)) & 0x03;
-
-                if (color0 > color1)
-                {
-                    switch (positionCode)
-                    {
-                        case 0:
-                            finalColor = PackRGBA (r0, g0, b0, finalAlpha);
-                            break;
-                        case 1:
-                            finalColor = PackRGBA (r1, g1, b1, finalAlpha);
-                            break;
-                        case 2:
-                            finalColor = PackRGBA ((2*r0+r1)/3, (2*g0+g1)/3, (2*b0+b1)/3, finalAlpha);
-                            break;
-                        case 3:
-                            finalColor = PackRGBA ((r0+2*r1)/3, (g0+2*g1)/3, (b0+2*b1)/3, finalAlpha);
-                            break;
-                    }
-                }
-                else
-                {
-                    switch (positionCode)
-                    {
-                        case 0:
-                            finalColor = PackRGBA (r0, g0, b0, finalAlpha);
-                            break;
-                        case 1:
-                            finalColor = PackRGBA (r1, g1, b1, finalAlpha);
-                            break;
-                        case 2:
-                            finalColor = PackRGBA ((r0 + r1) / 2, (g0 + g1) / 2, (b0 + b1) / 2, finalAlpha);
-                            break;
-                        case 3:
-                            finalColor = PackRGBA (0, 0, 0, finalAlpha);
-                            break;
-                    }
-                }
-
-                reinterpret_cast <irr::u32*> (image) [(y + j) * width + x + i] = finalColor;
-            }
-        }
-    }
-
-    // void BlockDecompressImageDXT5(): Decompresses all the blocks of a DXT5 compressed texture and stores the resulting pixels in 'image'.
-    //
-    // unsigned long width:					Texture width.
-    // unsigned long height:				Texture height.
-    // const unsigned char *blockStorage:	pointer to compressed DXT5 blocks.
-    // unsigned long *image:				pointer to the image where the decompressed pixels will be stored.
-
-    void CImageLoaderTex::BlockDecompressImageDXT5(unsigned long width, unsigned long height, const unsigned char *blockStorage, unsigned long *image) const
-    {
-        unsigned long blockCountX = (width + 3) / 4;
-        unsigned long blockCountY = (height + 3) / 4;
-        unsigned long blockWidth = (width < 4) ? width : 4;
-        unsigned long blockHeight = (height < 4) ? height : 4;
-
-        for (unsigned long j = 0; j < blockCountY; j++)
-        {
-            for (unsigned long i = 0; i < blockCountX; i++)
-                DecompressBlockDXT5(i*4, j*4, width, blockStorage + i * 16, image);
-
-            blockStorage += blockCountX * 16;
-        }
-    }
-};

+ 0 - 183
src/WallpaperEngine/Irrlicht/CImageLoaderTEX.h

@@ -1,183 +0,0 @@
-#pragma once
-
-#include <vector>
-
-#include <irrlicht/irrlicht.h>
-#include "CContext.h"
-
-namespace WallpaperEngine::Irrlicht
-{
-    //!  Surface Loader for PNG files
-    class CImageLoaderTex : public irr::video::IImageLoader
-    {
-    public:
-        CImageLoaderTex (CContext* context);
-
-        //! returns true if the file maybe is able to be loaded by this class
-        //! based on the file extension (e.g. ".png")
-        virtual bool isALoadableFileExtension(const irr::io::path& filename) const;
-
-        //! returns true if the file maybe is able to be loaded by this class
-        virtual bool isALoadableFileFormat(irr::io::IReadFile* file) const;
-
-        //! creates a surface from the file
-        virtual irr::video::IImage* loadImage(irr::io::IReadFile* input) const;
-
-        virtual void loadImageFromARGB8Data (irr::video::IImage* output, const char* input, irr::u32 width, irr::u32 height, irr::u32 mipmap_width) const;
-
-        virtual void loadImageFromDXT1 (irr::video::IImage* output, const char* input, irr::u32 destination_width, irr::u32 destination_height, irr::u32 origin_width, irr::u32 origin_height) const;
-        virtual void loadImageFromDXT5 (irr::video::IImage* output, const char* input, irr::u32 destination_width, irr::u32 destination_height, irr::u32 origin_width, irr::u32 origin_height) const;
-        virtual void loadImageFromDXT3 (irr::video::IImage* output, const char* input, irr::u32 destination_width, irr::u32 destination_height, irr::u32 origin_width, irr::u32 origin_height) const;
-    private:
-        enum ContainerVersion : int
-        {
-            UNKNOWN = -1,
-            TEXB0003 = 3,
-            TEXB0002 = 2,
-            TEXB0001 = 1
-        };
-
-        enum TextureFormat : int
-        {
-            ARGB8888,
-            RA88,
-            A8,
-            DXT5,
-            DXT1,
-            DXT3 = -1
-        };
-
-        // extracted from the free image library
-        enum FREE_IMAGE_FORMAT : int
-        {
-            FIF_UNKNOWN = -1,
-            FIF_BMP		= 0,
-            FIF_ICO		= 1,
-            FIF_JPEG	= 2,
-            FIF_JNG		= 3,
-            FIF_KOALA	= 4,
-            FIF_LBM		= 5,
-            FIF_IFF     = FIF_LBM,
-            FIF_MNG		= 6,
-            FIF_PBM		= 7,
-            FIF_PBMRAW	= 8,
-            FIF_PCD		= 9,
-            FIF_PCX		= 10,
-            FIF_PGM		= 11,
-            FIF_PGMRAW	= 12,
-            FIF_PNG		= 13,
-            FIF_PPM		= 14,
-            FIF_PPMRAW	= 15,
-            FIF_RAS		= 16,
-            FIF_TARGA	= 17,
-            FIF_TIFF	= 18,
-            FIF_WBMP	= 19,
-            FIF_PSD		= 20,
-            FIF_CUT		= 21,
-            FIF_XBM		= 22,
-            FIF_XPM		= 23,
-            FIF_DDS		= 24,
-            FIF_GIF     = 25,
-            FIF_HDR		= 26,
-            FIF_FAXG3	= 27,
-            FIF_SGI		= 28,
-            FIF_EXR		= 29,
-            FIF_J2K		= 30,
-            FIF_JP2		= 31,
-            FIF_PFM		= 32,
-            FIF_PICT	= 33,
-            FIF_RAW		= 34,
-            FIF_WEBP	= 35,
-            FIF_JXR     = 36
-        };
-
-        class TextureMipmap
-        {
-        public:
-            TextureMipmap ();
-            ~TextureMipmap ();
-
-            /** Width of the mipmap */
-            irr::u32 width;
-            /** Height of the mipmap */
-            irr::u32 height;
-            /** If the mipmap data is compressed */
-            irr::u32 compression;
-            /** Uncompressed size of the mipmap */
-            irr::u32 uncompressedSize;
-            /** Compress size of the mipmap */
-            irr::u32 compressedSize;
-            /** Pointer to the compressed data */
-            char* compressedData = nullptr;
-            /** Pointer to the uncompressed data */
-            char* uncompressedData = nullptr;
-            /**
-             * Performs actual decompression of the compressed data
-             */
-            void decompressData ();
-        };
-
-        class TextureContainer
-        {
-        public:
-            TextureContainer ();
-            ~TextureContainer ();
-
-            /** The version of the texture container */
-            ContainerVersion containerVersion = ContainerVersion::UNKNOWN;
-            /** Real width of the texture */
-            irr::u32 width;
-            /** Real height of the texture */
-            irr::u32 height;
-            /** Texture width in memory (power of 2) */
-            irr::u32 textureWidth;
-            /** Texture height in memory (power of 2) */
-            irr::u32 textureHeight;
-            /** Texture data format */
-            TextureFormat format;
-            /** Free Image format */
-            FREE_IMAGE_FORMAT freeimageFormat;
-            /** Number of mipmap levels for the texture */
-            irr::u32 mipmapCount;
-            /** List of mipmaps */
-            std::vector <TextureMipmap*> mipmaps;
-        };
-
-        /** Irrlicht context */
-        CContext* m_context;
-
-        /**
-         * Parses the container file and returns a texture ready to be used
-         *
-         * @param input The file to parse the data from
-         *
-         * @return The texture ready to be used
-         */
-        irr::video::IImage* parseFile (irr::io::IReadFile* input) const;
-        /**
-         * Parses the container header and returns it's information
-         *
-         * @param input The file to parse the data from
-         *
-         * @return The container header data
-         */
-        TextureContainer* parseHeader (irr::io::IReadFile* input) const;
-        /**
-         * Parses a mipmap level and returns it's information
-         *
-         * @param header The container header where this mipmap is contained
-         * @param input The file to parse the data from
-         *
-         * @return The mipmap info ready
-         */
-        TextureMipmap* parseMipmap (TextureContainer* header, irr::io::IReadFile* input) const;
-
-        void BlockDecompressImageDXT1(unsigned long width, unsigned long height, const unsigned char *blockStorage, unsigned long *image) const;
-        void DecompressBlockDXT1(unsigned long x, unsigned long y, unsigned long width, const unsigned char *blockStorage, unsigned long *image) const;
-        void BlockDecompressImageDXT3(unsigned long width, unsigned long height, const unsigned char *blockStorage, unsigned long *image) const;
-        void DecompressBlockDXT3(unsigned long x, unsigned long y, unsigned long width, const unsigned char *blockStorage, unsigned long *image) const;
-        unsigned long PackRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a) const;
-        void BlockDecompressImageDXT5(unsigned long width, unsigned long height, const unsigned char *blockStorage, unsigned long *image) const;
-        void DecompressBlockDXT5(unsigned long x, unsigned long y, unsigned long width, const unsigned char *blockStorage, unsigned long *image) const;
-    };
-}

+ 0 - 194
src/WallpaperEngine/Irrlicht/CPkgReader.cpp

@@ -1,194 +0,0 @@
-#include "CPkgReader.h"
-
-namespace WallpaperEngine::Irrlicht
-{
-    bool isPkgHeaderVersionValid(char* version)
-    {
-        return strcmp ("PKGV0007", version) == 0 ||
-               strcmp ("PKGV0002", version) == 0 ||
-               strcmp ("PKGV0001", version) == 0 ||
-               strcmp ("PKGV0008", version) == 0 ||
-               strcmp ("PKGV0009", version) == 0 ||
-               strcmp ("PKGV0004", version) == 0 ||
-               strcmp ("PKGV0005", version) == 0 ||
-               strcmp ("PKGV0006", version) == 0;
-    }
-
-    CArchiveLoaderPkg::CArchiveLoaderPkg (CContext* context) :
-            m_context (context)
-    {
-#ifdef _DEBUG
-        setDebugName("CArchiveLoaderPKG");
-#endif
-    }
-
-    bool CArchiveLoaderPkg::isALoadableFileFormat(const irr::io::path& filename) const
-    {
-        return irr::core::hasFileExtension (filename, "pkg");
-    }
-
-    irr::io::IFileArchive* CArchiveLoaderPkg::createArchive(const irr::io::path& filename, bool ignoreCase, bool ignorePaths) const
-    {
-        irr::io::IFileArchive *archive = nullptr;
-        irr::io::IReadFile* file = this->m_context->getDevice ()->getFileSystem ()->createAndOpenFile(filename);
-
-        if (file)
-        {
-            archive = this->createArchive (file, ignoreCase, ignorePaths);
-            file->drop ();
-        }
-
-        return archive;
-    }
-
-    irr::io::IFileArchive* CArchiveLoaderPkg::createArchive(irr::io::IReadFile* file, bool ignoreCase, bool ignorePaths) const
-    {
-        irr::io::IFileArchive *archive = nullptr;
-
-        if (file)
-        {
-            file->seek (0);
-            archive = new CPkgReader (this->m_context, file, ignoreCase, ignorePaths);
-        }
-
-        return archive;
-    }
-
-    bool CArchiveLoaderPkg::isALoadableFileFormat(irr::io::IReadFile* file) const
-    {
-        unsigned int size;
-        char* pointer;
-
-        file->read (&size, 4);
-
-        // the string doesnt include the null terminator
-        size ++;
-
-        pointer = new char [size];
-        memset (pointer, 0, size);
-
-        file->read (pointer, size - 1);
-
-
-        if (isPkgHeaderVersionValid (pointer) == false)
-        {
-            delete [] pointer;
-            return false;
-        }
-
-        delete [] pointer;
-        return true;
-    }
-
-//! Check to see if the loader can create archives of this type.
-    bool CArchiveLoaderPkg::isALoadableFileFormat(irr::io::E_FILE_ARCHIVE_TYPE fileType) const
-    {
-        return false;
-    }
-
-    CPkgReader::CPkgReader (CContext* context, irr::io::IReadFile* file, bool ignoreCase, bool ignorePaths)
-            : CFileList((file ? file->getFileName() : irr::io::path("")), ignoreCase, ignorePaths),
-            m_file(file),
-            m_context (context)
-    {
-        if (this->m_file)
-        {
-            this->m_file->grab ();
-            this->scanPkgHeader ();
-        }
-    }
-
-    CPkgReader::~CPkgReader()
-    {
-        if (this->m_file)
-            this->m_file->drop();
-    }
-
-    irr::io::E_FILE_ARCHIVE_TYPE CPkgReader::getType() const
-    {
-        return irr::io::E_FILE_ARCHIVE_TYPE::EFAT_ZIP;
-    }
-
-    const irr::io::IFileList* CPkgReader::getFileList() const
-    {
-        return this;
-    }
-
-    void CPkgReader::scanPkgHeader ()
-    {
-        char* headerVersion = this->readSizedString ();
-
-        if (isPkgHeaderVersionValid (headerVersion) == false)
-        {
-            delete [] headerVersion;
-
-            this->m_context->getDevice ()->getLogger ()->log (
-                "unexpected package header", this->m_file->getFileName ().c_str (), irr::ELL_ERROR
-            );
-
-            return;
-        }
-
-        delete [] headerVersion;
-        irr::u32 entriesCount;
-
-        this->m_file->read (&entriesCount, 4);
-
-
-        for (irr::u32 i = 0; i < entriesCount; i ++)
-        {
-            char* filename = this->readSizedString ();
-            irr::u32 offset, length;
-
-            this->m_file->read (&offset, 4);
-            this->m_file->read (&length, 4);
-
-            this->addItem (filename, offset, length, false);
-
-            delete [] filename;
-        }
-
-        // after the header is read we have to update the actual offsets
-        for (irr::u32 i = 0; i < this->m_files.size (); i ++)
-        {
-            this->m_files [i].Offset += this->m_file->getPos ();
-        }
-    }
-
-    char* CPkgReader::readSizedString ()
-    {
-        unsigned int size;
-        char* pointer;
-
-        this->m_file->read (&size, 4);
-
-        // the string doesnt include the null terminator
-        size ++;
-
-        pointer = new char [size];
-        memset (pointer, 0, size);
-
-        this->m_file->read (pointer, size - 1);
-
-        return pointer;
-    }
-
-    irr::io::IReadFile* CPkgReader::createAndOpenFile (const irr::io::path& filename)
-    {
-        irr::s32 index = this->findFile (filename, false);
-
-        if (index != -1)
-            return createAndOpenFile (index);
-
-        return nullptr;
-    }
-
-    irr::io::IReadFile* CPkgReader::createAndOpenFile (irr::u32 index)
-    {
-        if (index > this->m_files.size ())
-            return nullptr;
-
-        const SFileListEntry entry = m_files [index];
-        return irr::io::createLimitReadFile (entry.FullName, m_file, entry.Offset, entry.Size);
-    }
-}

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels