* 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;
|
OpenMesh::Vec4f c4f;
|
||||||
BaseImporter::VHandles vhandles;
|
BaseImporter::VHandles vhandles;
|
||||||
VertexHandle vh;
|
VertexHandle vh;
|
||||||
|
static std::stringstream stream;
|
||||||
|
static std::string trash;
|
||||||
|
|
||||||
// read header line
|
// read header line
|
||||||
std::string header;
|
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() );
|
int colorType = getColorType(line, options_.vertex_has_texcoord() );
|
||||||
|
|
||||||
std::stringstream stream( line );
|
stream.str(line);
|
||||||
|
stream.clear();
|
||||||
|
|
||||||
//perhaps read COLOR
|
//perhaps read COLOR
|
||||||
if ( options_.vertex_has_color() ){
|
if ( options_.vertex_has_color() ){
|
||||||
|
|
||||||
std::string trash;
|
|
||||||
|
|
||||||
switch (colorType){
|
switch (colorType){
|
||||||
case 0 : break; //no color
|
case 0 : break; //no color
|
||||||
case 1 : stream >> trash; break; //one int (isn't handled atm)
|
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 );
|
int colorType = getColorType(line, false );
|
||||||
|
|
||||||
std::stringstream stream( line );
|
stream.str(line);
|
||||||
|
stream.clear();
|
||||||
std::string trash;
|
|
||||||
|
|
||||||
switch (colorType){
|
switch (colorType){
|
||||||
case 0 : break; //no color
|
case 0 : break; //no color
|
||||||
|
|||||||
Reference in New Issue
Block a user