diff options
| author | 2020-10-27 19:38:53 -0400 | |
|---|---|---|
| committer | 2020-10-27 19:38:53 -0400 | |
| commit | 99c22028164d423377a37873572cb1654756591f (patch) | |
| tree | 43cd168018fa9f0d40089f0a611f43b6869ae082 /src/objects | |
| parent | 3c5f029889db977dae80455144d8a473d369a395 (diff) | |
| download | mauri-99c22028164d423377a37873572cb1654756591f.tar.gz mauri-99c22028164d423377a37873572cb1654756591f.tar.bz2 mauri-99c22028164d423377a37873572cb1654756591f.zip | |
add write to file, finish gifs, gl fixes
Diffstat (limited to 'src/objects')
| -rw-r--r-- | src/objects/model.cc | 1 | ||||
| -rw-r--r-- | src/objects/object.cc | 6 | ||||
| -rw-r--r-- | src/objects/object.h | 2 | ||||
| -rw-r--r-- | src/objects/pass.cc | 27 | ||||
| -rw-r--r-- | src/objects/pass.h | 4 | ||||
| -rw-r--r-- | src/objects/scene.cc | 4 |
6 files changed, 35 insertions, 9 deletions
diff --git a/src/objects/model.cc b/src/objects/model.cc index 68aa04b..7fac34b 100644 --- a/src/objects/model.cc +++ b/src/objects/model.cc @@ -4,6 +4,7 @@ #include "objects/material.h" #include "objects/model.h" +#include "objects/pass.h" using namespace Mauri; diff --git a/src/objects/object.cc b/src/objects/object.cc index a0e4485..ab6d7d1 100644 --- a/src/objects/object.cc +++ b/src/objects/object.cc @@ -160,9 +160,11 @@ void Object::load(Engine *engine) ortho = glm::ortho(-size[0], size[0], -size[1], size[1], 0.f, 1.f); - gl_object = new RenderObject(OBJECT, size[0], size[1]); gl_uv_object = new RenderObject(UV_SCALE, size[0], size[1]); + gl_object = new RenderObject(OBJECT, size[0], size[1]); + gl_object_flipped = new RenderObject(OBJECT_FLIPPED, size[0], size[1]); + if (image != nullptr) { image->load(engine, this); @@ -206,7 +208,7 @@ void Object::draw(Engine *engine) { for (auto &dep : deps) { - engine->scene->get_object_by_id(dep)->draw(engine); + //engine->scene->get_object_by_id(dep)->draw(engine); } #if FRAME_STEP diff --git a/src/objects/object.h b/src/objects/object.h index 5ca7702..138c6e0 100644 --- a/src/objects/object.h +++ b/src/objects/object.h @@ -48,7 +48,9 @@ class Object mat4x4 model; RenderObject *gl_uv_object = nullptr; + RenderObject *gl_object = nullptr; + RenderObject *gl_object_flipped = nullptr; s32 color_blend_mode; diff --git a/src/objects/pass.cc b/src/objects/pass.cc index 2301321..00a5eae 100644 --- a/src/objects/pass.cc +++ b/src/objects/pass.cc @@ -78,6 +78,13 @@ Pass::Pass(Parser &p, json &root, PassStage stage) auto _textures = root["textures"]; + /* + if (_textures.is_array()) + { + textures.fill("null"); + } + */ + for (int i = 0; i < _textures.size(); i++) { auto texture = _textures[i]; @@ -197,7 +204,7 @@ RenderPass::RenderPass(Engine *engine, Pass *pass) shader = new Shader(engine->parser, pass->shader); - for (int i = 0; i < MAX_TEXTURES; i++) + for (int i = 0; i < shader->texture_count; i++) { if (!shader->textures[i].empty()) { @@ -296,7 +303,14 @@ RenderPass::RenderPass(Engine *engine, Pass *pass) else if (combine) { model = &pass->object->model; - robject = pass->object->gl_uv_object; + if (textures[0]->is_gif) + { + robject = pass->object->gl_object_flipped; + } + else + { + robject = pass->object->gl_uv_object; + } } // The object with UV's that scale the texture @@ -305,7 +319,14 @@ RenderPass::RenderPass(Engine *engine, Pass *pass) else { model = &pass->object->ortho; - robject = pass->object->gl_uv_object; + if (textures[0]->is_gif) + { + robject = pass->object->gl_object_flipped; + } + else + { + robject = pass->object->gl_uv_object; + } } } else diff --git a/src/objects/pass.h b/src/objects/pass.h index 75e5563..ad645bf 100644 --- a/src/objects/pass.h +++ b/src/objects/pass.h @@ -81,6 +81,8 @@ class RenderPass Shader *shader = nullptr; + std::array<Texture *, MAX_TEXTURES> textures = {0}; + void draw(Engine *engine); private: @@ -93,8 +95,6 @@ class RenderPass mat4x4 *model; RenderObject *robject; - - std::array<Texture *, MAX_TEXTURES> textures = {0}; }; } // namespace Mauri diff --git a/src/objects/scene.cc b/src/objects/scene.cc index 97b9f58..b39921c 100644 --- a/src/objects/scene.cc +++ b/src/objects/scene.cc @@ -75,8 +75,8 @@ void Scene::draw(Engine *engine) { for (auto &object : objects) { - if (object->loaded_as_dep) - continue; + //if (object->loaded_as_dep) + // continue; object->draw(engine); } } |