Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
jfr_io_mask.h
00001 /**************************************************************/
00002 /* This is a modified version of the io_mask.h   from VCGLib. */
00003 /* The original license is below                              */
00004 /**************************************************************/
00005 
00006 /****************************************************************************
00007 * VCGLib                                                            o o     *
00008 * Visual and Computer Graphics Library                            o     o   *
00009 *                                                                _   O  _   *
00010 * Copyright(C) 2004                                                \/)\/    *
00011 * Visual Computing Lab                                            /\/|      *
00012 * ISTI - Italian National Research Council                           |      *
00013 *                                                                    \      *
00014 * All rights reserved.                                                      *
00015 *                                                                           *
00016 * This program is free software; you can redistribute it and/or modify      *   
00017 * it under the terms of the GNU General Public License as published by      *
00018 * the Free Software Foundation; either version 2 of the License, or         *
00019 * (at your option) any later version.                                       *
00020 *                                                                           *
00021 * This program is distributed in the hope that it will be useful,           *
00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
00024 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)          *
00025 * for more details.                                                         *
00026 *                                                                           *
00027 ****************************************************************************/
00028 #ifndef _JAFAR_IO_MASK
00029 #define _JAFAR_IO_MASK
00030 
00031 namespace vcg {
00032 namespace tri {
00033 namespace io {
00034 
00039   
00040 class JfrMask
00041 {
00042 public:
00043 
00044   /*
00045   Bitmask for specifying what data has to be loaded or saved or it is present in a given plyfile;
00046 */
00047 
00048 enum {
00049   IOM_NONE         = 0x00000,
00050 
00051   IOM_VERTCOORD    = 0x00001,
00052   IOM_VERTFLAGS    = 0x00002,
00053   IOM_VERTCOLOR    = 0x00004,
00054   IOM_VERTQUALITY  = 0x00008,
00055   IOM_VERTNORMAL   = 0x00010,
00056   IOM_VERTTEXCOORD = 0x00020,
00057   IOM_VERTRADIUS   = 0x10000,
00058   IOM_VERTID       = 0x40000,
00059   IOM_VERTORIGINES = 0x80000,
00060 
00061   IOM_FACEINDEX    = 0x00040,
00062   IOM_FACEFLAGS    = 0x00080,
00063   IOM_FACECOLOR    = 0x00100,
00064   IOM_FACEQUALITY  = 0x00200,
00065   IOM_FACENORMAL   = 0x00400,
00066   
00067   IOM_WEDGCOLOR    = 0x00800,
00068   IOM_WEDGTEXCOORD = 0x01000,
00069   IOM_WEDGTEXMULTI = 0x02000, // when textrue index is explicit
00070   IOM_WEDGNORMAL   = 0x04000,
00071 
00072   IOM_BITPOLYGONAL = 0x20000, // loads explicit polygonal mesh
00073 
00074   IOM_CAMERA       = 0x08000,
00075   
00076   IOM_FLAGS        = IOM_VERTFLAGS + IOM_FACEFLAGS,
00077 
00078   IOM_ALL          = 0xFFFFF
00079 };
00080 //
00081 //
00082 //static void IOMask2String( int mask, char str[] )
00083 //{
00084 //  str[0] = 0;
00085 //
00086 //  strcat(str,"V:");
00087 //  if( mask & IOM_VERTFLAGS    ) strcat(str,"flag,");
00088 //  if( mask & IOM_VERTCOLOR    ) strcat(str,"color,");
00089 //  if( mask & IOM_VERTQUALITY  ) strcat(str,"quality,");
00090 //  if( mask & IOM_VERTTEXCOORD ) strcat(str,"texcoord,");
00091 //  if( mask & IOM_VERTNORMAL ) strcat(str,"normal,");
00092 //
00093 //  strcat(str," F:");
00094 //  if( mask & IOM_FACEFLAGS    ) strcat(str,"mask,");
00095 //  if( mask & IOM_FACECOLOR    ) strcat(str,"color,");
00096 //  if( mask & IOM_FACEQUALITY  ) strcat(str,"quality,");
00097 //  if( mask & IOM_FACENORMAL   ) strcat(str,"normal,");
00098 //
00099 //  strcat(str," W:");
00100 //  if( mask & IOM_WEDGCOLOR    ) strcat(str,"color,");
00101 //  if( mask & IOM_WEDGTEXCOORD ) strcat(str,"texcoord,");
00102 //  if( mask & IOM_WEDGNORMAL  ) strcat(str,"normal,");
00103 //
00104 //  if( mask & IOM_CAMERA ) strcat(str," camera");
00105 //}
00106 template <class MeshType>
00107 static void ClampMask(MeshType &m, int &mask)
00108 {
00109   if( (mask & IOM_FACECOLOR)    && !HasPerFaceColor(m) )       mask = mask & (~IOM_FACECOLOR);
00110   if( (mask & IOM_WEDGTEXCOORD) && !HasPerWedgeTexCoord(m) )   mask = mask & (~IOM_WEDGTEXCOORD);
00111   if( (mask & IOM_WEDGNORMAL)   && !m.HasPerWedgeNormal() )    mask = mask & (~IOM_WEDGNORMAL);
00112   if( (mask & IOM_VERTCOLOR)    && !m.HasPerVertexColor() )    mask = mask & (~IOM_VERTCOLOR);
00113   if( (mask & IOM_VERTID)       && !m.HasPerVertexAttribute(m, "Id") )       mask = mask & (~IOM_VERTID);
00114   if( (mask & IOM_VERTORIGINES) && !m.HasPerVertexAttribute(m, "Origines") ) mask = mask & (~IOM_VERTORIGINES);
00115 }
00116 
00117 }; // end class
00119 
00120 } // end namespace tri
00121 } // end namespace io
00122 } // end namespace vcg
00123 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:25 for Jafar by doxygen 1.7.6.1
LAAS-CNRS