trimeshloader  1.0.0
Flexible ANSI C trimeshloader 3DS/OBJ
Data Structures | Macros | Functions
Trimeshloader high level API

Data Structures

struct  tlObject
 Structure describing an Object (or SubMesh, Batch) More...
 
struct  tlMaterial
 Structure describing a Material (Colors and/or Texture) More...
 
struct  tlMaterialReference
 Structure describing the reference to a Material. More...
 
struct  tlTrimesh
 Structure describing an Trimesh (index triangle list) containing objects, vertices (point, texture coordinate and normal) and triangle indices. More...
 

Macros

#define TL_FVF_XYZ   1
 Used as format flag in loading functions: load the position of the vertex. More...
 
#define TL_FVF_UV   2
 Used as format flag in loading functions: load the texturecoordinate of the vertex. More...
 
#define TL_FVF_NORMAL   4
 Used as format flag in loading functions: load the normal of the vertex. More...
 

Functions

TRIMESH_LOADER_API tlTrimeshtlLoad3DS (const char *filename, unsigned int vertex_format)
 Load a 3DS file in an tlTrimesh structure. More...
 
TRIMESH_LOADER_API tlTrimeshtlLoadOBJ (const char *filename, unsigned int vertex_format)
 Load a OBJ file in an tlTrimesh structure. More...
 
TRIMESH_LOADER_API tlTrimeshtlCreateTrimeshFromObjState (tlObjState *state, unsigned int vertex_format)
 Create an a tlTrimesh structure from a tlObjState. More...
 
TRIMESH_LOADER_API tlTrimeshtlCreateTrimeshFrom3dsState (tl3dsState *state, unsigned int vertex_format)
 Create an a tlTrimesh structure from a tl3dsState. More...
 
TRIMESH_LOADER_API void tlTrimeshCreateNormals (tlTrimesh *trimesh)
 
TRIMESH_LOADER_API tlTrimeshtlLoadTrimesh (const char *filename, unsigned int vertex_format)
 Load an 3DS or OBJ file in an tlTrimesh structure. More...
 
TRIMESH_LOADER_API void tlDeleteTrimesh (tlTrimesh *trimesh)
 Delete an previously loaded tlTrimesh object. More...
 

Detailed Description

Macro Definition Documentation

◆ TL_FVF_NORMAL

#define TL_FVF_NORMAL   4

Used as format flag in loading functions: load the normal of the vertex.

◆ TL_FVF_UV

#define TL_FVF_UV   2

Used as format flag in loading functions: load the texturecoordinate of the vertex.

◆ TL_FVF_XYZ

#define TL_FVF_XYZ   1

Used as format flag in loading functions: load the position of the vertex.

Function Documentation

◆ tlCreateTrimeshFrom3dsState()

TRIMESH_LOADER_API tlTrimesh* tlCreateTrimeshFrom3dsState ( tl3dsState state,
unsigned int  vertex_format 
)

Create an a tlTrimesh structure from a tl3dsState.

Parameters
statePointer to state after parsing.
vertex_formatDefines the vertex format. any format combination of TL_FVF_XYZ, TL_FVF_UV, TL_FVF_NORMAL
Returns
Returns a new tlTrimesh object, which needs to be deleted with tlDeleteTrimesh. NULL on error.

◆ tlCreateTrimeshFromObjState()

TRIMESH_LOADER_API tlTrimesh* tlCreateTrimeshFromObjState ( tlObjState state,
unsigned int  vertex_format 
)

Create an a tlTrimesh structure from a tlObjState.

Parameters
statePointer to state after parsing.
vertex_formatDefines the vertex format. any format combination of TL_FVF_XYZ, TL_FVF_UV, TL_FVF_NORMAL
Returns
Returns a new tlTrimesh object, which needs to be deleted with tlDeleteTrimesh. NULL on error.

◆ tlDeleteTrimesh()

TRIMESH_LOADER_API void tlDeleteTrimesh ( tlTrimesh trimesh)

Delete an previously loaded tlTrimesh object.

Parameters
trimeshPreviously loaded tlTrimesh object

◆ tlLoad3DS()

TRIMESH_LOADER_API tlTrimesh* tlLoad3DS ( const char *  filename,
unsigned int  vertex_format 
)

Load a 3DS file in an tlTrimesh structure.

Parameters
filenamePointer to NULL-terminated string containing the filename
vertex_formatDefines the vertex format. any format combination of TL_FVF_XYZ, TL_FVF_UV, TL_FVF_NORMAL
Returns
Returns a new tlTrimesh object, which needs to be deleted with tlDeleteTrimesh. NULL on error.

◆ tlLoadOBJ()

TRIMESH_LOADER_API tlTrimesh* tlLoadOBJ ( const char *  filename,
unsigned int  vertex_format 
)

Load a OBJ file in an tlTrimesh structure.

Parameters
filenamePointer to NULL-terminated string containing the filename
vertex_formatDefines the vertex format. any format combination of TL_FVF_XYZ, TL_FVF_UV, TL_FVF_NORMAL
Returns
Returns a new tlTrimesh object, which needs to be deleted with tlDeleteTrimesh. NULL on error.

◆ tlLoadTrimesh()

TRIMESH_LOADER_API tlTrimesh* tlLoadTrimesh ( const char *  filename,
unsigned int  vertex_format 
)

Load an 3DS or OBJ file in an tlTrimesh structure.

Automatic extension parsing is done.

Parameters
filenamePointer to NULL-terminated string containing the filename
vertex_formatDefines the vertex format. any format combination of TL_FVF_XYZ, TL_FVF_UV, TL_FVF_NORMAL
Returns
Returns a new tlTrimesh object, which needs to be deleted with tlDeleteTrimesh. NULL on error.

◆ tlTrimeshCreateNormals()

TRIMESH_LOADER_API void tlTrimeshCreateNormals ( tlTrimesh trimesh)