Commit 9f50f53c authored by Jan Möbius's avatar Jan Möbius
Browse files

Changed color input

parent 07a1c7ab
......@@ -86,6 +86,10 @@ public:
mesh_.set_color( currentPoint_,_color );
};
void setColor(ACG::Vec3uc _color) override{
mesh_.set_color( currentPoint_, OpenMesh::color_cast <typename MeshT::Color>(_color));
};
void setPointSize(double /*_size*/ ) override {
};
......@@ -149,7 +153,11 @@ public:
};
void setColor(ACG::Vec4f _color) override{
cloud_.colors( splatIdx_ ) = OpenMesh::color_cast<ACG::Vec3f>(_color);
cloud_.colors( splatIdx_ ) = OpenMesh::color_cast<SplatCloud::Color>(_color);
};
void setColor(ACG::Vec3uc _color) override{
cloud_.colors( splatIdx_) = _color;
};
void setPointSize(double /*_size*/ ) override {
......@@ -605,7 +613,7 @@ bool FilePTSPlugin::readTextFile ( const char *_filename, AdaptorBase& _adaptor
// Process all lines in file.
while (!in.atEnd()) {
if ( (currentPoint % 10000) == 0 )
if ( (currentPoint % 100000) == 0 )
emit log( LOGINFO, tr("Reading point %1\n").arg( currentPoint ) );
// Read a position, which should be always here:
......@@ -623,33 +631,40 @@ bool FilePTSPlugin::readTextFile ( const char *_filename, AdaptorBase& _adaptor
// Read color, if it has been selected
if( loadColors )
{
if( loadColorRange == COLORRANGE_0_1 )
{
ACG::Vec4f color(0.0,0.0,0.0,1.0);
float col[3];
in >> color[0] >> color[1] >> color[2];
in >> col[0] >> col[1] >> col[2];
if ( in.status() == QTextStream::Ok ) {
_adaptor.setColor(color);
} else {
emit log( LOGERR, tr("Failed to read color for point %1\n").arg( currentPoint ) );
break;
}
if ( in.status() == QTextStream::Ok ) {
} else { // loadColorRange == COLORRANGE_0_255
TriMesh::Color color(0.0,0.0,0.0,1.0);
if( loadColorRange == COLORRANGE_0_1 )
{
color[0] = (unsigned char) (255.999f * col[0]);
color[1] = (unsigned char) (255.999f * col[1]);
color[2] = (unsigned char) (255.999f * col[2]);
}
else // loadColorRange == COLORRANGE_0_255
{
color[0] = (unsigned char) col[0];
color[1] = (unsigned char) col[1];
color[2] = (unsigned char) col[2];
}
int col[3];
_adaptor.setColor(color);
in >> col[0] >> col[1] >> col[2];
} else {
emit log( LOGERR, tr("Failed to read color for point %1\n").arg( currentPoint ) );
break;
}
ACG::Vec3uc color;
color[0] = (unsigned char) col[0];
color[1] = (unsigned char) col[1];
color[2] = (unsigned char) col[2];
if ( in.status() == QTextStream::Ok ) {
_adaptor.setColor(color);
} else {
emit log( LOGERR, tr("Failed to read color for point %1\n").arg( currentPoint ) );
break;
}
}
}
// read normal
......
......@@ -91,6 +91,7 @@ public:
virtual void add_point(ACG::Vec3d _point) = 0;
virtual void setNormal(ACG::Vec3d _normal) = 0;
virtual void setColor(ACG::Vec4f _color) = 0;
virtual void setColor(ACG::Vec3uc _color) = 0;
virtual void setPointSize(double _size ) = 0;
virtual void setIndex(int _size ) = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment