Update gb.h to v0.31

This commit is contained in:
Ginger Bill 2017-08-23 21:02:22 +01:00
parent fd88428545
commit 7bba49ce13
3 changed files with 569 additions and 227 deletions

774
gb.h

File diff suppressed because it is too large Load Diff

View File

@ -1336,7 +1336,9 @@ gb_inline b32 gbgl_make_texture2d_coloured(gbglTexture *t, gbglColour colour) {
gb_inline void gbgl_bind_texture2d(gbglTexture const *t, u32 position, u32 sampler) {
GB_ASSERT(t->type == gbglgTexture_2D);
if (t != NULL) {
GB_ASSERT(t->type == gbglgTexture_2D);
}
if (position > 31) {
position = 31;

View File

@ -483,7 +483,10 @@ GB_MATH_DEF void gb_quat_squad_approx(gbQuat *d, gbQuat p, gbQuat a, gbQuat b, g
/* Rects */
GB_MATH_DEF gbRect2 gb_rect2(gbVec2 pos, gbVec2 dim);
GB_MATH_DEF gbRect2 gb_rect2v(float v[4]);
GB_MATH_DEF gbRect3 gb_rect3(gbVec3 pos, gbVec3 dim);
GB_MATH_DEF gbRect3 gb_rect3v(float v[6]);
GB_MATH_DEF int gb_rect2_contains (gbRect2 a, float x, float y);
GB_MATH_DEF int gb_rect2_contains_vec2 (gbRect2 a, gbVec2 p);
@ -2025,6 +2028,13 @@ gbRect2 gb_rect2(gbVec2 pos, gbVec2 dim) {
return r;
}
gbRect2 gb_rect2v(float v[4]) {
gbRect2 r;
r.pos = gb_vec2v(&v[0]);
r.dim = gb_vec2v(&v[2]);
return r;
}
gbRect3 gb_rect3(gbVec3 pos, gbVec3 dim) {
gbRect3 r;
r.pos = pos;
@ -2032,6 +2042,14 @@ gbRect3 gb_rect3(gbVec3 pos, gbVec3 dim) {
return r;
}
gbRect3 gb_rect3v(float v[6]) {
gbRect3 r;
r.pos = gb_vec3v(&v[0]);
r.dim = gb_vec3v(&v[3]);
return r;
}
int gb_rect2_contains(gbRect2 a, float x, float y) {
float min_x = gb_min(a.pos.x, a.pos.x+a.dim.x);
float max_x = gb_max(a.pos.x, a.pos.x+a.dim.x);