| 1 | /**************************************************************************** |
| 2 | * VCGLib o o * |
| 3 | * Visual and Computer Graphics Library o o * |
| 4 | * _ O _ * |
| 5 | * Copyright(C) 2004 \/)\/ * |
| 6 | * Visual Computing Lab /\/| * |
| 7 | * ISTI - Italian National Research Council | * |
| 8 | * \ * |
| 9 | * All rights reserved. * |
| 10 | * * |
| 11 | * This program is free software; you can redistribute it and/or modify * |
| 12 | * it under the terms of the GNU General Public License as published by * |
| 13 | * the Free Software Foundation; either version 2 of the License, or * |
| 14 | * (at your option) any later version. * |
| 15 | * * |
| 16 | * This program is distributed in the hope that it will be useful, * |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 19 | * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * |
| 20 | * for more details. * |
| 21 | * * |
| 22 | ****************************************************************************/ |
| 23 | /**************************************************************************** |
| 24 | History |
| 25 | |
| 26 | $Log: io_ply.h,v $ |
| 27 | Revision 1.1 2004/06/03 13:16:32 ganovelli |
| 28 | created |
| 29 | |
| 30 | Revision 1.3 2004/05/12 10:19:30 ganovelli |
| 31 | new line added at the end of file |
| 32 | |
| 33 | Revision 1.2 2004/03/09 21:26:47 cignoni |
| 34 | cr lf mismatch |
| 35 | |
| 36 | Revision 1.1 2004/03/08 09:21:34 cignoni |
| 37 | Initial commit |
| 38 | |
| 39 | Revision 1.1 2004/03/03 15:00:51 cignoni |
| 40 | Initial commit |
| 41 | |
| 42 | ****************************************************************************/ |
| 43 | #ifndef __VCGLIB_IOTRIMESH_IO_PLY |
| 44 | #define __VCGLIB_IOTRIMESH_IO_PLY |
| 45 | |
| 46 | |
| 47 | /** |
| 48 | @name Load and Save in Ply format |
| 49 | */ |
| 50 | //@{ |
| 51 | #include<wrap/callback.h> |
| 52 | #include<wrap/ply/plylib.h> |
| 53 | |
| 54 | namespace vcg { |
| 55 | namespace tetra { |
| 56 | namespace io { |
| 57 | |
| 58 | |
| 59 | /** Additional data needed or useful for parsing a ply mesh. |
| 60 | This class can be passed to the ImporterPLY::Open() function for |
| 61 | - retrieving additional per-vertex per-tetra data |
| 62 | - specifying a callback for long ply parsing |
| 63 | - knowing what data is contained in a ply file |
| 64 | */ |
| 65 | class PlyInfo |
| 66 | { |
| 67 | public: |
| 68 | typedef ::vcg::ply::PropDescriptor PropDescriptor ; |
| 69 | |
| 70 | PlyInfo() |
| 71 | { |
| 72 | status=0; |
| 73 | mask=0; |
| 74 | cb=0; |
| 75 | vdn=fdn=0; |
| 76 | VertexData=TetraData=0; |
| 77 | } |
| 78 | /// Store the error codes enconutered when parsing a ply |
| 79 | int status; |
| 80 | /// It returns a bit mask describing the field preesnt in the ply file |
| 81 | int mask; |
| 82 | |
| 83 | /// a Simple callback that can be used for long ply parsing. |
| 84 | // it returns the current position, and formats a string with a description of what th efunction is doing (loading vertexes, faces...) |
| 85 | CallBackPos *cb; |
| 86 | |
| 87 | /// the number of per-vertex descriptor (usually 0) |
| 88 | int vdn; |
| 89 | /// The additional vertex descriptor that a user can specify to load additional per-vertex non-standard data stored in a ply |
| 90 | PropDescriptor *VertexData; |
| 91 | /// the number of per-face descriptor (usually 0) |
| 92 | int fdn; |
| 93 | |
| 94 | /// The additional vertex descriptor that a user can specify to load additional per-face non-standard data stored in a ply |
| 95 | PropDescriptor *TetraData; |
| 96 | |
| 97 | /// a string containing the current ply header. Useful for showing it to the user. |
| 98 | std::string header; |
| 99 | |
| 100 | enum Error |
| 101 | { |
| 102 | // Funzioni superiori |
| 103 | E_NO_VERTEX, // 14 |
| 104 | E_NO_FACE, // 15 |
| 105 | E_SHORTFILE, // 16 |
| 106 | E_NO_3VERTINFACE, // 17 |
| 107 | E_BAD_VERT_INDEX, // 18 |
| 108 | E_NO_6TCOORD, // 19 |
| 109 | E_DIFFER_COLORS, // 20 |
| 110 | }; |
| 111 | |
| 112 | }; // end class |
| 113 | } // end namespace tri |
| 114 | } // end namespace io |
| 115 | } // end namespace vcg |
| 116 | #endif |