diff options
author | 2025-02-07 11:27:18 -0500 | |
---|---|---|
committer | 2025-02-07 11:27:18 -0500 | |
commit | 4da7be39827ea5888ef9c97b1aadf61b0d76347c (patch) | |
tree | 15d0ff8f8bcb0e871efb1b2e65c2bc8d07b17565 /mons_3d/src/model.c |
initial commit (lol)
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); +} |