2 #ifndef INCLUDED_LIB3DS_MATERIAL_H
3 #define INCLUDED_LIB3DS_MATERIAL_H
5 * The 3D Studio File Format Library
6 * Copyright (C) 1996-2001 by J.E. Hoffmann <je-h@gmx.net>
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.
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.
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.
23 * $Id: material.h,v 1.15 2004/12/31 16:17:15 reed Exp $
26 #ifndef INCLUDED_LIB3DS_TYPES_H
27 #include <lib3ds/types.h>
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,
45 LIB3DS_IGNORE_ALPHA =0x0080,
46 LIB3DS_RGB_TINT =0x0100
47 } Lib3dsTextureMapFlags;
53 typedef struct _Lib3dsTextureMap {
60 Lib3dsFloat offset[2];
72 typedef enum _Lib3dsAutoReflMapFlags {
73 LIB3DS_USE_REFL_MAP =0x0001,
74 LIB3DS_READ_FIRST_FRAME_ONLY =0x0004,
75 LIB3DS_FLAT_MIRROR =0x0008
76 } Lib3dsAutoReflectionMapFlags;
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;
89 * Auto reflection map settings
92 typedef struct _Lib3dsAutoReflMap {
96 Lib3dsIntd frame_step;
102 typedef enum _Lib3dsMaterialShading {
103 LIB3DS_WIRE_FRAME =0,
108 } Lib3dsMaterialShading;
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;
125 Lib3dsFloat transparency;
128 Lib3dsFloat self_ilpct;
129 Lib3dsBool use_falloff;
130 Lib3dsBool self_illum;
134 Lib3dsBool two_sided; /*! Material visible from back */
135 Lib3dsBool map_decal;
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;
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);