add src/coders/obj

This commit is contained in:
MihailRis
2024-06-22 20:24:35 +03:00
parent a9640fff36
commit e4f9bd03b7
11 changed files with 241 additions and 28 deletions
+11 -15
View File
@@ -7,10 +7,12 @@
#include "../../assets/Assets.hpp"
#include "../../content/Content.hpp"
#include "../../engine.hpp"
#include "../../coders/obj.hpp"
#include "../../frontend/LevelFrontend.hpp"
#include "../../items/Inventory.hpp"
#include "../../items/ItemDef.hpp"
#include "../../items/ItemStack.hpp"
#include "../../files/files.hpp"
#include "../../logic/PlayerController.hpp"
#include "../../maths/FrustumCulling.hpp"
#include "../../maths/voxmaths.hpp"
@@ -70,6 +72,10 @@ WorldRenderer::WorldRenderer(Engine* engine, LevelFrontend* frontend, Player* pl
settings.graphics.skyboxResolution.get(),
assets->getShader("skybox_gen")
);
auto name = "dingus.obj";
auto text = files::read_string(fs::path(name));
model = obj::parse(name, text);
}
WorldRenderer::~WorldRenderer() {
@@ -194,23 +200,13 @@ void WorldRenderer::renderLevel(
drawChunks(level->chunks.get(), camera, shader);
model::Model model {};
auto& mesh = model.addMesh("gui/warning");
mesh.addBox({}, glm::vec3(0.3f));
mesh.addBox({}, glm::vec3(0.6f));
auto& mesh2 = model.addMesh("gui/error");
mesh2.addBox({}, glm::vec3(0.7f));
mesh2.addBox({}, glm::vec3(0.9f));
float timer = static_cast<float>(Window::time());
assets->getTexture("gui/menubg")->bind();
shader->uniformMatrix("u_model", glm::mat4(1.0f));
modelBatch->translate({0, 86, 0});
modelBatch->scale(glm::vec3(glm::sin(timer*6)+1));
modelBatch->rotate(glm::vec3(1, 0, 0), timer);
modelBatch->draw(model);
modelBatch->popMatrix();
modelBatch->translate({0, 85, 0});
//modelBatch->scale(glm::vec3(glm::sin(timer*6)+10));
modelBatch->rotate(glm::vec3(0, 1, 0), timer*6);
modelBatch->draw(*model);
//modelBatch->popMatrix();
modelBatch->popMatrix();
modelBatch->popMatrix();