#include "renderer.h" Mat4 Entity_GetModelTransform(Entity* entity) { Mat4 temp; Mat4 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 modelTransform = mat4_mul(&temp, &rotation); temp = mat4_scale(entity->scale[0], entity->scale[1], entity->scale[2]); modelTransform = mat4_mul(&modelTransform, &temp); return modelTransform; } Vec2 Entity_GetTexOffset(Entity *entity) { /* Offset inside a texture atlas should default to (0, 0)*/ Vec2 tex_offset; Texture *t = entity->texture; int column = entity->index % t->number_of_rows; int row = entity->index / t->number_of_rows; tex_offset.x = (float)column / t->number_of_rows; tex_offset.y = (float)row / t->number_of_rows; return tex_offset; }