Add vec3() function for creating 3d vecs

This commit is contained in:
8dcc 2023-07-23 00:27:16 +02:00
parent 25a9a474cf
commit 9ec237509d
2 changed files with 11 additions and 0 deletions

View File

@ -12,6 +12,7 @@ typedef float vec2_t[2];
bool is_alive(cl_entity_t* ent);
bool valid_client(cl_entity_t* ent);
char* get_name(int ent_idx);
vec3_t vec3(float x, float y, float z);
bool vec_is_zero(vec3_t v);
bool world_to_screen(vec3_t vec, vec2_t screen);

View File

@ -18,6 +18,16 @@ char* get_name(int ent_idx) {
return info.name;
}
vec3_t vec3(float x, float y, float z) {
vec3_t ret;
ret[0] = x;
ret[1] = y;
ret[2] = z;
return ret;
}
bool vec_is_zero(vec3_t v) {
return v[0] == 0.0f && v[1] == 0.0f && v[2] == 0.0f;
}