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

# mesh.h

Go to the documentation of this file.

    00001 /* -*- c -*- */
    00002 #ifndef INCLUDED_LIB3DS_MESH_H
    00003 #define INCLUDED_LIB3DS_MESH_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: mesh.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  * Triangular mesh point
    00036  * \ingroup mesh
    00037  */
    00038 typedef struct _Lib3dsPoint {
    00039     Lib3dsVector pos;
    00040 } Lib3dsPoint;
    00041
    00042 /*!
    00043  * Triangular mesh face
    00044  * \ingroup mesh
    00045  */
    00046 struct _Lib3dsFace {
    00047     Lib3dsUserData user;
    00048     char material[64];
    00049     Lib3dsWord points[3];
    00050     Lib3dsWord flags;
    00051     Lib3dsDword smoothing;
    00052     Lib3dsVector normal;
    00053 };
    00054
    00055 /*!
    00056  * Triangular mesh box mapping settings
    00057  * \ingroup mesh
    00058  */
    00059 struct _Lib3dsBoxMap {
    00060     char front[64];
    00061     char back[64];
    00062     char left[64];
    00063     char right[64];
    00064     char top[64];
    00065     char bottom[64];
    00066 };
    00067
    00068 /*!
    00069  * Lib3dsMapData maptype
    00070  * \ingroup tracks
    00071  */
    00072 typedef enum {
    00073   LIB3DS_MAP_NONE        =0xFFFF,
    00074   LIB3DS_MAP_PLANAR      =0,
    00075   LIB3DS_MAP_CYLINDRICAL =1,
    00076   LIB3DS_MAP_SPHERICAL   =2
    00077 } Lib3dsMapType;
    00078
    00079 /*!
    00080  * Triangular mesh texture mapping data
    00081  * \ingroup mesh
    00082  */
    00083 struct _Lib3dsMapData {
    00084     Lib3dsWord maptype;
    00085     Lib3dsVector pos;
    00086     Lib3dsMatrix matrix;
    00087     Lib3dsFloat scale;
    00088     Lib3dsFloat tile[2];
    00089     Lib3dsFloat planar_size[2];
    00090     Lib3dsFloat cylinder_height;
    00091 };
    00092
    00093 /*!
    00094  * Triangular mesh object
    00095  * \ingroup mesh
    00096  */
    00097 struct _Lib3dsMesh {
    00098     Lib3dsUserData user;
    00099     Lib3dsMesh *next;
    00100     char name[64];
    00101     Lib3dsByte color;
    00102     Lib3dsMatrix matrix;
    00103     Lib3dsDword points;
    00104     Lib3dsPoint *pointL;
    00105     Lib3dsDword flags;
    00106     Lib3dsWord *flagL;
    00107     Lib3dsDword texels;
    00108     Lib3dsTexel *texelL;
    00109     Lib3dsDword faces;
    00110     Lib3dsFace *faceL;
    00111     Lib3dsBoxMap box_map;
    00112     Lib3dsMapData map_data;
    00113 };
    00114
    00115 extern LIB3DSAPI Lib3dsMesh* lib3ds_mesh_new(const char *name);
    00116 extern LIB3DSAPI void lib3ds_mesh_free(Lib3dsMesh *mesh);
    00117 extern LIB3DSAPI Lib3dsBool lib3ds_mesh_new_point_list(Lib3dsMesh *mesh, Lib3dsDword points);
    00118 extern LIB3DSAPI void lib3ds_mesh_free_point_list(Lib3dsMesh *mesh);
    00119 extern LIB3DSAPI Lib3dsBool lib3ds_mesh_new_flag_list(Lib3dsMesh *mesh, Lib3dsDword flags);
    00120 extern LIB3DSAPI void lib3ds_mesh_free_flag_list(Lib3dsMesh *mesh);
    00121 extern LIB3DSAPI Lib3dsBool lib3ds_mesh_new_texel_list(Lib3dsMesh *mesh, Lib3dsDword texels);
    00122 extern LIB3DSAPI void lib3ds_mesh_free_texel_list(Lib3dsMesh *mesh);
    00123 extern LIB3DSAPI Lib3dsBool lib3ds_mesh_new_face_list(Lib3dsMesh *mesh, Lib3dsDword flags);
    00124 extern LIB3DSAPI void lib3ds_mesh_free_face_list(Lib3dsMesh *mesh);
    00125 extern LIB3DSAPI void lib3ds_mesh_bounding_box(Lib3dsMesh *mesh, Lib3dsVector min, Lib3dsVector max);
    00126 extern LIB3DSAPI void lib3ds_mesh_calculate_normals(Lib3dsMesh *mesh, Lib3dsVector *normalL);
    00127 extern LIB3DSAPI void lib3ds_mesh_dump(Lib3dsMesh *mesh);
    00128 extern LIB3DSAPI Lib3dsBool lib3ds_mesh_read(Lib3dsMesh *mesh, Lib3dsIo *io);
    00129 extern LIB3DSAPI Lib3dsBool lib3ds_mesh_write(Lib3dsMesh *mesh, Lib3dsIo *io);
    00130
    00131 #ifdef __cplusplus
    00132 };
    00133 #endif
    00134 #endif
    00135