summaryrefslogtreecommitdiff
path: root/src/objects
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2024-10-19 12:05:15 -0400
committerAndrew Opalach <andrew@akon.city> 2024-10-19 12:13:26 -0400
commit42e8c4d28b6fe9cc5e041f02e0c85b390d49a218 (patch)
tree59080eec3dd79d225bb31fb0f7e646cc22880d39 /src/objects
parent2bb807dd32e1c18a6f1e8f22c25141de3334de9f (diff)
downloadmauri-42e8c4d28b6fe9cc5e041f02e0c85b390d49a218.tar.gz
mauri-42e8c4d28b6fe9cc5e041f02e0c85b390d49a218.tar.bz2
mauri-42e8c4d28b6fe9cc5e041f02e0c85b390d49a218.zip
Attempt to make usable and packageable
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/objects')
-rw-r--r--src/objects/material.cc10
-rw-r--r--src/objects/model.cc2
-rw-r--r--src/objects/model.h2
-rw-r--r--src/objects/pass.cc22
-rw-r--r--src/objects/scene.cc2
5 files changed, 18 insertions, 20 deletions
diff --git a/src/objects/material.cc b/src/objects/material.cc
index 7c36d13..8b582ff 100644
--- a/src/objects/material.cc
+++ b/src/objects/material.cc
@@ -31,11 +31,6 @@ auto Material::load(Engine *engine, Object *object, MaterialType type, Pass *pas
{
switch (type)
{
- case MATERIAL_EFFECT:
- {
- pass0->load(engine, MATERIAL_PASS, pass);
- break;
- }
case MATERIAL_MODEL:
{
Pass model_pass;
@@ -59,6 +54,11 @@ auto Material::load(Engine *engine, Object *object, MaterialType type, Pass *pas
break;
}
+ case MATERIAL_EFFECT:
+ {
+ pass0->load(engine, MATERIAL_PASS, pass);
+ break;
+ }
}
}
}
diff --git a/src/objects/model.cc b/src/objects/model.cc
index f5ce9c4..1eb958d 100644
--- a/src/objects/model.cc
+++ b/src/objects/model.cc
@@ -16,6 +16,8 @@ auto Model::parse(Parser &pr, const std::string &path) -> Model *
pr.map_value<bool>(root, "fullscreen", &model->fullscreen, false);
pr.map_value<bool>(root, "passthrough", &model->passthrough, false);
+ pr.map_value<vec2>(root, "cropoffset", &model->cropoffset, vec2(0.f));
+
pr.map_value<f32>(root, "width", &model->width, 0.f);
pr.map_value<f32>(root, "height", &model->height, 0.f);
diff --git a/src/objects/model.h b/src/objects/model.h
index d000bd7..d34130b 100644
--- a/src/objects/model.h
+++ b/src/objects/model.h
@@ -16,6 +16,8 @@ class Model
bool fullscreen = false;
bool passthrough = false;
+ vec2 cropoffset;
+
f32 width;
f32 height;
diff --git a/src/objects/pass.cc b/src/objects/pass.cc
index a7cfc09..afe7c8a 100644
--- a/src/objects/pass.cc
+++ b/src/objects/pass.cc
@@ -1,4 +1,5 @@
#include "../gl.h"
+#include "../context.h"
#include "pass.h"
@@ -199,10 +200,6 @@ RenderPass::RenderPass(Engine *engine, Pass *pass)
if (this->model && i == 0 && this->textures[0])
{
- if (this->textures[0]->is_gif())
- {
- pass->combos.push_back(Combo("SPRITESHEET", 1));
- }
this->object->create_objects(engine, this->textures[0]);
objects_created = true;
}
@@ -222,7 +219,7 @@ RenderPass::RenderPass(Engine *engine, Pass *pass)
{
// Take value as reference because "uniform_override->value" points
// to the value stored in the parser. This allows changing that value
- // to have an instant effect.
+ // to have an immediate effect.
uniform->value = &uniform_override->value;
break;
}
@@ -276,9 +273,9 @@ RenderPass::RenderPass(Engine *engine, Pass *pass)
#ifdef _DEBUG_
debug("PASS (%s)", this->command == COPY ? "copy" : "draw");
- debug(" object: %s (passthrough: %d, fullscreen %d)", this->object->name.c_str(),
- this->object->passthrough, this->object->fullscreen);
- debug(" visible: %d", this->object->visible);
+ debug(" object: %s (passthrough: %s, fullscreen %s)", this->object->name.c_str(),
+ AL_BOOLSTR(this->object->passthrough), AL_BOOLSTR(this->object->fullscreen));
+ debug(" visible: %s", AL_BOOLSTR(this->object->visible));
debug(" shader: %s", this->shader->origin()->name.c_str());
debug(" target: %s", pass->target.c_str());
debug(" textures (%u):", this->shader->origin()->texture_count);
@@ -287,7 +284,7 @@ RenderPass::RenderPass(Engine *engine, Pass *pass)
switch (this->texture_types[i])
{
case STATIC:
- if (pass->textures[i].empty() && !this->shader->origin()->textures[i].empty())
+ if (!this->shader->origin()->textures[i].empty() && pass->textures[i] == this->shader->origin()->textures[i])
{
debug(" [%u] %s (DEFAULT)", i, this->shader->origin()->textures[i].c_str());
}
@@ -307,8 +304,8 @@ RenderPass::RenderPass(Engine *engine, Pass *pass)
debug(" %s %s %s", uniform_type_to_string(uniform->type).c_str(),
uniform->uname.c_str(), glm::to_string(*uniform->value).c_str());
}
- debug(" model: %d", this->model);
- debug(" combine: %d", this->combine);
+ debug(" model: %s", AL_BOOLSTR(this->model));
+ debug(" combine: %s", AL_BOOLSTR(this->combine));
#endif
}
@@ -343,8 +340,7 @@ auto RenderPass::draw(Engine *engine) -> void
Render::color_mask(1.f, 1.f, 1.f, this->combine ? 0.f : 1.f);
- engine->view.default_viewport(
- adjusted_target->buffer->width, adjusted_target->buffer->height);
+ engine->view.default_viewport(adjusted_target->buffer->width, adjusted_target->buffer->height);
this->render_object->draw();
diff --git a/src/objects/scene.cc b/src/objects/scene.cc
index 832cea6..21a2449 100644
--- a/src/objects/scene.cc
+++ b/src/objects/scene.cc
@@ -57,7 +57,6 @@ auto Scene::get_object_by_id(u32 id) -> Object *
auto Scene::load(Engine *engine) -> void
{
- /*
if (this->objects.size() > 0)
{
for (auto it = this->objects.begin(); it != this->objects.end();)
@@ -66,7 +65,6 @@ auto Scene::load(Engine *engine) -> void
else it++;
}
}
- */
for (Object *object : this->objects)
{