![]() |
LibGame v0.4.0
The LG Game Engine - Copyright (C) 2024-2026 ETMSoftware
|
Functions | |
| static void | build_base_hexagon (vec3_t *hexagon2, vec3_t v1, vec3_t v2, float line_width) |
| LG_MeshLine | lg_meshline_new (vec3_t v1, vec3_t v2, int n_seg, float line_width, LG_Color_u c1, LG_Color_u c2, zboolean *is_ok) |
| int | lg_meshline_set_data (LG_MeshLine *mesh_line, vec3_t v1, vec3_t v2, LG_Color_u c1, LG_Color_u c2) |
| int | lg_meshline_render (LG_MeshLine *mesh_line, mat4_t *model_view_proj_m) |
| void | lg_meshline_free (LG_MeshLine *mesh_line) |
| vec3_t * | lg_v3_grid (uint16_t half_grid_width, float scaling, int *n_vertices) |
| LG_MeshLine_Grid | lg_meshline_grid_new (uint16_t half_grid_width, float scaling, LG_Color_u c, uint32_t n_seg, float line_width, zboolean *is_ok) |
| int | lg_meshline_grid_render (LG_MeshLine_Grid *m_grid, mat4_t *model_view_proj_m) |
| void | lg_meshline_grid_free (LG_MeshLine_Grid *m_grid) |
=== Trying to find a better alternative to glDrawArrays(GL_LINES) ===
| LG_MeshLine lg_meshline_new | ( | vec3_t | v1, |
| vec3_t | v2, | ||
| int | n_seg, | ||
| float | line_width, | ||
| LG_Color_u | c1, | ||
| LG_Color_u | c2, | ||
| zboolean * | is_ok | ||
| ) |
Create and return a new LG_MeshLine, ie a hexagon-based mesh line, and initialize its renderer (VAO and shader prog)
Draw with lg_meshline_set_data()/lg_meshline_render()
base
x x (i = 1)
x x (i = 0)
x x
n_seg = 2
x x
x/ / x
/x x /
x/ / x
/x x /
x x
x x
n_seg = 3
x x----x----x----x
x x----x----x----x
x x----x----x----x
You can/should check the value of is_ok
No GL error checking is performed
| v1 | |
| v2 | |
| n_seg | |
| line_width | |
| c1 | Color of odd segments |
| c2 | Color of even segments |
| is_ok |
| int lg_meshline_set_data | ( | LG_MeshLine * | mesh_line, |
| vec3_t | v1, | ||
| vec3_t | v2, | ||
| LG_Color_u | c1, | ||
| LG_Color_u | c2 | ||
| ) |
Set vbo_data of an already created LG_MeshLine from v1, v2, c1, and c2
| v1 | |
| v2 | |
| c1 | Color of odd segments |
| c2 | Color of even segments |
| int lg_meshline_render | ( | LG_MeshLine * | mesh_line, |
| mat4_t * | model_view_proj_m | ||
| ) |
Render a LG_MeshLine
| mesh_line | Pointer to a LG_MeshLine |
| model_view_proj_m | Pointer to a mat4_t transform matrix |
| void lg_meshline_free | ( | LG_MeshLine * | mesh_line | ) |
Free a LG_MeshLine renderer resources (VAO, VBO, shader prog, and vbo_data)
| mesh_line | Pointer to a LG_MeshLine |
| vec3_t * lg_v3_grid | ( | uint16_t | half_grid_width, |
| float | scaling, | ||
| int * | n_vertices | ||
| ) |
| LG_MeshLine_Grid lg_meshline_grid_new | ( | uint16_t | half_grid_width, |
| float | scaling, | ||
| LG_Color_u | c, | ||
| uint32_t | n_seg, | ||
| float | line_width, | ||
| zboolean * | is_ok | ||
| ) |
Horiz centered square meshlines grid
Draw with lg_meshline_grid_render()
You can/should check the value of is_ok
TODO: add params:
| half_grid_width | Half grid width |
| scaling | Scaling k |
| c | Color |
| n_seg | |
| line_width | |
| is_ok |
| int lg_meshline_grid_render | ( | LG_MeshLine_Grid * | m_grid, |
| mat4_t * | model_view_proj_m | ||
| ) |
Render a LG_MeshLine_Grid
| m_grid | Pointer to a LG_MeshLine_Grid |
| model_view_proj_m | Pointer to a mat4_t transform matrix |
| void lg_meshline_grid_free | ( | LG_MeshLine_Grid * | m_grid | ) |
Free a LG_MeshLine_Grid renderer resources (VAO, VBO, shader prog, vbo_data, and vec3 grid)
| mesh_line | Pointer to a LG_MeshLine |