mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-07-13 21:02:34 +08:00
- removed/commented out most irrlicht-specific code
~ written close to equivalent versions in OpenGL code using GLM and GLFW ~ written replacements for texture and package loading to not use irrlicht anymore ~ updated shader compiler as we now don't need to replace attributes anymore + added support for texture flags in the texture header (as they're needed for opengl to get proper information) TODO: REWRITE VIDEO PLAYER SUPPORT AS THIS UPDATE EFFECTIVELY BREAKS IT Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
parent
861f2261ef
commit
291b7e364a
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
cmake-build-debug
|
||||
assets.zip
|
||||
.idea
|
||||
assets/
|
||||
assets/
|
||||
lib/
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CMakeRunConfigurationManager" shouldGenerate="true" shouldDeleteObsolete="true" buildAllGenerated="true">
|
||||
<component name="CMakeRunConfigurationManager" shouldGenerate="true" shouldDeleteObsolete="true">
|
||||
<generated>
|
||||
<config projectName="wallengine" targetName="wallengine" />
|
||||
<config projectName="wallengine" targetName="temp" />
|
||||
@ -8,285 +8,127 @@
|
||||
</component>
|
||||
<component name="CMakeSettings">
|
||||
<configurations>
|
||||
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
|
||||
<configuration PROFILE_NAME="Debug" ENABLED="true" 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" />
|
||||
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/CMakeLists.txt" beforeDir="false" afterPath="$PROJECT_DIR$/CMakeLists.txt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/CMakeModules/FindXrandr.cmake" beforeDir="false" afterPath="$PROJECT_DIR$/CMakeModules/FindXrandr.cmake" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/main.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/CObject.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/CObject.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/CObject.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/CObject.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/CProject.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/CProject.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/CProject.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/CProject.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/CScene.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/CScene.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/CScene.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/CScene.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/Core.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/Core.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/Core.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/Core.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/CEffect.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/CEffect.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/CEffect.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/CEffect.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/CImage.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/CImage.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/CImage.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/CImage.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/CParticle.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/CParticle.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/CParticle.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/CParticle.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/CSound.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/CSound.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/CSound.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/CSound.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantInteger.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantInteger.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantInteger.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantInteger.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector3.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector3.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector3.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector3.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/Images/CMaterial.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/Images/CMaterial.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/Images/CMaterial.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/Images/CMaterial.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/Scenes/CCamera.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/Scenes/CCamera.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/Scenes/CCamera.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/Scenes/CCamera.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/Scenes/CProjection.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/Scenes/CProjection.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Core/Scenes/CProjection.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Core/Scenes/CProjection.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/FileSystem/FileSystem.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/FileSystem/FileSystem.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/FileSystem/FileSystem.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/FileSystem/FileSystem.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/CCamera.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/CCamera.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/CCamera.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/CCamera.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/CObject.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/CObject.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/CObject.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/CObject.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/CScene.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/CScene.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/CScene.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/CScene.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/CVideo.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/CVideo.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/CVideo.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/CVideo.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/CWallpaper.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/CWallpaper.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/CWallpaper.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/CWallpaper.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/CEffect.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/CEffect.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/CEffect.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/CEffect.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/CImage.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/CImage.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/CImage.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/CImage.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/CSound.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/CSound.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/CSound.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/CSound.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/Effects/CFBO.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/Effects/CFBO.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/Effects/CFBO.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/Effects/CFBO.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/Effects/CMaterial.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/Effects/CMaterial.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/Effects/CMaterial.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/Effects/CMaterial.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/Effects/CPass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/Effects/CPass.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/Effects/CPass.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/Objects/Effects/CPass.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/Shaders/Compiler.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/Shaders/Compiler.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/Shaders/Compiler.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/Shaders/Compiler.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector2.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector2.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector2.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector2.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector3.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector3.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector3.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector3.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector4.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector4.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector4.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector4.h" afterDir="false" />
|
||||
</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 name="ClangdSettings">
|
||||
<option name="formatViaClangd" value="false" />
|
||||
</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>"."</find>
|
||||
<find>->render</find>
|
||||
<find>Failed</find>
|
||||
</findStrings>
|
||||
<component name="ExecutionTargetManager" SELECTED_TARGET="CMakeBuildProfile:Debug" />
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="CMakeLists.txt" />
|
||||
</list>
|
||||
</option>
|
||||
</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 name="GitSEFilterConfiguration">
|
||||
<file-type-list>
|
||||
<filtered-out-file-type name="LOCAL_BRANCH" />
|
||||
<filtered-out-file-type name="REMOTE_BRANCH" />
|
||||
<filtered-out-file-type name="TAG" />
|
||||
<filtered-out-file-type name="COMMIT_BY_MESSAGE" />
|
||||
</file-type-list>
|
||||
</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 name="ProjectId" id="1fRS5InzpMSVfsbaumQ0TSwBSVT" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||
<property name="RunOnceActivity.cidr.known.project.marker" value="true" />
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
<property name="cf.first.check.clang-format" value="false" />
|
||||
<property name="cidr.known.project.marker" value="true" />
|
||||
<property name="cmake.loaded.for.project" value="true" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/../../wallpaper-engine-kde-plugin" />
|
||||
<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" />
|
||||
<property name="settings.editor.selected.configurable" value="preferences.sourceCode.TypeScript" />
|
||||
</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/src/WallpaperEngine/Core/Types" />
|
||||
<recent name="$PROJECT_DIR$/cmake-build-debug" />
|
||||
<recent name="$PROJECT_DIR$" />
|
||||
<recent name="$PROJECT_DIR$/res/materials/effects" />
|
||||
</key>
|
||||
@ -298,26 +140,99 @@
|
||||
<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 />
|
||||
<component name="RunManager" selected="CMake Application.Unnamed">
|
||||
<configuration default="true" type="CLionExternalRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true">
|
||||
<method v="2">
|
||||
<option name="CLION.EXTERNAL.BUILD" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="1461427298" type="CMakeRunConfiguration" factoryName="Application" PROGRAM_PARAMS="--pkg $PROJECT_DIR$/../../../../tmp/1461427298/" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="wallengine" TARGET_NAME="wallengine" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="wallengine" RUN_TARGET_NAME="wallengine">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="1851912143 - bugreport 38" type="CMakeRunConfiguration" factoryName="Application" PROGRAM_PARAMS="--dir $PROJECT_DIR$/../../../../tmp/bugreport/1851912143" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="wallengine" TARGET_NAME="wallengine" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="wallengine" RUN_TARGET_NAME="wallengine">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="1905804984 - bugreport 38" type="CMakeRunConfiguration" factoryName="Application" PROGRAM_PARAMS="--pkg $PROJECT_DIR$/../../../../tmp/bugreport/1905804984" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="wallengine" TARGET_NAME="wallengine" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="wallengine" RUN_TARGET_NAME="wallengine">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="1980267847 - bugreport 38" type="CMakeRunConfiguration" factoryName="Application" PROGRAM_PARAMS="--pkg $PROJECT_DIR$/../../../../tmp/bugreport/1980267847" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="wallengine" TARGET_NAME="wallengine" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="wallengine" RUN_TARGET_NAME="wallengine">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="2065411781 - bugreport 38" type="CMakeRunConfiguration" factoryName="Application" PROGRAM_PARAMS="--pkg $PROJECT_DIR$/../../../../tmp/bugreport/2065411781" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="wallengine" TARGET_NAME="wallengine" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="wallengine" RUN_TARGET_NAME="wallengine">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="2186698820" type="CMakeRunConfiguration" factoryName="Application" PROGRAM_PARAMS="--pkg $PROJECT_DIR$/../../../../tmp/2186698820/" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="wallengine" TARGET_NAME="wallengine" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="wallengine" RUN_TARGET_NAME="wallengine">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="Asuka" type="CMakeRunConfiguration" factoryName="Application" PROGRAM_PARAMS="--pkg $PROJECT_DIR$/../../../../tmp/asuka/" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="wallengine" TARGET_NAME="wallengine" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="wallengine" RUN_TARGET_NAME="wallengine">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="Byoukushoku Folder" type="CMakeRunConfiguration" factoryName="Application" PROGRAM_PARAMS="--dir $PROJECT_DIR$/../../../../tmp/byoukushoku/output/" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="wallengine" TARGET_NAME="wallengine" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="wallengine" RUN_TARGET_NAME="wallengine">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="Byoukushoku" type="CMakeRunConfiguration" factoryName="Application" PROGRAM_PARAMS="--pkg $PROJECT_DIR$/../../../../tmp/byoukushoku/" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="wallengine" TARGET_NAME="wallengine" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="wallengine" RUN_TARGET_NAME="wallengine">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="Kurisu 2 Folder" type="CMakeRunConfiguration" factoryName="Application" PROGRAM_PARAMS="--dir $PROJECT_DIR$/../../../../tmp/kurisu2/output/ --silent" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="wallengine" TARGET_NAME="wallengine" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="wallengine" RUN_TARGET_NAME="wallengine">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="Kurisu 2" type="CMakeRunConfiguration" factoryName="Application" PROGRAM_PARAMS="--pkg $PROJECT_DIR$/../../../../tmp/kurisu2/ --silent" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="wallengine" TARGET_NAME="wallengine" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="wallengine" RUN_TARGET_NAME="wallengine">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="Kurisu" type="CMakeRunConfiguration" factoryName="Application" PROGRAM_PARAMS="--pkg $PROJECT_DIR$/../../../../tmp/kurisu/" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="wallengine" TARGET_NAME="wallengine" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="wallengine" RUN_TARGET_NAME="wallengine">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="Unnamed" type="CMakeRunConfiguration" factoryName="Application" PROGRAM_PARAMS="--dir $PROJECT_DIR$/../../../../tmp/nier__automata_-_become_as_gods_edition/" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="wallengine" TARGET_NAME="wallengine" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="wallengine" RUN_TARGET_NAME="wallengine">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration default="true" type="GradleAppRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.cpp.gradle.execution.GradleNativeBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<list>
|
||||
<item itemvalue="CMake Application.Unnamed" />
|
||||
<item itemvalue="CMake Application.Asuka" />
|
||||
<item itemvalue="CMake Application.Byoukushoku" />
|
||||
<item itemvalue="CMake Application.Byoukushoku Folder" />
|
||||
<item itemvalue="CMake Application.1461427298" />
|
||||
<item itemvalue="CMake Application.2186698820" />
|
||||
<item itemvalue="CMake Application.1851912143 - bugreport 38" />
|
||||
<item itemvalue="CMake Application.1905804984 - bugreport 38" />
|
||||
<item itemvalue="CMake Application.1980267847 - bugreport 38" />
|
||||
<item itemvalue="CMake Application.2065411781 - bugreport 38" />
|
||||
<item itemvalue="CMake Application.Kurisu" />
|
||||
<item itemvalue="CMake Application.Kurisu 2" />
|
||||
<item itemvalue="CMake Application.Kurisu 2 Folder" />
|
||||
</list>
|
||||
</component>
|
||||
<component name="ShelveChangesManager" show_recycled="false">
|
||||
<option name="remove_strategy" value="false" />
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
@ -344,61 +259,23 @@
|
||||
<workItem from="1531833563019" duration="18910000" />
|
||||
<workItem from="1535381505231" duration="2647000" />
|
||||
<workItem from="1537556584820" duration="4148000" />
|
||||
<workItem from="1596179231007" duration="3877000" />
|
||||
<workItem from="1598277062236" duration="7102000" />
|
||||
<workItem from="1623857387050" duration="15441000" />
|
||||
<workItem from="1624150580949" duration="3341000" />
|
||||
<workItem from="1627524366342" duration="16629000" />
|
||||
<workItem from="1628172804296" duration="13408000" />
|
||||
<workItem from="1628367485876" duration="31283000" />
|
||||
<workItem from="1628440211208" duration="35458000" />
|
||||
<workItem from="1628518618716" duration="53867000" />
|
||||
<workItem from="1629323799064" duration="22426000" />
|
||||
<workItem from="1629977506180" duration="737000" />
|
||||
<workItem from="1630358841626" duration="5064000" />
|
||||
</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" />
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
@ -424,351 +301,16 @@
|
||||
<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" />
|
||||
<url>file://$PROJECT_DIR$/src/WallpaperEngine/Core/Objects/Images/CMaterial.cpp</url>
|
||||
<line>34</line>
|
||||
<option name="timeStamp" value="55" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
|
||||
<url>file://$PROJECT_DIR$/src/WallpaperEngine/Render/Shaders/Compiler.cpp</url>
|
||||
<line>601</line>
|
||||
<option name="timeStamp" value="69" />
|
||||
</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>
|
@ -6,9 +6,13 @@ set(CMAKE_CXX_FLAGS "-fpermissive")
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
|
||||
set(OpenGL_GL_PREFERENCE "LEGACY")
|
||||
|
||||
add_compile_definitions(DEBUG=1)
|
||||
|
||||
find_package(X11 REQUIRED)
|
||||
find_package(Xrandr REQUIRED)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(GLFW3 3.1 REQUIRED)
|
||||
find_package(GLEW REQUIRED)
|
||||
find_package(GLUT REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(Irrlicht REQUIRED)
|
||||
@ -17,12 +21,23 @@ 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)
|
||||
include_directories(${X11_INCLUDE_DIR} ${XRANDR_INCLUDE_DIR} ${GLEW_INCLUDE_DIR} ${glfw3_INCLUDE_DIR} ${IRRLICHT_INCLUDE_DIR} ${LZ4_INCLUDE_DIR} ${SDL_INCLUDE_DIRS} ${SDL_MIXER_INCLUDE_DIRS} ${FFMPEG_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
|
||||
|
||||
@ -163,4 +178,4 @@ 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} ${GLFW3_LIBRARY} ${GLUT_LIBRARIES} ${ZLIB_LIBRARIES} ${IRRLICHT_LIBRARY} ${LZ4_LIBRARY} ${SDL_LIBRARY} ${SDL_MIXER_LIBRARIES} ${FFMPEG_LIBRARIES})
|
47
CMakeModules/FindGLFW3.cmake
Normal file
47
CMakeModules/FindGLFW3.cmake
Normal file
@ -0,0 +1,47 @@
|
||||
# Locate the glfw3 library
|
||||
#
|
||||
# This module defines the following variables:
|
||||
#
|
||||
# GLFW3_LIBRARY the name of the library;
|
||||
# GLFW3_INCLUDE_DIR where to find glfw include files.
|
||||
# GLFW3_FOUND true if both the GLFW3_LIBRARY and GLFW3_INCLUDE_DIR have been found.
|
||||
#
|
||||
# To help locate the library and include file, you can define a
|
||||
# variable called GLFW3_ROOT which points to the root of the glfw library
|
||||
# installation.
|
||||
#
|
||||
# default search dirs
|
||||
#
|
||||
# Cmake file from: https://github.com/daw42/glslcookbook
|
||||
|
||||
set( _glfw3_HEADER_SEARCH_DIRS
|
||||
"/usr/include"
|
||||
"/usr/local/include"
|
||||
"${CMAKE_SOURCE_DIR}/includes" )
|
||||
set( _glfw3_LIB_SEARCH_DIRS
|
||||
"/usr/lib"
|
||||
"/usr/local/lib"
|
||||
"${CMAKE_SOURCE_DIR}/lib")
|
||||
|
||||
# Check environment for root search directory
|
||||
set( _glfw3_ENV_ROOT $ENV{GLFW3_ROOT} )
|
||||
if( NOT GLFW3_ROOT AND _glfw3_ENV_ROOT )
|
||||
set(GLFW3_ROOT ${_glfw3_ENV_ROOT} )
|
||||
endif()
|
||||
|
||||
# Put user specified location at beginning of search
|
||||
if( GLFW3_ROOT )
|
||||
list( INSERT _glfw3_HEADER_SEARCH_DIRS 0 "${GLFW3_ROOT}/include" )
|
||||
list( INSERT _glfw3_LIB_SEARCH_DIRS 0 "${GLFW3_ROOT}/lib" )
|
||||
endif()
|
||||
|
||||
# Search for the header
|
||||
FIND_PATH(GLFW3_INCLUDE_DIR "GLFW/glfw3.h"
|
||||
PATHS ${_glfw3_HEADER_SEARCH_DIRS} )
|
||||
|
||||
# Search for the library
|
||||
FIND_LIBRARY(GLFW3_LIBRARY NAMES glfw3 glfw
|
||||
PATHS ${_glfw3_LIB_SEARCH_DIRS} )
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLFW3 DEFAULT_MSG
|
||||
GLFW3_LIBRARY GLFW3_INCLUDE_DIR)
|
186
main.cpp
186
main.cpp
@ -1,15 +1,28 @@
|
||||
#include <iostream>
|
||||
#include <irrlicht/irrlicht.h>
|
||||
#include <getopt.h>
|
||||
#include <unistd.h>
|
||||
#include <SDL_mixer.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#include <GL/glew.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/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,
|
||||
@ -19,7 +32,9 @@ enum BACKGROUND_RUN_MODE
|
||||
};
|
||||
|
||||
WallpaperEngine::Irrlicht::CContext* IrrlichtContext = nullptr;
|
||||
irr::f32 g_Time;
|
||||
double g_Time;
|
||||
|
||||
using namespace WallpaperEngine::Core::Types;
|
||||
|
||||
void print_help (const char* route)
|
||||
{
|
||||
@ -117,6 +132,157 @@ int main (int argc, char* argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
// first of all, initialize the window
|
||||
if (glfwInit () == GLFW_FALSE)
|
||||
{
|
||||
fprintf (stderr, "Failed to initialize GLFW\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
// 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)
|
||||
{
|
||||
fprintf (stderr, "Failed to open a GLFW window");
|
||||
glfwTerminate ();
|
||||
return 2;
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent (window);
|
||||
|
||||
int windowWidth = 1920;
|
||||
int windowHeight = 1080;
|
||||
|
||||
// get the real framebuffer size
|
||||
glfwGetFramebufferSize (window, &windowWidth, &windowHeight);
|
||||
|
||||
if (glewInit () != GLEW_OK)
|
||||
{
|
||||
fprintf (stderr, "Failed to initialize GLEW");
|
||||
glfwTerminate ();
|
||||
return 3;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
// nothing to do here anymore
|
||||
}
|
||||
|
||||
// parse the project.json file
|
||||
auto project = WallpaperEngine::Core::CProject::fromFile ("project.json", containers);
|
||||
WallpaperEngine::Render::CWallpaper* wallpaper;
|
||||
|
||||
if (project->getType () == "scene")
|
||||
{
|
||||
WallpaperEngine::Core::CScene* scene = project->getWallpaper ()->as <WallpaperEngine::Core::CScene> ();
|
||||
wallpaper = new WallpaperEngine::Render::CScene (scene, containers);
|
||||
// TODO: BUILD THE SCENE
|
||||
}
|
||||
else if (project->getType () == "video")
|
||||
{
|
||||
// TODO: BUILD THE VIDEO OBJECT
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error ("Unsupported wallpaper type");
|
||||
}
|
||||
|
||||
if (shouldEnableAudio == true)
|
||||
{
|
||||
int mixer_flags = MIX_INIT_MP3 | MIX_INIT_FLAC | MIX_INIT_OGG;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
// set the scene clear color
|
||||
auto sceneInformation = project->getWallpaper ()->as <WallpaperEngine::Core::CScene> ();
|
||||
FloatColor clearColor = sceneInformation->getClearColor ();
|
||||
|
||||
glClearColor (clearColor.r, clearColor.g, clearColor.b, clearColor.a);
|
||||
|
||||
// enable depth text
|
||||
glEnable (GL_DEPTH_TEST);
|
||||
glDepthFunc (GL_LESS);
|
||||
|
||||
// cull anything that doesn't look at the camera (might be useful to disable in the future)
|
||||
//glEnable (GL_CULL_FACE);
|
||||
|
||||
clock_t minimumTime = 1000 / maximumFPS;
|
||||
clock_t startTime = 0;
|
||||
clock_t endTime = 0;
|
||||
|
||||
while (glfwWindowShouldClose (window) == 0)
|
||||
{
|
||||
// calculate the current time value
|
||||
g_Time += static_cast <double> (endTime - startTime) / CLOCKS_PER_SEC;
|
||||
// get the start time of the frame
|
||||
startTime = clock ();
|
||||
|
||||
// do not use any framebuffer for now
|
||||
glBindFramebuffer (GL_FRAMEBUFFER, 0);
|
||||
// ensure we render over the whole screen
|
||||
glViewport (0, 0, 1920, 1080);
|
||||
|
||||
// clear window
|
||||
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
// render the scene
|
||||
wallpaper->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> (endTime - startTime) / CLOCKS_PER_SEC) * 1000));
|
||||
}
|
||||
|
||||
// terminate gl
|
||||
glfwTerminate ();
|
||||
// terminate SDL
|
||||
SDL_Quit ();
|
||||
|
||||
return 0;
|
||||
/*
|
||||
try
|
||||
{
|
||||
IrrlichtContext = new WallpaperEngine::Irrlicht::CContext (screens, isRootWindow);
|
||||
@ -147,22 +313,6 @@ int main (int argc, char* argv[])
|
||||
IrrlichtContext->getDevice ()->getFileSystem ()->changeWorkingDirectoryTo (wallpaper_path);
|
||||
}
|
||||
|
||||
if (shouldEnableAudio == true)
|
||||
{
|
||||
int mixer_flags = MIX_INIT_MP3 | MIX_INIT_FLAC | MIX_INIT_OGG;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// initialize audio engine
|
||||
Mix_OpenAudio (22050, AUDIO_S16SYS, 2, 640);
|
||||
}
|
||||
|
||||
WallpaperEngine::Core::CProject* project = WallpaperEngine::Core::CProject::fromFile (project_path);
|
||||
WallpaperEngine::Render::CWallpaper* wallpaper;
|
||||
|
||||
@ -206,5 +356,5 @@ int main (int argc, char* argv[])
|
||||
}
|
||||
|
||||
SDL_Quit ();
|
||||
return 0;
|
||||
return 0;*/
|
||||
}
|
31
src/WallpaperEngine/Assets/CCombinedContainer.cpp
Normal file
31
src/WallpaperEngine/Assets/CCombinedContainer.cpp
Normal file
@ -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
src/WallpaperEngine/Assets/CCombinedContainer.h
Normal file
32
src/WallpaperEngine/Assets/CCombinedContainer.h
Normal file
@ -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;
|
||||
};
|
||||
};
|
50
src/WallpaperEngine/Assets/CContainer.cpp
Normal file
50
src/WallpaperEngine/Assets/CContainer.cpp
Normal file
@ -0,0 +1,50 @@
|
||||
#include "CContainer.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <utility>
|
||||
|
||||
using namespace WallpaperEngine::Assets;
|
||||
|
||||
void* CContainer::readTexture (std::string filename, uint32_t* length)
|
||||
{
|
||||
// get the texture's filename (usually .tex)
|
||||
filename = "materials/" + filename + ".tex";
|
||||
|
||||
return this->readFile (filename, length);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
75
src/WallpaperEngine/Assets/CContainer.h
Normal file
75
src/WallpaperEngine/Assets/CContainer.h
Normal file
@ -0,0 +1,75 @@
|
||||
//
|
||||
// Created by almamu on 8/8/21.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
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)
|
||||
* @param length The file's length after it's been read
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
void* readTexture (std::string filename, uint32_t* length);
|
||||
|
||||
/**
|
||||
* Wrapper for readFile, appends the .vert extension at the end and opens the given shader file
|
||||
*
|
||||
* @param filename
|
||||
* @param length
|
||||
*
|
||||
* @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
|
||||
* @param length
|
||||
*
|
||||
* @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
|
||||
* @param length
|
||||
*
|
||||
* @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);
|
||||
};
|
||||
}
|
58
src/WallpaperEngine/Assets/CDirectory.cpp
Normal file
58
src/WallpaperEngine/Assets/CDirectory.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
#include "CDirectory.h"
|
||||
|
||||
using namespace WallpaperEngine::Assets;
|
||||
|
||||
CDirectory::CDirectory (std::string basepath) :
|
||||
m_basepath (std::move (basepath))
|
||||
{
|
||||
// TODO: ENSURE THE BASEPATH ENDS WITH A LEADING /
|
||||
}
|
||||
|
||||
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 ())
|
||||
{
|
||||
*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
src/WallpaperEngine/Assets/CDirectory.h
Normal file
26
src/WallpaperEngine/Assets/CDirectory.h
Normal file
@ -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
src/WallpaperEngine/Assets/CFileEntry.h
Normal file
19
src/WallpaperEngine/Assets/CFileEntry.h
Normal file
@ -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
src/WallpaperEngine/Assets/CPackage.cpp
Normal file
170
src/WallpaperEngine/Assets/CPackage.cpp
Normal file
@ -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
src/WallpaperEngine/Assets/CPackage.h
Normal file
68
src/WallpaperEngine/Assets/CPackage.h
Normal file
@ -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;
|
||||
};
|
||||
}
|
306
src/WallpaperEngine/Assets/CTexture.cpp
Normal file
306
src/WallpaperEngine/Assets/CTexture.cpp
Normal file
@ -0,0 +1,306 @@
|
||||
#include "CTexture.h"
|
||||
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <lz4.h>
|
||||
|
||||
using namespace WallpaperEngine::Assets;
|
||||
|
||||
CTexture::CTexture (void* fileData)
|
||||
{
|
||||
TextureHeader* header = this->parseHeader (static_cast <char*> (fileData));
|
||||
|
||||
if (header->freeImageFormat != FREE_IMAGE_FORMAT::FIF_UNKNOWN)
|
||||
throw std::runtime_error ("Normal images are not supported yet");
|
||||
|
||||
GLint formatGL;
|
||||
|
||||
// detect the image format and hand it to openGL to be used
|
||||
switch (header->format)
|
||||
{
|
||||
case TextureFormat::DXT5:
|
||||
formatGL = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
||||
break;
|
||||
case TextureFormat::DXT3:
|
||||
formatGL = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
||||
break;
|
||||
case TextureFormat::DXT1:
|
||||
formatGL = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
||||
break;
|
||||
case TextureFormat::ARGB8888:
|
||||
formatGL = GL_RGBA8;
|
||||
break;
|
||||
default:
|
||||
delete header;
|
||||
throw std::runtime_error ("Cannot determine the texture format");
|
||||
}
|
||||
|
||||
// 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, header->mipmapCount - 1);
|
||||
|
||||
// setup texture wrapping and filtering
|
||||
if (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 (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 = (formatGL == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) ? 8 : 16;
|
||||
|
||||
auto cur = header->mipmaps.begin ();
|
||||
auto end = header->mipmaps.end ();
|
||||
|
||||
for (int32_t level = 0; cur != end; cur ++, level ++)
|
||||
{
|
||||
switch (formatGL)
|
||||
{
|
||||
case GL_RGBA8:
|
||||
glTexImage2D (GL_TEXTURE_2D, level, formatGL,
|
||||
(*cur)->width, (*cur)->height, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
(*cur)->uncompressedData
|
||||
);
|
||||
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, formatGL,
|
||||
(*cur)->width, (*cur)->height, 0,
|
||||
(*cur)->uncompressedSize, (*cur)->uncompressedData
|
||||
);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
delete header;
|
||||
// TODO: IMPLEMENT SUPPORT FOR NORMAL IMAGES
|
||||
}
|
||||
|
||||
CTexture::~CTexture ()
|
||||
{
|
||||
// TODO: FREE STUFF HERE
|
||||
}
|
||||
|
||||
const GLuint CTexture::getTextureID () const
|
||||
{
|
||||
return this->m_textureID;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
CTexture::TextureHeader* 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;
|
||||
|
||||
TextureHeader* header = new TextureHeader;
|
||||
|
||||
uint32_t* pointer = reinterpret_cast<uint32_t*> (fileData);
|
||||
|
||||
header->format = static_cast<TextureFormat>(*pointer ++);
|
||||
header->flags = static_cast<TextureFlags> (*pointer ++);
|
||||
header->textureWidth = *pointer ++;
|
||||
header->textureHeight = *pointer ++;
|
||||
header->width = *pointer ++;
|
||||
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
|
||||
char* afterFileData = fileData + 9;
|
||||
|
||||
if (memcmp (fileData, "TEXB0003", 9) == 0)
|
||||
{
|
||||
header->containerVersion = ContainerVersion::TEXB0003;
|
||||
|
||||
// get back the pointer and use it
|
||||
pointer = reinterpret_cast <uint32_t*> (afterFileData);
|
||||
pointer ++;
|
||||
header->freeImageFormat = static_cast<FREE_IMAGE_FORMAT> (*pointer++);
|
||||
// set back the pointer
|
||||
fileData = reinterpret_cast <char*> (pointer);
|
||||
}
|
||||
else if(memcmp (fileData, "TEXB0002", 9) == 0)
|
||||
{
|
||||
header->containerVersion = ContainerVersion::TEXB0002;
|
||||
|
||||
// get back the pointer and use it
|
||||
pointer = reinterpret_cast <uint32_t*> (afterFileData);
|
||||
pointer ++;
|
||||
// set back the pointer
|
||||
fileData = reinterpret_cast <char*> (pointer);
|
||||
}
|
||||
else if (memcmp (fileData, "TEXB0001", 9) == 0)
|
||||
{
|
||||
header->containerVersion = ContainerVersion::TEXB0001;
|
||||
|
||||
// get back the pointer and use it
|
||||
pointer = reinterpret_cast <uint32_t*> (afterFileData);
|
||||
pointer ++;
|
||||
// set back the pointer
|
||||
fileData = reinterpret_cast <char*> (pointer);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete header;
|
||||
throw std::runtime_error ("unknown texture format type");
|
||||
}
|
||||
|
||||
if (header->format == TextureFormat::R8)
|
||||
{
|
||||
delete header;
|
||||
|
||||
throw std::runtime_error ("R8 format is not supported yet");
|
||||
}
|
||||
else if (header->format == TextureFormat::RG88)
|
||||
{
|
||||
delete header;
|
||||
|
||||
throw std::runtime_error ("RG88 format is not supported yet");
|
||||
}
|
||||
|
||||
// get back an integer pointer
|
||||
pointer = reinterpret_cast <uint32_t*> (fileData);
|
||||
|
||||
// read the number of mipmaps available
|
||||
header->mipmapCount = *pointer ++;
|
||||
|
||||
fileData = reinterpret_cast <char*> (pointer);
|
||||
|
||||
for (uint32_t i = 0; i < header->mipmapCount; i ++)
|
||||
header->mipmaps.emplace_back (this->parseMipmap (header, &fileData));
|
||||
|
||||
return header;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
153
src/WallpaperEngine/Assets/CTexture.h
Normal file
153
src/WallpaperEngine/Assets/CTexture.h
Normal file
@ -0,0 +1,153 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
||||
namespace WallpaperEngine::Assets
|
||||
{
|
||||
class CTexture
|
||||
{
|
||||
private:
|
||||
enum ContainerVersion : int
|
||||
{
|
||||
UNKNOWN = -1,
|
||||
TEXB0003 = 3,
|
||||
TEXB0002 = 2,
|
||||
TEXB0001 = 1
|
||||
};
|
||||
|
||||
enum TextureFormat : uint32_t
|
||||
{
|
||||
ARGB8888 = 0,
|
||||
DXT5 = 4,
|
||||
DXT3 = 6,
|
||||
DXT1 = 7,
|
||||
RG88 = 8,
|
||||
R8 = 9,
|
||||
};
|
||||
|
||||
// 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 */
|
||||
uint32_t width;
|
||||
/** Height of the mipmap */
|
||||
uint32_t height;
|
||||
/** If the mipmap data is compressed */
|
||||
uint32_t compression;
|
||||
/** Uncompressed size of the mipmap */
|
||||
uint32_t uncompressedSize;
|
||||
/** Compress size of the mipmap */
|
||||
uint32_t 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 ();
|
||||
};
|
||||
|
||||
/**
|
||||
* Configures how the texture will be handled by the background
|
||||
*/
|
||||
enum TextureFlags: uint32_t
|
||||
{
|
||||
None = 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;
|
||||
};
|
||||
public:
|
||||
CTexture (void* fileData);
|
||||
~CTexture ();
|
||||
|
||||
const GLuint getTextureID () const;
|
||||
|
||||
|
||||
private:
|
||||
TextureHeader* parseHeader (char* fileData);
|
||||
TextureMipmap* parseMipmap (TextureHeader* header, char** fileData);
|
||||
|
||||
GLuint m_textureID;
|
||||
};
|
||||
}
|
@ -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,
|
||||
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;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "Core.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Objects/CEffect.h"
|
||||
#include "WallpaperEngine/Assets/CContainer.h"
|
||||
|
||||
namespace WallpaperEngine::Core::Objects
|
||||
{
|
||||
@ -14,11 +15,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; }
|
||||
@ -29,9 +31,9 @@ namespace WallpaperEngine::Core
|
||||
const std::vector<irr::u32>& 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 ();
|
||||
@ -41,9 +43,9 @@ namespace WallpaperEngine::Core
|
||||
irr::u32 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);
|
||||
@ -54,9 +56,9 @@ namespace WallpaperEngine::Core
|
||||
bool m_visible;
|
||||
irr::u32 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;
|
||||
|
@ -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);
|
||||
|
@ -6,16 +6,19 @@
|
||||
#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 +26,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 +38,6 @@ namespace WallpaperEngine::Core
|
||||
std::string m_title;
|
||||
std::string m_type;
|
||||
CWallpaper* m_wallpaper;
|
||||
CContainer* m_container;
|
||||
};
|
||||
};
|
||||
|
@ -2,10 +2,13 @@
|
||||
#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,
|
||||
bool bloom,
|
||||
@ -21,10 +24,11 @@ CScene::CScene (
|
||||
irr::f64 cameraShakeAmplitude,
|
||||
irr::f64 cameraShakeRoughness,
|
||||
irr::f64 cameraShakeSpeed,
|
||||
irr::video::SColorf clearColor,
|
||||
FloatColor clearColor,
|
||||
Scenes::CProjection* orthogonalProjection,
|
||||
irr::video::SColorf 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");
|
||||
@ -75,6 +79,7 @@ CScene* CScene::fromFile (const irr::io::path& filename)
|
||||
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),
|
||||
*bloom_it,
|
||||
@ -90,7 +95,7 @@ CScene* CScene::fromFile (const irr::io::path& filename)
|
||||
camerashakeamplitude,
|
||||
camerashakeroughness,
|
||||
camerashakespeed,
|
||||
WallpaperEngine::Core::atoSColorf (*clearcolor_it),
|
||||
WallpaperEngine::Core::aToColor (*clearcolor_it),
|
||||
Scenes::CProjection::fromJSON (*orthogonalprojection_it),
|
||||
WallpaperEngine::Core::atoSColorf (*skylightcolor_it)
|
||||
);
|
||||
@ -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,6 +125,11 @@ 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;
|
||||
@ -195,7 +205,7 @@ const irr::f64 CScene::getCameraShakeSpeed () const
|
||||
return this->m_cameraShakeSpeed;
|
||||
}
|
||||
|
||||
const irr::video::SColorf& CScene::getClearColor () const
|
||||
const FloatColor& CScene::getClearColor () const
|
||||
{
|
||||
return this->m_clearColor;
|
||||
}
|
||||
|
@ -9,17 +9,19 @@
|
||||
|
||||
#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;
|
||||
|
||||
@ -37,7 +39,7 @@ namespace WallpaperEngine::Core
|
||||
const irr::f64 getCameraShakeAmplitude() const;
|
||||
const irr::f64 getCameraShakeRoughness() const;
|
||||
const irr::f64 getCameraShakeSpeed() const;
|
||||
const irr::video::SColorf& getClearColor() const;
|
||||
const FloatColor& getClearColor() const;
|
||||
const Scenes::CProjection* getOrthogonalProjection() const;
|
||||
const irr::video::SColorf& getSkylightColor() const;
|
||||
const Scenes::CCamera* getCamera () const;
|
||||
@ -46,6 +48,7 @@ namespace WallpaperEngine::Core
|
||||
friend class CWallpaper;
|
||||
|
||||
CScene (
|
||||
CContainer* container,
|
||||
Scenes::CCamera* camera,
|
||||
irr::video::SColorf ambientColor,
|
||||
bool bloom,
|
||||
@ -61,7 +64,7 @@ namespace WallpaperEngine::Core
|
||||
irr::f64 cameraShakeAmplitude,
|
||||
irr::f64 cameraShakeRoughness,
|
||||
irr::f64 cameraShakeSpeed,
|
||||
irr::video::SColorf clearColor,
|
||||
FloatColor clearColor,
|
||||
Scenes::CProjection* orthogonalProjection,
|
||||
irr::video::SColorf skylightColor
|
||||
);
|
||||
@ -69,7 +72,10 @@ namespace WallpaperEngine::Core
|
||||
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
|
||||
@ -87,7 +93,7 @@ namespace WallpaperEngine::Core
|
||||
irr::f64 m_cameraShakeAmplitude;
|
||||
irr::f64 m_cameraShakeRoughness;
|
||||
irr::f64 m_cameraShakeSpeed;
|
||||
irr::video::SColorf m_clearColor;
|
||||
FloatColor m_clearColor;
|
||||
Scenes::CProjection* m_orthogonalProjection;
|
||||
irr::video::SColorf m_skylightColor;
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "Core.h"
|
||||
|
||||
using namespace WallpaperEngine;
|
||||
using namespace WallpaperEngine::Core::Types;
|
||||
|
||||
irr::core::vector3df Core::ato3vf(const char *str)
|
||||
{
|
||||
@ -55,11 +56,52 @@ irr::video::SColor Core::atoSColor (const char *str)
|
||||
return irr::video::SColor (255, r, g, b);
|
||||
}
|
||||
|
||||
glm::vec3 Core::aToVector3 (const char* 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 {x, y, z};
|
||||
}
|
||||
|
||||
glm::vec2 Core::aToVector2 (const char* str)
|
||||
{
|
||||
float x = strtof (str, const_cast <char**> (&str)); while (*str == ' ') str ++;
|
||||
float y = strtof (str, const_cast <char**> (&str));
|
||||
|
||||
return {x, y};
|
||||
}
|
||||
|
||||
glm::vec3 Core::aToVector3 (const std::string& str)
|
||||
{
|
||||
return Core::aToVector3 (str.c_str ());
|
||||
}
|
||||
|
||||
glm::vec2 Core::aToVector2 (const std::string& str)
|
||||
{
|
||||
return Core::aToVector2 (str.c_str ());
|
||||
}
|
||||
|
||||
irr::video::SColor Core::atoSColor (const std::string& str)
|
||||
{
|
||||
return Core::atoSColor (str.c_str ());
|
||||
}
|
||||
|
||||
FloatColor Core::aToColor (const char* 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 {r, g, b, 1.0f};
|
||||
}
|
||||
|
||||
FloatColor Core::aToColor (const std::string& str)
|
||||
{
|
||||
return aToColor (str.c_str ());
|
||||
}
|
||||
|
||||
nlohmann::json::iterator Core::jsonFindRequired (nlohmann::json& data, const char *key, const char *notFoundMsg)
|
||||
{
|
||||
auto value = data.find (key);
|
||||
|
@ -3,9 +3,16 @@
|
||||
#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"
|
||||
|
||||
namespace WallpaperEngine::Core
|
||||
{
|
||||
using namespace WallpaperEngine::Core::Types;
|
||||
|
||||
irr::core::vector3df ato3vf (const char *str);
|
||||
irr::core::vector2df ato2vf (const char *str);
|
||||
|
||||
@ -18,6 +25,15 @@ namespace WallpaperEngine::Core
|
||||
irr::video::SColor atoSColor (const char *str);
|
||||
irr::video::SColor atoSColor (const std::string& str);
|
||||
|
||||
glm::vec3 aToVector3 (const char* str);
|
||||
glm::vec2 aToVector2 (const char* str);
|
||||
|
||||
glm::vec3 aToVector3 (const std::string& str);
|
||||
glm::vec2 aToVector2 (const std::string& str);
|
||||
|
||||
FloatColor aToColor (const char* str);
|
||||
FloatColor aToColor (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);
|
||||
};
|
||||
|
@ -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 ())
|
||||
@ -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 ())
|
||||
|
@ -7,6 +7,7 @@
|
||||
#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 +17,7 @@ namespace WallpaperEngine::Core
|
||||
namespace WallpaperEngine::Core::Objects
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
using namespace WallpaperEngine::Assets;
|
||||
|
||||
class CEffect
|
||||
{
|
||||
@ -28,7 +30,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 +42,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);
|
||||
|
@ -1,4 +1,6 @@
|
||||
#include "CImage.h"
|
||||
|
||||
#include <utility>
|
||||
#include "WallpaperEngine/Core/Objects/Images/CMaterial.h"
|
||||
|
||||
#include "WallpaperEngine/FileSystem/FileSystem.h"
|
||||
@ -10,41 +12,46 @@ CImage::CImage (
|
||||
bool visible,
|
||||
irr::u32 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,
|
||||
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";
|
@ -7,9 +7,12 @@
|
||||
#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,16 +21,18 @@ namespace WallpaperEngine::Core::Objects
|
||||
public:
|
||||
static CObject* fromJSON (
|
||||
json data,
|
||||
CContainer* container,
|
||||
bool visible,
|
||||
irr::u32 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 (
|
||||
@ -35,16 +40,18 @@ namespace WallpaperEngine::Core::Objects
|
||||
bool visible,
|
||||
irr::u32 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;
|
||||
};
|
||||
};
|
||||
|
@ -6,13 +6,14 @@
|
||||
using namespace WallpaperEngine::Core::Objects;
|
||||
|
||||
CParticle* CParticle::fromFile (
|
||||
const irr::io::path& filename,
|
||||
const std::string& filename,
|
||||
CContainer* container,
|
||||
irr::u32 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");
|
||||
@ -69,9 +70,9 @@ CParticle::CParticle (
|
||||
irr::u32 maxcount,
|
||||
irr::u32 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)
|
||||
{
|
||||
|
@ -19,11 +19,12 @@ namespace WallpaperEngine::Core::Objects
|
||||
|
||||
public:
|
||||
static CParticle* fromFile (
|
||||
const irr::io::path& filename,
|
||||
const std::string& filename,
|
||||
CContainer* container,
|
||||
irr::u32 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;
|
||||
@ -36,8 +37,8 @@ namespace WallpaperEngine::Core::Objects
|
||||
irr::u32 maxcount,
|
||||
irr::u32 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);
|
||||
|
@ -9,9 +9,9 @@ CSound::CSound (
|
||||
bool visible,
|
||||
irr::u32 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)
|
||||
{
|
||||
}
|
||||
@ -21,9 +21,9 @@ WallpaperEngine::Core::CObject* CSound::fromJSON (
|
||||
bool visible,
|
||||
irr::u32 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");
|
||||
|
||||
|
@ -19,9 +19,9 @@ namespace WallpaperEngine::Core::Objects
|
||||
bool visible,
|
||||
irr::u32 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);
|
||||
@ -32,9 +32,9 @@ namespace WallpaperEngine::Core::Objects
|
||||
bool visible,
|
||||
irr::u32 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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -10,12 +10,12 @@ 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,13 +3,13 @@
|
||||
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;
|
||||
}
|
||||
|
@ -10,12 +10,12 @@ 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,13 +3,13 @@
|
||||
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;
|
||||
}
|
||||
|
@ -4,18 +4,19 @@
|
||||
|
||||
#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;
|
||||
};
|
||||
}
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
#include "WallpaperEngine/FileSystem/FileSystem.h"
|
||||
|
||||
using namespace WallpaperEngine::Assets;
|
||||
|
||||
using namespace WallpaperEngine::Core::Objects;
|
||||
using namespace WallpaperEngine::Core::Objects::Images;
|
||||
|
||||
@ -13,16 +15,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
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -6,17 +6,19 @@
|
||||
#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);
|
||||
|
@ -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)
|
||||
);
|
||||
}
|
@ -13,14 +13,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;
|
||||
};
|
||||
};
|
||||
|
@ -8,12 +8,12 @@ CProjection::CProjection (irr::u32 width, irr::u32 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;
|
||||
}
|
||||
|
@ -13,12 +13,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
src/WallpaperEngine/Core/Types/FloatColor.h
Normal file
28
src/WallpaperEngine/Core/Types/FloatColor.h
Normal file
@ -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;
|
||||
};
|
||||
}
|
@ -29,3 +29,22 @@ std::string FileSystem::loadFullFile (const irr::io::path& file)
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
std::string FileSystem::loadFullFile (const std::string& file, WallpaperEngine::Assets::CContainer* containers)
|
||||
{
|
||||
uint32_t length = 0;
|
||||
void* contents = containers->readFile (file, &length);
|
||||
|
||||
// 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;
|
||||
}
|
@ -8,6 +8,8 @@
|
||||
#include <irrlicht/path.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "WallpaperEngine/Assets/CContainer.h"
|
||||
|
||||
namespace WallpaperEngine::FileSystem
|
||||
{
|
||||
/**
|
||||
@ -17,4 +19,12 @@ namespace WallpaperEngine::FileSystem
|
||||
* @return
|
||||
*/
|
||||
std::string loadFullFile (const irr::io::path& file);
|
||||
|
||||
/**
|
||||
* Loads a full file into an std::string
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
std::string loadFullFile (const std::string& file, WallpaperEngine::Assets::CContainer* containers);
|
||||
}
|
||||
|
@ -1,16 +1,20 @@
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
|
||||
#include "CCamera.h"
|
||||
|
||||
using namespace WallpaperEngine;
|
||||
using namespace WallpaperEngine::Render;
|
||||
using namespace WallpaperEngine::Core::Types;
|
||||
|
||||
CCamera::CCamera (CScene* scene, const Core::Scenes::CCamera* camera) :
|
||||
m_camera (camera),
|
||||
m_scene (scene)
|
||||
m_scene (scene),
|
||||
m_isOrthogonal (false)
|
||||
{
|
||||
this->m_sceneCamera = scene->getContext ()->getDevice ()->getSceneManager ()->addCameraSceneNode (
|
||||
scene, this->getEye (), this->getCenter (), scene->nextId ()
|
||||
);
|
||||
this->m_sceneCamera->setUpVector (this->getUp ());
|
||||
// get the lookat position
|
||||
// TODO: ENSURE THIS IS ONLY USED WHEN NOT DOING AN ORTOGRAPHIC CAMERA AS IT THROWS OFF POINTS
|
||||
this->m_lookat = glm::lookAt (this->getEye (), this->getCenter (), this->getUp ());
|
||||
}
|
||||
|
||||
CCamera::~CCamera ()
|
||||
@ -18,32 +22,42 @@ CCamera::~CCamera ()
|
||||
this->m_sceneCamera->remove ();
|
||||
}
|
||||
|
||||
const irr::core::vector3df& CCamera::getCenter () const
|
||||
const glm::vec3& CCamera::getCenter () const
|
||||
{
|
||||
return this->m_camera->getCenter ();
|
||||
}
|
||||
|
||||
const irr::core::vector3df& CCamera::getEye () const
|
||||
const glm::vec3& CCamera::getEye () const
|
||||
{
|
||||
return this->m_camera->getEye ();
|
||||
}
|
||||
|
||||
const irr::core::vector3df& CCamera::getUp () const
|
||||
const glm::vec3& CCamera::getUp () const
|
||||
{
|
||||
return this->m_camera->getUp ();
|
||||
}
|
||||
|
||||
void CCamera::setOrthogonalProjection (irr::f32 width, irr::f32 height)
|
||||
const glm::mat4& CCamera::getProjection () const
|
||||
{
|
||||
irr::core::matrix4 identity; identity.makeIdentity ();
|
||||
irr::core::matrix4 orthogonalProjection; orthogonalProjection.buildProjectionMatrixOrthoLH (
|
||||
width, height,
|
||||
this->getCenter ().Z,
|
||||
this->getEye ().Z
|
||||
);
|
||||
return this->m_projection;
|
||||
}
|
||||
|
||||
this->m_sceneCamera->setProjectionMatrix (orthogonalProjection, true);
|
||||
this->m_scene->getContext ()->getDevice ()->getVideoDriver ()->setTransform (irr::video::ETS_PROJECTION, orthogonalProjection);
|
||||
this->m_scene->getContext ()->getDevice ()->getVideoDriver ()->setTransform (irr::video::ETS_VIEW, identity);
|
||||
this->m_scene->getContext ()->getDevice ()->getVideoDriver ()->setTransform (irr::video::ETS_WORLD, identity);
|
||||
const glm::mat4& CCamera::getLookAt () const
|
||||
{
|
||||
return this->m_lookat;
|
||||
}
|
||||
|
||||
const bool CCamera::isOrthogonal () const
|
||||
{
|
||||
return this->m_isOrthogonal;
|
||||
}
|
||||
|
||||
void CCamera::setOrthogonalProjection (float width, float height)
|
||||
{
|
||||
// TODO: GET THE ZNEAR AND ZFAR FROM THE BACKGROUND (IF AVAILABLE)
|
||||
// get the orthogonal projection (the float is there to ensure the values are casted to float, so maths do work)
|
||||
this->m_projection = glm::ortho <float> (0, width, 0, height, 0, 1000);
|
||||
this->m_projection = glm::translate (this->m_projection, this->getEye ());
|
||||
// update the orthogonal flag
|
||||
this->m_isOrthogonal = true;
|
||||
}
|
@ -1,9 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <glm/vec3.hpp>
|
||||
#include <glm/vec2.hpp>
|
||||
#include <glm/mat4x4.hpp>
|
||||
#include "CScene.h"
|
||||
|
||||
#include "WallpaperEngine/Core/Scenes/CCamera.h"
|
||||
|
||||
using namespace WallpaperEngine::Core::Types;
|
||||
|
||||
namespace WallpaperEngine::Render
|
||||
{
|
||||
class CScene;
|
||||
@ -14,13 +19,19 @@ namespace WallpaperEngine::Render
|
||||
CCamera (CScene* scene, const Core::Scenes::CCamera* camera);
|
||||
~CCamera ();
|
||||
|
||||
void setOrthogonalProjection (irr::f32 width, irr::f32 height);
|
||||
void setOrthogonalProjection (float width, float height);
|
||||
|
||||
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;
|
||||
const glm::mat4& getProjection () const;
|
||||
const glm::mat4& getLookAt () const;
|
||||
const bool isOrthogonal () const;
|
||||
|
||||
private:
|
||||
bool m_isOrthogonal;
|
||||
glm::mat4 m_projection;
|
||||
glm::mat4 m_lookat;
|
||||
const Core::Scenes::CCamera* m_camera;
|
||||
irr::scene::ICameraSceneNode* m_sceneCamera;
|
||||
CScene* m_scene;
|
||||
|
@ -1,21 +1,18 @@
|
||||
#include "CObject.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
using namespace WallpaperEngine;
|
||||
using namespace WallpaperEngine::Render;
|
||||
|
||||
CObject::CObject(CScene* scene, std::string type, Core::CObject *object) :
|
||||
irr::scene::ISceneNode (
|
||||
scene,
|
||||
scene->getContext ()->getDevice ()->getSceneManager (),
|
||||
object->getId ()
|
||||
),
|
||||
m_scene (scene),
|
||||
m_object (object),
|
||||
m_type (type)
|
||||
m_type (std::move (type))
|
||||
{
|
||||
}
|
||||
|
||||
CObject::~CObject()
|
||||
CObject::~CObject ()
|
||||
{
|
||||
}
|
||||
|
||||
@ -24,10 +21,7 @@ CScene* CObject::getScene () const
|
||||
return this->m_scene;
|
||||
}
|
||||
|
||||
void CObject::OnRegisterSceneNode ()
|
||||
CContainer* CObject::getContainer () const
|
||||
{
|
||||
if (this->m_object->isVisible () == true)
|
||||
SceneManager->registerNodeForRendering (this);
|
||||
|
||||
ISceneNode::OnRegisterSceneNode ();
|
||||
return this->getScene ()->getContainer ();
|
||||
}
|
@ -11,7 +11,7 @@ namespace WallpaperEngine::Render
|
||||
{
|
||||
class CScene;
|
||||
|
||||
class CObject : public irr::scene::ISceneNode
|
||||
class CObject
|
||||
{
|
||||
public:
|
||||
template<class T> const T* As () const { assert (Is<T> ()); return (const T*) this; }
|
||||
@ -19,13 +19,14 @@ namespace WallpaperEngine::Render
|
||||
|
||||
template<class T> bool Is () { return this->m_type == T::Type; }
|
||||
|
||||
protected:
|
||||
CObject (CScene* scene, std::string type, Core::CObject *object);
|
||||
~CObject () override;
|
||||
|
||||
void OnRegisterSceneNode () override;
|
||||
virtual void render () = 0;
|
||||
|
||||
CScene* getScene () const;
|
||||
CContainer* getContainer () const;
|
||||
|
||||
protected:
|
||||
CObject (CScene* scene, std::string type, Core::CObject *object);
|
||||
~CObject ();
|
||||
|
||||
private:
|
||||
std::string m_type;
|
||||
|
@ -9,13 +9,14 @@
|
||||
using namespace WallpaperEngine;
|
||||
using namespace WallpaperEngine::Render;
|
||||
|
||||
CScene::CScene (Core::CScene* scene, Irrlicht::CContext* context) :
|
||||
CWallpaper (scene, Type, context)
|
||||
CScene::CScene (Core::CScene* scene, CContainer* container) :
|
||||
CWallpaper (scene, Type, container)
|
||||
{
|
||||
// setup the scene camera
|
||||
this->m_camera = new CCamera (this, scene->getCamera ());
|
||||
this->m_camera->setOrthogonalProjection (
|
||||
scene->getOrthogonalProjection ()->getWidth (),
|
||||
scene->getOrthogonalProjection ()->getHeight ()
|
||||
scene->getOrthogonalProjection ()->getWidth (),
|
||||
scene->getOrthogonalProjection ()->getHeight ()
|
||||
);
|
||||
|
||||
auto cur = scene->getObjects ().begin ();
|
||||
@ -28,18 +29,20 @@ CScene::CScene (Core::CScene* scene, Irrlicht::CContext* context) :
|
||||
if ((*cur)->getId () > highestId)
|
||||
highestId = (*cur)->getId ();
|
||||
|
||||
CObject* object = nullptr;
|
||||
|
||||
if ((*cur)->is<Core::Objects::CImage>() == true)
|
||||
{
|
||||
new Objects::CImage (this, (*cur)->as<Core::Objects::CImage>());
|
||||
object = new Objects::CImage (this, (*cur)->as<Core::Objects::CImage>());
|
||||
}
|
||||
else if ((*cur)->is<Core::Objects::CSound>() == true)
|
||||
{
|
||||
new Objects::CSound (this, (*cur)->as<Core::Objects::CSound>());
|
||||
object = new Objects::CSound (this, (*cur)->as<Core::Objects::CSound>());
|
||||
}
|
||||
}
|
||||
|
||||
this->m_nextId = ++highestId;
|
||||
this->setAutomaticCulling (irr::scene::EAC_OFF);
|
||||
if (object != nullptr)
|
||||
this->m_objects.emplace_back (object);
|
||||
}
|
||||
}
|
||||
|
||||
CCamera* CScene::getCamera () const
|
||||
@ -54,6 +57,11 @@ int CScene::nextId ()
|
||||
|
||||
void CScene::render ()
|
||||
{
|
||||
auto cur = this->m_objects.begin ();
|
||||
auto end = this->m_objects.end ();
|
||||
|
||||
for (; cur != end; cur ++)
|
||||
(*cur)->render ();
|
||||
}
|
||||
|
||||
Core::CScene* CScene::getScene ()
|
||||
|
@ -5,17 +5,19 @@
|
||||
#include "WallpaperEngine/Core/CScene.h"
|
||||
|
||||
#include "WallpaperEngine/Render/CWallpaper.h"
|
||||
#include "WallpaperEngine/Render/CObject.h"
|
||||
|
||||
#include "WallpaperEngine/Irrlicht/CContext.h"
|
||||
|
||||
namespace WallpaperEngine::Render
|
||||
{
|
||||
class CCamera;
|
||||
class CObject;
|
||||
|
||||
class CScene : public CWallpaper
|
||||
{
|
||||
public:
|
||||
CScene (Core::CScene* scene, WallpaperEngine::Irrlicht::CContext* context);
|
||||
CScene (Core::CScene* scene, CContainer* container);
|
||||
|
||||
CCamera* getCamera () const;
|
||||
int nextId ();
|
||||
@ -32,5 +34,6 @@ namespace WallpaperEngine::Render
|
||||
private:
|
||||
CCamera* m_camera;
|
||||
irr::u32 m_nextId;
|
||||
std::vector<CObject*> m_objects;
|
||||
};
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ using namespace WallpaperEngine;
|
||||
|
||||
using namespace WallpaperEngine::Render;
|
||||
|
||||
CVideo::CVideo (Core::CVideo* video, WallpaperEngine::Irrlicht::CContext* context) :
|
||||
CWallpaper (video, Type, context)
|
||||
CVideo::CVideo (Core::CVideo* video, CContainer* container) :
|
||||
CWallpaper (video, Type, container)
|
||||
{
|
||||
if (avformat_open_input (&m_formatCtx, video->getFilename ().c_str (), NULL, NULL) < 0)
|
||||
throw std::runtime_error ("Failed to open video file");
|
||||
@ -76,6 +76,8 @@ void CVideo::setSize (int width, int height)
|
||||
|
||||
void CVideo::render ()
|
||||
{
|
||||
// TODO: REWRITE
|
||||
/*
|
||||
irr::video::IVideoDriver* driver = m_context->getDevice ()->getVideoDriver ();
|
||||
int width = driver->getScreenSize ().Width;
|
||||
int height = driver->getScreenSize ().Height;
|
||||
@ -91,7 +93,7 @@ void CVideo::render ()
|
||||
m_frameTexture = driver->addTexture ("frameTexture", m_frameImage);
|
||||
m_frameImage->drop ();
|
||||
|
||||
driver->draw2DImage (m_frameTexture, irr::core::vector2di(0));
|
||||
driver->draw2DImage (m_frameTexture, irr::core::vector2di(0));*/
|
||||
}
|
||||
|
||||
void CVideo::getNextFrame ()
|
||||
|
@ -21,7 +21,7 @@ namespace WallpaperEngine::Render
|
||||
class CVideo : public CWallpaper
|
||||
{
|
||||
public:
|
||||
CVideo (Core::CVideo* video, WallpaperEngine::Irrlicht::CContext* context);
|
||||
CVideo (Core::CVideo* video, CContainer* container);
|
||||
|
||||
void render () override;
|
||||
|
||||
|
@ -1,40 +1,101 @@
|
||||
#include "CWallpaper.h"
|
||||
|
||||
#include <utility>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
using namespace WallpaperEngine::Render;
|
||||
|
||||
CWallpaper::CWallpaper (Core::CWallpaper* wallpaperData, std::string type, WallpaperEngine::Irrlicht::CContext* context) :
|
||||
irr::scene::ISceneNode (
|
||||
context->getDevice ()->getSceneManager ()->getRootSceneNode (),
|
||||
context->getDevice ()->getSceneManager ()
|
||||
),
|
||||
m_context (context),
|
||||
CWallpaper::CWallpaper (Core::CWallpaper* wallpaperData, std::string type, CContainer* container) :
|
||||
m_container (container),
|
||||
m_wallpaperData (wallpaperData),
|
||||
m_type (type)
|
||||
m_type (std::move(type))
|
||||
{
|
||||
this->setupFramebuffers ();
|
||||
}
|
||||
|
||||
CWallpaper::~CWallpaper ()
|
||||
{
|
||||
}
|
||||
|
||||
void CWallpaper::OnRegisterSceneNode ()
|
||||
CContainer* CWallpaper::getContainer () const
|
||||
{
|
||||
SceneManager->registerNodeForRendering (this);
|
||||
|
||||
ISceneNode::OnRegisterSceneNode ();
|
||||
}
|
||||
|
||||
WallpaperEngine::Irrlicht::CContext* CWallpaper::getContext () const
|
||||
{
|
||||
return this->m_context;
|
||||
}
|
||||
|
||||
const irr::core::aabbox3d<irr::f32>& CWallpaper::getBoundingBox () const
|
||||
{
|
||||
return this->m_boundingBox;
|
||||
return this->m_container;
|
||||
}
|
||||
|
||||
WallpaperEngine::Core::CWallpaper* CWallpaper::getWallpaperData ()
|
||||
{
|
||||
return this->m_wallpaperData;
|
||||
}
|
||||
|
||||
void CWallpaper::pinpongFramebuffer (GLuint* drawTo, GLuint* inputTexture)
|
||||
{
|
||||
// get current main framebuffer and texture so we can swap them
|
||||
GLuint currentMainFramebuffer = this->m_mainFramebuffer;
|
||||
GLuint currentMainTexture = this->m_mainTexture;
|
||||
GLuint currentSubFramebuffer = this->m_subFramebuffer;
|
||||
GLuint currentSubTexture = this->m_subTexture;
|
||||
|
||||
if (drawTo != nullptr)
|
||||
*drawTo = currentSubFramebuffer;
|
||||
if (inputTexture != nullptr)
|
||||
*inputTexture = currentMainTexture;
|
||||
|
||||
// swap the textures
|
||||
this->m_mainFramebuffer = currentSubFramebuffer;
|
||||
this->m_mainTexture = currentSubTexture;
|
||||
this->m_subFramebuffer = currentMainFramebuffer;
|
||||
this->m_subTexture = currentMainTexture;
|
||||
}
|
||||
|
||||
void CWallpaper::setupFramebuffers ()
|
||||
{
|
||||
// TODO: ENSURE THE WINDOW WIDTH AND HEIGHT IS CORRECT AND UPDATE THEM WHEN THE SCREEN CHANGES
|
||||
GLenum drawBuffers [1] = {GL_COLOR_ATTACHMENT0};
|
||||
// create the main framebuffer
|
||||
glGenFramebuffers (1, &this->m_mainFramebuffer);
|
||||
glBindFramebuffer (GL_FRAMEBUFFER, this->m_mainFramebuffer);
|
||||
// create the main texture
|
||||
glGenTextures (1, &this->m_mainTexture);
|
||||
// bind the new texture to set settings on it
|
||||
glBindTexture (GL_TEXTURE_2D, this->m_mainTexture);
|
||||
// give OpenGL an empty image
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 1920, 1080, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
||||
|
||||
// create the depth render buffer for the main framebuffer
|
||||
glGenRenderbuffers (1, &this->m_mainDepthBuffer);
|
||||
glBindRenderbuffer (GL_RENDERBUFFER, this->m_mainDepthBuffer);
|
||||
glRenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT, 1920, 1080);
|
||||
glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, this->m_mainDepthBuffer);
|
||||
// set the texture as the colour attachmend #0
|
||||
glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, this->m_mainTexture, 0);
|
||||
// finally set the list of draw buffers
|
||||
glDrawBuffers (1, drawBuffers);
|
||||
|
||||
// ensure first framebuffer is okay
|
||||
if (glCheckFramebufferStatus (GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
|
||||
throw std::runtime_error ("Framebuffers are not properly set");
|
||||
|
||||
// create the sub framebuffer
|
||||
glGenFramebuffers (1, &this->m_subFramebuffer);
|
||||
glBindFramebuffer (GL_FRAMEBUFFER, this->m_subFramebuffer);
|
||||
// create the sub texture
|
||||
glGenTextures (1, &this->m_subTexture);
|
||||
// bind the new texture to set settings on it
|
||||
glBindTexture (GL_TEXTURE_2D, this->m_subTexture);
|
||||
// give OpenGL an empty image
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 1920, 1080, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
||||
|
||||
// create the depth render buffer for the main framebuffer
|
||||
glGenRenderbuffers (1, &this->m_subDepthBuffer);
|
||||
glBindRenderbuffer (GL_RENDERBUFFER, this->m_subDepthBuffer);
|
||||
glRenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT, 1920, 1080);
|
||||
glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, this->m_subDepthBuffer);
|
||||
// set the texture as the colour attachmend #0
|
||||
glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, this->m_subTexture, 0);
|
||||
// finally set the list of draw buffers
|
||||
glDrawBuffers (1, drawBuffers);
|
||||
|
||||
// ensure second framebuffer is okay
|
||||
if (glCheckFramebufferStatus (GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
|
||||
throw std::runtime_error ("Framebuffers are not properly set");
|
||||
}
|
@ -1,12 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include "WallpaperEngine/Core/CWallpaper.h"
|
||||
#include "WallpaperEngine/Core/CScene.h"
|
||||
#include "WallpaperEngine/Core/CVideo.h"
|
||||
|
||||
#include "WallpaperEngine/Irrlicht/CContext.h"
|
||||
#include "WallpaperEngine/Assets/CContainer.h"
|
||||
|
||||
using namespace WallpaperEngine::Assets;
|
||||
|
||||
namespace WallpaperEngine::Irrlicht
|
||||
{
|
||||
@ -15,7 +20,7 @@ namespace WallpaperEngine::Irrlicht
|
||||
|
||||
namespace WallpaperEngine::Render
|
||||
{
|
||||
class CWallpaper : public irr::scene::ISceneNode
|
||||
class CWallpaper
|
||||
{
|
||||
public:
|
||||
template<class T> const T* as () const { assert (is<T> ()); return (const T*) this; }
|
||||
@ -23,23 +28,69 @@ namespace WallpaperEngine::Render
|
||||
|
||||
template<class T> bool is () { return this->m_type == T::Type; }
|
||||
|
||||
CWallpaper (Core::CWallpaper* wallpaperData, std::string type, WallpaperEngine::Irrlicht::CContext* context);
|
||||
~CWallpaper () override;
|
||||
CWallpaper (Core::CWallpaper* wallpaperData, std::string type, CContainer* container);
|
||||
~CWallpaper ();
|
||||
|
||||
void OnRegisterSceneNode () override;
|
||||
/**
|
||||
* Performs a render pass of the wallpaper
|
||||
*/
|
||||
virtual void render () = 0;
|
||||
|
||||
WallpaperEngine::Irrlicht::CContext* getContext () const;
|
||||
const irr::core::aabbox3d<irr::f32>& getBoundingBox () const override;
|
||||
/**
|
||||
* @return The container to resolve files for this wallpaper
|
||||
*/
|
||||
CContainer* getContainer () const;
|
||||
|
||||
/**
|
||||
* Performs a ping-pong on the available framebuffers to be able to continue rendering things to them
|
||||
*
|
||||
* @param drawTo The framebuffer to use
|
||||
* @param asInput The last texture used as output (if needed)
|
||||
*/
|
||||
void pinpongFramebuffer (GLuint* drawTo, GLuint* inputTexture);
|
||||
|
||||
protected:
|
||||
WallpaperEngine::Irrlicht::CContext* m_context;
|
||||
CContainer* m_container;
|
||||
Core::CWallpaper* m_wallpaperData;
|
||||
|
||||
Core::CWallpaper* getWallpaperData ();
|
||||
|
||||
private:
|
||||
irr::core::aabbox3d<irr::f32> m_boundingBox = irr::core::aabbox3d<irr::f32> (0, 0, 0, 0, 0, 0);
|
||||
/**
|
||||
* The main framebuffer
|
||||
*/
|
||||
GLuint m_mainFramebuffer;
|
||||
/**
|
||||
* The sub framebuffer
|
||||
*/
|
||||
GLuint m_subFramebuffer;
|
||||
|
||||
/**
|
||||
* The main depth render buffer
|
||||
*/
|
||||
GLuint m_mainDepthBuffer;
|
||||
/**
|
||||
* The sub depth render buffer
|
||||
*/
|
||||
GLuint m_subDepthBuffer;
|
||||
|
||||
/**
|
||||
* The main texture used on the framebuffer
|
||||
*/
|
||||
GLuint m_mainTexture;
|
||||
/**
|
||||
* The sub texture used on the framebuffer
|
||||
*/
|
||||
GLuint m_subTexture;
|
||||
|
||||
/**
|
||||
* Setups OpenGL's framebuffers for ping-pong
|
||||
*/
|
||||
void setupFramebuffers ();
|
||||
|
||||
private:
|
||||
/**
|
||||
* The type of background this wallpaper is (used
|
||||
*/
|
||||
std::string m_type;
|
||||
};
|
||||
}
|
||||
|
@ -2,12 +2,12 @@
|
||||
|
||||
using namespace WallpaperEngine::Render::Objects;
|
||||
|
||||
CEffect::CEffect (CImage* image, Core::Objects::CEffect* effect, Irrlicht::CContext* context, irr::video::ITexture* input) :
|
||||
m_context (context),
|
||||
CEffect::CEffect (CImage* image, Core::Objects::CEffect* effect) :
|
||||
m_image (image),
|
||||
m_effect (effect),
|
||||
m_inputTexture (input)
|
||||
m_effect (effect)
|
||||
{
|
||||
// TODO: REWRITE THIS
|
||||
/*
|
||||
irr::core::dimension2du size = irr::core::dimension2du (
|
||||
this->m_image->getImage ()->getSize ().X,
|
||||
this->m_image->getImage ()->getSize ().Y
|
||||
@ -22,20 +22,9 @@ CEffect::CEffect (CImage* image, Core::Objects::CEffect* effect, Irrlicht::CCont
|
||||
"_effect_output"
|
||||
).c_str ()
|
||||
);
|
||||
|
||||
*/
|
||||
this->generateFBOs ();
|
||||
this->generatePasses ();
|
||||
this->generateOutputMaterial ();
|
||||
}
|
||||
|
||||
irr::video::ITexture* CEffect::getInputTexture () const
|
||||
{
|
||||
return this->m_inputTexture;
|
||||
}
|
||||
|
||||
irr::video::ITexture *const CEffect::getOutputTexture () const
|
||||
{
|
||||
return this->m_outputTexture;
|
||||
}
|
||||
|
||||
const CImage* CEffect::getImage () const
|
||||
@ -68,19 +57,9 @@ void CEffect::generatePasses ()
|
||||
{
|
||||
auto cur = this->m_effect->getMaterials ().begin ();
|
||||
auto end = this->m_effect->getMaterials ().end ();
|
||||
irr::video::ITexture* inputTexture = this->getInputTexture ();
|
||||
|
||||
for (; cur != end; cur ++)
|
||||
{
|
||||
Effects::CMaterial* material = new Effects::CMaterial (this->m_context, this->m_image, *cur, inputTexture);
|
||||
|
||||
// next input texture will be the output texture of the material
|
||||
inputTexture = material->getOutputTexture ();
|
||||
|
||||
this->m_materials.push_back (material);
|
||||
}
|
||||
|
||||
this->m_outputMaterial.setTexture (0, inputTexture);
|
||||
this->m_materials.emplace_back (new Effects::CMaterial (this->getImage (), *cur));
|
||||
}
|
||||
|
||||
void CEffect::generateFBOs ()
|
||||
@ -91,44 +70,23 @@ void CEffect::generateFBOs ()
|
||||
for (; cur != end; cur ++)
|
||||
{
|
||||
this->m_fbos.push_back (
|
||||
new Effects::CFBO (*cur, this->m_image->getImage (), this->m_context)
|
||||
new Effects::CFBO (*cur, this->m_image->getImage ())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void CEffect::generateOutputMaterial ()
|
||||
void CEffect::render (GLuint drawTo, GLuint inputTexture)
|
||||
{
|
||||
this->m_outputMaterial.MaterialType = irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
this->m_outputMaterial.setFlag (irr::video::EMF_LIGHTING, false);
|
||||
this->m_outputMaterial.setFlag (irr::video::EMF_BLEND_OPERATION, true);
|
||||
this->m_outputMaterial.Wireframe = false;
|
||||
this->m_outputMaterial.Lighting = false;
|
||||
}
|
||||
auto begin = this->getMaterials ().begin ();
|
||||
auto cur = this->getMaterials ().begin ();
|
||||
auto end = this->getMaterials ().end ();
|
||||
|
||||
void CEffect::render ()
|
||||
{
|
||||
uint16_t indices [] =
|
||||
for (; cur != end; cur ++)
|
||||
{
|
||||
3, 2, 1, 0
|
||||
};
|
||||
// pingpong buffer only if not the first pass (as it would be taken care by the CImage)
|
||||
if (cur != begin)
|
||||
this->getImage ()->getScene ()->pinpongFramebuffer (&drawTo, &inputTexture);
|
||||
|
||||
irr::video::IVideoDriver* driver = this->getImage ()->getSceneManager ()->getVideoDriver ();
|
||||
|
||||
auto mainCur = this->getMaterials ().begin ();
|
||||
auto mainEnd = this->getMaterials ().end ();
|
||||
|
||||
for (; mainCur != mainEnd; mainCur ++)
|
||||
{
|
||||
(*mainCur)->render ();
|
||||
(*cur)->render (drawTo, inputTexture);
|
||||
}
|
||||
|
||||
// set the proper render target
|
||||
driver->setRenderTarget (this->getOutputTexture (), true, true, irr::video::SColor (0, 0, 0, 0));
|
||||
// set the material
|
||||
driver->setMaterial (this->m_outputMaterial);
|
||||
// draw it
|
||||
driver->drawVertexPrimitiveList (
|
||||
this->m_image->getVertex (), 4, indices, 1,
|
||||
irr::video::EVT_STANDARD, irr::scene::EPT_QUADS, irr::video::EIT_16BIT
|
||||
);
|
||||
}
|
@ -21,31 +21,23 @@ namespace WallpaperEngine::Render::Objects
|
||||
class CEffect
|
||||
{
|
||||
public:
|
||||
CEffect (CImage* image, Core::Objects::CEffect* effect, Irrlicht::CContext* context, irr::video::ITexture* input);
|
||||
CEffect (CImage* image, Core::Objects::CEffect* effect);
|
||||
|
||||
irr::video::ITexture *const getOutputTexture () const;
|
||||
irr::video::ITexture* getInputTexture () const;
|
||||
const CImage* getImage () const;
|
||||
|
||||
const std::vector<Effects::CMaterial*>& getMaterials () const;
|
||||
|
||||
Effects::CFBO* findFBO (const std::string& name);
|
||||
|
||||
void render ();
|
||||
void render (GLuint drawTo, GLuint inputTexture);
|
||||
private:
|
||||
void generatePasses ();
|
||||
void generateFBOs ();
|
||||
void generateOutputMaterial ();
|
||||
|
||||
Irrlicht::CContext* m_context;
|
||||
CImage* m_image;
|
||||
Core::Objects::CEffect* m_effect;
|
||||
|
||||
std::vector<Effects::CFBO*> m_fbos;
|
||||
std::vector<Effects::CMaterial*> m_materials;
|
||||
|
||||
irr::video::ITexture* m_inputTexture;
|
||||
irr::video::ITexture* m_outputTexture;
|
||||
irr::video::SMaterial m_outputMaterial;
|
||||
};
|
||||
};
|
||||
|
@ -7,141 +7,151 @@ CImage::CImage (CScene* scene, Core::Objects::CImage* image) :
|
||||
Render::CObject (scene, Type, image),
|
||||
m_image (image)
|
||||
{
|
||||
// TODO: INITIALIZE NEEDED EFFECTS AND PROPERLY CALCULATE THESE?
|
||||
irr::f32 xsize = this->m_image->getSize ().X;
|
||||
irr::f32 ysize = this->m_image->getSize ().Y;
|
||||
irr::f32 xscale = this->m_image->getScale ().X;
|
||||
irr::f32 yscale = this->m_image->getScale ().Y;
|
||||
auto projection = this->getScene ()->getScene ()->getOrthogonalProjection ();
|
||||
|
||||
if (xsize == 0.0f || ysize == 0.0f)
|
||||
// get scene width and height to calculate positions
|
||||
auto scene_width = static_cast <float> (projection->getWidth ());
|
||||
auto scene_height = static_cast <float> (projection->getHeight ());
|
||||
|
||||
float xleft = 0.0f;
|
||||
float ytop = 0.0f;
|
||||
float xright = 0.0f;
|
||||
float ybottom = 0.0f;
|
||||
|
||||
// TODO: TAKE INTO ACCOUNT SCALE
|
||||
// depending on the alignment these values might change, for now just support center
|
||||
if (this->getImage ()->getAlignment () == "center")
|
||||
{
|
||||
xsize = 1920.0f;
|
||||
ysize = 1080.0f;
|
||||
|
||||
this->getScene ()->getContext ()->getDevice ()->getLogger ()->log (
|
||||
"Initializing xsise and ysize as default values 1920 and 1080",
|
||||
this->getImage ()->getName ().c_str ()
|
||||
);
|
||||
}
|
||||
|
||||
irr::core::vector3df cameraCenter = this->getScene ()->getCamera ()->getCenter ();
|
||||
|
||||
// take the orthogonal projection into account
|
||||
irr::f32 scene_width = this->getScene ()->getScene ()->getOrthogonalProjection ()->getWidth ();
|
||||
irr::f32 scene_height = this->getScene ()->getScene ()->getOrthogonalProjection ()->getHeight ();
|
||||
|
||||
irr::f32 xright = (-scene_width / 2.0f + this->m_image->getOrigin ().X + xsize * xscale / 2.0f) + cameraCenter.X;
|
||||
irr::f32 xleft = (-scene_width / 2.0f + this->m_image->getOrigin ().X - xsize * xscale / 2.0f) + cameraCenter.X;
|
||||
irr::f32 ytop = (-scene_height / 2.0f + this->m_image->getOrigin ().Y + ysize * yscale / 2.0f) + cameraCenter.Y;
|
||||
irr::f32 ybottom = (-scene_height / 2.0f + this->m_image->getOrigin ().Y - ysize * yscale / 2.0f) + cameraCenter.Y;
|
||||
irr::f32 z = this->m_image->getOrigin ().Z;
|
||||
|
||||
// top left
|
||||
this->m_vertex [0].Pos = irr::core::vector3df (xleft, ytop, z);
|
||||
// top right
|
||||
this->m_vertex [1].Pos = irr::core::vector3df (xright, ytop, z);
|
||||
// bottom right
|
||||
this->m_vertex [2].Pos = irr::core::vector3df (xright, ybottom, z);
|
||||
// bottom left
|
||||
this->m_vertex [3].Pos = irr::core::vector3df (xleft, ybottom, z);
|
||||
|
||||
this->m_vertex [0].TCoords = irr::core::vector2df (1.0f, 0.0f);
|
||||
this->m_vertex [1].TCoords = irr::core::vector2df (0.0f, 0.0f);
|
||||
this->m_vertex [2].TCoords = irr::core::vector2df (0.0f, 1.0f);
|
||||
this->m_vertex [3].TCoords = irr::core::vector2df (1.0f, 1.0f);
|
||||
|
||||
this->m_vertex [0].Color = irr::video::SColor (255, 255, 255, 255);
|
||||
this->m_vertex [1].Color = irr::video::SColor (255, 255, 255, 255);
|
||||
this->m_vertex [2].Color = irr::video::SColor (255, 255, 255, 255);
|
||||
this->m_vertex [3].Color = irr::video::SColor (255, 255, 255, 255);
|
||||
|
||||
this->setAutomaticCulling (irr::scene::EAC_OFF);
|
||||
this->m_boundingBox = irr::core::aabbox3d<irr::f32>(0, 0, 0, 0, 0, 0);
|
||||
|
||||
// load the texture in the main material
|
||||
irr::io::path texturepath = this->getScene ()->getContext ()->resolveMaterials (
|
||||
(*(*this->m_image->getMaterial ()->getPasses ().begin ())->getTextures ().begin ())
|
||||
);
|
||||
irr::video::ITexture *texture = this->getScene ()->getContext ()->getDevice ()->getVideoDriver ()->getTexture (texturepath);
|
||||
|
||||
this->m_material = new Render::Objects::Effects::CMaterial (this->getScene ()->getContext (), this, this->m_image->getMaterial (), texture);
|
||||
|
||||
auto effectsCur = this->m_image->getEffects ().begin ();
|
||||
auto effectsEnd = this->m_image->getEffects ().end ();
|
||||
|
||||
texture = this->m_material->getOutputTexture ();
|
||||
|
||||
for (; effectsCur != effectsEnd; effectsCur ++)
|
||||
{
|
||||
CEffect* effect = new CEffect (this, *effectsCur, this->getScene ()->getContext (), texture);
|
||||
|
||||
this->m_effects.push_back (effect);
|
||||
|
||||
texture = effect->getOutputTexture ();
|
||||
}
|
||||
|
||||
this->generateMaterial (texture);
|
||||
}
|
||||
|
||||
void CImage::render()
|
||||
{
|
||||
uint16_t indices [] =
|
||||
{
|
||||
3, 2, 1, 0
|
||||
};
|
||||
|
||||
irr::video::IVideoDriver* driver = SceneManager->getVideoDriver ();
|
||||
|
||||
// first render the base material
|
||||
this->m_material->render ();
|
||||
|
||||
// now render all the effects, they should already be linked to each other
|
||||
auto effectCur = this->m_effects.begin ();
|
||||
auto effectEnd = this->m_effects.end ();
|
||||
size_t passes = 0;
|
||||
|
||||
for (; effectCur != effectEnd; effectCur ++)
|
||||
{
|
||||
auto matCur = (*effectCur)->getMaterials ().begin ();
|
||||
auto matEnd = (*effectCur)->getMaterials ().end ();
|
||||
|
||||
for (; matCur != matEnd; matCur ++)
|
||||
passes += (*matCur)->getPasses ().size ();
|
||||
|
||||
(*effectCur)->render ();
|
||||
}
|
||||
|
||||
passes ++;
|
||||
|
||||
// depending on the number of passes we might need to flip the texture
|
||||
if (passes % 2 == 0)
|
||||
{
|
||||
// set render target to the screen
|
||||
driver->setRenderTarget (irr::video::ERT_FRAME_BUFFER, false, false);
|
||||
// set the material to use
|
||||
driver->setMaterial (this->m_irrlichtMaterialInvert);
|
||||
// draw it
|
||||
driver->drawVertexPrimitiveList (
|
||||
this->m_vertex, 4, indices, 1,
|
||||
irr::video::EVT_STANDARD, irr::scene::EPT_QUADS, irr::video::EIT_16BIT
|
||||
);
|
||||
// calculate the real position of the image
|
||||
xleft = this->getImage ()->getOrigin ().x - (this->getImage ()->getSize ().x / 2);
|
||||
xright = this->getImage ()->getOrigin ().x + (this->getImage ()->getSize ().x / 2);
|
||||
ytop = this->getImage ()->getOrigin ().y - (this->getImage ()->getSize ().y / 2);
|
||||
ybottom = this->getImage ()->getOrigin ().y + (this->getImage ()->getSize ().y / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
// set render target to the screen
|
||||
driver->setRenderTarget (irr::video::ERT_FRAME_BUFFER, false, false);
|
||||
// set the material to use
|
||||
driver->setMaterial (this->m_irrlichtMaterial);
|
||||
// draw it
|
||||
driver->drawVertexPrimitiveList (
|
||||
this->m_vertex, 4, indices, 1,
|
||||
irr::video::EVT_STANDARD, irr::scene::EPT_QUADS, irr::video::EIT_16BIT
|
||||
);
|
||||
throw std::runtime_error ("Only centered images are supported for now!");
|
||||
}
|
||||
|
||||
// build a list of vertices, these might need some change later (or maybe invert the camera)
|
||||
GLfloat data [] = {
|
||||
xleft, ytop, 0.0f,
|
||||
xright, ytop, 0.0f,
|
||||
xleft, ybottom, 0.0f,
|
||||
xleft, ybottom, 0.0f,
|
||||
xright, ytop, 0.0f,
|
||||
xright, ybottom, 0.0f
|
||||
};
|
||||
|
||||
memcpy (this->m_vertexList, data, sizeof (data));
|
||||
|
||||
GLfloat data1 [] = {
|
||||
0.0f, 0.0f, 0.0f,
|
||||
scene_width, 0.0f, 0.0f,
|
||||
0.0f, scene_height, 0.0f,
|
||||
0.0f, scene_height, 0.0f,
|
||||
scene_width, 0.0f, 0.0f,
|
||||
scene_width, scene_height, 0.0f
|
||||
};
|
||||
|
||||
memcpy (this->m_passesVertexList, data1, sizeof (data1));
|
||||
|
||||
// generate correct width and height for the texCoord data
|
||||
GLfloat data2 [] = {
|
||||
0.0f, 0.0f,
|
||||
1.0f, 0.0f,
|
||||
0.0f, 1.0f,
|
||||
0.0f, 1.0f,
|
||||
1.0f, 0.0f,
|
||||
1.0f, 1.0f
|
||||
};
|
||||
|
||||
memcpy (this->m_texCoordList, data2, sizeof (data2));
|
||||
|
||||
// bind vertex list to the openGL buffers
|
||||
glGenBuffers (1, &this->m_vertexBuffer);
|
||||
glBindBuffer (GL_ARRAY_BUFFER, this->m_vertexBuffer);
|
||||
glBufferData (GL_ARRAY_BUFFER, sizeof (this->m_vertexList), this->m_vertexList, GL_STATIC_DRAW);
|
||||
|
||||
// bind pass' vertex list to the openGL buffers
|
||||
glGenBuffers (1, &this->m_passesVertexBuffer);
|
||||
glBindBuffer (GL_ARRAY_BUFFER, this->m_passesVertexBuffer);
|
||||
glBufferData (GL_ARRAY_BUFFER, sizeof (this->m_passesVertexList), this->m_passesVertexList, GL_STATIC_DRAW);
|
||||
|
||||
glGenBuffers (1, &this->m_texCoordBuffer);
|
||||
glBindBuffer (GL_ARRAY_BUFFER, this->m_texCoordBuffer);
|
||||
glBufferData (GL_ARRAY_BUFFER, sizeof (this->m_texCoordList), this->m_texCoordList, GL_STATIC_DRAW);
|
||||
|
||||
uint32_t textureSize = 0;
|
||||
|
||||
// get the first texture on the first pass (this one represents the image assigned to this object)
|
||||
void* textureData = this->getScene ()->getContainer ()->readTexture (
|
||||
(*(*this->m_image->getMaterial ()->getPasses ().begin ())->getTextures ().begin ()), &textureSize
|
||||
);
|
||||
// now generate our opengl texture
|
||||
this->m_texture = new CTexture (textureData);
|
||||
|
||||
// generate the main material used to render the image
|
||||
this->m_material = new Effects::CMaterial (this, this->m_image->getMaterial ());
|
||||
|
||||
// generate the effects used by this material
|
||||
auto cur = this->getImage ()->getEffects ().begin ();
|
||||
auto end = this->getImage ()->getEffects ().end ();
|
||||
|
||||
for (; cur != end; cur ++)
|
||||
this->m_effects.emplace_back (new CEffect (this, *cur));
|
||||
}
|
||||
|
||||
void CImage::render ()
|
||||
{
|
||||
GLuint drawTo = 0;
|
||||
GLuint inputTexture = this->m_texture->getTextureID ();
|
||||
// get the orthogonal projection
|
||||
auto projection = this->getScene ()->getScene ()->getOrthogonalProjection ();
|
||||
|
||||
std::cout << "Rendering " << this->getImage ()->getName () << "\n";
|
||||
|
||||
// pinpong current buffer
|
||||
this->getScene ()->pinpongFramebuffer (&drawTo, nullptr);
|
||||
// render all the other materials
|
||||
auto cur = this->getEffects ().begin ();
|
||||
auto end = this->getEffects ().end ();
|
||||
auto begin = this->getEffects ().begin ();
|
||||
|
||||
for (; cur != end; cur ++)
|
||||
{
|
||||
if (cur != begin)
|
||||
// pinpong current buffer
|
||||
this->getScene ()->pinpongFramebuffer (&drawTo, &inputTexture);
|
||||
|
||||
// render now
|
||||
(*cur)->render (drawTo, inputTexture);
|
||||
}
|
||||
|
||||
if (this->getEffects ().size () > 0)
|
||||
this->getScene ()->pinpongFramebuffer (nullptr, &inputTexture);
|
||||
|
||||
// render the main material
|
||||
this->m_material->render (0, inputTexture);
|
||||
/*
|
||||
glBindFramebuffer (GL_FRAMEBUFFER, 0);
|
||||
// set the viewport, for now use the scene width/height but we might want to use image's size TODO: INVESTIGATE THAT
|
||||
glViewport (0, 0, projection->getWidth (), projection->getHeight ());
|
||||
// bind the texture to the first slot
|
||||
glActiveTexture (GL_TEXTURE0);
|
||||
glBindTexture (GL_TEXTURE_2D, inputTexture);
|
||||
// now render the last pass (to screen)
|
||||
glBindBuffer (GL_ARRAY_BUFFER, *this->m_material->getImage ()->getVertexBuffer ());
|
||||
glDrawArrays (GL_TRIANGLES, 0, 6);*/
|
||||
|
||||
// flush stdout
|
||||
std::cout << std::flush;
|
||||
}
|
||||
|
||||
void CImage::generateMaterial (irr::video::ITexture* resultTexture)
|
||||
{
|
||||
// TODO: REWRITE THIS
|
||||
/*
|
||||
this->m_irrlichtMaterial.setTexture (0, resultTexture);
|
||||
this->m_irrlichtMaterial.MaterialType = irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
this->m_irrlichtMaterial.setFlag (irr::video::EMF_LIGHTING, false);
|
||||
@ -200,9 +210,9 @@ void CImage::generateMaterial (irr::video::ITexture* resultTexture)
|
||||
vertex.c_str (), "main", irr::video::EVST_VS_2_0,
|
||||
fragment.c_str (), "main", irr::video::EPST_PS_2_0,
|
||||
this, irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL, 0, irr::video::EGSL_DEFAULT
|
||||
);
|
||||
);*/
|
||||
}
|
||||
|
||||
/*
|
||||
void CImage::OnSetConstants (irr::video::IMaterialRendererServices *services, int32_t userData)
|
||||
{
|
||||
irr::s32 g_Texture0 = 0;
|
||||
@ -218,12 +228,7 @@ void CImage::OnSetConstants (irr::video::IMaterialRendererServices *services, in
|
||||
services->setPixelShaderConstant ("TextureSampler", &g_Texture0, 1);
|
||||
services->setVertexShaderConstant ("g_ModelViewProjectionMatrix", worldViewProj.pointer(), 16);
|
||||
}
|
||||
|
||||
const irr::core::aabbox3d<irr::f32>& CImage::getBoundingBox() const
|
||||
{
|
||||
return this->m_boundingBox;
|
||||
}
|
||||
|
||||
*/
|
||||
const Core::Objects::CImage* CImage::getImage () const
|
||||
{
|
||||
return this->m_image;
|
||||
@ -234,9 +239,24 @@ const std::vector<CEffect*>& CImage::getEffects () const
|
||||
return this->m_effects;
|
||||
}
|
||||
|
||||
const irr::video::S3DVertex* CImage::getVertex () const
|
||||
const GLfloat* CImage::getVertex () const
|
||||
{
|
||||
return this->m_vertex;
|
||||
return this->m_vertexList;
|
||||
}
|
||||
|
||||
const GLuint* CImage::getVertexBuffer () const
|
||||
{
|
||||
return &this->m_vertexBuffer;
|
||||
}
|
||||
|
||||
const GLuint* CImage::getPassVertexBuffer () const
|
||||
{
|
||||
return &this->m_passesVertexBuffer;
|
||||
}
|
||||
|
||||
const GLuint* CImage::getTexCoordBuffer () const
|
||||
{
|
||||
return &this->m_texCoordBuffer;
|
||||
}
|
||||
|
||||
const std::string CImage::Type = "image";
|
@ -9,7 +9,12 @@
|
||||
|
||||
#include "WallpaperEngine/Render/Shaders/Compiler.h"
|
||||
|
||||
#include "WallpaperEngine/Assets/CTexture.h"
|
||||
|
||||
#include <glm/vec3.hpp>
|
||||
|
||||
using namespace WallpaperEngine;
|
||||
using namespace WallpaperEngine::Assets;
|
||||
|
||||
namespace WallpaperEngine::Render::Objects::Effects
|
||||
{
|
||||
@ -20,20 +25,20 @@ namespace WallpaperEngine::Render::Objects
|
||||
{
|
||||
class CEffect;
|
||||
|
||||
class CImage : public CObject, public irr::video::IShaderConstantSetCallBack
|
||||
class CImage : public CObject
|
||||
{
|
||||
public:
|
||||
CImage (CScene* scene, Core::Objects::CImage* image);
|
||||
|
||||
void OnSetConstants (irr::video::IMaterialRendererServices* services, int32_t userData) override;
|
||||
|
||||
void render () override;
|
||||
const irr::core::aabbox3d<irr::f32>& getBoundingBox() const override;
|
||||
|
||||
const Core::Objects::CImage* getImage () const;
|
||||
const std::vector<CEffect*>& getEffects () const;
|
||||
|
||||
const irr::video::S3DVertex* getVertex () const;
|
||||
const GLfloat* getVertex () const;
|
||||
const GLuint* getVertexBuffer () const;
|
||||
const GLuint* getPassVertexBuffer () const;
|
||||
const GLuint* getTexCoordBuffer () const;
|
||||
|
||||
protected:
|
||||
static const std::string Type;
|
||||
@ -41,10 +46,17 @@ namespace WallpaperEngine::Render::Objects
|
||||
private:
|
||||
void generateMaterial (irr::video::ITexture* resultTexture);
|
||||
|
||||
irr::video::S3DVertex m_vertex [4];
|
||||
CTexture* m_texture;
|
||||
GLfloat m_vertexList [6 * 3];
|
||||
GLfloat m_passesVertexList [6 * 3];
|
||||
GLfloat m_texCoordList [6 * 2];
|
||||
GLuint m_vertexBuffer;
|
||||
GLuint m_passesVertexBuffer;
|
||||
GLuint m_texCoordBuffer;
|
||||
uint16_t m_vertexIndices [6];
|
||||
|
||||
|
||||
Core::Objects::CImage* m_image;
|
||||
irr::core::aabbox3d<irr::f32> m_boundingBox;
|
||||
|
||||
std::vector<CEffect*> m_effects;
|
||||
Effects::CMaterial* m_material;
|
||||
|
@ -10,9 +10,6 @@ CSound::CSound (CScene* scene, Core::Objects::CSound* sound) :
|
||||
CObject (scene, Type, sound),
|
||||
m_sound (sound)
|
||||
{
|
||||
this->setAutomaticCulling (irr::scene::EAC_OFF);
|
||||
this->m_boundingBox = irr::core::aabbox3d<irr::f32>(0, 0, 0, 0, 0, 0);
|
||||
|
||||
this->load ();
|
||||
this->play ();
|
||||
}
|
||||
@ -29,26 +26,14 @@ void CSound::load ()
|
||||
|
||||
for (; cur != end; cur ++)
|
||||
{
|
||||
SDL_RWops* sdlRwops = nullptr;
|
||||
Mix_Music* music = nullptr;
|
||||
irr::io::IReadFile* readfile = this->getScene ()->getContext ()->getDevice ()->getFileSystem ()->createAndOpenFile ((*cur).c_str ());
|
||||
int filesize = readfile->getSize ();
|
||||
char* filebuffer = new char [filesize];
|
||||
uint32_t filesize = 0;
|
||||
void* filebuffer = this->getContainer ()->readFile ((*cur), &filesize);
|
||||
|
||||
readfile->read (filebuffer, filesize);
|
||||
|
||||
sdlRwops = SDL_RWFromConstMem (filebuffer, filesize);
|
||||
music = Mix_LoadMUS_RW (sdlRwops);
|
||||
readfile->drop ();
|
||||
SDL_RWops* sdlRwops = SDL_RWFromConstMem (filebuffer, filesize);
|
||||
Mix_Music* music = Mix_LoadMUS_RW (sdlRwops);
|
||||
|
||||
if (music == nullptr)
|
||||
{
|
||||
this->getScene ()->getContext ()->getDevice ()->getLogger ()->log (
|
||||
"cannot load audio", Mix_GetError (), irr::ELL_ERROR
|
||||
);
|
||||
|
||||
continue;
|
||||
}
|
||||
throw std::runtime_error ("cannot load audio");
|
||||
|
||||
this->m_bufferReader.push_back (sdlRwops);
|
||||
this->m_soundBuffer.push_back (filebuffer);
|
||||
@ -68,11 +53,7 @@ void CSound::play ()
|
||||
for (; mixcur != mixend; mixcur ++)
|
||||
{
|
||||
if (Mix_PlayMusic ((*mixcur), -1) == -1)
|
||||
{
|
||||
this->getScene ()->getContext ()->getDevice ()->getLogger ()->log (
|
||||
"cannot play audio", Mix_GetError (), irr::ELL_ERROR
|
||||
);
|
||||
}
|
||||
throw std::runtime_error ("cannot play audio");
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,9 +62,4 @@ void CSound::render ()
|
||||
|
||||
}
|
||||
|
||||
const irr::core::aabbox3d<irr::f32>& CSound::getBoundingBox() const
|
||||
{
|
||||
return this->m_boundingBox;
|
||||
}
|
||||
|
||||
const std::string CSound::Type = "sound";
|
@ -17,7 +17,6 @@ namespace WallpaperEngine::Render::Objects
|
||||
CSound (CScene* scene, Core::Objects::CSound* sound);
|
||||
|
||||
void render () override;
|
||||
const irr::core::aabbox3d<irr::f32>& getBoundingBox() const override;
|
||||
|
||||
protected:
|
||||
static const std::string Type;
|
||||
@ -32,6 +31,5 @@ namespace WallpaperEngine::Render::Objects
|
||||
std::vector <void*> m_soundBuffer;
|
||||
|
||||
Core::Objects::CSound* m_sound;
|
||||
irr::core::aabbox3d<irr::f32> m_boundingBox;
|
||||
};
|
||||
}
|
||||
|
@ -2,15 +2,16 @@
|
||||
|
||||
using namespace WallpaperEngine::Render::Objects::Effects;
|
||||
|
||||
CFBO::CFBO (Core::Objects::Effects::CFBO* fbo, const Core::Objects::CImage* image, Irrlicht::CContext* context) :
|
||||
CFBO::CFBO (Core::Objects::Effects::CFBO* fbo, const Core::Objects::CImage* image) :
|
||||
m_fbo (fbo)
|
||||
{
|
||||
irr::core::dimension2du size = irr::core::dimension2du (
|
||||
image->getSize ().X * this->getScale (),
|
||||
image->getSize ().Y * this->getScale ()
|
||||
// TODO: REWRITE
|
||||
/*irr::core::dimension2du size = irr::core::dimension2du (
|
||||
image->getSize ().x * this->getScale (),
|
||||
image->getSize ().y * this->getScale ()
|
||||
);
|
||||
|
||||
context->getDevice ()->getVideoDriver ()->addRenderTargetTexture (size, this->getName ().c_str ());
|
||||
context->getDevice ()->getVideoDriver ()->addRenderTargetTexture (size, this->getName ().c_str ());*/
|
||||
}
|
||||
|
||||
const irr::video::ITexture* CFBO::getTexture () const
|
||||
|
@ -12,7 +12,7 @@ namespace WallpaperEngine::Render::Objects::Effects
|
||||
class CFBO
|
||||
{
|
||||
public:
|
||||
CFBO (Core::Objects::Effects::CFBO* fbo, const Core::Objects::CImage* image, Irrlicht::CContext* context);
|
||||
CFBO (Core::Objects::Effects::CFBO* fbo, const Core::Objects::CImage* image);
|
||||
|
||||
const irr::video::ITexture* getTexture () const;
|
||||
const std::string& getName () const;
|
||||
|
@ -4,13 +4,12 @@ using namespace WallpaperEngine::Render::Objects;
|
||||
|
||||
using namespace WallpaperEngine::Render::Objects::Effects;
|
||||
|
||||
CMaterial::CMaterial (Irrlicht::CContext* context, Render::Objects::CImage* image, const Core::Objects::Images::CMaterial* material, irr::video::ITexture* texture) :
|
||||
m_context (context),
|
||||
CMaterial::CMaterial (const Render::Objects::CImage* image, const Core::Objects::Images::CMaterial* material) :
|
||||
m_image (image),
|
||||
m_material (material),
|
||||
m_inputTexture (texture)
|
||||
m_material (material)
|
||||
{
|
||||
this->m_outputTexture = this->m_context->getDevice ()->getVideoDriver ()->addRenderTargetTexture (
|
||||
// TODO: REWRITE THIS
|
||||
/*this->m_outputTexture = this->m_context->getDevice ()->getVideoDriver ()->addRenderTargetTexture (
|
||||
this->m_inputTexture->getSize (),
|
||||
(
|
||||
"_rt_WALLENGINELINUX_OUTPUT_" +
|
||||
@ -18,10 +17,9 @@ CMaterial::CMaterial (Irrlicht::CContext* context, Render::Objects::CImage* imag
|
||||
std::to_string (this->m_image->getEffects ().size ()) +
|
||||
"_material_output"
|
||||
).c_str ()
|
||||
);
|
||||
);*/
|
||||
|
||||
this->generatePasses ();
|
||||
this->generateOutputMaterial ();
|
||||
}
|
||||
|
||||
const std::vector<CPass*>& CMaterial::getPasses () const
|
||||
@ -34,45 +32,59 @@ const CImage* CMaterial::getImage () const
|
||||
return this->m_image;
|
||||
}
|
||||
|
||||
irr::video::ITexture* CMaterial::getOutputTexture () const
|
||||
{
|
||||
return this->m_outputTexture;
|
||||
}
|
||||
|
||||
irr::video::ITexture* CMaterial::getInputTexture () const
|
||||
{
|
||||
return this->m_inputTexture;
|
||||
}
|
||||
|
||||
void CMaterial::generatePasses ()
|
||||
{
|
||||
auto cur = this->m_material->getPasses ().begin ();
|
||||
auto end = this->m_material->getPasses ().end ();
|
||||
irr::video::ITexture* inputTexture = this->getInputTexture ();
|
||||
|
||||
// these are simple now, just create the entries and done
|
||||
for (; cur != end; cur ++)
|
||||
this->m_passes.emplace_back (new CPass (this, *cur));
|
||||
}
|
||||
|
||||
// TODO: REWRITE THIS
|
||||
/*
|
||||
void CMaterial::OnSetConstants (irr::video::IMaterialRendererServices *services, int32_t userData)
|
||||
{
|
||||
irr::s32 g_Texture0 = 0;
|
||||
|
||||
irr::video::IVideoDriver* driver = services->getVideoDriver ();
|
||||
|
||||
irr::core::matrix4 worldViewProj;
|
||||
worldViewProj = driver->getTransform (irr::video::ETS_PROJECTION);
|
||||
worldViewProj *= driver->getTransform (irr::video::ETS_VIEW);
|
||||
worldViewProj *= driver->getTransform (irr::video::ETS_WORLD);
|
||||
|
||||
|
||||
services->setPixelShaderConstant ("TextureSampler", &g_Texture0, 1);
|
||||
services->setVertexShaderConstant ("g_ModelViewProjectionMatrix", worldViewProj.pointer(), 16);
|
||||
}
|
||||
*/
|
||||
void CMaterial::render (GLuint drawTo, GLuint inputTexture)
|
||||
{
|
||||
// get the orthogonal projection
|
||||
auto projection = this->getImage ()->getScene ()->getScene ()->getOrthogonalProjection ();
|
||||
|
||||
auto begin = this->getPasses ().begin ();
|
||||
auto cur = this->getPasses ().begin ();
|
||||
auto end = this->getPasses ().end ();
|
||||
|
||||
for (; cur != end; cur ++)
|
||||
{
|
||||
CPass* pass = new CPass (this->m_context, this, *cur, inputTexture);
|
||||
// get the current framebuffer to use (only after the first iteration)
|
||||
if (cur != begin)
|
||||
this->getImage ()->getScene ()->pinpongFramebuffer (&drawTo, &inputTexture);
|
||||
|
||||
inputTexture = pass->getOutputTexture ();
|
||||
|
||||
this->m_passes.push_back (pass);
|
||||
// bind to this new framebuffer
|
||||
glBindFramebuffer (GL_FRAMEBUFFER, drawTo);
|
||||
// set the viewport, for now use the scene width/height but we might want to use image's size TODO: INVESTIGATE THAT
|
||||
glViewport (0, 0, projection->getWidth (), projection->getHeight ());
|
||||
// render the pass
|
||||
(*cur)->render (drawTo, inputTexture);
|
||||
}
|
||||
|
||||
this->m_outputMaterial.setTexture (0, inputTexture);
|
||||
}
|
||||
|
||||
void CMaterial::generateOutputMaterial ()
|
||||
{
|
||||
this->m_outputMaterial.MaterialType = irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
this->m_outputMaterial.setFlag (irr::video::EMF_LIGHTING, false);
|
||||
this->m_outputMaterial.setFlag (irr::video::EMF_BLEND_OPERATION, true);
|
||||
this->m_outputMaterial.Wireframe = false;
|
||||
this->m_outputMaterial.Lighting = false;
|
||||
}
|
||||
|
||||
void CMaterial::render ()
|
||||
{
|
||||
// TODO: REWRITE THIS
|
||||
/*
|
||||
uint16_t indices [] =
|
||||
{
|
||||
3, 2, 1, 0
|
||||
@ -106,4 +118,5 @@ void CMaterial::render ()
|
||||
this->m_image->getVertex (), 4, indices, 1,
|
||||
irr::video::EVT_STANDARD, irr::scene::EPT_QUADS, irr::video::EIT_16BIT
|
||||
);
|
||||
*/
|
||||
}
|
@ -28,27 +28,23 @@ namespace WallpaperEngine::Render::Objects::Effects
|
||||
{
|
||||
friend class CPass;
|
||||
public:
|
||||
CMaterial (Irrlicht::CContext* context, Render::Objects::CImage* image, const Core::Objects::Images::CMaterial* material, irr::video::ITexture* texture);
|
||||
|
||||
irr::video::ITexture* getOutputTexture () const;
|
||||
irr::video::ITexture* getInputTexture () const;
|
||||
CMaterial (const Render::Objects::CImage* image, const Core::Objects::Images::CMaterial* material);
|
||||
|
||||
const std::vector<CPass*>& getPasses () const;
|
||||
const CImage* getImage () const;
|
||||
|
||||
void render ();
|
||||
/**
|
||||
* Renders the given material, using inputTexture as first texture of the shader
|
||||
*
|
||||
* @param drawTo
|
||||
* @param inputTexture
|
||||
*/
|
||||
void render (GLuint drawTo, GLuint inputTexture);
|
||||
|
||||
private:
|
||||
void generatePasses ();
|
||||
void generateOutputMaterial ();
|
||||
|
||||
Irrlicht::CContext* m_context;
|
||||
|
||||
irr::video::ITexture* m_inputTexture;
|
||||
irr::video::ITexture* m_outputTexture;
|
||||
irr::video::SMaterial m_outputMaterial;
|
||||
|
||||
Render::Objects::CImage* m_image;
|
||||
const Render::Objects::CImage* m_image;
|
||||
const Core::Objects::Images::CMaterial* m_material;
|
||||
|
||||
std::vector<CPass*> m_passes;
|
||||
|
@ -19,74 +19,244 @@ using namespace WallpaperEngine::Render::Shaders::Variables;
|
||||
|
||||
using namespace WallpaperEngine::Render::Objects::Effects;
|
||||
|
||||
extern irr::f32 g_Time;
|
||||
extern double g_Time;
|
||||
|
||||
CPass::CPass (Irrlicht::CContext* context, CMaterial* material, Core::Objects::Images::Materials::CPass* pass, irr::video::ITexture* texture) :
|
||||
CPass::CPass (CMaterial* material, Core::Objects::Images::Materials::CPass* pass) :
|
||||
m_material (material),
|
||||
m_pass (pass),
|
||||
m_context (context),
|
||||
m_inputTexture (texture),
|
||||
m_outputTexture (nullptr)
|
||||
m_pass (pass)
|
||||
{
|
||||
this->m_outputTexture = this->m_context->getDevice ()->getVideoDriver ()->addRenderTargetTexture (
|
||||
this->m_inputTexture->getSize (),
|
||||
(
|
||||
"_rt_WALLENGINELINUX_OUTPUT_" +
|
||||
std::to_string (this->m_material->getImage ()->getImage ()->getId ()) + "_" +
|
||||
std::to_string (this->m_material->getImage ()->getEffects ().size ()) +
|
||||
"_pass_output"
|
||||
).c_str ()
|
||||
);
|
||||
|
||||
irr::io::path vertPath = this->m_context->resolveVertexShader (pass->getShader ());
|
||||
irr::io::path fragPath = this->m_context->resolveFragmentShader (pass->getShader ());
|
||||
// register fragment shader
|
||||
this->m_fragShader = new Render::Shaders::Compiler (
|
||||
this->m_context, fragPath, Render::Shaders::Compiler::Type::Type_Pixel,
|
||||
pass->getCombos (), pass->getConstants (), false
|
||||
this->m_material->getImage ()->getContainer (),
|
||||
pass->getShader (),
|
||||
Shaders::Compiler::Type_Pixel,
|
||||
pass->getCombos (),
|
||||
pass->getConstants ()
|
||||
);
|
||||
// compile fragment shader
|
||||
this->m_fragShader->precompile ();
|
||||
// register vertex shader, combos come from the fragment as it can sometimes define them
|
||||
this->m_vertShader = new Render::Shaders::Compiler (
|
||||
this->m_context, vertPath, Render::Shaders::Compiler::Type::Type_Vertex,
|
||||
this->m_fragShader->getCombos (), pass->getConstants (), false
|
||||
this->m_material->getImage ()->getContainer (),
|
||||
pass->getShader (),
|
||||
Shaders::Compiler::Type_Vertex,
|
||||
this->m_fragShader->getCombos (),
|
||||
pass->getConstants ()
|
||||
);
|
||||
// compile vertex shader
|
||||
this->m_vertShader->precompile ();
|
||||
this->setupTextures ();
|
||||
// initialize material data and compile shader used for this pass
|
||||
this->m_irrlichtMaterial.Wireframe = false;
|
||||
this->m_irrlichtMaterial.Lighting = false;
|
||||
this->m_irrlichtMaterial.setFlag (irr::video::EMF_LIGHTING, false);
|
||||
this->m_irrlichtMaterial.setFlag (irr::video::EMF_BLEND_OPERATION, true);
|
||||
this->m_irrlichtMaterial.MaterialType = (irr::video::E_MATERIAL_TYPE)
|
||||
this->m_context->getDevice ()->getVideoDriver ()->getGPUProgrammingServices ()->addHighLevelShaderMaterial (
|
||||
this->m_vertShader->getCompiled ().c_str (), "main", irr::video::EVST_VS_2_0,
|
||||
this->m_fragShader->getCompiled ().c_str (), "main", irr::video::EPST_PS_2_0,
|
||||
this, irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL, 0, irr::video::EGSL_DEFAULT
|
||||
);
|
||||
|
||||
this->setupTextures ();
|
||||
this->setupShaders ();
|
||||
this->setupShaderVariables ();
|
||||
}
|
||||
|
||||
irr::video::ITexture *CPass::getOutputTexture () const
|
||||
void CPass::render (GLuint drawTo, GLuint input)
|
||||
{
|
||||
return this->m_outputTexture;
|
||||
}
|
||||
|
||||
irr::video::ITexture* CPass::getInputTexture () const
|
||||
{
|
||||
return this->m_inputTexture;
|
||||
}
|
||||
|
||||
const irr::video::SMaterial& CPass::getMaterial () const
|
||||
{
|
||||
return this->m_irrlichtMaterial;
|
||||
if (drawTo == 0)
|
||||
std::cout << "FINAL PASS TO SCREEN --------------------------\n";
|
||||
else
|
||||
std::cout << "NEW PASS --------------------------------------\n";
|
||||
|
||||
// clear whatever buffer we're drawing to if we're not drawing to screen
|
||||
if (drawTo > 0)
|
||||
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
// use the shader we have registered
|
||||
glUseProgram (this->m_programID);
|
||||
|
||||
// bind the input texture
|
||||
glActiveTexture (GL_TEXTURE0);
|
||||
glBindTexture (GL_TEXTURE_2D, input);
|
||||
std::cout << "Binding texture " << 0 << " to " << input << "\n";
|
||||
|
||||
// first bind the textures to their sampler place
|
||||
{
|
||||
// set texture slots for the shader
|
||||
auto cur = this->m_textures.begin ();
|
||||
auto end = this->m_textures.end ();
|
||||
|
||||
for (int index = 1; cur != end; cur ++, index ++)
|
||||
{
|
||||
std::cout << "Binding texture " << index << " to " << (*cur)->getTextureID () << "\n";
|
||||
|
||||
// set the active texture index
|
||||
glActiveTexture (GL_TEXTURE0 + index);
|
||||
// bind the correct texture there
|
||||
glBindTexture (GL_TEXTURE_2D, (*cur)->getTextureID ());
|
||||
}
|
||||
}
|
||||
|
||||
// now bind variables needed
|
||||
{
|
||||
auto cur = this->m_variables.begin ();
|
||||
auto end = this->m_variables.end ();
|
||||
|
||||
for (; cur != end; cur ++)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cout << "(" << (*cur).second->getIdentifierName() << ") - " << (*cur).second->getName () << " = ";
|
||||
#endif /* DEBUG */
|
||||
|
||||
if ((*cur).second->is <CShaderVariableInteger> () == true)
|
||||
{
|
||||
GLint value = *static_cast <const int32_t*> ((*cur).second->getValue ());
|
||||
#ifdef DEBUG
|
||||
std::cout << value << "\n";
|
||||
#endif /* DEBUG */
|
||||
glUniform1i ((*cur).first, value);
|
||||
}
|
||||
else if ((*cur).second->is <CShaderVariableFloat> () == true)
|
||||
{
|
||||
GLfloat value = *static_cast <const float*> ((*cur).second->getValue ());
|
||||
#ifdef DEBUG
|
||||
std::cout << value << "\n";
|
||||
#endif /* DEBUG */
|
||||
glUniform1f ((*cur).first, value);
|
||||
}
|
||||
else if ((*cur).second->is <CShaderVariableVector2> () == true)
|
||||
{
|
||||
glm::vec2 value = *static_cast <const glm::vec2*> ((*cur).second-> as <CShaderVariableVector2> ()->getValue ());
|
||||
#ifdef DEBUG
|
||||
std::cout << value.x << " " << value.y << "\n";
|
||||
#endif /* DEBUG */
|
||||
glUniform2fv ((*cur).first, 1, glm::value_ptr (value));
|
||||
}
|
||||
else if ((*cur).second->is <CShaderVariableVector3> () == true)
|
||||
{
|
||||
glm::vec3 value = *static_cast <const glm::vec3*> ((*cur).second-> as <CShaderVariableVector3> ()->getValue ());
|
||||
#ifdef DEBUG
|
||||
std::cout << value.x << " " << value.y << " " << value.z << "\n";
|
||||
#endif /* DEBUG */
|
||||
glUniform3fv ((*cur).first, 1, glm::value_ptr (value));
|
||||
}
|
||||
else if ((*cur).second->is <CShaderVariableVector4> () == true)
|
||||
{
|
||||
glm::vec4 value = *static_cast <const glm::vec4*> ((*cur).second-> as <CShaderVariableVector4> ()->getValue ());
|
||||
#ifdef DEBUG
|
||||
std::cout << value.x << " " << value.y << " " << value.z << " " << value.w << "\n";
|
||||
#endif /* DEBUG */
|
||||
glUniform4fv ((*cur).first, 1, glm::value_ptr (value));
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cout << "null\n";
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add static things
|
||||
if (this->g_Texture0 != -1)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cout << "g_Texture0 = 0\n";
|
||||
#endif /* DEBUG */
|
||||
glUniform1i (this->g_Texture0, 0);
|
||||
}
|
||||
if (this->g_Texture1 != -1)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cout << "g_Texture1 = 1\n";
|
||||
#endif /* DEBUG */
|
||||
glUniform1i (this->g_Texture1, 1);
|
||||
}
|
||||
if (this->g_Texture2 != -1)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cout << "g_Texture2 = 2\n";
|
||||
#endif /* DEBUG */
|
||||
glUniform1i (this->g_Texture2, 2);
|
||||
}
|
||||
if (this->g_Time != -1)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cout << "g_Time = " << (float) ::g_Time << "\n";
|
||||
#endif /* DEBUG */
|
||||
glUniform1d (this->g_Time, (float) ::g_Time);
|
||||
}
|
||||
if (this->g_ModelViewProjectionMatrix != -1)
|
||||
{
|
||||
// calculate the new matrix
|
||||
glm::mat4 projection = this->m_material->getImage ()->getScene ()->getCamera ()->getProjection ();
|
||||
glm::mat4 view = this->m_material->getImage ()->getScene ()->getCamera ()->getLookAt ();
|
||||
glm::mat4 model = glm::mat4 (1.0f);
|
||||
glm::mat4 mvp = projection * view * model;
|
||||
|
||||
glUniformMatrix4fv (this->g_ModelViewProjectionMatrix, 1, GL_FALSE, &mvp [0] [0]);
|
||||
|
||||
#ifdef DEBUG
|
||||
std::cout << "g_ModelViewProjectionMatrix\n";
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
if (this->g_Brightness != -1)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cout << "g_Brightness = 1.0\n";
|
||||
#endif /* DEBUG */
|
||||
glUniform1f (this->g_Brightness, 1.0f);
|
||||
}
|
||||
if (this->g_UserAlpha != -1)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cout << "g_UserAlpha = 1.0\n";
|
||||
#endif /* DEBUG */
|
||||
glUniform1f (this->g_UserAlpha, 1.0f);
|
||||
}
|
||||
if (this->g_Texture0Rotation != -1)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cout << "g_Texture0Rotation = {0.0, 0.0}\n";
|
||||
#endif /* DEBUG */
|
||||
glUniform2f (this->g_Texture0Rotation, 0.0f, 0.0f);
|
||||
}
|
||||
if (this->g_Texture0Translation != -1)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cout << "g_Texture0Translation = {0.0, 0.0, 0.0, 0.0}\n";
|
||||
#endif /* DEBUG */
|
||||
glUniform4f (this->g_Texture0Translation, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
if (this->a_TexCoord != -1)
|
||||
{
|
||||
std::cout << "a_TexCoord present!\n";
|
||||
glEnableVertexAttribArray (this->a_TexCoord);
|
||||
glBindBuffer (GL_ARRAY_BUFFER, *this->m_material->getImage ()->getTexCoordBuffer ());
|
||||
glVertexAttribPointer (
|
||||
this->a_TexCoord,
|
||||
2,
|
||||
GL_FLOAT,
|
||||
GL_FALSE,
|
||||
0,
|
||||
nullptr
|
||||
);
|
||||
}
|
||||
if (this->a_Position != -1)
|
||||
{
|
||||
std::cout << "a_Position present!\n";
|
||||
glEnableVertexAttribArray (this->a_Position);
|
||||
glBindBuffer (GL_ARRAY_BUFFER, (drawTo > 0) ? *this->m_material->getImage ()->getPassVertexBuffer () : *this->m_material->getImage ()->getVertexBuffer ());
|
||||
glVertexAttribPointer (
|
||||
this->a_Position,
|
||||
3,
|
||||
GL_FLOAT,
|
||||
GL_FALSE,
|
||||
0,
|
||||
nullptr
|
||||
);
|
||||
}
|
||||
|
||||
// start actual rendering now
|
||||
glBindBuffer (GL_ARRAY_BUFFER, (drawTo > 0) ? *this->m_material->getImage ()->getPassVertexBuffer () : *this->m_material->getImage ()->getVertexBuffer ());
|
||||
glDrawArrays (GL_TRIANGLES, 0, 6);
|
||||
|
||||
if (this->a_Position != -1)
|
||||
glDisableVertexAttribArray (this->a_Position);
|
||||
if (this->a_TexCoord != -1)
|
||||
glDisableVertexAttribArray (this->a_TexCoord);
|
||||
}
|
||||
|
||||
/*
|
||||
void CPass::OnSetConstants (irr::video::IMaterialRendererServices *services, int32_t userData)
|
||||
{
|
||||
// TODO: REWRITE
|
||||
const Core::Objects::CImage* image = this->m_material->getImage ()->getImage ();
|
||||
|
||||
irr::video::IVideoDriver* driver = services->getVideoDriver ();
|
||||
@ -212,6 +382,118 @@ void CPass::OnSetConstants (irr::video::IMaterialRendererServices *services, int
|
||||
services->setVertexShaderConstant ("g_Time", &g_Time, 1);
|
||||
services->setPixelShaderConstant ("g_Time", &g_Time, 1);
|
||||
}
|
||||
*/
|
||||
|
||||
GLuint CPass::compileShader (Render::Shaders::Compiler* shader, GLuint type)
|
||||
{
|
||||
// reserve shaders in OpenGL
|
||||
GLuint shaderID = glCreateShader (type);
|
||||
|
||||
// give shader's source code to OpenGL to be compiled
|
||||
const char* sourcePointer = shader->getCompiled ().c_str ();
|
||||
|
||||
glShaderSource (shaderID, 1, &sourcePointer, nullptr);
|
||||
glCompileShader (shaderID);
|
||||
|
||||
GLint result = GL_FALSE;
|
||||
int infoLogLength = 0;
|
||||
|
||||
// ensure the vertex shader was correctly compiled
|
||||
glGetShaderiv (shaderID, GL_COMPILE_STATUS, &result);
|
||||
glGetShaderiv (shaderID, GL_INFO_LOG_LENGTH, &infoLogLength);
|
||||
|
||||
if (infoLogLength > 0)
|
||||
{
|
||||
char* logBuffer = new char [infoLogLength + 1];
|
||||
// ensure logBuffer ends with a \0
|
||||
memset (logBuffer, 0, infoLogLength + 1);
|
||||
// get information about the error
|
||||
glGetShaderInfoLog (shaderID, infoLogLength, nullptr, logBuffer);
|
||||
// throw an exception about the issue
|
||||
std::string message = logBuffer;
|
||||
// free the buffer
|
||||
delete[] logBuffer;
|
||||
// throw an exception
|
||||
throw std::runtime_error (message);
|
||||
}
|
||||
|
||||
return shaderID;
|
||||
}
|
||||
|
||||
void CPass::setupShaders ()
|
||||
{
|
||||
// compile the shaders
|
||||
GLuint vertexShaderID = compileShader (this->m_vertShader, GL_VERTEX_SHADER);
|
||||
GLuint fragmentShaderID = compileShader (this->m_fragShader, GL_FRAGMENT_SHADER);
|
||||
// create the final program
|
||||
this->m_programID = glCreateProgram ();
|
||||
// link the shaders together
|
||||
glAttachShader (this->m_programID, vertexShaderID);
|
||||
glAttachShader (this->m_programID, fragmentShaderID);
|
||||
glLinkProgram (this->m_programID);
|
||||
// check that the shader was properly linked
|
||||
GLint result = GL_FALSE;
|
||||
int infoLogLength = 0;
|
||||
|
||||
glGetProgramiv (this->m_programID, GL_LINK_STATUS, &result);
|
||||
glGetProgramiv (this->m_programID, GL_INFO_LOG_LENGTH, &infoLogLength);
|
||||
|
||||
if (infoLogLength > 0)
|
||||
{
|
||||
char* logBuffer = new char [infoLogLength + 1];
|
||||
// ensure logBuffer ends with a \0
|
||||
memset (logBuffer, 0, infoLogLength + 1);
|
||||
// get information about the error
|
||||
glGetProgramInfoLog (this->m_programID, infoLogLength, nullptr, logBuffer);
|
||||
// throw an exception about the issue
|
||||
std::string message = logBuffer;
|
||||
// free the buffer
|
||||
delete[] logBuffer;
|
||||
// throw an exception
|
||||
throw std::runtime_error (message);
|
||||
}
|
||||
|
||||
// after being liked shaders can be dettached and deleted
|
||||
glDetachShader (this->m_programID, vertexShaderID);
|
||||
glDetachShader (this->m_programID, fragmentShaderID);
|
||||
|
||||
glDeleteShader (vertexShaderID);
|
||||
glDeleteShader (fragmentShaderID);
|
||||
|
||||
// get information from the program, like uniforms, etc
|
||||
// support three textures for now
|
||||
this->g_Texture0 = glGetUniformLocation (this->m_programID, "g_Texture0");
|
||||
this->g_Texture1 = glGetUniformLocation (this->m_programID, "g_Texture1");
|
||||
this->g_Texture2 = glGetUniformLocation (this->m_programID, "g_Texture2");
|
||||
this->g_Time = glGetUniformLocation (this->m_programID, "g_Time");
|
||||
this->g_Texture0Rotation = glGetUniformLocation (this->m_programID, "g_Texture0Rotation");
|
||||
this->g_Texture0Translation = glGetUniformLocation (this->m_programID, "g_Texture0Translation");
|
||||
this->g_ModelViewProjectionMatrix = glGetUniformLocation (this->m_programID, "g_ModelViewProjectionMatrix");
|
||||
this->g_UserAlpha = glGetUniformLocation (this->m_programID, "g_UserAlpha");
|
||||
this->g_Brightness = glGetUniformLocation (this->m_programID, "g_Brightness");
|
||||
|
||||
// bind a_TexCoord and a_Position
|
||||
this->a_TexCoord = glGetAttribLocation (this->m_programID, "a_TexCoord");
|
||||
this->a_Position = glGetAttribLocation (this->m_programID, "a_Position");
|
||||
}
|
||||
|
||||
void CPass::setupTextures ()
|
||||
{
|
||||
auto cur = this->m_pass->getTextures ().begin ();
|
||||
auto end = this->m_pass->getTextures ().end ();
|
||||
|
||||
for (; cur != end; cur ++)
|
||||
{
|
||||
uint32_t textureSize = 0;
|
||||
|
||||
// get the first texture on the first pass (this one represents the image assigned to this object)
|
||||
void* textureData = this->m_material->getImage ()->getContainer ()->readTexture (
|
||||
(*cur), &textureSize
|
||||
);
|
||||
// load a new texture and push it into the list
|
||||
this->m_textures.emplace_back (new CTexture (textureData));
|
||||
}
|
||||
}
|
||||
|
||||
void CPass::setupShaderVariables ()
|
||||
{
|
||||
@ -238,6 +520,13 @@ void CPass::setupShaderVariables ()
|
||||
{
|
||||
pixelVar->as <CShaderVariableVector3> ()->setValue (*(*cur).second->as <CShaderConstantVector3> ()->getValue ());
|
||||
}
|
||||
|
||||
// get the uniform first
|
||||
GLint uniform = glGetUniformLocation (this->m_programID, pixelVar->getName ().c_str ());
|
||||
|
||||
if (uniform != -1)
|
||||
// register the variable
|
||||
this->m_variables.insert (std::make_pair (uniform, pixelVar));
|
||||
}
|
||||
|
||||
if (vertexVar)
|
||||
@ -254,27 +543,13 @@ void CPass::setupShaderVariables ()
|
||||
{
|
||||
vertexVar->as <CShaderVariableVector3> ()->setValue (*(*cur).second->as <CShaderConstantVector3> ()->getValue ());
|
||||
}
|
||||
|
||||
// get the uniform first
|
||||
GLint uniform = glGetUniformLocation (this->m_programID, vertexVar->getName ().c_str ());
|
||||
|
||||
if (uniform != -1)
|
||||
// register the variable
|
||||
this->m_variables.insert (std::make_pair (uniform, vertexVar));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CPass::setupTextures ()
|
||||
{
|
||||
auto textureCur = this->m_pass->getTextures ().begin ();
|
||||
auto textureEnd = this->m_pass->getTextures ().end ();
|
||||
|
||||
for (int textureNumber = 0; textureCur != textureEnd; textureCur ++, textureNumber ++)
|
||||
{
|
||||
irr::video::ITexture* texture = this->m_inputTexture;
|
||||
|
||||
// XXXHACK: TODO: PROPERLY DETECT WHERE THE INPUT TEXTURE SHOULD BE USED IN THE SHADER GRAPH
|
||||
if (textureNumber != 0)
|
||||
{
|
||||
irr::io::path texturepath = this->m_context->resolveMaterials (*textureCur);
|
||||
texture = this->m_context->getDevice ()->getVideoDriver ()->getTexture (texturepath);
|
||||
}
|
||||
|
||||
this->m_irrlichtMaterial.setTexture (textureNumber, texture);
|
||||
this->m_textures.push_back (texture);
|
||||
}
|
||||
}
|
@ -1,44 +1,57 @@
|
||||
#pragma once
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
#include "WallpaperEngine/Irrlicht/CContext.h"
|
||||
|
||||
#include "WallpaperEngine/Render/Shaders/Variables/CShaderVariable.h"
|
||||
#include "WallpaperEngine/Render/Objects/Effects/CMaterial.h"
|
||||
#include "WallpaperEngine/Render/Shaders/Compiler.h"
|
||||
#include "WallpaperEngine/Assets/CTexture.h"
|
||||
|
||||
namespace WallpaperEngine::Render::Objects::Effects
|
||||
{
|
||||
using namespace WallpaperEngine::Render::Shaders::Variables;
|
||||
|
||||
class CMaterial;
|
||||
|
||||
class CPass : public irr::video::IShaderConstantSetCallBack
|
||||
class CPass
|
||||
{
|
||||
public:
|
||||
CPass (Irrlicht::CContext* context, CMaterial* material, Core::Objects::Images::Materials::CPass* pass, irr::video::ITexture* texture);
|
||||
CPass (CMaterial* material, Core::Objects::Images::Materials::CPass* pass);
|
||||
|
||||
void OnSetConstants (irr::video::IMaterialRendererServices* services, int32_t userData) override;
|
||||
|
||||
irr::video::ITexture *getOutputTexture () const;
|
||||
irr::video::ITexture* getInputTexture () const;
|
||||
|
||||
const irr::video::SMaterial& getMaterial () const;
|
||||
void render (GLuint drawTo, GLuint input);
|
||||
|
||||
private:
|
||||
void setupShaderVariables ();
|
||||
static GLuint compileShader (Render::Shaders::Compiler* shader, GLuint type);
|
||||
void setupTextures ();
|
||||
void setupShaders ();
|
||||
void setupShaderVariables ();
|
||||
|
||||
CMaterial* m_material;
|
||||
Core::Objects::Images::Materials::CPass* m_pass;
|
||||
Irrlicht::CContext* m_context;
|
||||
|
||||
irr::video::ITexture* m_inputTexture;
|
||||
irr::video::ITexture* m_outputTexture;
|
||||
|
||||
irr::video::SMaterial m_irrlichtMaterial;
|
||||
std::vector<CTexture*> m_textures;
|
||||
std::map<GLint,CShaderVariable*> m_variables;
|
||||
std::map<GLint,CShaderVariable*> m_attribs;
|
||||
std::map<GLint,int> m_uniforms;
|
||||
|
||||
Render::Shaders::Compiler* m_fragShader;
|
||||
Render::Shaders::Compiler* m_vertShader;
|
||||
|
||||
std::vector<irr::video::ITexture*> m_textures;
|
||||
GLuint m_programID;
|
||||
|
||||
// shader variables used temporary
|
||||
GLint g_Texture0;
|
||||
GLint g_Texture1;
|
||||
GLint g_Texture2;
|
||||
GLint g_Time;
|
||||
GLint g_Texture0Rotation;
|
||||
GLint g_Texture0Translation;
|
||||
GLint g_ModelViewProjectionMatrix;
|
||||
GLint a_TexCoord;
|
||||
GLint a_Position;
|
||||
GLint g_UserAlpha;
|
||||
GLint g_Brightness;
|
||||
GLint positionAttribute;
|
||||
};
|
||||
}
|
||||
|
@ -21,12 +21,13 @@
|
||||
#include "WallpaperEngine/Render/Shaders/Variables/CShaderVariableVector4.h"
|
||||
|
||||
using namespace WallpaperEngine::Core;
|
||||
using namespace WallpaperEngine::Assets;
|
||||
|
||||
namespace WallpaperEngine::Render::Shaders
|
||||
{
|
||||
Compiler::Compiler (
|
||||
Irrlicht::CContext* context,
|
||||
irr::io::path& file,
|
||||
CContainer* container,
|
||||
std::string filename,
|
||||
Type type,
|
||||
std::map<std::string, int> combos,
|
||||
const std::map<std::string, CShaderConstant*>& constants,
|
||||
@ -34,13 +35,18 @@ namespace WallpaperEngine::Render::Shaders
|
||||
m_combos (combos),
|
||||
m_recursive (recursive),
|
||||
m_type (type),
|
||||
m_file (file),
|
||||
m_file (std::move(filename)),
|
||||
m_error (""),
|
||||
m_errorInfo (""),
|
||||
m_context (context),
|
||||
m_constants (constants)
|
||||
m_constants (constants),
|
||||
m_container (container)
|
||||
{
|
||||
this->m_content =WallpaperEngine::FileSystem::loadFullFile (file);
|
||||
if (type == Type_Vertex)
|
||||
this->m_content = this->m_container->readVertexShader (this->m_file);
|
||||
else if (type == Type_Pixel)
|
||||
this->m_content = this->m_container->readFragmentShader (this->m_file);
|
||||
else if (type == Type_Include)
|
||||
this->m_content = this->m_container->readIncludeShader (this->m_file);
|
||||
}
|
||||
|
||||
bool Compiler::peekString(std::string str, std::string::const_iterator& it)
|
||||
@ -207,44 +213,15 @@ namespace WallpaperEngine::Render::Shaders
|
||||
|
||||
std::string Compiler::lookupShaderFile (std::string filename)
|
||||
{
|
||||
// get file information
|
||||
irr::io::path shader = this->m_context->resolveIncludeShader (filename);
|
||||
|
||||
if (shader == "")
|
||||
{
|
||||
this->m_error = true;
|
||||
this->m_errorInfo = "Cannot find file " + filename + " to include";
|
||||
return "";
|
||||
}
|
||||
|
||||
// now compile the new shader
|
||||
// do not include the default header (as it's already included in the parent)
|
||||
Compiler loader (this->m_context, shader, this->m_type, this->m_combos, this->m_constants, true);
|
||||
Compiler loader (this->m_container, std::move (filename), Type_Include, this->m_combos, this->m_constants, true);
|
||||
|
||||
loader.precompile ();
|
||||
|
||||
return loader.getCompiled ();
|
||||
}
|
||||
|
||||
std::string Compiler::lookupReplaceSymbol (std::string symbol)
|
||||
{
|
||||
auto cur = sVariableReplacement.begin ();
|
||||
auto end = sVariableReplacement.end ();
|
||||
|
||||
while (cur != end)
|
||||
{
|
||||
if (cur->first == symbol)
|
||||
{
|
||||
return cur->second;
|
||||
}
|
||||
|
||||
cur ++;
|
||||
}
|
||||
|
||||
// if there is no replacement, return the original
|
||||
return symbol;
|
||||
}
|
||||
|
||||
std::string& Compiler::getCompiled ()
|
||||
{
|
||||
return this->m_compiledContent;
|
||||
@ -325,52 +302,59 @@ namespace WallpaperEngine::Render::Shaders
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (*it == 'a')
|
||||
/*else if (*it == 'a')
|
||||
{
|
||||
// find attribute definitions
|
||||
if (this->peekString ("attribute", it) == true)
|
||||
{
|
||||
this->ignoreSpaces (it);
|
||||
std::string type = this->extractType (it); BREAK_IF_ERROR
|
||||
this->ignoreSpaces (it);
|
||||
std::string name = this->extractName (it); BREAK_IF_ERROR
|
||||
this->ignoreSpaces (it);
|
||||
std::string array = this->extractArray (it, false); BREAK_IF_ERROR
|
||||
this->ignoreSpaces (it);
|
||||
this->expectSemicolon (it); BREAK_IF_ERROR
|
||||
|
||||
this->m_compiledContent += "// attribute " + type + " " + name + array;
|
||||
this->m_compiledContent += "; /* replaced by " + this->lookupReplaceSymbol (name) + " */";
|
||||
}
|
||||
else
|
||||
{
|
||||
// check for types first
|
||||
std::string type = this->extractType (it);
|
||||
|
||||
// types not found, try names
|
||||
if (this->m_error == false)
|
||||
{
|
||||
this->m_compiledContent += type;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_error = false;
|
||||
std::string name = this->extractName (it);
|
||||
|
||||
if (this->m_error == false)
|
||||
{
|
||||
// check if the name is a translated one or not
|
||||
this->m_compiledContent += this->lookupReplaceSymbol (name);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_error = false;
|
||||
this->m_compiledContent += *it;
|
||||
it ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
// else if (*it == 'a')
|
||||
// {
|
||||
// // find attribute definitions
|
||||
// if (this->peekString ("attribute", it) == true)
|
||||
// {
|
||||
// this->ignoreSpaces (it);
|
||||
// std::string type = this->extractType (it); BREAK_IF_ERROR
|
||||
// this->ignoreSpaces (it);
|
||||
// std::string name = this->extractName (it); BREAK_IF_ERROR
|
||||
// this->ignoreSpaces (it);
|
||||
// std::string array = this->extractArray (it, false); BREAK_IF_ERROR
|
||||
// this->ignoreSpaces (it);
|
||||
// this->expectSemicolon (it); BREAK_IF_ERROR
|
||||
//
|
||||
// this->m_compiledContent += "// attribute " + type + " " + name + array;
|
||||
// this->m_compiledContent += "; /* replaced by " + this->lookupReplaceSymbol (name) + " */";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // check for types first
|
||||
// std::string type = this->extractType (it);
|
||||
//
|
||||
// // types not found, try names
|
||||
// if (this->m_error == false)
|
||||
// {
|
||||
// this->m_compiledContent += type;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this->m_error = false;
|
||||
// std::string name = this->extractName (it);
|
||||
//
|
||||
// if (this->m_error == false)
|
||||
// {
|
||||
// // check if the name is a translated one or not
|
||||
// this->m_compiledContent += this->lookupReplaceSymbol (name);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this->m_error = false;
|
||||
// this->m_compiledContent += *it;
|
||||
// it ++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
else if (*it == '/')
|
||||
{
|
||||
if (this->peekString ("//", it) == true)
|
||||
@ -441,13 +425,12 @@ namespace WallpaperEngine::Render::Shaders
|
||||
if (this->m_error == false)
|
||||
{
|
||||
// check if the name is a translated one or not
|
||||
this->m_compiledContent += this->lookupReplaceSymbol (name);
|
||||
this->m_compiledContent += name;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_error = false;
|
||||
this->m_compiledContent += *it;
|
||||
it ++;
|
||||
this->m_compiledContent += *it++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -491,7 +474,10 @@ namespace WallpaperEngine::Render::Shaders
|
||||
|
||||
if (this->m_recursive == false)
|
||||
{
|
||||
std::cout << "======================== COMPILED SHADER " << this->m_file.c_str () << " ========================" << std::endl;
|
||||
if (this->m_type == Type_Vertex)
|
||||
std::cout << "======================== COMPILED VERTEX SHADER " << this->m_file.c_str () << " ========================" << std::endl;
|
||||
else
|
||||
std::cout << "======================== COMPILED FRAGMENT SHADER " << this->m_file.c_str () << " ========================" << std::endl;
|
||||
std::cout << finalCode << std::endl;
|
||||
}
|
||||
|
||||
@ -560,21 +546,21 @@ namespace WallpaperEngine::Render::Shaders
|
||||
if (type == "vec4")
|
||||
{
|
||||
parameter = new Variables::CShaderVariableVector4 (
|
||||
WallpaperEngine::Core::ato3vf (*defvalue)
|
||||
WallpaperEngine::Core::aToVector3 (*defvalue)
|
||||
);
|
||||
}
|
||||
else if (type == "vec3")
|
||||
{
|
||||
parameter = new Variables::CShaderVariableVector3 (
|
||||
constant == this->m_constants.end ()
|
||||
? WallpaperEngine::Core::ato3vf (*defvalue)
|
||||
? WallpaperEngine::Core::aToVector3 (*defvalue)
|
||||
: *(*constant).second->as <CShaderConstantVector3> ()->getValue ()
|
||||
);
|
||||
}
|
||||
else if (type == "vec2")
|
||||
{
|
||||
parameter = new Variables::CShaderVariableVector2 (
|
||||
WallpaperEngine::Core::ato2vf (*defvalue)
|
||||
WallpaperEngine::Core::aToVector2 (*defvalue)
|
||||
);
|
||||
}
|
||||
else if (type == "float")
|
||||
@ -658,16 +644,6 @@ namespace WallpaperEngine::Render::Shaders
|
||||
return this->m_combos;
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> Compiler::sVariableReplacement =
|
||||
{
|
||||
// attribute vec3 a_position
|
||||
{"a_Position", "gl_Vertex.xyz"},
|
||||
// attribute vec2 a_TexCoord
|
||||
{"a_TexCoord", "gl_MultiTexCoord0.xy"},
|
||||
// attribute vec3 a_Normal
|
||||
{"a_Normal", "gl_Normal.xyz"}
|
||||
};
|
||||
|
||||
std::vector<std::string> Compiler::sTypes =
|
||||
{
|
||||
"vec4", "vec3", "vec2", "float", "sampler2D", "mat4"
|
||||
|
@ -31,12 +31,9 @@ namespace WallpaperEngine::Render::Shaders
|
||||
{
|
||||
Type_Vertex = 0,
|
||||
Type_Pixel = 1,
|
||||
Type_Include = 2
|
||||
};
|
||||
|
||||
/**
|
||||
* List of variables to replace when pre-process is performed
|
||||
*/
|
||||
static std::map<std::string, std::string> sVariableReplacement;
|
||||
/**
|
||||
* Types of variables the pre-processor understands
|
||||
*/
|
||||
@ -55,8 +52,8 @@ namespace WallpaperEngine::Render::Shaders
|
||||
* @param recursive Whether the compiler should add base definitions or not
|
||||
*/
|
||||
Compiler (
|
||||
Irrlicht::CContext* context,
|
||||
irr::io::path& file,
|
||||
CContainer* container,
|
||||
std::string filename,
|
||||
Type type,
|
||||
std::map<std::string, int> combos,
|
||||
const std::map<std::string, CShaderConstant*>& constants,
|
||||
@ -174,14 +171,6 @@ namespace WallpaperEngine::Render::Shaders
|
||||
* @return The compiled contents
|
||||
*/
|
||||
std::string lookupShaderFile (std::string filename);
|
||||
/**
|
||||
* Searches for the given symbol in the replace table
|
||||
*
|
||||
* @param symbol The symbol to look for
|
||||
*
|
||||
* @return The symbol it should be replaced with
|
||||
*/
|
||||
std::string lookupReplaceSymbol (std::string symbol);
|
||||
|
||||
/**
|
||||
* @return Whether the character in the current position is a character or not
|
||||
@ -208,7 +197,7 @@ namespace WallpaperEngine::Render::Shaders
|
||||
/**
|
||||
* The shader file this instance is loading
|
||||
*/
|
||||
irr::io::path m_file;
|
||||
std::string m_file;
|
||||
/**
|
||||
* The original file content
|
||||
*/
|
||||
@ -246,8 +235,8 @@ namespace WallpaperEngine::Render::Shaders
|
||||
*/
|
||||
bool m_recursive;
|
||||
/**
|
||||
* The irrlicht context in use
|
||||
* The container to load files from
|
||||
*/
|
||||
Irrlicht::CContext* m_context;
|
||||
CContainer* m_container;
|
||||
};
|
||||
}
|
||||
|
@ -4,23 +4,23 @@
|
||||
|
||||
using namespace WallpaperEngine::Render::Shaders::Variables;
|
||||
|
||||
CShaderVariableVector2::CShaderVariableVector2 (const irr::core::vector2df& defaultValue) :
|
||||
CShaderVariableVector2::CShaderVariableVector2 (const glm::vec2& defaultValue) :
|
||||
m_defaultValue (defaultValue),
|
||||
m_value (irr::core::vector2df ()),
|
||||
m_value (glm::vec2 ()),
|
||||
CShaderVariable (&this->m_defaultValue, nullptr, Type)
|
||||
{
|
||||
}
|
||||
|
||||
CShaderVariableVector2::CShaderVariableVector2 (const irr::core::vector2df& defaultValue, std::string name) :
|
||||
CShaderVariableVector2::CShaderVariableVector2 (const glm::vec2& defaultValue, std::string name) :
|
||||
m_defaultValue (defaultValue),
|
||||
m_value (irr::core::vector2df ()),
|
||||
m_value (glm::vec2 ()),
|
||||
CShaderVariable (&this->m_defaultValue, nullptr, Type)
|
||||
{
|
||||
this->setName (std::move(name));
|
||||
}
|
||||
|
||||
|
||||
void CShaderVariableVector2::setValue (const irr::core::vector2df& value)
|
||||
void CShaderVariableVector2::setValue (const glm::vec2& value)
|
||||
{
|
||||
this->m_value = value;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
#include <glm/vec2.hpp>
|
||||
|
||||
#include "WallpaperEngine/Render/Shaders/Variables/CShaderVariable.h"
|
||||
|
||||
@ -9,17 +10,17 @@ namespace WallpaperEngine::Render::Shaders::Variables
|
||||
class CShaderVariableVector2 : public CShaderVariable
|
||||
{
|
||||
public:
|
||||
explicit CShaderVariableVector2 (const irr::core::vector2df& defaultValue);
|
||||
CShaderVariableVector2 (const irr::core::vector2df& defaultValue, std::string name);
|
||||
explicit CShaderVariableVector2 (const glm::vec2& defaultValue);
|
||||
CShaderVariableVector2 (const glm::vec2& defaultValue, std::string name);
|
||||
|
||||
const int getSize () const override;
|
||||
|
||||
void setValue (const irr::core::vector2df& value);
|
||||
void setValue (const glm::vec2& value);
|
||||
|
||||
static const std::string Type;
|
||||
|
||||
private:
|
||||
irr::core::vector2df m_defaultValue;
|
||||
irr::core::vector2df m_value;
|
||||
glm::vec2 m_defaultValue;
|
||||
glm::vec2 m_value;
|
||||
};
|
||||
}
|
||||
|
@ -2,22 +2,22 @@
|
||||
|
||||
using namespace WallpaperEngine::Render::Shaders::Variables;
|
||||
|
||||
CShaderVariableVector3::CShaderVariableVector3 (const irr::core::vector3df& defaultValue) :
|
||||
CShaderVariableVector3::CShaderVariableVector3 (const glm::vec3& defaultValue) :
|
||||
m_defaultValue (defaultValue),
|
||||
m_value (irr::core::vector3df ()),
|
||||
m_value (glm::vec3 ()),
|
||||
CShaderVariable (&this->m_defaultValue, nullptr, Type)
|
||||
{
|
||||
}
|
||||
|
||||
CShaderVariableVector3::CShaderVariableVector3 (const irr::core::vector3df& defaultValue, std::string name) :
|
||||
CShaderVariableVector3::CShaderVariableVector3 (const glm::vec3& defaultValue, std::string name) :
|
||||
m_defaultValue (defaultValue),
|
||||
m_value (irr::core::vector3df ()),
|
||||
m_value (glm::vec3 ()),
|
||||
CShaderVariable (&this->m_defaultValue, nullptr, Type)
|
||||
{
|
||||
this->setName (name);
|
||||
}
|
||||
|
||||
void CShaderVariableVector3::setValue (const irr::core::vector3df& value)
|
||||
void CShaderVariableVector3::setValue (const glm::vec3& value)
|
||||
{
|
||||
this->m_value = value;
|
||||
CShaderVariable::setValue (&this->m_value);
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
#include <glm/vec3.hpp>
|
||||
|
||||
#include "WallpaperEngine/Render/Shaders/Variables/CShaderVariable.h"
|
||||
|
||||
@ -9,17 +10,17 @@ namespace WallpaperEngine::Render::Shaders::Variables
|
||||
class CShaderVariableVector3 : public CShaderVariable
|
||||
{
|
||||
public:
|
||||
explicit CShaderVariableVector3 (const irr::core::vector3df& defaultValue);
|
||||
CShaderVariableVector3 (const irr::core::vector3df& defaultValue, std::string name);
|
||||
explicit CShaderVariableVector3 (const glm::vec3& defaultValue);
|
||||
CShaderVariableVector3 (const glm::vec3& defaultValue, std::string name);
|
||||
|
||||
const int getSize () const override;
|
||||
|
||||
void setValue (const irr::core::vector3df& value);
|
||||
void setValue (const glm::vec3& value);
|
||||
|
||||
static const std::string Type;
|
||||
|
||||
private:
|
||||
irr::core::vector3df m_defaultValue;
|
||||
irr::core::vector3df m_value;
|
||||
glm::vec3 m_defaultValue;
|
||||
glm::vec3 m_value;
|
||||
};
|
||||
}
|
||||
|
@ -4,22 +4,22 @@
|
||||
|
||||
using namespace WallpaperEngine::Render::Shaders::Variables;
|
||||
|
||||
CShaderVariableVector4::CShaderVariableVector4 (const irr::core::vector3df& defaultValue) :
|
||||
CShaderVariableVector4::CShaderVariableVector4 (const glm::vec3& defaultValue) :
|
||||
m_defaultValue (defaultValue),
|
||||
m_value (irr::core::vector3df ()),
|
||||
m_value (glm::vec3 ()),
|
||||
CShaderVariable (&this->m_defaultValue, nullptr, Type)
|
||||
{
|
||||
}
|
||||
|
||||
CShaderVariableVector4::CShaderVariableVector4 (const irr::core::vector3df& defaultValue, std::string name) :
|
||||
CShaderVariableVector4::CShaderVariableVector4 (const glm::vec3& defaultValue, std::string name) :
|
||||
m_defaultValue (defaultValue),
|
||||
m_value (irr::core::vector3df ()),
|
||||
m_value (glm::vec3 ()),
|
||||
CShaderVariable (&this->m_defaultValue, nullptr, Type)
|
||||
{
|
||||
this->setName (std::move(name));
|
||||
}
|
||||
|
||||
void CShaderVariableVector4::setValue (const irr::core::vector3df& value)
|
||||
void CShaderVariableVector4::setValue (const glm::vec3& value)
|
||||
{
|
||||
this->m_value = value;
|
||||
CShaderVariable::setValue (&this->m_value);
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <irrlicht/irrlicht.h>
|
||||
#include <glm/vec3.hpp>
|
||||
|
||||
#include "WallpaperEngine/Render/Shaders/Variables/CShaderVariable.h"
|
||||
|
||||
@ -9,17 +10,17 @@ namespace WallpaperEngine::Render::Shaders::Variables
|
||||
class CShaderVariableVector4 : public CShaderVariable
|
||||
{
|
||||
public:
|
||||
explicit CShaderVariableVector4 (const irr::core::vector3df& defaultValue);
|
||||
CShaderVariableVector4 (const irr::core::vector3df& defaultValue, std::string name);
|
||||
explicit CShaderVariableVector4 (const glm::vec3& defaultValue);
|
||||
CShaderVariableVector4 (const glm::vec3& defaultValue, std::string name);
|
||||
|
||||
const int getSize () const override;
|
||||
|
||||
void setValue (const irr::core::vector3df& value);
|
||||
void setValue (const glm::vec3& value);
|
||||
|
||||
static const std::string Type;
|
||||
|
||||
private:
|
||||
irr::core::vector3df m_defaultValue;
|
||||
irr::core::vector3df m_value;
|
||||
glm::vec3 m_defaultValue;
|
||||
glm::vec3 m_value;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user