home *** CD-ROM | disk | FTP | other *** search
/ Enter 2005 March / ENTER.ISO / files / fwp-0.0.6-win32-installer.exe / mesh.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-07-07  |  3.7 KB  |  136 lines

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