Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenMesh
OpenMesh
Commits
ebd5180a
Commit
ebd5180a
authored
Sep 11, 2015
by
Martin Schultz
Browse files
* made OBJReader reuse stringstream objects.
Should speedup Reading on MS Windows especially with lots of materials.
parent
c9180795
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/OpenMesh/Core/IO/reader/OBJReader.cc
View file @
ebd5180a
...
...
@@ -172,6 +172,8 @@ read_material(std::fstream& _in)
std
::
string
keyWrd
;
std
::
string
textureName
;
static
std
::
stringstream
stream
;
std
::
string
key
;
Material
mat
;
float
f1
,
f2
,
f3
;
...
...
@@ -193,7 +195,8 @@ read_material(std::fstream& _in)
if
(
line
.
empty
()
)
continue
;
std
::
stringstream
stream
(
line
);
stream
.
str
(
line
);
stream
.
clear
();
stream
>>
keyWrd
;
...
...
@@ -305,6 +308,8 @@ read(std::istream& _in, BaseImporter& _bi, Options& _opt)
std
::
string
matname
;
static
std
::
stringstream
stream
,
lineData
,
tmp
;
// Options supplied by the user
Options
userOptions
=
_opt
;
...
...
@@ -329,7 +334,8 @@ read(std::istream& _in, BaseImporter& _bi, Options& _opt)
continue
;
}
std
::
stringstream
stream
(
line
);
stream
.
str
(
line
);
stream
.
clear
();
stream
>>
keyWrd
;
...
...
@@ -463,7 +469,8 @@ read(std::istream& _in, BaseImporter& _bi, Options& _opt)
// read full line after detecting a face
std
::
string
faceLine
;
std
::
getline
(
stream
,
faceLine
);
std
::
stringstream
lineData
(
faceLine
);
lineData
.
str
(
faceLine
);
lineData
.
clear
();
FaceHandle
fh
;
BaseImporter
::
VHandles
faceVertices
;
...
...
@@ -484,7 +491,8 @@ read(std::istream& _in, BaseImporter& _bi, Options& _opt)
if
(
found
!=
std
::
string
::
npos
){
// read the index value
std
::
stringstream
tmp
(
vertex
.
substr
(
0
,
found
)
);
tmp
.
str
(
vertex
.
substr
(
0
,
found
)
);
tmp
.
clear
();
// If we get an empty string this property is undefined in the file
if
(
vertex
.
substr
(
0
,
found
).
empty
()
)
{
...
...
@@ -507,7 +515,8 @@ read(std::istream& _in, BaseImporter& _bi, Options& _opt)
}
else
{
// last component of the vertex, read it.
std
::
stringstream
tmp
(
vertex
);
tmp
.
str
(
vertex
);
tmp
.
clear
();
tmp
>>
value
;
// Clear vertex after finished reading the line
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment