summaryrefslogtreecommitdiff
path: root/src/objects
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2022-07-21 22:02:57 -0400
committerAndrew Opalach <andrew@akon.city> 2022-07-21 22:02:57 -0400
commit908e17ee1f85472237aae329f8605a985841a4e8 (patch)
tree860564f2856af5c7cacdde3e1c40066c362dea19 /src/objects
parent61794ae259000f1d0e463577d750f9d5ea45ac71 (diff)
downloadmauri-908e17ee1f85472237aae329f8605a985841a4e8.tar.gz
mauri-908e17ee1f85472237aae329f8605a985841a4e8.tar.bz2
mauri-908e17ee1f85472237aae329f8605a985841a4e8.zip
temporary fix for new assets, major cleanup
Diffstat (limited to 'src/objects')
-rw-r--r--src/objects/effect.cc7
-rw-r--r--src/objects/effect.h9
-rw-r--r--src/objects/material.cc14
-rw-r--r--src/objects/material.h6
-rw-r--r--src/objects/model.cc12
-rw-r--r--src/objects/model.h8
-rw-r--r--src/objects/object.cc23
-rw-r--r--src/objects/object.h8
-rw-r--r--src/objects/pass.cc42
-rw-r--r--src/objects/pass.h16
-rw-r--r--src/objects/scene.cc17
-rw-r--r--src/objects/scene.h20
12 files changed, 70 insertions, 112 deletions
diff --git a/src/objects/effect.cc b/src/objects/effect.cc
index 8e61964..9257061 100644
--- a/src/objects/effect.cc
+++ b/src/objects/effect.cc
@@ -5,10 +5,7 @@
#include "effect.h"
#include "object.h"
-
-#include "objects/pass.h"
-
-#include <glm/fwd.hpp>
+#include "pass.h"
using namespace Mauri;
@@ -55,7 +52,7 @@ void Effect::load(Engine *engine, Object *object, bool last)
u32 index = 0;
- for (u32 i = 0; i < passes1.size(); i++)
+ for (auto i = 0u; i < passes1.size(); i++)
{
Pass pass;
diff --git a/src/objects/effect.h b/src/objects/effect.h
index 840830b..8be54e7 100644
--- a/src/objects/effect.h
+++ b/src/objects/effect.h
@@ -1,11 +1,9 @@
#ifndef _EFFECT_H
#define _EFFECT_H
-#include <vector>
-
-#include "engine.h"
-#include "texture.h"
-#include "util.h"
+#include "../util.h"
+#include "../engine.h"
+#include "../texture.h"
namespace Mauri
{
@@ -34,7 +32,6 @@ class Effect
std::vector<RenderPass *> passes;
-
void load(Engine *engine, Object *object, bool last);
void draw(Engine *engine);
diff --git a/src/objects/material.cc b/src/objects/material.cc
index aae5940..b99b918 100644
--- a/src/objects/material.cc
+++ b/src/objects/material.cc
@@ -1,11 +1,11 @@
-#include "assets.h"
-#include "engine.h"
-#include "json.h"
-#include "log.h"
+#include "../assets.h"
+#include "../engine.h"
+#include "../json.h"
+#include "../log.h"
-#include "objects/material.h"
-#include "objects/object.h"
-#include "objects/pass.h"
+#include "material.h"
+#include "object.h"
+#include "pass.h"
using namespace Mauri;
diff --git a/src/objects/material.h b/src/objects/material.h
index 11a2c46..5bc7c3a 100644
--- a/src/objects/material.h
+++ b/src/objects/material.h
@@ -1,10 +1,8 @@
#ifndef _MATERIAL_H
#define _MATERIAL_H
-#include <iostream>
-
-#include "json.h"
-#include "engine.h"
+#include "../json.h"
+#include "../engine.h"
namespace Mauri
{
diff --git a/src/objects/model.cc b/src/objects/model.cc
index 7fac34b..8af3224 100644
--- a/src/objects/model.cc
+++ b/src/objects/model.cc
@@ -1,10 +1,10 @@
-#include "assets.h"
-#include "json.h"
-#include "log.h"
+#include "../assets.h"
+#include "../json.h"
+#include "../log.h"
-#include "objects/material.h"
-#include "objects/model.h"
-#include "objects/pass.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 243de1f..a9b2b01 100644
--- a/src/objects/model.h
+++ b/src/objects/model.h
@@ -1,12 +1,10 @@
#ifndef _MODEL_H
#define _MODEL_H
-#include <iostream>
+#include "../engine.h"
+#include "../json.h"
-#include "engine.h"
-#include "json.h"
-
-#include "objects/material.h"
+#include "material.h"
namespace Mauri
{
diff --git a/src/objects/object.cc b/src/objects/object.cc
index bc744d1..4c7273b 100644
--- a/src/objects/object.cc
+++ b/src/objects/object.cc
@@ -1,21 +1,12 @@
-#include <cstdlib>
-#include <forward_list>
-#include <glm/fwd.hpp>
-#include <glm/trigonometric.hpp>
-
-#include <glm/ext/matrix_transform.hpp>
-#include <glm/glm.hpp>
-#include <glm/gtc/type_ptr.hpp>
-
#include "../gl.h"
#include "../json.h"
#include "../log.h"
-#include "objects/effect.h"
-#include "objects/model.h"
-#include "objects/object.h"
-#include "objects/scene.h"
-#include "objects/pass.h"
+#include "effect.h"
+#include "model.h"
+#include "object.h"
+#include "scene.h"
+#include "pass.h"
using namespace Mauri;
@@ -31,13 +22,13 @@ Object::Object(Parser &p, json &root)
// object or are repeated. This could be handled be sorting objects
// on the scene in order of deps but I'm not sure if that would
// break other things.
- std::vector<int>::const_iterator it = deps.begin();
+ std::vector<s32>::const_iterator it = deps.begin();
while (it != deps.end())
{
bool remove = false;
- if (*it == id)
+ if ((u32)(*it) == id)
{
remove = true;
}
diff --git a/src/objects/object.h b/src/objects/object.h
index eb8ad5a..d4a31a5 100644
--- a/src/objects/object.h
+++ b/src/objects/object.h
@@ -1,14 +1,10 @@
#ifndef _OBJECT_H
#define _OBJECT_H
-#include <glm/glm.hpp>
-
#include "../engine.h"
-#include "effect.h"
#include "model.h"
-
-using namespace glm;
+#include "effect.h"
namespace Mauri
{
@@ -35,7 +31,7 @@ class Object
bool visible;
- std::vector<int> deps;
+ std::vector<s32> deps;
bool passthrough = false;
bool fullscreen = false;
diff --git a/src/objects/pass.cc b/src/objects/pass.cc
index e938823..db5084a 100644
--- a/src/objects/pass.cc
+++ b/src/objects/pass.cc
@@ -1,23 +1,15 @@
-#include <cstdio>
-#include <glm/fwd.hpp>
-#include <glm/gtc/type_ptr.hpp>
-#include <stdint.h>
-#include <thread>
-#include <type_traits>
+#include "../assets.h"
+#include "../engine.h"
+#include "../gl.h"
+#include "../json.h"
+#include "../shader.h"
+#include "../texture.h"
-#include "assets.h"
-#include "engine.h"
-#include "gl.h"
-#include "json.h"
-#include "shader.h"
-#include "json.h"
-#include "texture.h"
-
-#include "objects/pass.h"
-#include "objects/material.h"
-#include "objects/model.h"
-#include "objects/object.h"
-#include "objects/scene.h"
+#include "pass.h"
+#include "material.h"
+#include "model.h"
+#include "object.h"
+#include "scene.h"
using namespace Mauri;
@@ -83,7 +75,7 @@ Pass::Pass(Parser &p, json &root, PassStage stage)
auto _textures = root["textures"];
- for (int i = 0; i < _textures.size(); i++)
+ for (auto i = 0u; i < _textures.size(); i++)
{
auto texture = _textures[i];
if (texture.is_string())
@@ -102,7 +94,7 @@ void Pass::load(Engine *engine, PassStage stage, Pass *pass)
{
intermidiate = true;
- for (int i = 0; i < MAX_TEXTURES; i++)
+ for (auto i = 0; i < MAX_TEXTURES; i++)
{
if (textures[i].empty())
continue;
@@ -132,7 +124,7 @@ void Pass::load(Engine *engine, PassStage stage, Pass *pass)
if (!pass->target.empty())
pass->target.append(pass->effect->buffer_id);
- for (int i = 0; i < MAX_TEXTURES; i++)
+ for (auto i = 0; i < MAX_TEXTURES; i++)
{
if (binds[i].empty())
continue;
@@ -194,7 +186,7 @@ RenderPass::RenderPass(Engine *engine, Pass *pass)
shader = new Shader(engine->parser, pass->shader);
- for (int i = 0; i < shader->texture_count; i++)
+ for (auto i = 0u; i < shader->texture_count; i++)
{
if (!shader->textures[i].empty())
{
@@ -361,7 +353,7 @@ void RenderPass::draw(Engine *engine)
_target->buffer->bind();
- for (int i = 0; i < shader->texture_count; i++)
+ for (auto i = 0u; i < shader->texture_count; i++)
{
if (texture_types[i] == PREVIOUS)
{
@@ -393,7 +385,7 @@ void RenderPass::draw(Engine *engine)
#if FRAME_STEP
_target->buffer->blit(0, context()->width, context()->height);
context()->swap_buffers();
- std::this_thread::sleep_for(std::chrono::seconds(2));
+ std::this_thread::sleep_for(std::chrono::seconds(1));
#endif
break;
diff --git a/src/objects/pass.h b/src/objects/pass.h
index c8d8d0e..d2806d9 100644
--- a/src/objects/pass.h
+++ b/src/objects/pass.h
@@ -1,16 +1,14 @@
#ifndef _PASS_H
#define _PASS_H
-#include <glm/glm.hpp>
+#include "../json.h"
+#include "../context.h"
+#include "../engine.h"
+#include "../gl.h"
+#include "../shader.h"
+#include "../texture.h"
-#include "json.h"
-#include "context.h"
-#include "engine.h"
-#include "gl.h"
-#include "shader.h"
-#include "texture.h"
-
-#include "objects/object.h"
+#include "object.h"
#define MAX_TEXTURES 8
diff --git a/src/objects/scene.cc b/src/objects/scene.cc
index 97b9f58..9bdc86c 100644
--- a/src/objects/scene.cc
+++ b/src/objects/scene.cc
@@ -1,13 +1,10 @@
-#include <istream>
-#include <sstream>
+#include "../assets.h"
+#include "../json.h"
+#include "../log.h"
+#include "../util.h"
-#include "assets.h"
-#include "json.h"
-#include "log.h"
-#include "util.h"
-
-#include "objects/scene.h"
-#include "objects/pass.h"
+#include "scene.h"
+#include "pass.h"
using namespace Mauri;
@@ -17,7 +14,7 @@ Scene::Scene(Parser &p, const std::string &path)
if (asset->type == ASSET_VOID)
{
- log_error("err: failed to open scene.json");
+ log_error("%s", "failed to open scene.json");
return;
}
diff --git a/src/objects/scene.h b/src/objects/scene.h
index 5c2b3a0..7dda288 100644
--- a/src/objects/scene.h
+++ b/src/objects/scene.h
@@ -1,17 +1,11 @@
#ifndef _SCENE_H
#define _SCENE_H
-#include <glm/glm.hpp>
+#include "../assets.h"
+#include "../engine.h"
+#include "../json.h"
-#include <vector>
-
-#include "assets.h"
-#include "engine.h"
-
-#include "json.h"
-#include "objects/object.h"
-
-using namespace glm;
+#include "object.h"
namespace Mauri
{
@@ -20,9 +14,9 @@ struct Camera {
vec3 center;
vec3 eye;
vec3 up;
- float farz;
- float nearz;
- float fov;
+ f32 farz;
+ f32 nearz;
+ f32 fov;
};
class Scene