Implement spritebatch properly.

This commit is contained in:
2026-03-22 09:13:42 -05:00
parent 66ebcb1608
commit ca0e9fc3b2
19 changed files with 205 additions and 142 deletions
+12 -3
View File
@@ -9,6 +9,7 @@
#include "assert/assert.h"
#include "util/memory.h"
#include "display/mesh/quad.h"
#include "display/shader/shaderunlit.h"
screen_t SCREEN;
@@ -370,10 +371,18 @@ errorret_t screenRender() {
FRAMEBUFFER_CLEAR_COLOR | FRAMEBUFFER_CLEAR_DEPTH,
COLOR_BLACK
);
cameraPushMatrix(&SCREEN.framebufferCamera);
errorChain(textureBind(&SCREEN.framebuffer.texture));
shaderBind(&SHADER_UNLIT);
mat4 proj, view, model;
cameraGetProjectionMatrix(&SCREEN.framebufferCamera, proj);
cameraGetViewMatrix(&SCREEN.framebufferCamera, view);
glm_mat4_identity(model);
shaderSetMatrix(&SHADER_UNLIT, SHADER_UNLIT_PROJECTION, proj);
shaderSetMatrix(&SHADER_UNLIT, SHADER_UNLIT_VIEW, view);
shaderSetMatrix(&SHADER_UNLIT, SHADER_UNLIT_MODEL, model);
// errorChain(textureBind(&SCREEN.framebuffer.texture));
errorChain(meshDraw(&SCREEN.frameBufferMesh, 0, -1));
cameraPopMatrix();
errorOk();
};