trimeshloader  1.0.0
Flexible ANSI C trimeshloader 3DS/OBJ
tl3ds.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007-2017 Gero Mueller <post@geromueller.de>
3  *
4  * This software is provided 'as-is', without any express or implied
5  * warranty. In no event will the authors be held liable for any damages
6  * arising from the use of this software.
7  *
8  * Permission is granted to anyone to use this software for any purpose,
9  * including commercial applications, and to alter it and redistribute it
10  * freely, subject to the following restrictions:
11  *
12  * 1. The origin of this software must not be misrepresented; you must not
13  * claim that you wrote the original software. If you use this software
14  * in a product, an acknowledgment in the product documentation would be
15  * appreciated but is not required.
16  *
17  * 2. Altered source versions must be plainly marked as such, and must not be
18  * misrepresented as being the original software.
19  *
20  * 3. This notice may not be removed or altered from any source
21  * distribution.
22  */
23 
24 #ifndef TRIMESH_LOADER_3DS_H
25 #define TRIMESH_LOADER_3DS_H
26 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #ifndef TRIMESH_LOADER_EXPORT
37  #define TRIMESH_LOADER_API
38 #else
39  #define TRIMESH_LOADER_API extern
40 #endif
41 
47 typedef struct tl3dsState tl3dsState;
48 
53 
58 
63 
72  tl3dsState *state,
73  const char *buffer,
74  unsigned int length,
75  int last );
76 
77 /* data access */
78 TRIMESH_LOADER_API unsigned int tl3dsObjectCount( tl3dsState *state );
79 
81  tl3dsState *state,
82  unsigned int object );
83 
85  tl3dsState *state,
86  unsigned int object );
87 
89  tl3dsState *state,
90  unsigned int object );
91 
92 TRIMESH_LOADER_API unsigned int tl3dsMaterialCount( tl3dsState *state );
93 
95  tl3dsState *state,
96  unsigned int object );
97 
99  tl3dsState *state,
100  unsigned int index,
101  float *ambient,
102  float *diffuse,
103  float *specular,
104  float *reflect );
105 
107 
109  tl3dsState *state,
110  unsigned int object );
111 
113  tl3dsState *state,
114  unsigned int index,
115  unsigned int *face_index,
116  unsigned int *face_count );
117 
118 TRIMESH_LOADER_API unsigned int tl3dsVertexCount( tl3dsState *state );
119 
121  tl3dsState *state,
122  unsigned int index,
123  double *x, double *y, double *z,
124  double *tu, double *tv,
125  double *nx, double *ny, double *nz );
126 
128  tl3dsState *state,
129  unsigned int index,
130  float *x, float *y, float *z,
131  float *tu, float *tv,
132  float *nx, float *ny, float *nz );
133 
135  tl3dsState *state );
136 
138  tl3dsState *state,
139  unsigned int index,
140  unsigned int *a,
141  unsigned int *b,
142  unsigned int *c );
143 
145  tl3dsState *state,
146  unsigned int index,
147  unsigned short *a,
148  unsigned short *b,
149  unsigned short *c );
150 
151 TRIMESH_LOADER_API int tl3dsCheckFileExtension( const char *filename );
152 
157 TRIMESH_LOADER_API unsigned int tl3dsHasNormals( tl3dsState *state );
158 
163 #ifdef __cplusplus
164 }
165 #endif
166 
167 #endif
TRIMESH_LOADER_API int tl3dsGetMaterialReference(tl3dsState *state, unsigned int index, unsigned int *face_index, unsigned int *face_count)
TRIMESH_LOADER_API void tl3dsDestroyState(tl3dsState *state)
Destroy a previously created state.
TRIMESH_LOADER_API unsigned int tl3dsFaceCount(tl3dsState *state)
TRIMESH_LOADER_API const char * tl3dsMaterialName(tl3dsState *state, unsigned int object)
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 tl3dsCheckFileExtension(const char *filename)
TRIMESH_LOADER_API int tl3dsGetFaceInt(tl3dsState *state, unsigned int index, unsigned int *a, unsigned int *b, unsigned int *c)
TRIMESH_LOADER_API int tl3dsParse(tl3dsState *state, const char *buffer, unsigned int length, int last)
Parse a chunk of data.
TRIMESH_LOADER_API unsigned int tl3dsObjectFaceIndex(tl3dsState *state, unsigned int object)
#define TRIMESH_LOADER_API
Definition: tl3ds.h:37
struct tl3dsState tl3dsState
Structure describing the parsing state.
Definition: tl3ds.h:47
TRIMESH_LOADER_API int tl3dsResetState(tl3dsState *state)
Reset the parsing state.
TRIMESH_LOADER_API tl3dsState * tl3dsCreateState()
Create a new parsing state.
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 const char * tl3dsObjectName(tl3dsState *state, unsigned int object)
TRIMESH_LOADER_API unsigned int tl3dsMaterialCount(tl3dsState *state)
TRIMESH_LOADER_API int tl3dsGetFace(tl3dsState *state, unsigned int index, unsigned short *a, unsigned short *b, unsigned short *c)
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 unsigned int tl3dsObjectCount(tl3dsState *state)
TRIMESH_LOADER_API const char * tl3dsMaterialReferenceName(tl3dsState *state, unsigned int object)
TRIMESH_LOADER_API unsigned int tl3dsHasNormals(tl3dsState *state)
Check if the loaded mesh has normals.
TRIMESH_LOADER_API unsigned int tl3dsVertexCount(tl3dsState *state)
TRIMESH_LOADER_API unsigned int tl3dsObjectFaceCount(tl3dsState *state, unsigned int object)