source: OGRE/trunk/ogrenew/Tools/MilkshapeExport/include/msLib.h @ 692

Revision 692, 12.4 KB checked in by mattausch, 19 years ago (diff)

adding ogre 1.2 and dependencies

Line 
1/**********************************************************************
2 *
3 * MilkShape 3D Model Import/Export API
4 *
5 * May 10 2000, Mete Ciragan, chUmbaLum sOft
6 *
7 **********************************************************************/
8
9#ifndef __MSLIB_H__
10#define __MSLIB_H__
11
12
13
14#ifdef MSLIB_EXPORTS
15#define MSLIB_API __declspec(dllexport)
16#else
17#define MSLIB_API __declspec(dllimport)
18#endif /* MSLIB_EXPORTS */
19
20
21
22#ifdef WIN32
23#include <pshpack1.h>
24#endif /* WIN32 */
25
26
27
28#ifdef __cplusplus
29extern "C" {
30#endif /* __cplusplus */
31
32
33
34/**********************************************************************
35 *
36 * Constants
37 *
38 **********************************************************************/
39
40#define MS_MAX_NAME             32
41#define MS_MAX_PATH             256
42
43
44
45/**********************************************************************
46 *
47 * Types
48 *
49 **********************************************************************/
50
51#ifndef byte
52typedef unsigned char byte;
53#endif /* byte */
54
55#ifndef word
56typedef unsigned short word;
57#endif /* word */
58
59typedef float   msVec4[4];
60typedef float   msVec3[3];
61typedef float   msVec2[2];
62
63/* msFlag */
64typedef enum {
65    eSelected = 1, eSelected2 = 2, eHidden = 4, eDirty = 8, eAveraged = 16, eUnused = 32
66} msFlag;
67
68/* msVertex */
69typedef struct msVertex
70{
71    byte        nFlags;
72    msVec3      Vertex;
73    float       u, v;
74    char        nBoneIndex;
75} msVertex;
76
77/* msTriangle */
78typedef struct
79{
80    word        nFlags;
81    word        nVertexIndices[3];
82    word        nNormalIndices[3];
83    msVec3      Normal;
84    byte        nSmoothingGroup;
85} msTriangle;
86
87/* msMesh */
88typedef struct msMesh
89{
90    byte        nFlags;
91    char        szName[MS_MAX_NAME];
92    char        nMaterialIndex;
93   
94    word        nNumVertices;
95    word        nNumAllocedVertices;
96    msVertex*   pVertices;
97
98    word        nNumNormals;
99    word        nNumAllocedNormals;
100    msVec3*     pNormals;
101
102    word        nNumTriangles;
103    word        nNumAllocedTriangles;
104    msTriangle* pTriangles;
105} msMesh;
106
107/* msMaterial */
108typedef struct msMaterial
109{
110    int         nFlags;
111    char        szName[MS_MAX_NAME];
112    msVec4      Ambient;
113    msVec4      Diffuse;
114    msVec4      Specular;
115    msVec4      Emissive;
116    float       fShininess;
117    float       fTransparency;
118    char        szDiffuseTexture[MS_MAX_PATH];
119    char        szAlphaTexture[MS_MAX_PATH];
120    int         nName;
121} msMaterial;
122
123/* msPositionKey */
124typedef struct msPositionKey
125{
126    float       fTime;
127    msVec3      Position;
128} msPositionKey;
129
130/* msRotationKey */
131typedef struct msRotationKey
132{
133    float   fTime;
134    msVec3  Rotation;
135} msRotationKey;
136
137/* msBone */
138typedef struct msBone
139{
140    int             nFlags;
141    char            szName[MS_MAX_NAME];
142    char            szParentName[MS_MAX_NAME];
143    msVec3          Position;
144    msVec3          Rotation;
145
146    int             nNumPositionKeys;
147    int             nNumAllocedPositionKeys;
148    msPositionKey*  pPositionKeys;
149
150    int             nNumRotationKeys;
151    int             nNumAllocedRotationKeys;
152    msRotationKey*  pRotationKeys;
153} msBone;
154
155/* msModel */
156typedef struct msModel
157{
158    int         nNumMeshes;
159    int         nNumAllocedMeshes;
160    msMesh*     pMeshes;
161
162    int         nNumMaterials;
163    int         nNumAllocedMaterials;
164    msMaterial* pMaterials;
165
166    int         nNumBones;
167    int         nNumAllocedBones;
168    msBone*     pBones;
169
170    int         nFrame;
171    int         nTotalFrames;
172
173    msVec3      Position;
174    msVec3      Rotation;
175} msModel;
176
177
178
179/**********************************************************************
180 *
181 * MilkShape 3D Interface
182 *
183 **********************************************************************/
184
185/**********************************************************************
186 * msModel
187 **********************************************************************/
188
189MSLIB_API void          msModel_Destroy (msModel *pModel);
190
191MSLIB_API int           msModel_GetMeshCount (msModel *pModel);
192MSLIB_API int           msModel_AddMesh (msModel *pModel);
193MSLIB_API msMesh*       msModel_GetMeshAt (msModel *pModel, int nIndex);
194MSLIB_API int           msModel_FindMeshByName (msModel *pModel, const char *szName);
195
196MSLIB_API int           msModel_GetMaterialCount (msModel *pModel);
197MSLIB_API int           msModel_AddMaterial (msModel *pModel);
198MSLIB_API msMaterial*   msModel_GetMaterialAt (msModel *pModel, int nIndex);
199MSLIB_API int           msModel_FindMaterialByName (msModel *pModel, const char *szName);
200
201MSLIB_API int           msModel_GetBoneCount (msModel *pModel);
202MSLIB_API int           msModel_AddBone (msModel *pModel);
203MSLIB_API msBone*       msModel_GetBoneAt (msModel *pModel, int nIndex);
204MSLIB_API int           msModel_FindBoneByName (msModel *pModel, const char *szName);
205
206MSLIB_API int           msModel_SetFrame (msModel *pModel, int nFrame);
207MSLIB_API int           msModel_GetFrame (msModel *pModel);
208MSLIB_API int           msModel_SetTotalFrames (msModel *pModel, int nTotalFrames);
209MSLIB_API int           msModel_GetTotalFrames (msModel *pModel);
210MSLIB_API void          msModel_SetPosition (msModel *pModel, msVec3 Position);
211MSLIB_API void          msModel_GetPosition (msModel *pModel, msVec3 Position);
212MSLIB_API void          msModel_SetRotation (msModel *pModel, msVec3 Rotation);
213MSLIB_API void          msModel_GetRotation (msModel *pModel, msVec3 Rotation);
214
215/**********************************************************************
216 * msMesh
217 **********************************************************************/
218
219MSLIB_API void          msMesh_Destroy (msMesh *pMesh);
220MSLIB_API void          msMesh_SetFlags (msMesh *pMesh, byte nFlags);
221MSLIB_API byte          msMesh_GetFlags (msMesh *pMesh);
222MSLIB_API void          msMesh_SetName (msMesh *pMesh, const char *szName);
223MSLIB_API void          msMesh_GetName (msMesh *pMesh, char *szName, int nMaxLength);
224MSLIB_API void          msMesh_SetMaterialIndex (msMesh *pMesh, int nIndex);
225MSLIB_API int           msMesh_GetMaterialIndex (msMesh *pMesh);
226
227MSLIB_API int           msMesh_GetVertexCount (msMesh *pMesh);
228MSLIB_API int           msMesh_AddVertex (msMesh *pMesh);
229MSLIB_API msVertex*     msMesh_GetVertexAt (msMesh *pMesh, int nIndex);
230MSLIB_API msVertex*     msMesh_GetInterpolatedVertexAt (msMesh *pMesh, int nIndex); // NOT YET IMPLEMENTED
231
232MSLIB_API int           msMesh_GetTriangleCount (msMesh *pMesh);
233MSLIB_API int           msMesh_AddTriangle (msMesh *pMesh);
234MSLIB_API msTriangle*   msMesh_GetTriangleAt (msMesh *pMesh, int nIndex);
235
236MSLIB_API int           msMesh_GetVertexNormalCount (msMesh *pMesh);
237MSLIB_API int           msMesh_AddVertexNormal (msMesh *pMesh);
238MSLIB_API void          msMesh_SetVertexNormalAt (msMesh *pMesh, int nIndex, msVec3 Normal);
239MSLIB_API void          msMesh_GetVertexNormalAt (msMesh *pMesh, int nIndex, msVec3 Normal);
240MSLIB_API void          msMesh_GetInterpolatedVertexNormalAt (msMesh *pMesh, int nIndex, msVec3 Normal); // NOT YET IMPLEMENTED
241
242/**********************************************************************
243 * msTriangle
244 **********************************************************************/
245
246MSLIB_API void          msTriangle_SetFlags (msTriangle* pTriangle, word nFlags);
247MSLIB_API word          msTriangle_GetFlags (msTriangle* pTriangle);
248MSLIB_API void          msTriangle_SetVertexIndices (msTriangle *pTriangle, word nIndices[]);
249MSLIB_API void          msTriangle_GetVertexIndices (msTriangle *pTriangle, word nIndices[]);
250MSLIB_API void          msTriangle_SetNormalIndices (msTriangle *pTriangle, word nNormalIndices[]);
251MSLIB_API void          msTriangle_GetNormalIndices (msTriangle *pTriangle, word nNormalIndices[]);
252MSLIB_API void          msTriangle_SetSmoothingGroup (msTriangle *pTriangle, byte nSmoothingGroup);
253MSLIB_API byte          msTriangle_GetSmoothingGroup (msTriangle *pTriangle);
254
255/**********************************************************************
256 * msVertex
257 **********************************************************************/
258
259MSLIB_API void          msVertex_SetFlags (msVertex* pVertex, byte nFlags);
260MSLIB_API byte          msVertex_GetFlags (msVertex* pVertex);
261MSLIB_API void          msVertex_SetVertex (msVertex* pVertex, msVec3 Vertex);
262MSLIB_API void          msVertex_GetVertex (msVertex* pVertex, msVec3 Vertex);
263MSLIB_API void          msVertex_SetTexCoords (msVertex* pVertex, msVec2 st);
264MSLIB_API void          msVertex_GetTexCoords (msVertex* pVertex, msVec2 st);
265MSLIB_API int           msVertex_SetBoneIndex (msVertex* pVertex, int nBoneIndex);
266MSLIB_API int           msVertex_GetBoneIndex (msVertex* pVertex);
267
268/**********************************************************************
269 * msMaterial
270 **********************************************************************/
271
272MSLIB_API void          msMaterial_SetName (msMaterial *pMaterial, const char *szName);
273MSLIB_API void          msMaterial_GetName (msMaterial *pMaterial, char *szName, int nMaxLength);
274MSLIB_API void          msMaterial_SetAmbient (msMaterial *pMaterial, msVec4 Ambient);
275MSLIB_API void          msMaterial_SetAmbient (msMaterial *pMaterial, msVec4 Ambient);
276MSLIB_API void          msMaterial_GetAmbient (msMaterial *pMaterial, msVec4 Ambient);
277MSLIB_API void          msMaterial_SetDiffuse (msMaterial *pMaterial, msVec4 Diffuse);
278MSLIB_API void          msMaterial_GetDiffuse (msMaterial *pMaterial, msVec4 Diffuse);
279MSLIB_API void          msMaterial_SetSpecular (msMaterial *pMaterial, msVec4 Specular);
280MSLIB_API void          msMaterial_GetSpecular (msMaterial *pMaterial, msVec4 Specular);
281MSLIB_API void          msMaterial_SetEmissive (msMaterial *pMaterial, msVec4 Emissive);
282MSLIB_API void          msMaterial_GetEmissive (msMaterial *pMaterial, msVec4 Emissive);
283MSLIB_API void          msMaterial_SetShininess (msMaterial *pMaterial, float fShininess);
284MSLIB_API float         msMaterial_GetShininess (msMaterial *pMaterial);
285MSLIB_API void          msMaterial_SetTransparency (msMaterial *pMaterial, float fTransparency);
286MSLIB_API float         msMaterial_GetTransparency (msMaterial *pMaterial);
287MSLIB_API void          msMaterial_SetDiffuseTexture (msMaterial *pMaterial, const char *szDiffuseTexture);
288MSLIB_API void          msMaterial_GetDiffuseTexture (msMaterial *pMaterial, char *szDiffuseTexture, int nMaxLength);
289MSLIB_API void          msMaterial_SetAlphaTexture (msMaterial *pMaterial, const char *szAlphaTexture);
290MSLIB_API void          msMaterial_GetAlphaTexture (msMaterial *pMaterial, char *szAlphaTexture, int nMaxLength);
291
292/**********************************************************************
293 * msBone
294 **********************************************************************/
295
296MSLIB_API void          msBone_Destroy (msBone *pBone);
297MSLIB_API void          msBone_SetFlags (msBone *pBone, int nFlags);
298MSLIB_API int           msBone_GetFlags (msBone *pBone);
299MSLIB_API void          msBone_SetName (msBone *pBone, const char *szName);
300MSLIB_API void          msBone_GetName (msBone *pBone, char *szName, int nMaxLength);
301MSLIB_API void          msBone_SetParentName (msBone *pBone, const char *szParentName);
302MSLIB_API void          msBone_GetParentName (msBone *pBone, char *szParentName, int nMaxLength);
303MSLIB_API void          msBone_SetPosition (msBone *pBone, msVec3 Position);
304MSLIB_API void          msBone_GetPosition (msBone *pBone, msVec3 Position);
305MSLIB_API void          msBone_GetInterpolatedPosition (msBone *pBone, msVec3 Position); // NOT YET IMPLEMENTED
306MSLIB_API void          msBone_SetRotation (msBone *pBone, msVec3 Rotation);
307MSLIB_API void          msBone_GetRotation (msBone *pBone, msVec3 Rotation);
308MSLIB_API void          msBone_GetInterpolatedRotation (msBone *pBone, msVec3 Rotation); // NOT YET IMPLEMENTED
309
310MSLIB_API int           msBone_GetPositionKeyCount (msBone *pBone);
311MSLIB_API int           msBone_AddPositionKey (msBone *pBone, float fTime, msVec3 Position);
312MSLIB_API msPositionKey* msBone_GetPositionKeyAt (msBone *pBone, int nIndex);
313
314MSLIB_API int           msBone_GetRotationKeyCount (msBone *pBone);
315MSLIB_API int           msBone_AddRotationKey (msBone *pBone, float fTime, msVec3 Rotation);
316MSLIB_API msRotationKey* msBone_GetRotationKeyAt (msBone *pBone, int nIndex);
317
318
319
320#ifdef __cplusplus
321}
322#endif /* __cplusplus */
323
324
325
326#ifdef WIN32
327#include <poppack.h>
328#endif /* WIN32 */
329
330
331
332#endif /* __MSLIB_H__ */
Note: See TracBrowser for help on using the repository browser.