From 324acba2f2d91f01e076b23eddb07de46cf506f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20M=C3=B6ller?= Date: Thu, 11 Jun 2015 14:20:16 +0000 Subject: [PATCH] - load vertex color values as float in range of [0..1] instead of integers [0..255] git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@1283 fdac6126-5c0c-442c-9429-916003d36597 --- src/OpenMesh/Core/IO/reader/OBJReader.cc | 8 ++++---- ...mal-vertex-colors-after-vertex-definition.obj | 16 ++++++++-------- .../cube-minimal-vertex-colors-as-vc-lines.obj | 16 ++++++++-------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/OpenMesh/Core/IO/reader/OBJReader.cc b/src/OpenMesh/Core/IO/reader/OBJReader.cc index 47345a44..cc390245 100644 --- a/src/OpenMesh/Core/IO/reader/OBJReader.cc +++ b/src/OpenMesh/Core/IO/reader/OBJReader.cc @@ -295,10 +295,10 @@ read(std::istream& _in, BaseImporter& _bi, Options& _opt) std::string keyWrd; float x, y, z, u, v; - int r, g, b; + float r, g, b; BaseImporter::VHandles vhandles; std::vector normals; - std::vector colors; + std::vector colors; std::vector texcoords; std::vector face_texcoords; std::vector vertexHandles; @@ -395,7 +395,7 @@ read(std::istream& _in, BaseImporter& _bi, Options& _opt) { if ( userOptions.vertex_has_color() ) { fileOptions += Options::VertexColor; - colors.push_back(OpenMesh::Vec3uc((unsigned char)r,(unsigned char)g,(unsigned char)b)); + colors.push_back(OpenMesh::Vec3f(r,g,b)); } } } @@ -431,7 +431,7 @@ read(std::istream& _in, BaseImporter& _bi, Options& _opt) if ( !stream.fail() ){ if ( userOptions.vertex_has_color() ) { - colors.push_back(OpenMesh::Vec3uc((unsigned char)r,(unsigned char)g,(unsigned char)b)); + colors.push_back(OpenMesh::Vec3f(r,g,b)); fileOptions += Options::VertexColor; } } diff --git a/src/Unittests/TestFiles/cube-minimal-vertex-colors-after-vertex-definition.obj b/src/Unittests/TestFiles/cube-minimal-vertex-colors-after-vertex-definition.obj index e6060a14..0a6578b1 100644 --- a/src/Unittests/TestFiles/cube-minimal-vertex-colors-after-vertex-definition.obj +++ b/src/Unittests/TestFiles/cube-minimal-vertex-colors-after-vertex-definition.obj @@ -1,12 +1,12 @@ g cube -v 0.0 0.0 0.0 0 0 0 -v 0.0 0.0 1.0 0 0 255 -v 0.0 1.0 0.0 0 255 0 -v 0.0 1.0 1.0 0 255 255 -v 1.0 0.0 0.0 255 0 0 -v 1.0 0.0 1.0 255 0 255 -v 1.0 1.0 0.0 255 255 0 -v 1.0 1.0 1.0 255 255 255 +v 0.0 0.0 0.0 0.0 0.0 0.0 +v 0.0 0.0 1.0 0.0 0.0 1.0 +v 0.0 1.0 0.0 0.0 1.0 0.0 +v 0.0 1.0 1.0 0.0 1.0 1.0 +v 1.0 0.0 0.0 1.0 0.0 0.0 +v 1.0 0.0 1.0 1.0 0.0 1.0 +v 1.0 1.0 0.0 1.0 1.0 0.0 +v 1.0 1.0 1.0 1.0 1.0 1.0 vn 0.0 0.0 1.0 vn 0.0 0.0 -1.0 vn 0.0 1.0 0.0 diff --git a/src/Unittests/TestFiles/cube-minimal-vertex-colors-as-vc-lines.obj b/src/Unittests/TestFiles/cube-minimal-vertex-colors-as-vc-lines.obj index 132bda88..2f903a77 100644 --- a/src/Unittests/TestFiles/cube-minimal-vertex-colors-as-vc-lines.obj +++ b/src/Unittests/TestFiles/cube-minimal-vertex-colors-as-vc-lines.obj @@ -7,14 +7,14 @@ v 1.0 0.0 0.0 v 1.0 0.0 1.0 v 1.0 1.0 0.0 v 1.0 1.0 1.0 -vc 0 0 0 -vc 0 0 255 -vc 0 255 0 -vc 0 255 255 -vc 255 0 0 -vc 255 0 255 -vc 255 255 0 -vc 255 255 255 +vc 0.0 0.0 0.0 +vc 0.0 0.0 1.0 +vc 0.0 1.0 0.0 +vc 0.0 1.0 1.0 +vc 1.0 0.0 0.0 +vc 1.0 0.0 1.0 +vc 1.0 1.0 0.0 +vc 1.0 1.0 1.0 vn 0.0 0.0 1.0 vn 0.0 0.0 -1.0 vn 0.0 1.0 0.0