- 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
This commit is contained in:
Matthias Möller
2015-06-11 14:20:16 +00:00
parent f4f07472c6
commit 324acba2f2
3 changed files with 20 additions and 20 deletions

View File

@@ -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<Vec3f> normals;
std::vector<Vec3uc> colors;
std::vector<Vec3f> colors;
std::vector<Vec2f> texcoords;
std::vector<Vec2f> face_texcoords;
std::vector<VertexHandle> 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;
}
}

View File

@@ -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

View File

@@ -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