| [8] | 1 | |
|---|
| 2 | #ifndef INCLUDED_LIB3DS_MESH_H |
|---|
| 3 | #define INCLUDED_LIB3DS_MESH_H |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | #ifndef INCLUDED_LIB3DS_TYPES_H |
|---|
| [1563] | 27 | #include "types.h" |
|---|
| [8] | 28 | #endif |
|---|
| 29 | |
|---|
| [10076] | 30 | #include <iostream> |
|---|
| 31 | using namespace std; |
|---|
| 32 | |
|---|
| [8] | 33 | #ifdef __cplusplus |
|---|
| 34 | extern "C" { |
|---|
| 35 | #endif |
|---|
| 36 | |
|---|
| [10076] | 37 | |
|---|
| 38 | |
|---|
| [8] | 39 | |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | typedef struct _Lib3dsPoint { |
|---|
| 44 | Lib3dsVector pos; |
|---|
| 45 | } Lib3dsPoint; |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | struct _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 | |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | struct _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 | |
|---|
| 75 | |
|---|
| 76 | |
|---|
| 77 | typedef 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 | |
|---|
| 86 | |
|---|
| 87 | |
|---|
| 88 | struct _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 | |
|---|
| 100 | |
|---|
| 101 | |
|---|
| 102 | struct _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 | |
|---|
| 120 | extern LIB3DSAPI Lib3dsMesh* lib3ds_mesh_new(const char *name); |
|---|
| 121 | extern LIB3DSAPI void lib3ds_mesh_free(Lib3dsMesh *mesh); |
|---|
| 122 | extern LIB3DSAPI Lib3dsBool lib3ds_mesh_new_point_list(Lib3dsMesh *mesh, Lib3dsDword points); |
|---|
| 123 | extern LIB3DSAPI void lib3ds_mesh_free_point_list(Lib3dsMesh *mesh); |
|---|
| 124 | extern LIB3DSAPI Lib3dsBool lib3ds_mesh_new_flag_list(Lib3dsMesh *mesh, Lib3dsDword flags); |
|---|
| 125 | extern LIB3DSAPI void lib3ds_mesh_free_flag_list(Lib3dsMesh *mesh); |
|---|
| 126 | extern LIB3DSAPI Lib3dsBool lib3ds_mesh_new_texel_list(Lib3dsMesh *mesh, Lib3dsDword texels); |
|---|
| 127 | extern LIB3DSAPI void lib3ds_mesh_free_texel_list(Lib3dsMesh *mesh); |
|---|
| 128 | extern LIB3DSAPI Lib3dsBool lib3ds_mesh_new_face_list(Lib3dsMesh *mesh, Lib3dsDword flags); |
|---|
| 129 | extern LIB3DSAPI void lib3ds_mesh_free_face_list(Lib3dsMesh *mesh); |
|---|
| 130 | extern LIB3DSAPI void lib3ds_mesh_bounding_box(Lib3dsMesh *mesh, Lib3dsVector min, Lib3dsVector max); |
|---|
| [151] | 131 | extern LIB3DSAPI void lib3ds_mesh_calculate_normals(Lib3dsMesh *mesh, Lib3dsVector *normalL); |
|---|
| [8] | 132 | extern LIB3DSAPI void lib3ds_mesh_dump(Lib3dsMesh *mesh); |
|---|
| [10076] | 133 | extern LIB3DSAPI Lib3dsBool lib3ds_mesh_read(Lib3dsMesh *mesh, iostream *strm); |
|---|
| 134 | extern LIB3DSAPI Lib3dsBool lib3ds_mesh_write(Lib3dsMesh *mesh, iostream *strm); |
|---|
| [8] | 135 | |
|---|
| 136 | #ifdef __cplusplus |
|---|
| [6461] | 137 | } |
|---|
| [8] | 138 | #endif |
|---|
| 139 | #endif |
|---|