* made Stringstreams in offReader static and reuse them to save performance
This commit is contained in:
@@ -192,6 +192,8 @@ _OFFReader_::read_ascii(std::istream& _in, BaseImporter& _bi, Options& _opt) con
|
||||
OpenMesh::Vec4f c4f;
|
||||
BaseImporter::VHandles vhandles;
|
||||
VertexHandle vh;
|
||||
static std::stringstream stream;
|
||||
static std::string trash;
|
||||
|
||||
// read header line
|
||||
std::string header;
|
||||
@@ -227,13 +229,12 @@ _OFFReader_::read_ascii(std::istream& _in, BaseImporter& _bi, Options& _opt) con
|
||||
|
||||
int colorType = getColorType(line, options_.vertex_has_texcoord() );
|
||||
|
||||
std::stringstream stream( line );
|
||||
stream.str(line);
|
||||
stream.clear();
|
||||
|
||||
//perhaps read COLOR
|
||||
if ( options_.vertex_has_color() ){
|
||||
|
||||
std::string trash;
|
||||
|
||||
switch (colorType){
|
||||
case 0 : break; //no color
|
||||
case 1 : stream >> trash; break; //one int (isn't handled atm)
|
||||
@@ -315,9 +316,8 @@ _OFFReader_::read_ascii(std::istream& _in, BaseImporter& _bi, Options& _opt) con
|
||||
|
||||
int colorType = getColorType(line, false );
|
||||
|
||||
std::stringstream stream( line );
|
||||
|
||||
std::string trash;
|
||||
stream.str(line);
|
||||
stream.clear();
|
||||
|
||||
switch (colorType){
|
||||
case 0 : break; //no color
|
||||
|
||||
Reference in New Issue
Block a user