diff options
Diffstat (limited to 'mons_3d/src/model.c')
-rw-r--r-- | mons_3d/src/model.c | 15 |
1 files changed, 15 insertions, 0 deletions
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 <glad/gl.h> + +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); +} |