Add (unsigned, signed) integer vectors

Those vectors are needed for storing a position  that is only on fixed
points on a grid. The  position and size of a window must be expressed
as integer vectors, for example.
This commit is contained in:
Eric-Paul Ickhorn 2024-09-09 21:31:49 +02:00
parent 19a7ac57ba
commit da3ce2dde9
1 changed files with 52 additions and 0 deletions

View File

@ -2,6 +2,7 @@
#ifndef VOXULA_UTILITY_H
#define VOXULA_UTILITY_H
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
@ -14,6 +15,15 @@ typedef uint64_t vx_uuid_d;
typedef struct vx_vec2f vx_vec2f_s;
typedef struct vx_vec3f vx_vec3f_s;
typedef struct vx_vec4f vx_vec4f_s;
typedef struct vx_vec2u vx_vec2u_s;
typedef struct vx_vec3u vx_vec3u_s;
typedef struct vx_vec4u vx_vec4u_s;
typedef struct vx_vec2i vx_vec2i_s;
typedef struct vx_vec3i vx_vec3i_s;
typedef struct vx_vec4i vx_vec4i_s;
typedef struct vx_mat2f vx_mat2f_s;
typedef struct vx_mat3f vx_mat3f_s;
typedef struct vx_mat4f vx_mat4f_s;
@ -106,6 +116,48 @@ struct vx_vec4f
float w;
};
struct vx_vec2u
{
uint64_t x;
uint64_t y;
};
struct vx_vec3u
{
uint64_t x;
uint64_t y;
uint64_t z;
};
struct vx_vec4u
{
uint64_t x;
uint64_t y;
uint64_t z;
uint64_t w;
};
struct vx_vec2i
{
int64_t x;
int64_t y;
};
struct vx_vec3i
{
int64_t x;
int64_t y;
int64_t z;
};
struct vx_vec4i
{
int64_t x;
int64_t y;
int64_t z;
int64_t w;
};
struct vx_mat2f
{
float val[4];