Debian Codegraph @

vcg/wrap/io_trimesh/import_off.h

raw symbols SCIP
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: import_off.h,v $
27 Revision 1.23 2008/04/15 10:38:12 cignoni
28 added suppor of color in OFF format.
29
30 Revision 1.22 2008/03/13 08:48:10 granzuglia
31 added two missing include files:
32 1) #include <wrap/callback.h>
33 2) #include <wrap/io_trimesh/io_mask.h>
34
35 Revision 1.21 2007/12/13 17:57:33 cignoni
36 removed harmless gcc warnings
37
38 Revision 1.20 2007/03/12 16:40:17 tarini
39 Texture coord name change! "TCoord" and "Texture" are BAD. "TexCoord" is GOOD.
40
41 Revision 1.19 2006/03/29 08:50:10 corsini
42 Fix bug in texture coordinates reading
43
44 Revision 1.18 2006/03/29 08:15:46 corsini
45 Fix several bugs
46 Add LoadMask
47 Improve parsing capabilities (account for unexpected newline)
48
49 Revision 1.17 2006/03/01 08:25:30 cignoni
50 Corrected bug in wrong counting the parsed tokens during the reading of color components
51
52 Revision 1.16 2006/02/28 15:18:10 corsini
53 Fix loading mask update
54
55 Revision 1.15 2006/02/09 15:56:34 corsini
56 Update load mask
57
58 Revision 1.14 2006/02/09 15:18:32 corsini
59 *** empty log message ***
60
61 Revision 1.12 2006/02/06 13:11:01 corsini
62 Renamed UnexpectedEOF as InvalidFile and
63 added UnsupportedFormat and ErrorNotTriangularFace (by Laurent Saboret)
64
65 Revision 1.11 2006/01/30 15:02:50 cignoni
66 Added mask filling in open
67
68 Revision 1.10 2006/01/10 13:20:42 cignoni
69 Changed ply::PlyMask to io::Mask
70
71 Revision 1.9 2005/12/01 00:58:56 cignoni
72 Added and removed typenames for gcc compiling...
73
74 Revision 1.8 2005/11/12 18:12:16 cignoni
75 Added casts and changed integral types to remove warnings
76
77 Revision 1.7 2005/09/28 10:30:14 rita_borgo
78 *** empty log message ***
79
80 Revision 1.6 2005/01/26 22:44:51 cignoni
81 Resolved scoping of constant of OFF codes
82
83 Revision 1.5 2005/01/18 12:35:18 rita_borgo
84 Added #include<vcg/complex/trimesh/allocate.h>
85 it was giving problems with Allocator::
86
87 Revision 1.4 2005/01/03 11:18:24 cignoni
88 changed a .. rfind('OFF') .. in rfind("OFF") and added some casts
89
90 Revision 1.3 2004/11/23 11:56:50 cignoni
91 Corrected small bug in the tokenizer (it would add a fake token for lines ending with a space before /n)
92
93
94 ****************************************************************************/
95
96 #ifndef __VCGLIB_IMPORT_OFF
97 #define __VCGLIB_IMPORT_OFF
98
99 #include <fstream>
100 #include <string>
101 #include <vector>
102 #include <assert.h>
103 #include <vcg/space/color4.h>
104 #include<vcg/complex/trimesh/allocate.h>
105 #include <wrap/callback.h>
106 #include <wrap/io_trimesh/io_mask.h>
107
108 namespace vcg
109 {
110 namespace tri
111 {
112 namespace io
113 {
114 // /** \addtogroup */
115 // /* @{ */
116 /**
117 This class encapsulate a filter for importing OFF meshes.
118 A basic description of the OFF file format can be found at http://www.geomview.org/docs/html/geomview_41.html
119 */
120 template<class MESH_TYPE>
121 class ImporterOFF
122 {
123 public:
124
125 typedef typename MESH_TYPE::VertexType VertexType;
126 typedef typename MESH_TYPE::VertexIterator VertexIterator;
127 typedef typename MESH_TYPE::VertexPointer VertexPointer;
128 typedef typename MESH_TYPE::FaceType FaceType;
129 typedef typename MESH_TYPE::FaceIterator FaceIterator;
130 typedef typename MESH_TYPE::FacePointer FacePointer;
131 typedef typename MESH_TYPE::CoordType CoordType;
132 typedef typename MESH_TYPE::ScalarType ScalarType;
133
134 // OFF codes
135 enum OFFCodes {NoError=0, CantOpen, InvalidFile,
136 UnsupportedFormat, ErrorNotTriangularFace};
137
138 /*!
139 * Standard call for knowing the meaning of an error code
140 * \param message_code The code returned by <CODE>Open</CODE>
141 * \return The string describing the error code
142 */
143 static const char* ErrorMsg(int message_code)
144 {
145 static const char* error_msg[] =
146 {
147 "No errors", "Can't open file", "Invalid file",
148 "Unsupported format", "Face with more than 3 vertices"
149 };
150
151 if(message_code>4 || message_code<0)
152 return "Unknown error";
153 else
154 return error_msg[message_code];
155 };
156
157 /**
158 * Load only the properties of the 3D objects.
159 *
160 * \param filename the name of the file to read from
161 * \param loadmask the mask which encodes the properties
162 * \return the operation result
163 */
164 static bool LoadMask(const char *filename, int &loadmask)
165 {
166 // To obtain the loading mask all the file must be parsed
167 // to distinguish between per-vertex and per-face color attribute.
168 loadmask=0;
169 MESH_TYPE dummyMesh;
170 return (Open(dummyMesh, filename, loadmask,0,true)==NoError);
171 }
172
173 static int Open(MESH_TYPE &mesh, const char *filename,CallBackPos *cb=0)
174 {
175 int loadmask;
176 return Open(mesh,filename,loadmask,cb);
177 }
178
179 /*!
180 * Standard call for reading a mesh.
181 *
182 * \param mesh the destination mesh
183 * \param filename the name of the file to read from
184 * \return the operation result
185 */
186 static int Open(MESH_TYPE &mesh, const char *filename, int &loadmask,
187 CallBackPos *cb=0, bool onlyMaskFlag=false )
188 {
189 std::ifstream stream(filename);
190 if (stream.fail())
191 return CantOpen;
192
193 std::vector< std::string > tokens;
194 TokenizeNextLine(stream, tokens);
195
196 bool isNormalDefined = false;
197 bool isColorDefined = false;
198 bool isTexCoordDefined = false;
199 int dimension = 3;
200 bool homogeneousComponents = false;
201
202 // The "[ST][C][N][4][n]OFF" keyword is optional. Default is "OFF".
203 std::string header = tokens[tokens.size()-1];
204 if (header.rfind("OFF") != std::basic_string<char>::npos)
205 {
206 for (int u = static_cast<int>(header.rfind("OFF")-1); u>=0; u--)
207 {
208 if (header[u] == 'C') isColorDefined = true;
209 else if (header[u] == 'N') isNormalDefined = true;
210 else if (u>0 && header[u-1] == 'S' && header[u] == 'T') isTexCoordDefined = true;
211 else if (header[u] == '4') homogeneousComponents = true;
212 else if (header[u] == 'n')
213 {
214 TokenizeNextLine(stream, tokens);
215 dimension = atoi(tokens[0].c_str());
216 }
217 }
218
219 TokenizeNextLine(stream, tokens);
220 }
221
222 // Update loading mask
223 ///////////////////////////////////////
224
225 loadmask = Mask::IOM_VERTCOORD | Mask::IOM_FACEINDEX;
226
227 if (isNormalDefined) loadmask |= Mask::IOM_VERTNORMAL;
228 if (isTexCoordDefined) loadmask |= Mask::IOM_VERTTEXCOORD;
229 if (isColorDefined) { loadmask |= Mask::IOM_VERTCOLOR;loadmask |= Mask::IOM_FACECOLOR;}
230
231
232 if(onlyMaskFlag) return NoError;
233
234
235 mesh.Clear();
236
237 // check on next 2 lines to detect corrupted files
238 if(tokens.size() < 3)
239 return InvalidFile;
240
241 unsigned int nVertices, nFaces, nEdges;
242 nVertices = atoi(tokens[0].c_str());
243 nFaces = atoi(tokens[1].c_str());
244 nEdges = atoi(tokens[2].c_str());
245
246 // dimension is the space dimension of vertices => it must be three(!)
247 if (dimension != 3)
248 return UnsupportedFormat;
249
250 if (homogeneousComponents)
251 return UnsupportedFormat;
252
253 // READ VERTICES
254 //////////////////////////////////////////////////////
255
256 VertexIterator v_iter = Allocator<MESH_TYPE>::AddVertices(mesh, nVertices);
257 TokenizeNextLine(stream, tokens);
258 size_t k = 0; // next token to read
259
260 for (unsigned int i=0; i<nVertices; i++, v_iter++)
261 {
262 if (cb && (i%1000)==0)
263 cb(i*50/nVertices, "Vertex Loading");
264
265 // Read 3 vertex coordinates
266 for (unsigned int j=0; j<3; j++)
267 {
268 // Go to next line when needed
269 if (k == tokens.size()) // if EOL
270 {
271 TokenizeNextLine(stream, tokens);
272 if (tokens.size() == 0) // if EOF
273 return InvalidFile;
274 k = 0;
275 }
276
277 // Read vertex coordinate
278 (*v_iter).P()[j] = (ScalarType) atof(tokens[k].c_str());
279 k++;
280 }
281
282 if (isNormalDefined)
283 {
284 // Read 3 normal coordinates
285 for (unsigned int j=0; j<3; j++)
286 {
287 // Go to next line when needed
288 if (k == tokens.size()) // if EOL
289 {
290 TokenizeNextLine(stream, tokens);
291 if (tokens.size() == 0) // if EOF
292 return InvalidFile;
293 k = 0;
294 }
295
296 // Read normal coordinate
297 (*v_iter).N()[j] = (ScalarType) atof(tokens[k].c_str());
298 k++;
299 }
300 }
301
302 // NOTE: It is assumed that colored vertex takes exactly one text line
303 // (otherwise it is impossible to parse color information since
304 // color components can vary)
305 if (isColorDefined)
306 {
307 // The number of color components varies from 0 to 4.
308 // The OFF format guaranties that there is 1 vertex per line.
309 int nb_color_components = static_cast<int>(tokens.size())
310 - static_cast<int>(k) /* tokens already parsed */
311 - 2 * (isTexCoordDefined ? 1 : 0);
312
313 if (nb_color_components < 0 || nb_color_components > 4)
314 return InvalidFile;
315
316 // set per-vertex color attribute
317 if (nb_color_components > 0)
318 loadmask |= Mask::IOM_VERTCOLOR;
319
320 // Store color components
321 if (tri::HasPerVertexColor(mesh))
322 {
323 // Read color components
324
325 if (nb_color_components == 1)
326 {
327 // read color index
328 (*v_iter).C().Import(ColorMap(atoi(tokens[k].c_str())));
329 }
330 else if (nb_color_components == 3)
331 {
332 // read RGB color
333 if (tokens[k].find(".") == size_t(-1))// if it is a float there is a dot
334 {
335 // integers
336 unsigned char r =
337 static_cast<unsigned char>(atoi(tokens[k].c_str()));
338 unsigned char g =
339 static_cast<unsigned char>(atoi(tokens[k+1].c_str()));
340 unsigned char b =
341 static_cast<unsigned char>(atoi(tokens[k+2].c_str()));
342
343 vcg::Color4b color(r, g, b, 255);
344 (*v_iter).C().Import(color);
345 }
346 else
347 {
348 // floats
349 float r = static_cast<float>(atof(tokens[k].c_str()));
350 float g = static_cast<float>(atof(tokens[k+1].c_str()));
351 float b = static_cast<float>(atof(tokens[k+2].c_str()));
352
353 vcg::Color4f color(r, g, b, 1.0);
354 (*v_iter).C().Import(color);
355 }
356 }
357 else if (nb_color_components == 4)
358 {
359 // read RGBA color
360 if (tokens[k].find(".") == size_t(-1))
361 {
362 // integers
363 unsigned char r =
364 static_cast<unsigned char>(atoi(tokens[k].c_str()));
365 unsigned char g =
366 static_cast<unsigned char>(atoi(tokens[k+1].c_str()));
367 unsigned char b =
368 static_cast<unsigned char>(atoi(tokens[k+2].c_str()));
369 unsigned char a =
370 static_cast<unsigned char>(atoi(tokens[k+3].c_str()));
371
372 Color4b color(r, g, b, a);
373 (*v_iter).C().Import(color);
374 }
375 else
376 {
377 // floats
378 float r = static_cast<float>(atof(tokens[k].c_str()));
379 float g = static_cast<float>(atof(tokens[k+1].c_str()));
380 float b = static_cast<float>(atof(tokens[k+2].c_str()));
381 float a = static_cast<float>(atof(tokens[k+3].c_str()));
382
383 vcg::Color4f color(r, g, b, a);
384 (*v_iter).C().Import(color);
385 }
386 }
387 }
388
389 k += nb_color_components;
390 }
391
392 if (isTexCoordDefined)
393 {
394 for (unsigned int j=0; j<2; j++)
395 {
396 // Go to next line when needed
397 if (k == tokens.size()) // if EOL
398 {
399 TokenizeNextLine(stream, tokens);
400 if (tokens.size() == 0) // if EOF
401 return InvalidFile;
402 k = 0;
403 }
404
405 std::string str = tokens[k];
406 k++;
407
408 // Store texture coordinates
409 if (tri::HasPerWedgeTexCoord(mesh))
410 {
411 //...TODO...
412 }
413 }
414 }
415 } // for i=...
416
417 // READ FACES
418 //////////////////////////////////////////////////////
419
420 Allocator<MESH_TYPE>::AddFaces(mesh, nFaces);
421 unsigned int f0=0;
422 for (unsigned int f=0; f < nFaces; f++)
423 {
424 f0 = f;
425 if (stream.fail())
426 return InvalidFile;
427
428 if(cb && (f%1000)==0)
429 cb(50+f*50/nFaces,"Face Loading");
430
431 TokenizeNextLine(stream, tokens);
432 int vert_per_face = atoi(tokens[0].c_str());
433
434 k = 1;
435 if (vert_per_face == 3)
436 {
437 for (int j = 0; j < 3; j++)
438 {
439 // Go to next line when needed
440 if (k == tokens.size()) // if EOL
441 {
442 TokenizeNextLine(stream, tokens);
443 if (tokens.size() == 0) // if EOF
444 return InvalidFile;
445 k = 0;
446 }
447
448 mesh.face[f].V(j) = &(mesh.vert[ atoi(tokens[k].c_str()) ]);
449 k++;
450 }
451 }
452 else
453 {
454 // The face must be triangulate
455 unsigned int trigs = vert_per_face-3; // number of extra faces to add
456 nFaces += trigs;
457 Allocator<MESH_TYPE>::AddFaces(mesh, trigs);
458 int *vertIndices = new int[vert_per_face];
459
460 for (int j=0; j < vert_per_face; j++)
461 {
462 // Go to next line when needed
463 if (k == tokens.size()) // if EOL
464 {
465 TokenizeNextLine(stream, tokens);
466 if (tokens.size() == 0) // if EOF
467 return InvalidFile;
468 k = 0;
469 }
470
471 vertIndices[j] = atoi(tokens[k].c_str());
472 k++;
473 }
474
475 for (int j=0; j<=vert_per_face-3; j++)
476 {
477 mesh.face[f+j].V(0) = &(mesh.vert[ vertIndices[0 ] ]);
478 mesh.face[f+j].V(1) = &(mesh.vert[ vertIndices[1+j] ]);
479 mesh.face[f+j].V(2) = &(mesh.vert[ vertIndices[2+j] ]);
480 }
481
482 f+=trigs;
483 delete [] vertIndices;
484 }
485
486 // NOTE: It is assumed that colored face takes exactly one text line
487 // (otherwise it is impossible to parse color information since
488 // color components can vary)
489 if (isColorDefined && tri::HasPerFaceColor(mesh))
490 {
491 size_t color_elements = tokens.size() - vert_per_face-1;
492
493 // set per-face color attribute
494 if (color_elements > 0)
495 loadmask |= Mask::IOM_FACECOLOR;
496
497 switch (color_elements)
498 {
499 case 0:
500 {
501 for ( ; f0<=f; f0++)
502 mesh.face[f0].C().Import(vcg::Color4f(.666f, .666f, .666f, .666f));
503 break;
504 }
505 case 1:
506 {
507 for ( ; f0<=f; f0++)
508 mesh.face[f0].C().Import( ColorMap( atoi(tokens[vert_per_face+1].c_str()) ) );
509 break;
510 }
511 case 3:
512 {
513 if (tokens[vert_per_face+1].find('.')==size_t(-1))
514 {
515 int rgb[3];
516 rgb[0] = atoi( tokens[vert_per_face+1].c_str() );
517 rgb[1] = atoi( tokens[vert_per_face+2].c_str() );
518 rgb[2] = atoi( tokens[vert_per_face+3].c_str() );
519 for ( ; f0<=f; f0++)
520 mesh.face[f0].C().SetRGB(rgb[0], rgb[1], rgb[2]);
521 }
522 else
523 {
524 float color[3];
525 color[0] = (float) atof( tokens[vert_per_face+1].c_str() );
526 color[1] = (float) atof( tokens[vert_per_face+2].c_str() );
527 color[2] = (float) atof( tokens[vert_per_face+3].c_str() );
528 for ( ; f0<=f; f0++)
529 mesh.face[f0].C().Import(vcg::Color4f(color[0], color[1], color[2], 1.0f));
530 }
531 break;
532 }
533 case 4:
534 {
535 if (tokens[vert_per_face+1].find('.')==0) // if it is a float there is a dot
536 {
537 unsigned char color[4];
538 color[0] = (unsigned char) atoi(tokens[vert_per_face+1].c_str());
539 color[1] = (unsigned char) atoi(tokens[vert_per_face+2].c_str());
540 color[2] = (unsigned char) atoi(tokens[vert_per_face+3].c_str());
541 color[3] = (unsigned char) atoi(tokens[vert_per_face+4].c_str());
542 for ( ; f0<=f; f0++)
543 mesh.face[f0].C().Import(vcg::Color4f(color[0], color[1], color[2], color[3]));
544 }
545 else
546 {
547 float color[4];
548 color[0] = float( atof(tokens[vert_per_face+1].c_str()) );
549 color[1] = float( atof(tokens[vert_per_face+2].c_str()) );
550 color[2] = float( atof(tokens[vert_per_face+3].c_str()) );
551 color[3] = float( atof(tokens[vert_per_face+4].c_str()) );
552 for ( ; f0<=f; f0++)
553 mesh.face[f0].C().Import(vcg::Color4f(color[0], color[1], color[2], color[3]));
554 }
555 break;
556 }
557 } //end switch
558 } // end if (isColorDefined)
559 } // end of for f=...
560
561 return NoError;
562
563 } // end Open
564
565 protected:
566
567 /*!
568 * Read the next valid line and parses it into "tokens", allowing the tokens to be read one at a time.
569 * \param stream The object providing the input stream
570 * \param tokens The "tokens" in the next line
571 */
572 inline static const void TokenizeNextLine(std::ifstream &stream, std::vector< std::string > &tokens)
573 {
574 std::string line;
575 do
576 std::getline(stream, line, '\n');
577 while (line[0] == '#' || line.length()==0);
578
579 size_t from = 0;
580 size_t to = 0;
581 size_t length = line.size();
582 tokens.clear();
583 do
584 {
585 while ( (line[from]==' ' || line[from] == '\t') && from!=length)
586 from++;
587 if(from!=length)
588 {
589 to = from+1;
590 while ( (line[to]!=' ' && line[to] != '\t') && to!=length)
591 to++;
592 tokens.push_back(line.substr(from, to-from).c_str());
593 from = to;
594 }
595 }
596 while (from<length);
597 } // end Tokenize
598
599 /*!
600 * Provide the int->color mapping, according to the Geomview's `cmap.fmap' file.
601 * \param i the color index
602 * \return the corresponding <CODE>vcg::Color4f</CODE> color
603 */
604 static const vcg::Color4f ColorMap(int i)
605 {
606 static const float colorMap[148][4] =
607 {
608 { 1.0f, 1.0f, 1.0f, 1.0f },
609 { 1.0f, 1.0f, 1.0f, 1.0f },
610 { 1.0f, 1.0f, 1.0f, 1.0f },
611 { 1.0f, 1.0f, 1.0f, 1.0f },
612 { 1.0f, 1.0f, 1.0f, 1.0f },
613 { 1.0f, 1.0f, 1.0f, 1.0f },
614 { 0.7f, 0.7f, 0.7f, 0.7f },
615 { 0.2f, 0.2f, 0.2f, 0.2f },
616 { 0.9f, 0.9f, 0.9f, 0.9f },
617 { 0.1f, 0.1f, 0.1f, 0.1f },
618 { 0.1f, 0.1f, 0.1f, 0.1f },
619 { 0.8f, 0.8f, 0.8f, 0.8f },
620 { 0.7f, 0.7f, 0.7f, 0.7f },
621 { 0.7f, 0.7f, 0.7f, 0.7f },
622 { 0.0f, 0.0f, 0.0f, 0.0f },
623 { 0.9f, 0.9f, 0.9f, 0.9f },
624 { 0.2f, 0.2f, 0.2f, 0.2f },
625 { 0.0f, 0.0f, 0.0f, 0.0f },
626 { 0.75f, 0.75f, 0.75f, 0.75f },
627 { 0.8f, 0.8f, 0.8f, 0.8f },
628 { 0.8f, 0.8f, 0.8f, 0.8f },
629 { 0.0f, 0.0f, 0.0f, 0.0f },
630 { 0.0f, 0.0f, 0.0f, 0.0f },
631 { 0.0f, 0.0f, 0.0f, 0.0f },
632 { 0.0f, 0.0f, 0.0f, 0.0f },
633 { 0.4f, 0.4f, 0.4f, 0.4f },
634 { 0.4f, 0.4f, 0.4f, 0.4f },
635 { 0.8f, 0.8f, 0.8f, 0.8f },
636 { 0.8f, 0.8f, 0.8f, 0.8f },
637 { 0.7f, 0.7f, 0.7f, 0.7f },
638 { 0.7f, 0.7f, 0.7f, 0.7f },
639 { 0.7f, 0.7f, 0.7f, 0.7f },
640 { 0.7f, 0.7f, 0.7f, 0.7f },
641 { 0.0f, 0.0f, 0.0f, 0.0f },
642 { 0.9f, 0.9f, 0.9f, 0.9f },
643 { 0.0f, 0.0f, 0.0f, 0.0f },
644 { 0.0f, 0.0f, 0.0f, 0.0f },
645 { 0.75f, 0.75f, 0.75f, 0.75f },
646 { 0.8f, 0.8f, 0.8f, 0.8f },
647 { 0.4f, 0.4f, 0.4f, 0.4f },
648 { 0.0f, 0.0f, 0.0f, 0.0f },
649 { 0.0f, 0.0f, 0.0f, 0.0f },
650 { 0.4f, 0.4f, 0.4f, 0.4f },
651 { 0.8f, 0.8f, 0.8f, 0.8f },
652 { 0.7f, 0.7f, 0.7f, 0.7f },
653 { 0.7f, 0.7f, 0.7f, 0.7f },
654 { 0.0f, 0.0f, 0.0f, 0.0f },
655 { 0.9f, 0.9f, 0.9f, 0.9f },
656 { 0.0f, 0.0f, 0.0f, 0.0f },
657 { 0.0f, 0.0f, 0.0f, 0.0f },
658 { 0.75f, 0.75f, 0.75f, 0.75f },
659 { 0.8f, 0.8f, 0.8f, 0.8f },
660 { 0.4f, 0.4f, 0.4f, 0.4f },
661 { 0.0f, 0.0f, 0.0f, 0.0f },
662 { 0.0f, 0.0f, 0.0f, 0.0f },
663 { 0.4f, 0.4f, 0.4f, 0.4f },
664 { 0.8f, 0.8f, 0.8f, 0.8f },
665 { 0.7f, 0.7f, 0.7f, 0.7f },
666 { 0.7f, 0.7f, 0.7f, 0.7f },
667 { 0.0f, 0.0f, 0.0f, 0.0f },
668 { 0.9f, 0.9f, 0.9f, 0.9f },
669 { 0.0f, 0.0f, 0.0f, 0.0f },
670 { 0.0f, 0.0f, 0.0f, 0.0f },
671 { 0.75f, 0.75f, 0.75f, 0.75f },
672 { 0.8f, 0.8f, 0.8f, 0.8f },
673 { 0.4f, 0.4f, 0.4f, 0.4f },
674 { 0.0f, 0.0f, 0.0f, 0.0f },
675 { 0.0f, 0.0f, 0.0f, 0.0f },
676 { 0.4f, 0.4f, 0.4f, 0.4f },
677 { 0.8f, 0.8f, 0.8f, 0.8f },
678 { 1.0f, 1.0f, 1.0f, 1.0f },
679 { 1.0f, 1.0f, 1.0f, 1.0f },
680 { 1.0f, 1.0f, 1.0f, 1.0f },
681 { 1.0f, 1.0f, 1.0f, 1.0f },
682 { 1.0f, 1.0f, 1.0f, 1.0f },
683 { 1.0f, 1.0f, 1.0f, 1.0f },
684 { 0.05f, 0.05f, 0.05f, 0.05f },
685 { 0.7f, 0.7f, 0.7f, 0.7f },
686 { 0.2f, 0.2f, 0.2f, 0.2f },
687 { 0.9f, 0.9f, 0.9f, 0.9f },
688 { 0.0f, 0.0f, 0.0f, 0.0f },
689 { 0.1f, 0.1f, 0.1f, 0.1f },
690 { 0.8f, 0.8f, 0.8f, 0.8f },
691 { 0.7f, 0.7f, 0.7f, 0.7f },
692 { 0.7f, 0.7f, 0.7f, 0.7f },
693 { 0.7f, 0.7f, 0.7f, 0.7f },
694 { 0.7f, 0.7f, 0.7f, 0.7f },
695 { 0.0f, 0.0f, 0.0f, 0.0f },
696 { 0.0f, 0.0f, 0.0f, 0.0f },
697 { 0.9f, 0.9f, 0.9f, 0.9f },
698 { 0.9f, 0.9f, 0.9f, 0.9f },
699 { 0.0f, 0.0f, 0.0f, 0.0f },
700 { 0.0f, 0.0f, 0.0f, 0.0f },
701 { 0.0f, 0.0f, 0.0f, 0.0f },
702 { 0.0f, 0.0f, 0.0f, 0.0f },
703 { 0.75f, 0.75f, 0.75f, 0.75f },
704 { 0.75f, 0.75f, 0.75f, 0.75f },
705 { 0.8f, 0.8f, 0.8f, 0.8f },
706 { 0.8f, 0.8f, 0.8f, 0.8f },
707 { 0.0f, 0.0f, 0.0f, 0.0f },
708 { 0.0f, 0.0f, 0.0f, 0.0f },
709 { 0.0f, 0.0f, 0.0f, 0.0f },
710 { 0.0f, 0.0f, 0.0f, 0.0f },
711 { 0.4f, 0.4f, 0.4f, 0.4f },
712 { 0.4f, 0.4f, 0.4f, 0.4f },
713 { 0.8f, 0.8f, 0.8f, 0.8f },
714 { 0.8f, 0.8f, 0.8f, 0.8f },
715 { 0.7f, 0.7f, 0.7f, 0.7f },
716 { 0.7f, 0.7f, 0.7f, 0.7f },
717 { 0.7f, 0.7f, 0.7f, 0.7f },
718 { 0.7f, 0.7f, 0.7f, 0.7f },
719 { 0.0f, 0.0f, 0.0f, 0.0f },
720 { 0.9f, 0.9f, 0.9f, 0.9f },
721 { 0.0f, 0.0f, 0.0f, 0.0f },
722 { 0.0f, 0.0f, 0.0f, 0.0f },
723 { 0.75f, 0.75f, 0.75f, 0.75f },
724 { 0.8f, 0.8f, 0.8f, 0.8f },
725 { 0.4f, 0.4f, 0.4f, 0.4f },
726 { 0.0f, 0.0f, 0.0f, 0.0f },
727 { 0.0f, 0.0f, 0.0f, 0.0f },
728 { 0.4f, 0.4f, 0.4f, 0.4f },
729 { 0.8f, 0.8f, 0.8f, 0.8f },
730 { 0.7f, 0.7f, 0.7f, 0.7f },
731 { 0.7f, 0.7f, 0.7f, 0.7f },
732 { 0.0f, 0.0f, 0.0f, 0.0f },
733 { 0.9f, 0.9f, 0.9f, 0.9f },
734 { 0.0f, 0.0f, 0.0f, 0.0f },
735 { 0.0f, 0.0f, 0.0f, 0.0f },
736 { 0.75f, 0.75f, 0.75f, 0.75f },
737 { 0.8f, 0.8f, 0.8f, 0.8f },
738 { 0.4f, 0.4f, 0.4f, 0.4f },
739 { 0.0f, 0.0f, 0.0f, 0.0f },
740 { 0.0f, 0.0f, 0.0f, 0.0f },
741 { 0.4f, 0.4f, 0.4f, 0.4f },
742 { 0.8f, 0.8f, 0.8f, 0.8f },
743 { 0.7f, 0.7f, 0.7f, 0.7f },
744 { 0.7f, 0.7f, 0.7f, 0.7f },
745 { 0.0f, 0.0f, 0.0f, 0.0f },
746 { 0.9f, 0.9f, 0.9f, 0.9f },
747 { 0.0f, 0.0f, 0.0f, 0.0f },
748 { 0.0f, 0.0f, 0.0f, 0.0f },
749 { 0.75f, 0.75f, 0.75f, 0.75f },
750 { 0.8f, 0.8f, 0.8f, 0.8f },
751 { 0.4f, 0.4f, 0.4f, 0.4f },
752 { 0.0f, 0.0f, 0.0f, 0.0f },
753 { 0.0f, 0.0f, 0.0f, 0.0f },
754 { 0.4f, 0.4f, 0.4f, 0.4f },
755 { 0.8f, 0.8f, 0.8f, 0.8f }
756 };
757 return Color4f(colorMap[i][0], colorMap[i][1], colorMap[i][2], colorMap[i][3]);
758 }
759 };
760 // /*! @} */
761 } //namespace io
762 }//namespace tri
763 } // namespace vcg
764
765 #endif //__VCGLIB_IMPORT_OFF