commit 965e65ab05cb7b71b65edbeefd3e96890e398d62
parent 055819cc19b9b3d317927ffc126b24e4f79b3fee
Author: amin <dev@aminmesbah.com>
Date: Fri, 19 Apr 2019 23:17:57 +0000
Move pixels per meter out of the model matrix
FossilOrigin-Name: 0305e0a635bda5dcc7efca028559d358dddd6aad59a5754963d2261f9dcd4bbe
Diffstat:
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/game.c b/src/game.c
@@ -209,16 +209,15 @@ void game_update_and_render(struct GameMemory *game_memory, struct GameInput *ga
// these dimensions are relative to a square 'meter', one tile
v2 player_dim = { 0.375f, 0.583f };
- // TODO: move ppm out of this matrix
m4 model = glmth_m4_init_id();
- model = glmth_translate(model, (v3) {player.pos.x * ppm, player.pos.y * ppm, 0.0f});
- model = glmth_scale(model, (v3) {player_dim.x * ppm, player_dim.y * ppm, 1.0f});
- shader_setm4(&game_state->tiles.shader, "model", &model);
+ model = glmth_translate(model, (v3) {player.pos.x, player.pos.y, 0.0f});
+ model = glmth_scale(model, (v3) {player_dim.x, player_dim.y, 1.0f});
m4 view = glmth_m4_init_id();
view = glmth_translate(view, (v3) {0.0f, framebuffer.height, 0.0f});
view = glmth_scale(view, (v3) {1.0f, -1.0f, 1.0f});
view = glmth_translate(view, (v3) {viewport.min.x, viewport.min.y, 0.0f});
+ view = glmth_scale(view, (v3) {ppm, ppm, 1.0f});
{
printf("Framebuffer :");