trimeshloader  1.0.0
Flexible ANSI C trimeshloader 3DS/OBJ
Typedefs | Functions
Trimeshloader low level 3DS API

Typedefs

typedef struct tl3dsState tl3dsState
 Structure describing the parsing state. More...
 

Functions

TRIMESH_LOADER_API tl3dsStatetl3dsCreateState ()
 Create a new parsing state. More...
 
TRIMESH_LOADER_API int tl3dsResetState (tl3dsState *state)
 Reset the parsing state. More...
 
TRIMESH_LOADER_API void tl3dsDestroyState (tl3dsState *state)
 Destroy a previously created state. More...
 
TRIMESH_LOADER_API int tl3dsParse (tl3dsState *state, const char *buffer, unsigned int length, int last)
 Parse a chunk of data. More...
 
TRIMESH_LOADER_API unsigned int tl3dsObjectCount (tl3dsState *state)
 
TRIMESH_LOADER_API const char * tl3dsObjectName (tl3dsState *state, unsigned int object)
 
TRIMESH_LOADER_API unsigned int tl3dsObjectFaceCount (tl3dsState *state, unsigned int object)
 
TRIMESH_LOADER_API unsigned int tl3dsObjectFaceIndex (tl3dsState *state, unsigned int object)
 
TRIMESH_LOADER_API unsigned int tl3dsMaterialCount (tl3dsState *state)
 
TRIMESH_LOADER_API const char * tl3dsMaterialName (tl3dsState *state, unsigned int object)
 
TRIMESH_LOADER_API int tl3dsGetMaterial (tl3dsState *state, unsigned int index, float *ambient, float *diffuse, float *specular, float *reflect)
 
TRIMESH_LOADER_API unsigned int tl3dsMaterialReferenceCount (tl3dsState *state)
 
TRIMESH_LOADER_API const char * tl3dsMaterialReferenceName (tl3dsState *state, unsigned int object)
 
TRIMESH_LOADER_API int tl3dsGetMaterialReference (tl3dsState *state, unsigned int index, unsigned int *face_index, unsigned int *face_count)
 
TRIMESH_LOADER_API unsigned int tl3dsVertexCount (tl3dsState *state)
 
TRIMESH_LOADER_API int tl3dsGetVertexDouble (tl3dsState *state, unsigned int index, double *x, double *y, double *z, double *tu, double *tv, double *nx, double *ny, double *nz)
 
TRIMESH_LOADER_API int tl3dsGetVertex (tl3dsState *state, unsigned int index, float *x, float *y, float *z, float *tu, float *tv, float *nx, float *ny, float *nz)
 
TRIMESH_LOADER_API unsigned int tl3dsFaceCount (tl3dsState *state)
 
TRIMESH_LOADER_API int tl3dsGetFaceInt (tl3dsState *state, unsigned int index, unsigned int *a, unsigned int *b, unsigned int *c)
 
TRIMESH_LOADER_API int tl3dsGetFace (tl3dsState *state, unsigned int index, unsigned short *a, unsigned short *b, unsigned short *c)
 
TRIMESH_LOADER_API int tl3dsCheckFileExtension (const char *filename)
 
TRIMESH_LOADER_API unsigned int tl3dsHasNormals (tl3dsState *state)
 Check if the loaded mesh has normals. More...
 

Detailed Description

Typedef Documentation

◆ tl3dsState

typedef struct tl3dsState tl3dsState

Structure describing the parsing state.

the user has no direkt access to it.

Function Documentation

◆ tl3dsCheckFileExtension()

TRIMESH_LOADER_API int tl3dsCheckFileExtension ( const char *  filename)

◆ tl3dsCreateState()

TRIMESH_LOADER_API tl3dsState* tl3dsCreateState ( )

Create a new parsing state.

Returns
A new parsing state, which needs to be deleted after parsing. NULL on error.

◆ tl3dsDestroyState()

TRIMESH_LOADER_API void tl3dsDestroyState ( tl3dsState state)

Destroy a previously created state.

Parameters
statepointer to an previously created state.

◆ tl3dsFaceCount()

TRIMESH_LOADER_API unsigned int tl3dsFaceCount ( tl3dsState state)

◆ tl3dsGetFace()

TRIMESH_LOADER_API int tl3dsGetFace ( tl3dsState state,
unsigned int  index,
unsigned short *  a,
unsigned short *  b,
unsigned short *  c 
)

◆ tl3dsGetFaceInt()

TRIMESH_LOADER_API int tl3dsGetFaceInt ( tl3dsState state,
unsigned int  index,
unsigned int *  a,
unsigned int *  b,
unsigned int *  c 
)

◆ tl3dsGetMaterial()

TRIMESH_LOADER_API int tl3dsGetMaterial ( tl3dsState state,
unsigned int  index,
float *  ambient,
float *  diffuse,
float *  specular,
float *  reflect 
)

◆ tl3dsGetMaterialReference()

TRIMESH_LOADER_API int tl3dsGetMaterialReference ( tl3dsState state,
unsigned int  index,
unsigned int *  face_index,
unsigned int *  face_count 
)

◆ tl3dsGetVertex()

TRIMESH_LOADER_API int tl3dsGetVertex ( tl3dsState state,
unsigned int  index,
float *  x,
float *  y,
float *  z,
float *  tu,
float *  tv,
float *  nx,
float *  ny,
float *  nz 
)

◆ tl3dsGetVertexDouble()

TRIMESH_LOADER_API int tl3dsGetVertexDouble ( tl3dsState state,
unsigned int  index,
double *  x,
double *  y,
double *  z,
double *  tu,
double *  tv,
double *  nx,
double *  ny,
double *  nz 
)

◆ tl3dsHasNormals()

TRIMESH_LOADER_API unsigned int tl3dsHasNormals ( tl3dsState state)

Check if the loaded mesh has normals.

3DS does not support normals. It is for convenience only, and always returns 0.

Parameters
statea previously created state.
Returns
Returns 0 if no normals are present, >0 if they are.

◆ tl3dsMaterialCount()

TRIMESH_LOADER_API unsigned int tl3dsMaterialCount ( tl3dsState state)

◆ tl3dsMaterialName()

TRIMESH_LOADER_API const char* tl3dsMaterialName ( tl3dsState state,
unsigned int  object 
)

◆ tl3dsMaterialReferenceCount()

TRIMESH_LOADER_API unsigned int tl3dsMaterialReferenceCount ( tl3dsState state)

◆ tl3dsMaterialReferenceName()

TRIMESH_LOADER_API const char* tl3dsMaterialReferenceName ( tl3dsState state,
unsigned int  object 
)

◆ tl3dsObjectCount()

TRIMESH_LOADER_API unsigned int tl3dsObjectCount ( tl3dsState state)

◆ tl3dsObjectFaceCount()

TRIMESH_LOADER_API unsigned int tl3dsObjectFaceCount ( tl3dsState state,
unsigned int  object 
)

◆ tl3dsObjectFaceIndex()

TRIMESH_LOADER_API unsigned int tl3dsObjectFaceIndex ( tl3dsState state,
unsigned int  object 
)

◆ tl3dsObjectName()

TRIMESH_LOADER_API const char* tl3dsObjectName ( tl3dsState state,
unsigned int  object 
)

◆ tl3dsParse()

TRIMESH_LOADER_API int tl3dsParse ( tl3dsState state,
const char *  buffer,
unsigned int  length,
int  last 
)

Parse a chunk of data.

Parameters
statea previously created state.
bufferpointer to the chunk of data to be parsed
lengthnumber of bytes to be parsed
lastindicator if this is the last chunk. 1 = yes, 0 = no.
Returns
Returns 0 on success, 1 on error.

◆ tl3dsResetState()

TRIMESH_LOADER_API int tl3dsResetState ( tl3dsState state)

Reset the parsing state.

Parameters
statepointer to an previously created state.

◆ tl3dsVertexCount()

TRIMESH_LOADER_API unsigned int tl3dsVertexCount ( tl3dsState state)