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

Revision 10076, 3.7 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_MESH_H
3#define INCLUDED_LIB3DS_MESH_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
[10076]37
38
[8]39/*!
40 * Triangular mesh point
41 * \ingroup mesh
42 */
43typedef struct _Lib3dsPoint {
44    Lib3dsVector pos;
45} Lib3dsPoint;
46
47/*!
48 * Triangular mesh face
49 * \ingroup mesh
50 */
51struct _Lib3dsFace {
52    Lib3dsUserData user;
53    char material[64];
54    Lib3dsWord points[3];
55    Lib3dsWord flags;
56    Lib3dsDword smoothing;
57    Lib3dsVector normal;
58};
59
60/*!
61 * Triangular mesh box mapping settings
62 * \ingroup mesh
63 */
64struct _Lib3dsBoxMap {
65    char front[64];
66    char back[64];
67    char left[64];
68    char right[64];
69    char top[64];
70    char bottom[64];
71};
72
73/*!
[151]74 * Lib3dsMapData maptype
75 * \ingroup tracks
76 */
77typedef enum {
78  LIB3DS_MAP_NONE        =0xFFFF,
79  LIB3DS_MAP_PLANAR      =0,
80  LIB3DS_MAP_CYLINDRICAL =1,
81  LIB3DS_MAP_SPHERICAL   =2
82} Lib3dsMapType;
83
84/*!
[8]85 * Triangular mesh texture mapping data
86 * \ingroup mesh
87 */
88struct _Lib3dsMapData {
[151]89    Lib3dsWord maptype;
[8]90    Lib3dsVector pos;
91    Lib3dsMatrix matrix;
92    Lib3dsFloat scale;
93    Lib3dsFloat tile[2];
94    Lib3dsFloat planar_size[2];
95    Lib3dsFloat cylinder_height;
96};
97
98/*!
99 * Triangular mesh object
100 * \ingroup mesh
101 */
102struct _Lib3dsMesh {
103    Lib3dsUserData user;
104    Lib3dsMesh *next;
105    char name[64];
106    Lib3dsByte color;
107    Lib3dsMatrix matrix;
108    Lib3dsDword points;
109    Lib3dsPoint *pointL;
110    Lib3dsDword flags;
111    Lib3dsWord *flagL;
112    Lib3dsDword texels;
113    Lib3dsTexel *texelL;
114    Lib3dsDword faces;
115    Lib3dsFace *faceL;
116    Lib3dsBoxMap box_map;
117    Lib3dsMapData map_data;
118};
119
120extern LIB3DSAPI Lib3dsMesh* lib3ds_mesh_new(const char *name);
121extern LIB3DSAPI void lib3ds_mesh_free(Lib3dsMesh *mesh);
122extern LIB3DSAPI Lib3dsBool lib3ds_mesh_new_point_list(Lib3dsMesh *mesh, Lib3dsDword points);
123extern LIB3DSAPI void lib3ds_mesh_free_point_list(Lib3dsMesh *mesh);
124extern LIB3DSAPI Lib3dsBool lib3ds_mesh_new_flag_list(Lib3dsMesh *mesh, Lib3dsDword flags);
125extern LIB3DSAPI void lib3ds_mesh_free_flag_list(Lib3dsMesh *mesh);
126extern LIB3DSAPI Lib3dsBool lib3ds_mesh_new_texel_list(Lib3dsMesh *mesh, Lib3dsDword texels);
127extern LIB3DSAPI void lib3ds_mesh_free_texel_list(Lib3dsMesh *mesh);
128extern LIB3DSAPI Lib3dsBool lib3ds_mesh_new_face_list(Lib3dsMesh *mesh, Lib3dsDword flags);
129extern LIB3DSAPI void lib3ds_mesh_free_face_list(Lib3dsMesh *mesh);
130extern LIB3DSAPI void lib3ds_mesh_bounding_box(Lib3dsMesh *mesh, Lib3dsVector min, Lib3dsVector max);
[151]131extern LIB3DSAPI void lib3ds_mesh_calculate_normals(Lib3dsMesh *mesh, Lib3dsVector *normalL);
[8]132extern LIB3DSAPI void lib3ds_mesh_dump(Lib3dsMesh *mesh);
[10076]133extern LIB3DSAPI Lib3dsBool lib3ds_mesh_read(Lib3dsMesh *mesh, iostream *strm);
134extern LIB3DSAPI Lib3dsBool lib3ds_mesh_write(Lib3dsMesh *mesh, iostream *strm);
[8]135
136#ifdef __cplusplus
[6461]137}
[8]138#endif
139#endif
Note: See TracBrowser for help on using the browser.