summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2023-07-15 01:16:04 -0400
committerAndrew Opalach <andrew@akon.city> 2023-07-15 01:16:04 -0400
commitf1a9751af6cc6aa0bac91e7f28fc43b1a4cb64fd (patch)
treee9660e27896c00d7a6d57123c172b8574e1e07b6 /src
parentaec7b72a146f489ec1947b4915b9ade6bfc19340 (diff)
downloadmauri-f1a9751af6cc6aa0bac91e7f28fc43b1a4cb64fd.tar.gz
mauri-f1a9751af6cc6aa0bac91e7f28fc43b1a4cb64fd.tar.bz2
mauri-f1a9751af6cc6aa0bac91e7f28fc43b1a4cb64fd.zip
cleanup, finalize notes, add README.md
Diffstat (limited to 'src')
-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
30 files changed, 39 insertions, 131 deletions
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};