LibGame
v0.4.0
The LG Game Engine - Copyright (C) 2024 ETMSoftware
|
Functions | |
LG_BBox | lg_bbox (float min_x, float max_x, float min_y, float max_y, float min_z, float max_z) |
LG_BBox | lg_bbox_from_cuboid (LG_Cuboid *cuboid) |
LG_Cuboid | lg_cuboid_from_bbox (LG_BBox bbox, LG_Color_u c) |
LG_BBox | lg_bbox_from_mesh (LG_Mesh *mesh) |
LG_BBox | lg_bbox_transform (LG_BBox bbox, mat4_t matrix) |
vec3_t | lg_bbox_get_center (LG_BBox *bbox) |
zboolean | lg_bboxes_collide (LG_BBox *bbox1, LG_BBox *bbox2) |
zboolean | lg_bbox_sets_collide (LG_BBox *bbox1[], LG_BBox *bbox2[]) |
Lines3D_VB | lg_l3d_vb_from_bbox (LG_BBox bbox, LG_Color_u c) |
void | lg_bbox_info (LG_BBox *bbox) |
LG_BSphere | lg_bsphere (float x_center, float y_center, float z_center, float radius) |
LG_BSphere | lg_bsphere_from_bbox (LG_BBox bbox) |
LG_BSphere | lg_bsphere_from_mesh (LG_Mesh *mesh) |
zboolean | lg_bspheres_collide (LG_BSphere *bsphere1, LG_BSphere *bsphere2) |
zboolean | lg_bsphere_sets_collide (LG_BSphere *bsphere1[], LG_BSphere *bsphere2[]) |
void | lg_bsphere_info (LG_BSphere bsphere) |
=== 3D collision detection funcs and algos === Using so far: - Bounding boxes - Bounding spheres
LG_BBox lg_bbox | ( | float | min_x, |
float | max_x, | ||
float | min_y, | ||
float | max_y, | ||
float | min_z, | ||
float | max_z | ||
) |
Create an axis-aligned bounding box (AABB)
min_x | |
max_x; | |
min_y | |
max_y | |
min_z | |
max_z |
LG_Cuboid lg_cuboid_from_bbox | ( | LG_BBox | bbox, |
LG_Color_u | c | ||
) |
Return a cuboid from a bounding box and color
bbox | A LG_BBox |
c | A LG_Color_u |
Lines3D_VB lg_l3d_vb_from_bbox | ( | LG_BBox | bbox, |
LG_Color_u | c | ||
) |
Create and fill a Lines3D_VB (line set vertex buffer and num of vertices) from a bounding box
Draw with glDrawArrays(GL_LINE, 0, LG_CUBOID_LINES_N_VERTICES or n_vertices) (if n_vertices > 0)
The vertex buffer is a static one (static array)
bbox | A LG_BBox |
c | A LG_Color_u |
LG_BSphere lg_bsphere | ( | float | x_center, |
float | y_center, | ||
float | z_center, | ||
float | radius | ||
) |
LG_BSphere lg_bsphere_from_bbox | ( | LG_BBox | bbox | ) |
LG_BSphere lg_bsphere_from_mesh | ( | LG_Mesh * | mesh | ) |
zboolean lg_bspheres_collide | ( | LG_BSphere * | bsphere1, |
LG_BSphere * | bsphere2 | ||
) |
Test if 2 bounding spheres collide
bsphere1 | Pointer to a LG_BSphere |
bsphere2 | Pointer to a LG_BSphere |
zboolean lg_bsphere_sets_collide | ( | LG_BSphere * | bsphere1[], |
LG_BSphere * | bsphere2[] | ||
) |
Test if 2 bounding sphere sets collide
bsphere1 | Array of pointers to LG_BSphere, NULL terminated |
bsphere2 | Array of pointers to LG_BSphere, NULL terminated |
void lg_bsphere_info | ( | LG_BSphere | bsphere | ) |
Print out bsphere info
bsphere | A LG_BSphere |