aboutsummaryrefslogtreecommitdiff
path: root/07-july/src/renderer/entity.c
blob: b96491d271082c3f4ad877edb26c57e25f5ad8a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "entity.h"

mat4_t Entity_GetModelTransform(entity_t* entity)
{
    mat4_t temp;
    mat4_t rotation = mat4_rotate_x(entity->rotX);
    temp = mat4_rotate_y(entity->rotY);
    rotation = mat4_mul(&rotation, &temp);
    temp = mat4_rotate_z(entity->rotZ);
    rotation = mat4_mul(&rotation, &temp);

    temp = mat4_translate(&entity->position);

    mat4_t modelTransform = mat4_mul(&temp, &rotation);

    return modelTransform;
}