From 4da7be39827ea5888ef9c97b1aadf61b0d76347c Mon Sep 17 00:00:00 2001 From: Silas Bartha Date: Fri, 7 Feb 2025 11:27:18 -0500 Subject: initial commit (lol) --- mons_3d/src/model.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 mons_3d/src/model.c (limited to 'mons_3d/src/model.c') diff --git a/mons_3d/src/model.c b/mons_3d/src/model.c new file mode 100644 index 0000000..ed2e543 --- /dev/null +++ b/mons_3d/src/model.c @@ -0,0 +1,15 @@ +#include "model.h" +#include "texture.h" +#include "camera.h" +#include + +void mons_model_draw(mons_model model) { + glUseProgram(model.shader); + mons_shader_apply_global_uniforms(model.shader); + mons_shader_set_mat4(model.shader, "transform", mons_transform_matrix(model.transform), GL_TRUE); + for (int i = 0; i < model.textures_len; i++) { + mons_texture_bind(model.shader, i, model.textures[i]); + } + glBindVertexArray(model.mesh.vao); + glDrawElements(GL_TRIANGLES, model.mesh.element_count, GL_UNSIGNED_INT, 0); +} -- cgit v1.2.3