Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# material.h

Go to the documentation of this file.

    00001 /* -*- c -*- */
    00002 #ifndef INCLUDED_LIB3DS_MATERIAL_H
    00003 #define INCLUDED_LIB3DS_MATERIAL_H
    00004 /*
    00005  * The 3D Studio File Format Library
    00006  * Copyright (C) 1996-2001 by J.E. Hoffmann <je-h@gmx.net>
    00007  * All rights reserved.
    00008  *
    00009  * This program is  free  software;  you can redistribute it and/or modify it
    00010  * under the terms of the  GNU Lesser General Public License  as published by
    00011  * the  Free Software Foundation;  either version 2.1 of the License,  or (at
    00012  * your option) any later version.
    00013  *
    00014  * This  program  is  distributed in  the  hope that it will  be useful,  but
    00015  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
    00016  * or  FITNESS FOR A  PARTICULAR PURPOSE.  See the  GNU Lesser General Public
    00017  * License for more details.
    00018  *
    00019  * You should  have received  a copy of the GNU Lesser General Public License
    00020  * along with  this program;  if not, write to the  Free Software Foundation,
    00021  * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    00022  *
    00023  * $Id: material.h,v 1.1 2005/03/07 11:16:26 Assassin Exp $
    00024  */
    00025
    00026 #ifndef INCLUDED_LIB3DS_TYPES_H
    00027 #include <lib3ds/types.h>
    00028 #endif
    00029
    00030 #ifdef __cplusplus
    00031 extern "C" {
    00032 #endif
    00033
    00034 /*!
    00035  * \ingroup material
    00036  */
    00037 typedef enum _Lib3dsTextureMapFlags {
    00038   LIB3DS_DECALE       =0x0001,
    00039   LIB3DS_MIRROR       =0x0002,
    00040   LIB3DS_NEGATE       =0x0004,
    00041   LIB3DS_NO_TILE      =0x0008,
    00042   LIB3DS_SUMMED_AREA  =0x0010,
    00043   LIB3DS_ALPHA_SOURCE =0x0020,
    00044   LIB3DS_TINT         =0x0040,
    00045   LIB3DS_IGNORE_ALPHA =0x0080,
    00046   LIB3DS_RGB_TINT     =0x0100
    00047 } Lib3dsTextureMapFlags;
    00048
    00049 /*!
    00050  * Mateial texture map
    00051  * \ingroup material
    00052  */
    00053 typedef struct _Lib3dsTextureMap {
    00054     char name[64];
    00055     Lib3dsDword flags;
    00056     Lib3dsFloat percent;
    00057     Lib3dsFloat blur;
    00058     Lib3dsFloat scale[2];
    00059     Lib3dsFloat offset[2];
    00060     Lib3dsFloat rotation;
    00061     Lib3dsRgb tint_1;
    00062     Lib3dsRgb tint_2;
    00063     Lib3dsRgb tint_r;
    00064     Lib3dsRgb tint_g;
    00065     Lib3dsRgb tint_b;
    00066 } Lib3dsTextureMap;
    00067
    00068 /*!
    00069  * \ingroup material
    00070  */
    00071 typedef enum _Lib3dsAutoReflMapFlags {
    00072   LIB3DS_USE_REFL_MAP          =0x0001,
    00073   LIB3DS_READ_FIRST_FRAME_ONLY =0x0004,
    00074   LIB3DS_FLAT_MIRROR           =0x0008
    00075 } Lib3dsAutoReflectionMapFlags;
    00076
    00077 /*!
    00078  * \ingroup material
    00079  */
    00080 typedef enum _Lib3dsAutoReflMapAntiAliasLevel {
    00081   LIB3DS_ANTI_ALIAS_NONE   =0,
    00082   LIB3DS_ANTI_ALIAS_LOW    =1,
    00083   LIB3DS_ANTI_ALIAS_MEDIUM =2,
    00084   LIB3DS_ANTI_ALIAS_HIGH   =3
    00085 } Lib3dsAutoReflMapAntiAliasLevel;
    00086
    00087 /*!
    00088  * Auto reflection map settings
    00089  * \ingroup material
    00090  */
    00091 typedef struct _Lib3dsAutoReflMap {
    00092     Lib3dsDword flags;
    00093     Lib3dsIntd level;
    00094     Lib3dsIntd size;
    00095     Lib3dsIntd frame_step;
    00096 } Lib3dsAutoReflMap;
    00097
    00098 /*!
    00099  * \ingroup material
    00100  */
    00101 typedef enum _Lib3dsMaterialShading {
    00102   LIB3DS_WIRE_FRAME =0,
    00103   LIB3DS_FLAT       =1,
    00104   LIB3DS_GOURAUD    =2,
    00105   LIB3DS_PHONG      =3,
    00106   LIB3DS_METAL      =4
    00107 } Lib3dsMaterialShading;
    00108
    00109 /*!
    00110  * Material
    00111  * \ingroup material
    00112  */
    00113 struct _Lib3dsMaterial {
    00114     Lib3dsUserData user;
    00115     Lib3dsMaterial *next;
    00116     char name[64];
    00117     Lib3dsRgba ambient;
    00118     Lib3dsRgba diffuse;
    00119     Lib3dsRgba specular;
    00120     Lib3dsFloat shininess;
    00121     Lib3dsFloat shin_strength;
    00122     Lib3dsBool use_blur;
    00123     Lib3dsFloat blur;
    00124     Lib3dsFloat transparency;
    00125     Lib3dsFloat falloff;
    00126     Lib3dsBool additive;
    00127     Lib3dsBool use_falloff;
    00128     Lib3dsBool self_illum;
    00129     Lib3dsIntw shading;
    00130     Lib3dsBool soften;
    00131     Lib3dsBool face_map;
    00132     Lib3dsBool two_sided;
    00133     Lib3dsBool map_decal;
    00134     Lib3dsBool use_wire;
    00135     Lib3dsBool use_wire_abs;
    00136     Lib3dsFloat wire_size;
    00137     Lib3dsTextureMap texture1_map;
    00138     Lib3dsTextureMap texture1_mask;
    00139     Lib3dsTextureMap texture2_map;
    00140     Lib3dsTextureMap texture2_mask;
    00141     Lib3dsTextureMap opacity_map;
    00142     Lib3dsTextureMap opacity_mask;
    00143     Lib3dsTextureMap bump_map;
    00144     Lib3dsTextureMap bump_mask;
    00145     Lib3dsTextureMap specular_map;
    00146     Lib3dsTextureMap specular_mask;
    00147     Lib3dsTextureMap shininess_map;
    00148     Lib3dsTextureMap shininess_mask;
    00149     Lib3dsTextureMap self_illum_map;
    00150     Lib3dsTextureMap self_illum_mask;
    00151     Lib3dsTextureMap reflection_map;
    00152     Lib3dsTextureMap reflection_mask;
    00153     Lib3dsAutoReflMap autorefl_map;
    00154 };
    00155
    00156 extern LIB3DSAPI Lib3dsMaterial* lib3ds_material_new();
    00157 extern LIB3DSAPI void lib3ds_material_free(Lib3dsMaterial *material);
    00158 extern LIB3DSAPI void lib3ds_material_dump(Lib3dsMaterial *material);
    00159 extern LIB3DSAPI Lib3dsBool lib3ds_material_read(Lib3dsMaterial *material, Lib3dsIo *io);
    00160 extern LIB3DSAPI Lib3dsBool lib3ds_material_write(Lib3dsMaterial *material, Lib3dsIo *io);
    00161
    00162 #ifdef __cplusplus
    00163 };
    00164 #endif
    00165 #endif
    00166
    00167
    00168