00001 /**************************************************************************** 00002 * VCGLib o o * 00003 * Visual and Computer Graphics Library o o * 00004 * _ O _ * 00005 * Copyright(C) 2004 \/)\/ * 00006 * Visual Computing Lab /\/| * 00007 * ISTI - Italian National Research Council | * 00008 * \ * 00009 * All rights reserved. * 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 * This program is distributed in the hope that it will be useful, * 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00019 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * 00020 * for more details. * 00021 * * 00022 ****************************************************************************/ 00023 /**************************************************************************** 00024 History 00025 00026 $Log: not supported by cvs2svn $ 00027 Revision 1.6 2006/05/21 06:58:55 cignoni 00028 Added ClampMask function 00029 00030 Revision 1.5 2006/01/10 13:20:42 cignoni 00031 Changed ply::PlyMask to io::Mask 00032 00033 Revision 1.4 2004/10/28 00:52:45 cignoni 00034 Better Doxygen documentation 00035 00036 Revision 1.3 2004/05/12 10:19:30 ganovelli 00037 new line added at the end of file 00038 00039 Revision 1.2 2004/03/09 21:26:47 cignoni 00040 cr lf mismatch 00041 00042 Revision 1.1 2004/03/03 15:00:51 cignoni 00043 Initial commit 00044 00045 ****************************************************************************/ 00046 #ifndef __VCGLIB_IOTRIMESH_IO_MASK 00047 #define __VCGLIB_IOTRIMESH_IO_MASK 00048 00049 namespace vcg { 00050 namespace tri { 00051 namespace io { 00052 00057 00058 class Mask 00059 { 00060 public: 00061 00062 /* 00063 Bitmask for specifying what data has to be loaded or saved or it is present in a given plyfile; 00064 */ 00065 00066 enum { 00067 IOM_NONE = 0x00000, 00068 00069 IOM_VERTCOORD = 0x00001, 00070 IOM_VERTFLAGS = 0x00002, 00071 IOM_VERTCOLOR = 0x00004, 00072 IOM_VERTQUALITY = 0x00008, 00073 IOM_VERTNORMAL = 0x00010, 00074 IOM_VERTTEXCOORD = 0x00020, 00075 IOM_VERTRADIUS = 0x10000, 00076 00077 IOM_FACEINDEX = 0x00040, 00078 IOM_FACEFLAGS = 0x00080, 00079 IOM_FACECOLOR = 0x00100, 00080 IOM_FACEQUALITY = 0x00200, 00081 IOM_FACENORMAL = 0x00400, 00082 00083 IOM_WEDGCOLOR = 0x00800, 00084 IOM_WEDGTEXCOORD = 0x01000, 00085 IOM_WEDGTEXMULTI = 0x02000, // when textrue index is explicit 00086 IOM_WEDGNORMAL = 0x04000, 00087 00088 IOM_BITPOLYGONAL = 0x20000, // loads explicit polygonal mesh 00089 00090 IOM_CAMERA = 0x08000, 00091 00092 IOM_FLAGS = IOM_VERTFLAGS + IOM_FACEFLAGS, 00093 00094 IOM_ALL = 0xFFFFF 00095 }; 00096 // 00097 // 00098 //static void IOMask2String( int mask, char str[] ) 00099 //{ 00100 // str[0] = 0; 00101 // 00102 // strcat(str,"V:"); 00103 // if( mask & IOM_VERTFLAGS ) strcat(str,"flag,"); 00104 // if( mask & IOM_VERTCOLOR ) strcat(str,"color,"); 00105 // if( mask & IOM_VERTQUALITY ) strcat(str,"quality,"); 00106 // if( mask & IOM_VERTTEXCOORD ) strcat(str,"texcoord,"); 00107 // if( mask & IOM_VERTNORMAL ) strcat(str,"normal,"); 00108 // 00109 // strcat(str," F:"); 00110 // if( mask & IOM_FACEFLAGS ) strcat(str,"mask,"); 00111 // if( mask & IOM_FACECOLOR ) strcat(str,"color,"); 00112 // if( mask & IOM_FACEQUALITY ) strcat(str,"quality,"); 00113 // if( mask & IOM_FACENORMAL ) strcat(str,"normal,"); 00114 // 00115 // strcat(str," W:"); 00116 // if( mask & IOM_WEDGCOLOR ) strcat(str,"color,"); 00117 // if( mask & IOM_WEDGTEXCOORD ) strcat(str,"texcoord,"); 00118 // if( mask & IOM_WEDGNORMAL ) strcat(str,"normal,"); 00119 // 00120 // if( mask & IOM_CAMERA ) strcat(str," camera"); 00121 //} 00122 template <class MeshType> 00123 static void ClampMask(MeshType &m, int &mask) 00124 { 00125 if( (mask & IOM_FACECOLOR) && !HasPerFaceColor(m) ) mask = mask & (~IOM_FACECOLOR); 00126 if( (mask & IOM_WEDGTEXCOORD) && !HasPerWedgeTexCoord(m) ) mask = mask & (~IOM_WEDGTEXCOORD); 00127 if( (mask & IOM_WEDGNORMAL) && !m.HasPerWedgeNormal() ) mask = mask & (~IOM_WEDGNORMAL); 00128 if( (mask & IOM_VERTCOLOR) && !m.HasPerVertexColor() ) mask = mask & (~IOM_VERTCOLOR); 00129 } 00130 00131 }; // end class 00133 00134 } // end namespace tri 00135 } // end namespace io 00136 } // end namespace vcg 00137 #endif