root/OpenSceneGraph/trunk/src/osgPlugins/3ds/material.h @ 10076

Revision 10076, 4.3 kB (checked in by robert, 5 years ago)

From Neil Hughes, converted across to use istream for reading data from file to enable reading .3ds files over http (use OSG's libcurl plugin).

From Robert Osfield, ammendments of the above to better support reading of files from local directories.

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