5b6f008ea8b7c84c699de98fc5b297fc731c0165
[summerhack] / src / 3dengfx / libs / lib3ds / types.h
1 /* -*- c -*- */
2 #ifndef INCLUDED_LIB3DS_TYPES_H
3 #define INCLUDED_LIB3DS_TYPES_H
4 /*
5  * The 3D Studio File Format Library
6  * Copyright (C) 1996-2001 by J.E. Hoffmann <je-h@gmx.net>
7  * All rights reserved.
8  *
9  * This program is  free  software;  you can redistribute it and/or modify it
10  * under the terms of the  GNU Lesser General Public License  as published by 
11  * the  Free Software Foundation;  either version 2.1 of the License,  or (at 
12  * your option) any later version.
13  *
14  * This  program  is  distributed in  the  hope that it will  be useful,  but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16  * or  FITNESS FOR A  PARTICULAR PURPOSE.  See the  GNU Lesser General Public  
17  * License for more details.
18  *
19  * You should  have received  a copy of the GNU Lesser General Public License
20  * along with  this program;  if not, write to the  Free Software Foundation,
21  * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22  *
23  * $Id: types.h,v 1.18 2005/01/11 16:12:52 madmac Exp $
24  */
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 #if defined (UBUILD_SHARED) && defined(_WIN32) && (!defined(__GNUC__))
30 #ifdef LIB3DS_EXPORT
31 #define LIB3DSAPI __declspec(dllexport)
32 #else               
33 #define LIB3DSAPI __declspec(dllimport)
34 #endif           
35 #else
36 #define LIB3DSAPI
37 #endif
38
39 #define LIB3DS_TRUE 1
40 #define LIB3DS_FALSE 0
41
42 typedef int Lib3dsBool;
43 typedef unsigned char Lib3dsByte;
44 typedef unsigned short int Lib3dsWord;
45 typedef unsigned long Lib3dsDword;
46 typedef signed char Lib3dsIntb;
47 typedef signed short int Lib3dsIntw;
48 typedef signed long Lib3dsIntd;
49 typedef float Lib3dsFloat;
50 typedef double Lib3dsDouble;
51
52 typedef float Lib3dsVector[3];
53 typedef float Lib3dsTexel[2];
54 typedef float Lib3dsQuat[4];
55 typedef float Lib3dsMatrix[4][4];
56 typedef float Lib3dsRgb[3];
57 typedef float Lib3dsRgba[4];
58
59 #define LIB3DS_EPSILON (1e-8)
60 #define LIB3DS_PI 3.14159265358979323846
61 #define LIB3DS_TWOPI (2.0*LIB3DS_PI)
62 #define LIB3DS_HALFPI (LIB3DS_PI/2.0)
63 #define LIB3DS_RAD_TO_DEG(x) ((180.0/LIB3DS_PI)*(x))
64 #define LIB3DS_DEG_TO_RAD(x) ((LIB3DS_PI/180.0)*(x))
65   
66 #ifndef INCLUDED_STDIO_H
67 #define INCLUDED_STDIO_H
68 #include <stdio.h>
69 #endif
70
71 #ifdef _DEBUG
72   #ifndef ASSERT
73   #include <assert.h>
74   #define ASSERT(__expr) assert(__expr)
75   #endif
76   #define LIB3DS_ERROR_LOG \
77     {printf("\t***LIB3DS_ERROR_LOG*** %s : %d\n", __FILE__, __LINE__);}
78 #else 
79   #ifndef ASSERT
80   #define ASSERT(__expr)
81   #endif
82   #define LIB3DS_ERROR_LOG
83 #endif
84
85 typedef struct _Lib3dsIo Lib3dsIo;
86 typedef struct _Lib3dsFile Lib3dsFile;
87 typedef struct _Lib3dsBackground Lib3dsBackground;
88 typedef struct _Lib3dsAtmosphere Lib3dsAtmosphere;
89 typedef struct _Lib3dsShadow Lib3dsShadow;
90 typedef struct _Lib3dsViewport Lib3dsViewport;
91 typedef struct _Lib3dsMaterial Lib3dsMaterial;
92 typedef struct _Lib3dsFace Lib3dsFace; 
93 typedef struct _Lib3dsBoxMap Lib3dsBoxMap; 
94 typedef struct _Lib3dsMapData Lib3dsMapData; 
95 typedef struct _Lib3dsMesh Lib3dsMesh;
96 typedef struct _Lib3dsCamera Lib3dsCamera;
97 typedef struct _Lib3dsLight Lib3dsLight;
98 typedef struct _Lib3dsBoolKey Lib3dsBoolKey;
99 typedef struct _Lib3dsBoolTrack Lib3dsBoolTrack;
100 typedef struct _Lib3dsLin1Key Lib3dsLin1Key;
101 typedef struct _Lib3dsLin1Track Lib3dsLin1Track;
102 typedef struct _Lib3dsLin3Key Lib3dsLin3Key;
103 typedef struct _Lib3dsLin3Track Lib3dsLin3Track;
104 typedef struct _Lib3dsQuatKey Lib3dsQuatKey;
105 typedef struct _Lib3dsQuatTrack Lib3dsQuatTrack;
106 typedef struct _Lib3dsMorphKey Lib3dsMorphKey;
107 typedef struct _Lib3dsMorphTrack Lib3dsMorphTrack;
108
109 typedef enum _Lib3dsNodeTypes {
110   LIB3DS_UNKNOWN_NODE =0,
111   LIB3DS_AMBIENT_NODE =1,
112   LIB3DS_OBJECT_NODE  =2,
113   LIB3DS_CAMERA_NODE  =3,
114   LIB3DS_TARGET_NODE  =4,
115   LIB3DS_LIGHT_NODE   =5,
116   LIB3DS_SPOT_NODE    =6
117 } Lib3dsNodeTypes;
118
119 typedef struct _Lib3dsNode Lib3dsNode;
120
121 typedef union _Lib3dsUserData {
122     void *p;
123     Lib3dsIntd i;
124     Lib3dsDword d;
125     Lib3dsFloat f;
126     Lib3dsMaterial *material;
127     Lib3dsMesh *mesh;
128     Lib3dsCamera *camera;
129     Lib3dsLight *light;
130     Lib3dsNode *node;
131 } Lib3dsUserData;
132
133 #ifndef LIB3DS_EXPORT
134         /* The purpose of this variable is to force a recompile of any code
135          * that links to the lib3ds library whenever there is an incompatible
136          * change in the header files.  It should be sufficient to include
137          * any lib3ds header file in any source file to satisfy this dependency.
138          *
139          * This variable will be updated any time there is an incompatible change
140          * in the lib3ds data structures.
141          */
142 //      int lib3ds_version1_3;
143 #endif
144
145 #ifdef __cplusplus
146 }
147 #endif
148 #endif