| 1 | /**************************************************************************** |
| 2 | * VCGLib o o * |
| 3 | * Visual and Computer Graphics Library o o * |
| 4 | * _ O _ * |
| 5 | * Copyright(C) 2004-2016 \/)\/ * |
| 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 | #ifndef __VCGLIB_IOTETRAMESH_IO_MASK |
| 25 | #define __VCGLIB_IOTETRAMESH_IO_MASK |
| 26 | |
| 27 | namespace vcg { |
| 28 | namespace tetra { |
| 29 | namespace io { |
| 30 | |
| 31 | /** |
| 32 | @name Input/output data mask |
| 33 | */ |
| 34 | //@{ |
| 35 | |
| 36 | class Mask |
| 37 | { |
| 38 | public: |
| 39 | |
| 40 | /* |
| 41 | Bitmask for specifying what data has to be loaded or saved or it is present in a given plyfile; |
| 42 | */ |
| 43 | |
| 44 | enum { |
| 45 | IOM_NONE = 0x00000, |
| 46 | |
| 47 | IOM_VERTCOORD = 0x00001, |
| 48 | IOM_VERTFLAGS = 0x00002, |
| 49 | IOM_VERTCOLOR = 0x00004, |
| 50 | IOM_VERTQUALITY = 0x00008, |
| 51 | IOM_VERTRADIUS = 0x10000, |
| 52 | |
| 53 | IOM_EDGEINDEX = 0x80000, |
| 54 | |
| 55 | IOM_TETRAINDEX = 0x00010, |
| 56 | IOM_TETRAFLAGS = 0x00020, |
| 57 | IOM_TETRACOLOR = 0x00040, |
| 58 | IOM_TETRAQUALITY = 0x00080, |
| 59 | |
| 60 | IOM_CAMERA = 0x08000, |
| 61 | |
| 62 | IOM_FLAGS = IOM_VERTFLAGS + IOM_TETRAFLAGS, |
| 63 | |
| 64 | IOM_ALL = 0xFFFFF |
| 65 | }; |
| 66 | |
| 67 | template <class MeshType> |
| 68 | static void ClampMask(MeshType &m, int &mask) |
| 69 | { |
| 70 | if( (mask & IOM_TETRACOLOR) && !HasPerTetraColor(m) ) mask = mask & (~IOM_TETRACOLOR); |
| 71 | if( (mask & IOM_VERTCOLOR) && !HasPerVertexColor(m) ) mask = mask & (~IOM_VERTCOLOR); |
| 72 | } |
| 73 | |
| 74 | }; // end class |
| 75 | //@} |
| 76 | |
| 77 | } // end namespace tetra |
| 78 | } // end namespace io |
| 79 | } // end namespace vcg |
| 80 | #endif |