summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NOTES46
-rw-r--r--README.md1
-rw-r--r--TODO70
-rwxr-xr-xattic/line_count.sh (renamed from scripts/line_count.sh)0
-rwxr-xr-xattic/random.sh (renamed from scripts/random.sh)8
-rw-r--r--meson.build19
-rw-r--r--src/assets.cc4
-rw-r--r--src/context.cc1
-rw-r--r--src/context.h2
-rw-r--r--src/context_glfw.cc4
-rw-r--r--src/context_glfw.h1
-rw-r--r--src/context_x11.cc4
-rw-r--r--src/context_x11.h6
-rw-r--r--src/engine.cc1
-rw-r--r--src/engine.h5
-rw-r--r--src/framebuffer.h2
-rw-r--r--src/gl.cc5
-rw-r--r--src/gl.h2
-rw-r--r--src/mauri.cc49
-rw-r--r--src/objects/effect.cc8
-rw-r--r--src/objects/effect.h1
-rw-r--r--src/objects/material.cc8
-rw-r--r--src/objects/model.cc6
-rw-r--r--src/objects/model.h3
-rw-r--r--src/objects/object.cc10
-rw-r--r--src/objects/object.h2
-rw-r--r--src/objects/pass.cc9
-rw-r--r--src/objects/pass.h7
-rw-r--r--src/objects/scene.cc6
-rw-r--r--src/objects/scene.h4
-rw-r--r--src/shader.cc4
-rw-r--r--src/shader.h3
-rw-r--r--src/texture.cc6
-rw-r--r--src/texture.h2
-rw-r--r--src/util.h2
-rw-r--r--src/visualizer.cc3
36 files changed, 95 insertions, 219 deletions
diff --git a/NOTES b/NOTES
new file mode 100644
index 0000000..227110d
--- /dev/null
+++ b/NOTES
@@ -0,0 +1,46 @@
+I haven't touched the actual wallpaper engine implementation of this project in years...
+if I had the motivation to continue working on a project like this, I would probably
+start from scratch. I could have made much better use of available reverse engineering
+tools (mainly renderdoc) to avoid the tons of trial and error that produced the convoluted
+logic contained in this code.
+
+TODO:
+[ ] make gl_enabled toggleable in code (i.e. toggleable at runtime)
+[ ] objects with blendmode other than 0 have extra pass using blendpassthrough shader
+[ ] more acurate visualizer
+
+Not Implemented:
+[ ] mouse paralax
+[ ] camera shake
+[ ] particles
+[ ] javascript scripting
+And much, much more...
+
+Known Issues:
+./mauri ../../../c/workshop_wallpapers/1703298496/scene.pkg
+ - xray only works in the middle
+
+./mauri ../../../c/workshop_wallpapers/2212570435/scene.pkg
+ - eyes not positioned correctly
+
+./mauri ../../../c/workshop_wallpapers/1829251189/scene.pkg
+ - xray is flipped/flickering
+
+./mauri ../../../c/workshop_wallpapers/2216609166/scene.pkg
+ - left side not drawing?
+
+./mauri ../../../c/workshop_wallpapers/2178257725/scene.pkg
+ - rotate breaks it
+
+./mauri ../../../c/workshop_wallpapers/1938288759/scene.pkg
+ - visualizer not drawn correctly
+
+./mauri ../../../c/workshop_wallpapers/2157658616/scene.pkg
+ - parse error
+
+./mauri ../../../c/workshop_wallpapers/1778616550/scene.pkg
+ - first object has different blendmode, so we need to handle "combine" passes differently.
+ The final pass should draw to the objects framebuffer as well as to the combine buffer,
+ but using the "passthroughblend" shader.
+
+And many others that either crash or are completely broken. \ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..c63ea70
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+# marui: Wallpaper Engine Implementation (for Linux)
diff --git a/TODO b/TODO
deleted file mode 100644
index 7a2aa97..0000000
--- a/TODO
+++ /dev/null
@@ -1,70 +0,0 @@
-decent looking:
- - 1574428821
- - 1457581889
- - 2086821449
-
-[ ] make gl_enabled toggleable in code (i.e. toggleable at runtime)
-
-[ ] cleanup pass on non-objects (asset, texture, shader, etc)
-
-[ ] objects with blendmode other than 0 have extra pass using blendpassthrough shader
-
-[ ] really analyze the structue of a pass/object and try to simplify the code
- - verify if the model/robject order is correct (renderdoc)
-
-[ ] more acurate visualizer
-
-[x] gifs
- - https://github.com/notscuffed/repkg/blob/master/RePKG.Application/Texture/TexFrameInfoContainerReader.cs
- - still kinda broken tho...
-
-Broken:
-[ ] ./mauri ../../../c/workshop_wallpapers/1703298496/scene.pkg
- - xray only works in the middle
-
-[X] ./mauri ../../../c/workshop_wallpapers/2048972911/scene.pkg
- - black background
-
-[ ] ./mauri ../../../c/workshop_wallpapers/2212570435/scene.pkg
- - eyes not positioned correctly
-
-[ ] ./mauri ../../../c/workshop_wallpapers/1829251189/scene.pkg
- - xray is flipped/flickering
-
-[ ] ./mauri ../../../c/workshop_wallpapers/2216609166/scene.pkg
- - left side not draw?
-
-[ ] ./mauri ../../../c/workshop_wallpapers/2178257725/scene.pkg
- - rotate breaks it
-
-[ ] ./mauri ../../../c/workshop_wallpapers/1938288759/scene.pkg
- - visualizer not drawn correctly
-
-[ ] ./mauri ../../../c/workshop_wallpapers/2157658616/scene.pkg
- - parse error
-
-[ ] ./mauri ../../../c/workshop_wallpapers/1778616550/scene.pkg
- - first object has different blendmode, so we need to handle "combine" passes differently.
- The final pass should draw to the objects framebuffer as well as to the combine buffer,
- but using the "passthroughblend" shader.
-
-[X] ./mauri ../../../c/workshop_wallpapers/2008251577/scene.pkg
- - effect doesnt draw correctly
- - It was because of incorrect GL_TEXTURE_WRAP
- - should analyze this in renderdoc
-
-[X] if version 2 is defined as a combo, g_Alpha and g_Color need to be set from the object
- visible should be a draw time check not handled when parsing
-
-[ ] mouse paralax
-[ ] camera shake
-
-// long term
-
-[ ] separate gui and engine in mauri
- - engine should be a shared library
- - there should be a cli interface along with gui
-
-[ ] javascript scripting
-
-[ ] particles
diff --git a/scripts/line_count.sh b/attic/line_count.sh
index dbc74af..dbc74af 100755
--- a/scripts/line_count.sh
+++ b/attic/line_count.sh
diff --git a/scripts/random.sh b/attic/random.sh
index 446a4a4..f6cb285 100755
--- a/scripts/random.sh
+++ b/attic/random.sh
@@ -1,9 +1,7 @@
#!/bin/bash
-#cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
-
-WALLPAPERS_PATH=workshop_wallpapers_11-8-21
-BUILD_DIR=build-release
+BUILD_DIR=build-release2
+WALLPAPERS_PATH=workshop_wallpapers_3-12-23
export mesa_glthread=true
@@ -22,7 +20,7 @@ then
[[ "$RES" == 'null' || "$RES" != '"Everyone"' ]] || break
done
else
- DIR=$(find $WALLPAPERS_PATH -maxdepth 1 -type d | shuf -n 1)
+ DIR=$(find $WALLPAPERS_PATH -maxdepth 1 -type d | shuf -n 1)
fi
echo $DIR
diff --git a/meson.build b/meson.build
index 09ffb93..eb8d1fa 100644
--- a/meson.build
+++ b/meson.build
@@ -1,15 +1,10 @@
-project('mauri', 'cpp',
- version: '0.1',
+project('mauri', 'cpp', version: '0.12',
default_options: ['warning_level=3', 'cpp_std=c++20'])
if get_option('buildtype').startswith('debug')
add_project_arguments('-D_DEBUG_', language: 'cpp')
endif
-compiler = meson.get_compiler('cpp')
-
-cmake = import('cmake')
-
if host_machine.system() == 'linux'
add_project_arguments('-Wno-sign-compare', language: 'cpp')
add_project_arguments('-Wno-unused-parameter', language: 'cpp')
@@ -18,9 +13,12 @@ if host_machine.system() == 'linux'
add_project_arguments('-Wno-non-virtual-dtor', language: 'cpp')
endif
+compiler = meson.get_compiler('cpp')
+cmake = import('cmake')
+
mauri_src = [
- 'src/assets.cc',
'src/mauri.cc',
+ 'src/assets.cc',
'src/util.cc',
'src/gl.cc',
'src/shader.cc',
@@ -78,14 +76,9 @@ endif
if get_option('audio')
gstreamer = dependency('gstreamer-1.0', required: true)
fftw3 = dependency('fftw3', required: true)
-
mauri_src += 'src/visualizer.cc'
mauri_deps += [gstreamer, fftw3]
-
add_project_arguments('-DBUILD_AUDIO', language: 'cpp')
endif
-executable('mauri', mauri_src,
- dependencies: mauri_deps,
- install: true
-)
+executable('mauri', mauri_src, dependencies: mauri_deps, install: true)
diff --git a/src/assets.cc b/src/assets.cc
index de9d802..d48cffd 100644
--- a/src/assets.cc
+++ b/src/assets.cc
@@ -2,10 +2,8 @@
#include <fstream>
#include <iostream>
-#include "assets.h"
-#include "log.h"
-#include "util.h"
#include "texture.h"
+#include "assets.h"
namespace Mauri
{
diff --git a/src/context.cc b/src/context.cc
index 32952f9..f40790f 100644
--- a/src/context.cc
+++ b/src/context.cc
@@ -1,5 +1,4 @@
#include "context.h"
-#include "log.h"
namespace Mauri {
diff --git a/src/context.h b/src/context.h
index a726f56..bc824b6 100644
--- a/src/context.h
+++ b/src/context.h
@@ -1,8 +1,8 @@
#ifndef _CONTEXT_H
#define _CONTEXT_H
-#include <glad/gl.h>
#include <iostream>
+#include <glad/gl.h>
#include "util.h"
diff --git a/src/context_glfw.cc b/src/context_glfw.cc
index 63594eb..c4f7d17 100644
--- a/src/context_glfw.cc
+++ b/src/context_glfw.cc
@@ -1,8 +1,4 @@
#include "context_glfw.h"
-#include "context.h"
-#include "log.h"
-
-#include "objects/pass.h"
using namespace Mauri;
diff --git a/src/context_glfw.h b/src/context_glfw.h
index 34f2f96..3d11775 100644
--- a/src/context_glfw.h
+++ b/src/context_glfw.h
@@ -5,7 +5,6 @@
#include <GLFW/glfw3.h>
#include "context.h"
-#include "util.h"
namespace Mauri
{
diff --git a/src/context_x11.cc b/src/context_x11.cc
index 3f36aae..a35a9f2 100644
--- a/src/context_x11.cc
+++ b/src/context_x11.cc
@@ -1,9 +1,5 @@
#include "context_x11.h"
-#include "context.h"
-#include "engine.h"
-#include "log.h"
-
using namespace Mauri;
static Atom ATOM_WM_DELETE_WINDOW, ATOM__NET_ACTIVE_WINDOW;
diff --git a/src/context_x11.h b/src/context_x11.h
index b10cb37..7e4a5a8 100644
--- a/src/context_x11.h
+++ b/src/context_x11.h
@@ -1,8 +1,6 @@
#ifndef _CONTEXT_X11_H
#define _CONTEXT_X11_H
-#include "context.h"
-
#include <chrono>
#include <X11/Xlib.h>
@@ -11,9 +9,9 @@
#include <X11/extensions/shape.h>
#include <glad/gl.h>
-
#include <GL/glx.h>
-#include <GL/glu.h>
+
+#include "context.h"
#define XWIN_ALL_DESKTOPS 0xFFFFFFFF
diff --git a/src/engine.cc b/src/engine.cc
index 29d77f9..d6e597b 100644
--- a/src/engine.cc
+++ b/src/engine.cc
@@ -1,5 +1,6 @@
#include <thread>
+#include "context.h"
#include "engine.h"
#include "objects/object.h"
diff --git a/src/engine.h b/src/engine.h
index 214321c..95b92ab 100644
--- a/src/engine.h
+++ b/src/engine.h
@@ -1,11 +1,8 @@
#ifndef _ENGINE_H
#define _ENGINE_H
-#include "context.h"
-#include "gl.h"
-#include "shader.h"
-#include "texture.h"
#include "framebuffer.h"
+#include "shader.h"
#ifdef BUILD_AUDIO
#include "visualizer.h"
diff --git a/src/framebuffer.h b/src/framebuffer.h
index 3d1051f..9b373fa 100644
--- a/src/framebuffer.h
+++ b/src/framebuffer.h
@@ -1,8 +1,8 @@
#ifndef _FRAMEBUFFER_H
#define _FRAMEBUFFER_H
-#include "texture.h"
#include "gl.h"
+#include "texture.h"
namespace Mauri
{
diff --git a/src/gl.cc b/src/gl.cc
index 4dffb08..c45d641 100644
--- a/src/gl.cc
+++ b/src/gl.cc
@@ -1,10 +1,7 @@
-#include <glad/gl.h>
-
-#include "gl.h"
#include "log.h"
#include "texture.h"
-#include "util.h"
#include "context.h"
+#include "gl.h"
using namespace Mauri;
diff --git a/src/gl.h b/src/gl.h
index 7a5fc07..3ee6ab6 100644
--- a/src/gl.h
+++ b/src/gl.h
@@ -1,6 +1,8 @@
#ifndef _GL_H
#define _GL_H
+#include <glad/gl.h>
+
#include "util.h"
namespace Mauri
diff --git a/src/mauri.cc b/src/mauri.cc
index 3c9533f..330daa9 100644
--- a/src/mauri.cc
+++ b/src/mauri.cc
@@ -1,12 +1,8 @@
#include "assets.h"
#include "engine.h"
-#include "gl.h"
-#include "json.h"
-#include "util.h"
#include "context.h"
#include "context_null.h"
-#include <math.h>
#ifdef BUILD_GLFW
#include "context_glfw.h"
@@ -20,11 +16,20 @@
using namespace Mauri;
-static std::string scene_path = "scene.json";
+static const std::string scene_path = "scene.json";
s32 main(s32 argc, char *argv[])
{
- //srand(time(NULL));
+ if (argc != 2)
+ {
+ printf("Usage: %s <path_to_scene.pkg>\n", argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if (!asset_manager()->load_package(std::string(argv[1])))
+ {
+ return EXIT_FAILURE;
+ }
#ifdef BUILD_AUDIO
gst_init(&argc, &argv);
@@ -32,37 +37,23 @@ s32 main(s32 argc, char *argv[])
set_context(new ContextGLFW(1920, 1080, "mauri", false));
//set_context(new ContextX11(1920, 1080, "mauri", false));
- //set_context(new ContextGLFW(2560, 1440, "mauri", false));
- //set_context(new ContextX11(2560, 1440, "mauri", true));
//set_context(new ContextNull(1920, 1080, "mauri", false));
- if (argc == 2)
- {
- if (!asset_manager()->load_package(std::string(argv[1])))
- {
- set_context(nullptr);
- return 1;
- }
+ Parser parser;
+ Scene *scene = new Scene(parser, scene_path);
+ //context()->resize_window(scene->width, scene->height);
+ Engine *engine = new Engine(scene, &parser, true);
- Parser parser;
+ //asset_manager()->write_files("./output");
- Scene *scene = new Scene(parser, scene_path);
+ engine->run();
- //context()->resize_window(scene->width / 1.75, scene->height / 1.75);
- //context()->resize_window(scene->width, scene->height);
-
- Engine engine(scene, &parser, true);
-
- //asset_manager()->write_files("./output");
-
- engine.run();
-
- delete scene;
- }
+ delete scene;
+ delete engine;
asset_manager()->unload_package();
set_context(nullptr);
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/src/objects/effect.cc b/src/objects/effect.cc
index 9257061..72d9e7e 100644
--- a/src/objects/effect.cc
+++ b/src/objects/effect.cc
@@ -1,11 +1,5 @@
-#include "../assets.h"
-#include "../engine.h"
-#include "../json.h"
-#include "../log.h"
-
-#include "effect.h"
-#include "object.h"
#include "pass.h"
+#include "effect.h"
using namespace Mauri;
diff --git a/src/objects/effect.h b/src/objects/effect.h
index 8be54e7..558396b 100644
--- a/src/objects/effect.h
+++ b/src/objects/effect.h
@@ -2,6 +2,7 @@
#define _EFFECT_H
#include "../util.h"
+#include "../json.h"
#include "../engine.h"
#include "../texture.h"
diff --git a/src/objects/material.cc b/src/objects/material.cc
index b99b918..0957214 100644
--- a/src/objects/material.cc
+++ b/src/objects/material.cc
@@ -1,11 +1,5 @@
-#include "../assets.h"
-#include "../engine.h"
-#include "../json.h"
-#include "../log.h"
-
-#include "material.h"
-#include "object.h"
#include "pass.h"
+#include "material.h"
using namespace Mauri;
diff --git a/src/objects/model.cc b/src/objects/model.cc
index 8af3224..1517b23 100644
--- a/src/objects/model.cc
+++ b/src/objects/model.cc
@@ -1,10 +1,4 @@
-#include "../assets.h"
-#include "../json.h"
-#include "../log.h"
-
-#include "material.h"
#include "model.h"
-#include "pass.h"
using namespace Mauri;
diff --git a/src/objects/model.h b/src/objects/model.h
index a9b2b01..0d5b313 100644
--- a/src/objects/model.h
+++ b/src/objects/model.h
@@ -1,9 +1,6 @@
#ifndef _MODEL_H
#define _MODEL_H
-#include "../engine.h"
-#include "../json.h"
-
#include "material.h"
namespace Mauri
diff --git a/src/objects/object.cc b/src/objects/object.cc
index 833620a..73a16b3 100644
--- a/src/objects/object.cc
+++ b/src/objects/object.cc
@@ -1,12 +1,6 @@
-#include "../gl.h"
-#include "../json.h"
-#include "../log.h"
-
-#include "effect.h"
-#include "model.h"
-#include "object.h"
-#include "scene.h"
#include "pass.h"
+#include "scene.h"
+#include "object.h"
using namespace Mauri;
diff --git a/src/objects/object.h b/src/objects/object.h
index 37b8bce..1a79c6c 100644
--- a/src/objects/object.h
+++ b/src/objects/object.h
@@ -1,8 +1,6 @@
#ifndef _OBJECT_H
#define _OBJECT_H
-#include "../engine.h"
-
#include "model.h"
#include "effect.h"
diff --git a/src/objects/pass.cc b/src/objects/pass.cc
index 12d2cda..e6a9bfa 100644
--- a/src/objects/pass.cc
+++ b/src/objects/pass.cc
@@ -1,17 +1,8 @@
#include <thread>
-#include "../assets.h"
-#include "../engine.h"
#include "../gl.h"
-#include "../json.h"
-#include "../shader.h"
-#include "../texture.h"
#include "pass.h"
-#include "material.h"
-#include "model.h"
-#include "object.h"
-#include "scene.h"
using namespace Mauri;
diff --git a/src/objects/pass.h b/src/objects/pass.h
index d2806d9..97348a3 100644
--- a/src/objects/pass.h
+++ b/src/objects/pass.h
@@ -1,13 +1,6 @@
#ifndef _PASS_H
#define _PASS_H
-#include "../json.h"
-#include "../context.h"
-#include "../engine.h"
-#include "../gl.h"
-#include "../shader.h"
-#include "../texture.h"
-
#include "object.h"
#define MAX_TEXTURES 8
diff --git a/src/objects/scene.cc b/src/objects/scene.cc
index 6df5e02..8331b15 100644
--- a/src/objects/scene.cc
+++ b/src/objects/scene.cc
@@ -1,10 +1,4 @@
-#include "../assets.h"
-#include "../json.h"
-#include "../log.h"
-#include "../util.h"
-
#include "scene.h"
-#include "pass.h"
using namespace Mauri;
diff --git a/src/objects/scene.h b/src/objects/scene.h
index 8f13f3a..672df96 100644
--- a/src/objects/scene.h
+++ b/src/objects/scene.h
@@ -1,10 +1,6 @@
#ifndef _SCENE_H
#define _SCENE_H
-#include "../assets.h"
-#include "../engine.h"
-#include "../json.h"
-
#include "object.h"
namespace Mauri
diff --git a/src/shader.cc b/src/shader.cc
index 4862bb6..45c3e3e 100644
--- a/src/shader.cc
+++ b/src/shader.cc
@@ -1,10 +1,6 @@
#include <sstream>
#include <regex>
-#include "assets.h"
-#include "gl.h"
-#include "json.h"
-#include "log.h"
#include "shader.h"
#include "objects/object.h"
diff --git a/src/shader.h b/src/shader.h
index 1d41be7..593ffa2 100644
--- a/src/shader.h
+++ b/src/shader.h
@@ -1,9 +1,8 @@
#ifndef _SHADER_H
#define _SHADER_H
-#include "gl.h"
-#include "texture.h"
#include "json.h"
+#include "texture.h"
#define MAX_TEXTURES 8
diff --git a/src/texture.cc b/src/texture.cc
index 8016034..0cc2699 100644
--- a/src/texture.cc
+++ b/src/texture.cc
@@ -5,15 +5,9 @@
#include <stb_image_write.h>
#include <s3tc.h>
-#include <glad/gl.h>
#include <lz4.h>
-#include "assets.h"
-#include "engine.h"
-#include "gl.h"
-#include "log.h"
#include "texture.h"
-#include "util.h"
using namespace Mauri;
diff --git a/src/texture.h b/src/texture.h
index 8c5477a..cf6491d 100644
--- a/src/texture.h
+++ b/src/texture.h
@@ -1,9 +1,9 @@
#ifndef _TEXTURE_H
#define _TEXTURE_H
-#include "assets.h"
#include "gl.h"
#include "util.h"
+#include "assets.h"
namespace Mauri
{
diff --git a/src/util.h b/src/util.h
index c38569d..3b88745 100644
--- a/src/util.h
+++ b/src/util.h
@@ -6,6 +6,8 @@
#include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp>
+#include "log.h"
+
using namespace nlohmann;
using namespace glm;
diff --git a/src/visualizer.cc b/src/visualizer.cc
index ddffde2..8ef34d0 100644
--- a/src/visualizer.cc
+++ b/src/visualizer.cc
@@ -1,11 +1,8 @@
#include <cmath>
-#include "log.h"
#include "assets.h"
#include "visualizer.h"
-#include "objects/material.h"
-
using namespace Mauri;
static const float gausian_array[] = {.242, .399, .242};