Add vec3() function for creating 3d vecs
This commit is contained in:
parent
25a9a474cf
commit
9ec237509d
|
@ -12,6 +12,7 @@ typedef float vec2_t[2];
|
||||||
bool is_alive(cl_entity_t* ent);
|
bool is_alive(cl_entity_t* ent);
|
||||||
bool valid_client(cl_entity_t* ent);
|
bool valid_client(cl_entity_t* ent);
|
||||||
char* get_name(int ent_idx);
|
char* get_name(int ent_idx);
|
||||||
|
vec3_t vec3(float x, float y, float z);
|
||||||
bool vec_is_zero(vec3_t v);
|
bool vec_is_zero(vec3_t v);
|
||||||
bool world_to_screen(vec3_t vec, vec2_t screen);
|
bool world_to_screen(vec3_t vec, vec2_t screen);
|
||||||
|
|
||||||
|
|
10
src/util.c
10
src/util.c
|
@ -18,6 +18,16 @@ char* get_name(int ent_idx) {
|
||||||
return info.name;
|
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) {
|
bool vec_is_zero(vec3_t v) {
|
||||||
return v[0] == 0.0f && v[1] == 0.0f && v[2] == 0.0f;
|
return v[0] == 0.0f && v[1] == 0.0f && v[2] == 0.0f;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue