2022-04-20 21:38:32 +02:00

57 lines
792 B
C

#ifndef UTILS_H
#define UTILS_H
#include <stdbool.h>
#include <stdlib.h>
/**
* GLSL-like three dimensional vector
*/
typedef struct vec3f
{
float x;
float y;
float z;
} vec3f;
typedef struct vec3i
{
int x;
int y;
int z;
} vec3i;
typedef struct vec4f
{
float x;
float y;
float z;
float w;
} vec4f;
/**
* Color with RGB components
*/
typedef struct Color
{
float red;
float green;
float blue;
} Color;
/**
* Calculates radian from degree.
*/
double degree_to_radian(double degree);
bool is_oob(int i, int min, int max);
void mult_matrix(float *matrix, vec4f vector, vec4f *ret);
bool matrix_inverse(const float m[16], float invOut[16]);
void vec3f_normalize(vec3f *v);
int irand_range(int min, int max);
#endif /* UTILS_H */