352bda1d9389e5e0a2181a0885c437f515cc21f0
[summerhack] / src / 3dengfx / libs / lib3ds / material.h
1 /* -*- c -*- */
2 #ifndef INCLUDED_LIB3DS_MATERIAL_H
3 #define INCLUDED_LIB3DS_MATERIAL_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: material.h,v 1.15 2004/12/31 16:17:15 reed Exp $
24  */
25
26 #ifndef INCLUDED_LIB3DS_TYPES_H
27 #include <lib3ds/types.h>
28 #endif
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 /*!
35  * \ingroup material 
36  */
37 typedef enum _Lib3dsTextureMapFlags {
38   LIB3DS_DECALE       =0x0001,
39   LIB3DS_MIRROR       =0x0002,
40   LIB3DS_NEGATE       =0x0004,
41   LIB3DS_NO_TILE      =0x0008,
42   LIB3DS_SUMMED_AREA  =0x0010,
43   LIB3DS_ALPHA_SOURCE =0x0020,
44   LIB3DS_TINT         =0x0040,
45   LIB3DS_IGNORE_ALPHA =0x0080,
46   LIB3DS_RGB_TINT     =0x0100
47 } Lib3dsTextureMapFlags;
48
49 /*!
50  * Mateial texture map
51  * \ingroup material 
52  */
53 typedef struct _Lib3dsTextureMap {
54     Lib3dsUserData user;
55     char name[64];
56     Lib3dsDword flags;
57     Lib3dsFloat percent;
58     Lib3dsFloat blur;
59     Lib3dsFloat scale[2];
60     Lib3dsFloat offset[2];
61     Lib3dsFloat rotation;
62     Lib3dsRgb tint_1;
63     Lib3dsRgb tint_2;
64     Lib3dsRgb tint_r;
65     Lib3dsRgb tint_g;
66     Lib3dsRgb tint_b;
67 } Lib3dsTextureMap;
68
69 /*!
70  * \ingroup material 
71  */
72 typedef enum _Lib3dsAutoReflMapFlags {
73   LIB3DS_USE_REFL_MAP          =0x0001,
74   LIB3DS_READ_FIRST_FRAME_ONLY =0x0004,
75   LIB3DS_FLAT_MIRROR           =0x0008 
76 } Lib3dsAutoReflectionMapFlags;
77
78 /*!
79  * \ingroup material 
80  */
81 typedef enum _Lib3dsAutoReflMapAntiAliasLevel {
82   LIB3DS_ANTI_ALIAS_NONE   =0,
83   LIB3DS_ANTI_ALIAS_LOW    =1,
84   LIB3DS_ANTI_ALIAS_MEDIUM =2,
85   LIB3DS_ANTI_ALIAS_HIGH   =3
86 } Lib3dsAutoReflMapAntiAliasLevel;
87
88 /*!
89  * Auto reflection map settings
90  * \ingroup material 
91  */
92 typedef struct _Lib3dsAutoReflMap {
93     Lib3dsDword flags;
94     Lib3dsIntd level;
95     Lib3dsIntd size;
96     Lib3dsIntd frame_step;
97 } Lib3dsAutoReflMap;
98
99 /*!
100  * \ingroup material 
101  */
102 typedef enum _Lib3dsMaterialShading {
103   LIB3DS_WIRE_FRAME =0,
104   LIB3DS_FLAT       =1, 
105   LIB3DS_GOURAUD    =2, 
106   LIB3DS_PHONG      =3, 
107   LIB3DS_METAL      =4
108 } Lib3dsMaterialShading; 
109
110 /*!
111  * Material
112  * \ingroup material 
113  */
114 struct _Lib3dsMaterial {
115     Lib3dsUserData user;                /*! Arbitrary user data */
116     Lib3dsMaterial *next;
117     char name[64];                      /*! Material name */
118     Lib3dsRgba ambient;                 /*! Material ambient reflectivity */
119     Lib3dsRgba diffuse;                 /*! Material diffuse reflectivity */
120     Lib3dsRgba specular;                /*! Material specular reflectivity */
121     Lib3dsFloat shininess;              /*! Material specular exponent */
122     Lib3dsFloat shin_strength;
123     Lib3dsBool use_blur;
124     Lib3dsFloat blur;
125     Lib3dsFloat transparency;
126     Lib3dsFloat falloff;
127     Lib3dsBool additive;
128     Lib3dsFloat self_ilpct;
129     Lib3dsBool use_falloff;
130     Lib3dsBool self_illum;
131     Lib3dsIntw shading;
132     Lib3dsBool soften;
133     Lib3dsBool face_map;
134     Lib3dsBool two_sided;               /*! Material visible from back */
135     Lib3dsBool map_decal;
136     Lib3dsBool use_wire;
137     Lib3dsBool use_wire_abs;
138     Lib3dsFloat wire_size;
139     Lib3dsTextureMap texture1_map;
140     Lib3dsTextureMap texture1_mask;
141     Lib3dsTextureMap texture2_map;
142     Lib3dsTextureMap texture2_mask;
143     Lib3dsTextureMap opacity_map;
144     Lib3dsTextureMap opacity_mask;
145     Lib3dsTextureMap bump_map;
146     Lib3dsTextureMap bump_mask;
147     Lib3dsTextureMap specular_map;
148     Lib3dsTextureMap specular_mask;
149     Lib3dsTextureMap shininess_map;
150     Lib3dsTextureMap shininess_mask;
151     Lib3dsTextureMap self_illum_map;
152     Lib3dsTextureMap self_illum_mask;
153     Lib3dsTextureMap reflection_map;
154     Lib3dsTextureMap reflection_mask;
155     Lib3dsAutoReflMap autorefl_map;
156 };
157
158 extern LIB3DSAPI Lib3dsMaterial* lib3ds_material_new();
159 extern LIB3DSAPI void lib3ds_material_free(Lib3dsMaterial *material);
160 extern LIB3DSAPI void lib3ds_material_dump(Lib3dsMaterial *material);
161 extern LIB3DSAPI Lib3dsBool lib3ds_material_read(Lib3dsMaterial *material, Lib3dsIo *io);
162 extern LIB3DSAPI Lib3dsBool lib3ds_material_write(Lib3dsMaterial *material, Lib3dsIo *io);
163
164 #ifdef __cplusplus
165 }
166 #endif
167 #endif
168
169
170