LibGame  v0.4.0
The LG Game Engine - Copyright (C) 2024-2025 ETMSoftware
lg_fbx_parser.c File Reference

Functions

LG_Meshlg_fbx2vbo (const char *path, zboolean invert_z, zboolean normalize_xyz, zboolean horiz_center, zboolean vert_center, zboolean vert_bottom)
 
void lg_vb_uvn_iw_info (Vertex_uvn_iw *vb_data, uint32_t vb_size, int n_lines_max, const char *line_start, zboolean is_triangle_mesh)
 

Detailed Description

=== The FBX file parser ===

We use the excellent ufbx lib, by Samuli Raivio.

At the moment, the aim is to read skinned meshes, as OBJ files don't support them.

See: https://ufbx.github.io and https://github.com/ufbx/ufbx

Function Documentation

◆ lg_fbx2vbo()

LG_Mesh* lg_fbx2vbo ( const char *  path,
zboolean  invert_z,
zboolean  normalize_xyz,
zboolean  horiz_center,
zboolean  vert_center,
zboolean  vert_bottom 
)

Parse a FBX file to build a skinned mesh

Will create a Vertex_uvn_iw VBO (see lg_vertex.h)

Parameters
pathFBX file path
invert_zInvert z spatial coord (left_handed vs right_handed coords sys) - STILL EXPERIMENTAL
normalize_xyzNormalize spatial coords
horiz_centerCenter mesh horizontally
vert_centerCenter mesh vertically, if vert_bottom is not set
vert_bottomSet mesh origin vertically at bottom, override vert_center
Returns
The new mesh

◆ lg_vb_uvn_iw_info()

void lg_vb_uvn_iw_info ( Vertex_uvn_iw vb_data,
uint32_t  vb_size,
int  n_lines_max,
const char *  line_start,
zboolean  is_triangle_mesh 
)

Print out nicely a Vertex_uvn_iw buffer info spatial coords (only)

v[1/2/3] applies only for triangle meshes

Parameters
vb_dataPointer to a Vertex_uvn_iw buffer
vb_sizeBuffer size (uint32_t)
n_lines_maxPrint out up to n_lines_max lines
line_startString starting each line
is_triangle_mesh