diff options
| author | 2020-10-01 05:24:29 -0400 | |
|---|---|---|
| committer | 2020-10-01 05:24:29 -0400 | |
| commit | 5e981cd004ac092f35588ebdc4e58e03131296b3 (patch) | |
| tree | 8dcb262db78fdc5a3a7cde627a7f73f2f34f7c79 /src/objects | |
| parent | 4c200513158ad0b974cda961deffe6192830ecae (diff) | |
| download | mauri-5e981cd004ac092f35588ebdc4e58e03131296b3.tar.gz mauri-5e981cd004ac092f35588ebdc4e58e03131296b3.tar.bz2 mauri-5e981cd004ac092f35588ebdc4e58e03131296b3.zip | |
cleanup 'todo' usage
Diffstat (limited to 'src/objects')
| -rw-r--r-- | src/objects/effect.cc | 32 | ||||
| -rw-r--r-- | src/objects/material.cc | 6 | ||||
| -rw-r--r-- | src/objects/model.cc | 14 | ||||
| -rw-r--r-- | src/objects/object.cc | 120 | ||||
| -rw-r--r-- | src/objects/pass.cc | 170 | ||||
| -rw-r--r-- | src/objects/scene.cc | 57 | ||||
| -rw-r--r-- | src/objects/scene.h | 21 |
7 files changed, 197 insertions, 223 deletions
diff --git a/src/objects/effect.cc b/src/objects/effect.cc index 7f22ef0..cde37e6 100644 --- a/src/objects/effect.cc +++ b/src/objects/effect.cc @@ -18,13 +18,13 @@ using namespace Mauri; Effect::Effect(Json::Value root) { - this->id = root["id"].asInt(); + id = root["id"].asInt(); - this->visible = json_user_value(root.get("visible", true)).asBool(); + visible = json_user_value(root.get("visible", true)).asBool(); for (auto &pass0 : root["passes"]) { - this->passes0.emplace_back(new Pass(pass0, EFFECT0_PASS)); + passes0.emplace_back(new Pass(pass0, EFFECT0_PASS)); } auto asset = asset_manager()->get_file(root["file"].asString(), NONE); @@ -34,43 +34,43 @@ Effect::Effect(Json::Value root) Json::Value file = asset->as_json(); - this->name = file["name"].asString(); + name = file["name"].asString(); for (auto &pass1 : file["passes"]) { - this->passes1.emplace_back(new Pass(pass1, EFFECT1_PASS)); + passes1.emplace_back(new Pass(pass1, EFFECT1_PASS)); } for (auto &fbo : file["fbos"]) { - this->fbos.emplace_back((EffectBuffer) { fbo["name"].asString(), fbo["scale"].asFloat() }); + fbos.emplace_back((EffectBuffer) { fbo["name"].asString(), fbo["scale"].asFloat() }); } } void Effect::load(Engine *engine, Object *object, bool last_effect) { - if (!this->visible) + if (!visible) return; - this->buffer_id = fmt::format("{}_{}", this->id, object->id); + buffer_id = fmt::format("{}_{}", id, object->id); - for (auto &fbo : this->fbos) + for (auto &fbo : fbos) { - fbo.name.append(this->buffer_id); + fbo.name.append(buffer_id); engine->new_framebuffer(fbo.name, object->size[0], object->size[1], fbo.scale); } - for (int i = 0; i < this->passes0.size(); i++) + for (int i = 0; i < passes0.size(); i++) { Pass *pass = new Pass(); - pass->combine = (i == (this->passes0.size() - 1)) && last_effect; + pass->combine = (i == (passes0.size() - 1)) && last_effect; pass->object = object; pass->effect = this; - this->passes0[i]->load(EFFECT0_PASS, pass); - this->passes1[i]->load(EFFECT1_PASS, pass); + passes0[i]->load(EFFECT0_PASS, pass); + passes1[i]->load(EFFECT1_PASS, pass); object->passes.push_back(pass); } @@ -78,12 +78,12 @@ void Effect::load(Engine *engine, Object *object, bool last_effect) Effect::~Effect() { - for (auto &pass0 : this->passes0) + for (auto &pass0 : passes0) { delete pass0; } - for (auto &pass1 : this->passes1) + for (auto &pass1 : passes1) { delete pass1; } diff --git a/src/objects/material.cc b/src/objects/material.cc index 4c61cbc..59ac759 100644 --- a/src/objects/material.cc +++ b/src/objects/material.cc @@ -25,13 +25,13 @@ Material::Material(std::string path) for (auto &pass : root["passes"]) { - this->passes0.push_back(new Pass(pass, MATERIAL_PASS)); + passes0.push_back(new Pass(pass, MATERIAL_PASS)); } } void Material::load(Object *object, MaterialType type, Pass *pass, bool no_effects) { - for (auto &pass0 : this->passes0) + for (auto &pass0 : passes0) { switch (type) { @@ -57,7 +57,7 @@ void Material::load(Object *object, MaterialType type, Pass *pass, bool no_effec Material::~Material() { - for (auto &pass0 : this->passes0) + for (auto &pass0 : passes0) { delete pass0; } diff --git a/src/objects/model.cc b/src/objects/model.cc index 59c1cb3..322c188 100644 --- a/src/objects/model.cc +++ b/src/objects/model.cc @@ -21,20 +21,20 @@ Model::Model(std::string path) Json::Value root = asset->as_json(); - this->autosize = root.get("autosize", true).asBool(); - this->fullscreen = root.get("fullscreen", false).asBool(); - this->passthrough = root.get("passthrough", false).asBool(); + autosize = root.get("autosize", true).asBool(); + fullscreen = root.get("fullscreen", false).asBool(); + passthrough = root.get("passthrough", false).asBool(); - this->material = new Material(root["material"].asString()); + material = new Material(root["material"].asString()); } void Model::load(Object *object, bool no_effects) { - this->material->load(object, MATERIAL_MODEL, NULL, no_effects); + material->load(object, MATERIAL_MODEL, NULL, no_effects); } Model::~Model() { - if (this->material != nullptr) - delete this->material; + if (material != nullptr) + delete material; } diff --git a/src/objects/object.cc b/src/objects/object.cc index a356637..6cc775f 100644 --- a/src/objects/object.cc +++ b/src/objects/object.cc @@ -21,105 +21,105 @@ using namespace Mauri; Object::Object(Json::Value root) { - this->id = root["id"].asInt(); - this->name = root["name"].asString(); + id = root["id"].asInt(); + name = root["name"].asString(); for (auto &id : root["dependencies"]) - this->deps.push_back(id.asInt()); + deps.push_back(id.asInt()); - sscanf_vec3(json_user_value(root.get("angles", "")).asCString(), this->angles); - sscanf_vec3(json_user_value(root.get("colors", "")).asCString(), this->color); - sscanf_vec2(json_user_value(root.get("size", "")).asCString(), this->size); - sscanf_vec3(json_user_value(root.get("scale", "")).asCString(), this->scale); - sscanf_vec3(json_user_value(root.get("origin", "")).asCString(), this->origin); + sscanf_vec3(json_user_value(root.get("angles", "")).asCString(), angles); + sscanf_vec3(json_user_value(root.get("colors", "")).asCString(), color); + sscanf_vec2(json_user_value(root.get("size", "")).asCString(), size); + sscanf_vec3(json_user_value(root.get("scale", "")).asCString(), scale); + sscanf_vec3(json_user_value(root.get("origin", "")).asCString(), origin); - this->color_blend_mode = (BlendMode)root.get("colorblendmode", 0).asInt(); + color_blend_mode = (BlendMode)root.get("colorblendmode", 0).asInt(); - this->visible = json_user_value(root.get("visible", true)).asBool(); + visible = json_user_value(root.get("visible", true)).asBool(); auto _image = root["image"]; if (!_image.isNull()) - this->image = new Model(_image.asString()); + image = new Model(_image.asString()); auto config = root["config"]; if (!config.isNull()) - this->passthrough = config.get("passthrough", false).asBool(); + passthrough = config.get("passthrough", false).asBool(); for (auto &effect : root["effects"]) { - this->effects.emplace_back(new Effect(effect)); + effects.emplace_back(new Effect(effect)); } } void Object::get_model(f32 width, f32 height, bool flip) { - this->model = mat4x4(1.f); + model = mat4x4(1.f); - this->model = glm::translate(this->model, (vec3){-width, -height, 0.f}); - this->model = glm::translate(this->model, this->origin * 2.f); + model = glm::translate(model, (vec3){-width, -height, 0.f}); + model = glm::translate(model, origin * 2.f); - this->model = glm::rotate(this->model, this->angles[0], (vec3){1.f, 0.f, 0.f}); - this->model = glm::rotate(this->model, this->angles[1], (vec3){0.f, 1.f, 0.f}); - this->model = glm::rotate(this->model, this->angles[2], (vec3){0.f, 0.f, 1.f}); + model = glm::rotate(model, angles[0], (vec3){1.f, 0.f, 0.f}); + model = glm::rotate(model, angles[1], (vec3){0.f, 1.f, 0.f}); + model = glm::rotate(model, angles[2], (vec3){0.f, 0.f, 1.f}); - this->model = glm::scale(this->model, this->scale); + model = glm::scale(model, scale); mat4x4 _ortho = glm::ortho(-width, width, height, -height, 0.f, 1.f); if (flip) { - this->model = glm::scale(this->model, (vec3){1.f, -1.f, 1.f}); + model = glm::scale(model, (vec3){1.f, -1.f, 1.f}); } - this->model = _ortho * this->model; + model = _ortho * model; } void Object::load(Engine *engine) { - if (this->loaded || !this->visible) + if (loaded || !visible) return; - f32 width = this->size[0]; - f32 height = this->size[1]; + f32 width = size[0]; + f32 height = size[1]; - this->abuffer = fmt::format("_rt_imageLayerComposite_{}_a", this->id); - this->bbuffer = fmt::format("_rt_imageLayerComposite_{}_b", this->id); + abuffer = fmt::format("_rt_imageLayerComposite_{}_a", this->id); + bbuffer = fmt::format("_rt_imageLayerComposite_{}_b", this->id); - engine->new_framebuffer(this->abuffer, width, height, 1.f); - engine->new_framebuffer(this->bbuffer, width, height, 1.f); + engine->new_framebuffer(abuffer, width, height, 1.f); + engine->new_framebuffer(bbuffer, width, height, 1.f); - this->get_model(engine->view.width, engine->view.height, this->effects.size() == 0); + get_model(engine->view.width, engine->view.height, effects.size() == 0); - this->ortho = glm::ortho(-width, width, -height, height, 0.f, 1.f); + ortho = glm::ortho(-width, width, -height, height, 0.f, 1.f); - this->gl_object = new RenderObject(OBJECT, width, height); - this->gl_uv_object = new RenderObject(UV_SCALE, width, height); + gl_object = new RenderObject(OBJECT, width, height); + gl_uv_object = new RenderObject(UV_SCALE, width, height); - if (this->image) + if (image != nullptr) { - this->image->load(this, this->effects.size() == 0); + image->load(this, effects.size() == 0); - if (this->image->fullscreen) + if (image->fullscreen) { - this->fullscreen = true; - this->size[0] = engine->view.width; - this->size[1] = engine->view.height; - this->origin[0] = this->size[0] / 2.f; - this->origin[1] = this->size[1] / 2.f; + fullscreen = true; + size[0] = engine->view.width; + size[1] = engine->view.height; + origin[0] = size[0] / 2.f; + origin[1] = size[1] / 2.f; } - if (this->image->passthrough) - this->passthrough = true; + if (image->passthrough) + passthrough = true; } - for (int i = 0; i < this->effects.size(); i++) + for (int i = 0; i < effects.size(); i++) { - this->effects[i]->load(engine, this, i == (this->effects.size() - 1)); + effects[i]->load(engine, this, i == (effects.size() - 1)); } - this->loaded = true; + loaded = true; } void Object::update(Engine *engine) @@ -131,10 +131,10 @@ void Object::update(Engine *engine) void Object::draw(Engine *engine) { - if (!this->visible) + if (!visible) return; - for (auto &pass : this->passes) + for (auto &pass : passes) { pass->draw(engine); } @@ -142,32 +142,26 @@ void Object::draw(Engine *engine) std::string Object::get_target_buffer() const { - if (this->buffer_switch) - return this->abuffer; - else - return this->bbuffer; + return (buffer_switch) ? abuffer : bbuffer; } std::string Object::get_texture_buffer() const { - if (this->buffer_switch) - return this->bbuffer; - else - return this->abuffer; + return (buffer_switch) ? bbuffer : abuffer; } Object::~Object() { - if (this->image != nullptr) - delete this->image; + if (image != nullptr) + delete image; - if (this->gl_object != nullptr) - delete this->gl_object; + if (gl_object != nullptr) + delete gl_object; - if (this->gl_uv_object != nullptr) - delete this->gl_uv_object; + if (gl_uv_object != nullptr) + delete gl_uv_object; - for (auto &effect : this->effects) + for (auto &effect : effects) { delete effect; } diff --git a/src/objects/pass.cc b/src/objects/pass.cc index 7825602..cb3a3c0 100644 --- a/src/objects/pass.cc +++ b/src/objects/pass.cc @@ -24,69 +24,69 @@ Pass::Pass(Json::Value root, PassStage stage) switch (stage) { case EFFECT0_PASS: { - auto uniforms = root["constantshadervalues"]; + auto shader_values = root["constantshadervalues"]; - for (auto &name : uniforms.getMemberNames()) + for (auto &name : shader_values.getMemberNames()) { auto uniform = Uniform(); uniform.name = name; - json_number(json_user_value(uniforms[name]), + json_number(json_user_value(shader_values[name]), glm::value_ptr(uniform.value)); - this->uniforms.push_back(uniform); + uniforms.push_back(uniform); } break; } case EFFECT1_PASS: { - auto material = root["material"]; + auto pass_material = root["material"]; - if (material.isString()) - this->material = new Material(material.asString()); + if (pass_material.isString()) + material = new Material(pass_material.asString()); - this->target = root.get("target", "previous").asString(); + target = root.get("target", "previous").asString(); for (auto &bind : root["bind"]) { auto index = bind["index"].asInt(); - this->binds[index] = bind["name"].asString(); + binds[index] = bind["name"].asString(); } break; } case MATERIAL_ONLY_PASS: - this->target = "previous"; + target = "previous"; [[fallthrough]]; case MATERIAL_PASS: { - this->shader = root["shader"].asString(); + shader = root["shader"].asString(); - auto blend = root.get("blending", "normal").asString(); + auto blending = root.get("blending", "normal").asString(); - if (blend == "normal") - this->blend = NORMAL; - else if (blend == "translucent") - this->blend = TRANSLUCENT; + if (blending == "normal") + blend = NORMAL; + else if (blending == "translucent") + blend = TRANSLUCENT; break; } } - auto _textures = root["textures"]; + auto pass_textures = root["textures"]; - for (int i = 0; i < textures.size(); i++) + for (int i = 0; i < pass_textures.size(); i++) { - auto texture = _textures[i]; + auto texture = pass_textures[i]; if (texture.isString()) - this->textures[i] = texture.asString(); + textures[i] = texture.asString(); } - auto _combos = root["combos"]; + auto pass_combos = root["combos"]; - for (auto &name : _combos.getMemberNames()) + for (auto &name : pass_combos.getMemberNames()) { - this->combos.emplace_back((Combo){name, _combos[name].asInt()}); + combos.emplace_back((Combo){name, pass_combos[name].asInt()}); } } @@ -94,13 +94,13 @@ void Pass::load(PassStage stage, Pass *pass) { for (int i = 0; i < 8; i++) { - if (this->textures[i].empty()) + if (textures[i].empty()) continue; - pass->textures[i] = this->textures[i]; + pass->textures[i] = textures[i]; } - for (auto &combo : this->combos) + for (auto &combo : combos) { pass->combos.push_back(combo); } @@ -108,13 +108,13 @@ void Pass::load(PassStage stage, Pass *pass) switch (stage) { case EFFECT0_PASS: - for (auto &uniform : this->uniforms) + for (auto &uniform : uniforms) { pass->uniforms.push_back(uniform); } break; case EFFECT1_PASS: - pass->target = this->target; + pass->target = target; if (pass->target == "previous") { @@ -130,20 +130,20 @@ void Pass::load(PassStage stage, Pass *pass) for (int i = 0; i < 8; i++) { - if (this->binds[i].empty()) + if (binds[i].empty()) continue; - if (this->binds[i] == "previous") + if (binds[i] == "previous") pass->textures[i] = pass->object->get_texture_buffer(); else - pass->textures[i] = this->binds[i] + pass->effect->buffer_id; + pass->textures[i] = binds[i] + pass->effect->buffer_id; } - if (this->target == "previous") + if (target == "previous") pass->object->swap_buffer(); - if (this->material != nullptr) - this->material->load(pass->object, MATERIAL_EFFECT, pass, false); + if (material != nullptr) + material->load(pass->object, MATERIAL_EFFECT, pass, false); break; case MATERIAL_ONLY_PASS: @@ -156,36 +156,36 @@ void Pass::load(PassStage stage, Pass *pass) } [[fallthrough]]; case MATERIAL_PASS: - pass->shader = this->shader; + pass->shader = shader; break; } } void Pass::generate_pass(Engine *engine) { - this->rpass = new RenderPass(); + rpass = new RenderPass(); - this->rpass->combine = this->combine; - this->rpass->combine_blend = this->object->color_blend_mode; + rpass->combine = combine; + rpass->combine_blend = object->color_blend_mode; - this->rpass->shader = new Shader(this->shader); + rpass->shader = new Shader(shader); - auto rshader = this->rpass->shader; + auto rshader = rpass->shader; for (int i = 0; i < 8; i++) { - if (this->textures[i].empty() && !rshader->textures[i].empty()) - this->textures[i] = rshader->textures[i]; + if (textures[i].empty() && !rshader->textures[i].empty()) + textures[i] = rshader->textures[i]; - if (this->textures[i].empty()) + if (textures[i].empty()) continue; - auto asset = asset_manager()->get_file(this->textures[i], TEXTURE); + auto asset = asset_manager()->get_file(textures[i], TEXTURE); if (asset->type != ASSET_VOID) - this->rpass->textures[i] = new Texture(asset); + rpass->textures[i] = new Texture(asset); else - this->rpass->textures[i] = engine->get_framebuffer_texture(this->textures[i]); + rpass->textures[i] = engine->get_framebuffer_texture(textures[i]); } for (auto &uniform : rshader->uniforms) @@ -196,12 +196,12 @@ void Pass::generate_pass(Engine *engine) uniform.uname.compare(10, 10, "Resolution") == 0) { auto index = uniform.uname[9] - '0'; - if (this->rpass->textures[index] != nullptr) - uniform.value = this->rpass->textures[index]->texture_resolution; + if (rpass->textures[index] != nullptr) + uniform.value = rpass->textures[index]->texture_resolution; } } - for (auto &pass_uniform : this->uniforms) + for (auto &pass_uniform : uniforms) { for (auto &shader_uniform : rshader->uniforms) { @@ -224,7 +224,7 @@ void Pass::generate_pass(Engine *engine) } } - for (auto &pass_combo : this->combos) + for (auto &pass_combo : combos) { auto add = true; for (auto &shader_combo : rshader->combos) @@ -240,69 +240,69 @@ void Pass::generate_pass(Engine *engine) rshader->combos.push_back(pass_combo); } - this->rpass->shader->compile(); + rpass->shader->compile(); - this->rpass->target = engine->get_framebuffer(this->target); + rpass->target = engine->get_framebuffer(target); - if (this->effect == nullptr) + if (effect == nullptr) { - if (this->object->passthrough || this->combine) - this->rpass->model = &this->object->model; + if (object->passthrough || combine) + rpass->model = &object->model; else - this->rpass->model = &this->object->ortho; + rpass->model = &object->ortho; - if (this->object->passthrough) - this->rpass->robject = this->object->gl_object; + if (object->passthrough) + rpass->robject = object->gl_object; else - this->rpass->robject = this->object->gl_uv_object; + rpass->robject = object->gl_uv_object; } else { - if (this->combine) + if (combine) { - this->rpass->robject = this->object->gl_object; - this->rpass->model = &this->object->model; + rpass->robject = object->gl_object; + rpass->model = &object->model; } else { - this->rpass->robject = engine->default_object; - this->rpass->model = &engine->identity; + rpass->robject = engine->default_object; + rpass->model = &engine->identity; } } } void Pass::draw(Engine *engine) { - if (this->rpass != nullptr) - this->rpass->draw(engine); + if (rpass != nullptr) + rpass->draw(engine); } Pass::~Pass() { - if (this->material != nullptr) - delete this->material; + if (material != nullptr) + delete material; - if (this->rpass != nullptr) - delete this->rpass; + if (rpass != nullptr) + delete rpass; } void RenderPass::draw(Engine *engine) { - this->target->buffer->bind(); - this->shader->bind(engine, this->model); + target->buffer->bind(); + shader->bind(engine, model); - this->robject->bind(); + robject->bind(); - for (int i = 0; i < this->shader->texture_count; i++) + for (int i = 0; i < shader->texture_count; i++) { - if (this->textures[i] != nullptr) - this->textures[i]->bind(i); + if (textures[i] != nullptr) + textures[i]->bind(i); } BlendMode blend; - if (this->combine) - blend = this->combine_blend; + if (combine) + blend = combine_blend; else blend = NORMAL; @@ -318,15 +318,15 @@ void RenderPass::draw(Engine *engine) break; } - if (this->combine) + if (combine) engine->view.center_scale(engine->context->width, engine->context->height); else - engine->view.default_viewport(this->target->buffer->width, this->target->buffer->height); + engine->view.default_viewport(target->buffer->width, target->buffer->height); glDrawArrays(GL_TRIANGLES, 0, 6); #if 0 - engine->combine_buffer->buffer->blit(this->context->width, this->context->height); + engine->combine_buffer->buffer->blit(context->width, context->height); engine->context->swap_buffers(); std::this_thread::sleep_for(std::chrono::seconds(1)); #endif @@ -334,13 +334,13 @@ void RenderPass::draw(Engine *engine) RenderPass::~RenderPass() { - if (this->shader != nullptr) - delete this->shader; + if (shader != nullptr) + delete shader; for (int i = 0; i < 8; i++) { - if (this->textures[i] != nullptr && !this->textures[i]->wrapped) - delete this->textures[i]; + if (textures[i] != nullptr && !textures[i]->wrapped) + delete textures[i]; } } diff --git a/src/objects/scene.cc b/src/objects/scene.cc index 5c00147..2bedb54 100644 --- a/src/objects/scene.cc +++ b/src/objects/scene.cc @@ -26,28 +26,28 @@ Scene::Scene(std::string path) auto camera = root["camera"]; auto general = root["general"]; auto ortho = general["orthogonalprojection"]; + + sscanf_vec3(json_user_value(camera.get("center", "")).asCString(), cam.center); + sscanf_vec3(json_user_value(camera.get("eye", "")).asCString(), cam.eye); + sscanf_vec3(json_user_value(camera.get("up", "")).asCString(), cam.up); - sscanf_vec3(json_user_value(camera.get("center", "")).asCString(), this->camera.center); - sscanf_vec3(json_user_value(camera.get("eye", "")).asCString(), this->camera.eye); - sscanf_vec3(json_user_value(camera.get("up", "")).asCString(), this->camera.up); + clear_enabled = general.get("clearenabled", true).asBool(); - this->clear_enabled = general.get("clearenabled", false).asBool(); + sscanf_vec3(json_user_value(general.get("clearcolor", "")).asCString(), clear_color); + clear_color[3] = 1.f; - sscanf_vec3(json_user_value(general.get("clearcolor", "")).asCString(), this->clear_color); - this->clear_color[3] = 1.f; - - this->width = json_user_value(ortho.get("width", 0.f)).asFloat(); - this->height = json_user_value(ortho.get("height", 0.f)).asFloat(); + width = json_user_value(ortho.get("width", 0.f)).asFloat(); + height = json_user_value(ortho.get("height", 0.f)).asFloat(); for (auto &object : root["objects"]) { - this->objects.emplace_back(new Object(object)); + objects.emplace_back(new Object(object)); } } Object *Scene::get_object_by_id(u32 id) { - for (auto &object : this->objects) + for (auto &object : objects) { if (object->id == id) { @@ -60,14 +60,14 @@ Object *Scene::get_object_by_id(u32 id) void Scene::load(Engine *engine) { - engine->view.width = this->width; - engine->view.height = this->height; + engine->view.width = width; + engine->view.height = height; - for (auto &object : this->objects) + for (auto &object : objects) { for (auto &dep : object->deps) { - auto dep_object = this->get_object_by_id(dep); + auto dep_object = get_object_by_id(dep); if (dep_object) dep_object->load(engine); } @@ -75,7 +75,7 @@ void Scene::load(Engine *engine) object->load(engine); } - for (auto &object : this->objects) + for (auto &object : objects) { for (auto &pass : object->passes) pass->generate_pass(engine); @@ -84,7 +84,7 @@ void Scene::load(Engine *engine) void Scene::draw(Engine *engine) { - for (auto &object : this->objects) + for (auto &object : objects) { object->draw(engine); } @@ -92,29 +92,8 @@ void Scene::draw(Engine *engine) Scene::~Scene() { - for (auto &object : this->objects) + for (auto &object : objects) { delete object; } } - -s32 Scene::estimated_buffer_count() -{ - return 0; -// s32 total = 0; -// -// for (auto &object : this->objects) -// { -// for (auto &effect : object->effects) -// { -// for (auto &pass1 : effect->passes1) -// { -// if (!pass1->target.empty()) -// total++; -// } -// } -// total += 2; -// } -// -// return total; -} diff --git a/src/objects/scene.h b/src/objects/scene.h index 47aa19a..2f6f210 100644 --- a/src/objects/scene.h +++ b/src/objects/scene.h @@ -15,6 +15,16 @@ using namespace glm; namespace Mauri { +struct Camera { + vec3 center; + vec3 eye; + vec3 up; + + float farz; + float nearz; + float fov; +}; + class Scene { public: @@ -37,16 +47,7 @@ class Scene std::vector<Object *> objects; private: - struct - { - vec3 center; - vec3 eye; - vec3 up; - - float farz; - float nearz; - float fov; - } camera; + Camera cam; }; } // namespace Mauri |