From 256a767f37e2ca7e51cb1d2cff107f8614ee6109 Mon Sep 17 00:00:00 2001 From: cignoni Date: Fri, 19 Oct 2012 12:46:25 +0000 Subject: [PATCH] updated after the changes to UpdateColor --- wrap/io_trimesh/import_off.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/wrap/io_trimesh/import_off.h b/wrap/io_trimesh/import_off.h index 6f466101..2f3df900 100644 --- a/wrap/io_trimesh/import_off.h +++ b/wrap/io_trimesh/import_off.h @@ -476,14 +476,14 @@ namespace vcg } case 3: { - if (tokens[vert_per_face+1].find('.')==size_t(-1)) + if (tokens[vert_per_face+1].find('.')==std::string::npos) // if there is a float there is a dot { - int rgb[3]; - rgb[0] = atoi( tokens[vert_per_face+1].c_str() ); - rgb[1] = atoi( tokens[vert_per_face+2].c_str() ); - rgb[2] = atoi( tokens[vert_per_face+3].c_str() ); + Color4b cc(Color4b::White); + cc[0] = (unsigned char)atoi( tokens[vert_per_face+1].c_str() ); + cc[1] = (unsigned char)atoi( tokens[vert_per_face+2].c_str() ); + cc[2] = (unsigned char)atoi( tokens[vert_per_face+3].c_str() ); for ( ; f0<=f; f0++) - mesh.face[f0].C().SetRGB(rgb[0], rgb[1], rgb[2]); + mesh.face[f0].C()=cc; } else { @@ -498,15 +498,15 @@ namespace vcg } case 4: { - if (tokens[vert_per_face+1].find('.')==0) // if it is a float there is a dot + if (tokens[vert_per_face+1].find('.')==std::string::npos) // if it is a float there is a dot { - unsigned char color[4]; - color[0] = (unsigned char) atoi(tokens[vert_per_face+1].c_str()); - color[1] = (unsigned char) atoi(tokens[vert_per_face+2].c_str()); - color[2] = (unsigned char) atoi(tokens[vert_per_face+3].c_str()); - color[3] = (unsigned char) atoi(tokens[vert_per_face+4].c_str()); + Color4b cc; + cc[0] = (unsigned char) atoi(tokens[vert_per_face+1].c_str()); + cc[1] = (unsigned char) atoi(tokens[vert_per_face+2].c_str()); + cc[2] = (unsigned char) atoi(tokens[vert_per_face+3].c_str()); + cc[3] = (unsigned char) atoi(tokens[vert_per_face+4].c_str()); for ( ; f0<=f; f0++) - mesh.face[f0].C().Import(vcg::Color4f(color[0], color[1], color[2], color[3])); + mesh.face[f0].C()=cc; } else {