| 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.4 2004/06/23 15:36:44 cignoni |
| 28 | Restructured management of error, now the standard open for any mesh type return the error code, the default success value is zero |
| 29 | Any import class has a method ErrorMsg that give a verbal description of an error code. |
| 30 | |
| 31 | Revision 1.3 2004/05/12 10:19:30 ganovelli |
| 32 | new line added at the end of file |
| 33 | |
| 34 | Revision 1.2 2004/03/09 21:26:47 cignoni |
| 35 | cr lf mismatch |
| 36 | |
| 37 | Revision 1.1 2004/03/08 09:21:34 cignoni |
| 38 | Initial commit |
| 39 | |
| 40 | Revision 1.1 2004/03/03 15:00:51 cignoni |
| 41 | Initial commit |
| 42 | |
| 43 | ****************************************************************************/ |
| 44 | #ifndef __VCGLIB_IOTRIMESH_IO_PLY |
| 45 | #define __VCGLIB_IOTRIMESH_IO_PLY |
| 46 | |
| 47 | |
| 48 | /** |
| 49 | @name Load and Save in Ply format |
| 50 | */ |
| 51 | //@{ |
| 52 | #include<wrap/callback.h> |
| 53 | #include<wrap/ply/plylib.h> |
| 54 | |
| 55 | namespace vcg { |
| 56 | namespace tri { |
| 57 | namespace io { |
| 58 | |
| 59 | |
| 60 | /** Additional data needed or useful for parsing a ply mesh. |
| 61 | This class can be passed to the ImporterPLY::Open() function for |
| 62 | - retrieving additional per-vertex per-face data |
| 63 | - specifying a callback for long ply parsing |
| 64 | - knowing what data is contained in a ply file |
| 65 | */ |
| 66 | class PlyInfo |
| 67 | { |
| 68 | public: |
| 69 | typedef ::vcg::ply::PropDescriptor PropDescriptor ; |
| 70 | |
| 71 | PlyInfo() |
| 72 | { |
| 73 | status=0; |
| 74 | mask=0; |
| 75 | cb=0; |
| 76 | vdn=fdn=0; |
| 77 | VertexData=FaceData=0; |
| 78 | } |
| 79 | /// Store the error codes enconutered when parsing a ply |
| 80 | int status; |
| 81 | /// It returns a bit mask describing the field preesnt in the ply file |
| 82 | int mask; |
| 83 | |
| 84 | /// a Simple callback that can be used for long ply parsing. |
| 85 | // it returns the current position, and formats a string with a description of what th efunction is doing (loading vertexes, faces...) |
| 86 | CallBackPos *cb; |
| 87 | |
| 88 | /// the number of per-vertex descriptor (usually 0) |
| 89 | int vdn; |
| 90 | /// The additional vertex descriptor that a user can specify to load additional per-vertex non-standard data stored in a ply |
| 91 | PropDescriptor *VertexData; |
| 92 | /// the number of per-face descriptor (usually 0) |
| 93 | int fdn; |
| 94 | |
| 95 | /// The additional vertex descriptor that a user can specify to load additional per-face non-standard data stored in a ply |
| 96 | PropDescriptor *FaceData; |
| 97 | |
| 98 | /// a string containing the current ply header. Useful for showing it to the user. |
| 99 | std::string header; |
| 100 | |
| 101 | enum Error |
| 102 | { |
| 103 | // Funzioni superiori |
| 104 | E_NO_VERTEX = ply::E_MAXPLYERRORS+1, // 14 |
| 105 | E_NO_FACE = ply::E_MAXPLYERRORS+2, // 15 |
| 106 | E_SHORTFILE = ply::E_MAXPLYERRORS+3, // 16 |
| 107 | E_NO_3VERTINFACE = ply::E_MAXPLYERRORS+4, // 17 |
| 108 | E_BAD_VERT_INDEX = ply::E_MAXPLYERRORS+5, // 18 |
| 109 | E_NO_6TCOORD = ply::E_MAXPLYERRORS+6, // 19 |
| 110 | E_DIFFER_COLORS = ply::E_MAXPLYERRORS+7, |
| 111 | E_MAXPLYINFOERRORS= ply::E_MAXPLYERRORS+8// 20 |
| 112 | }; |
| 113 | |
| 114 | }; // end class |
| 115 | } // end namespace tri |
| 116 | } // end namespace io |
| 117 | } // end namespace vcg |
| 118 | #endif |