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
ACGL
acgl
Commits
2f7dca91
Commit
2f7dca91
authored
Jun 04, 2014
by
Martin Schultz
Browse files
* faster obj parsing for tabs
parent
468672ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/ACGL/OpenGL/Data/GeometryDataLoadStoreOBJ.cc
View file @
2f7dca91
...
...
@@ -73,29 +73,26 @@ namespace
const
char
*
nextObject
(
const
char
*
_position
,
const
char
*
_end
)
{
return
std
::
find_if
(
_position
,
_end
,
[](
char
_value
)
while
(
_position
<
_end
)
{
return
(
_value
==
' '
||
_value
==
'\t'
);
if
(
*
_position
==
' '
||
*
_position
==
'\t'
)
return
_position
;
++
_position
;
}
);
return
_position
;
}
// Parses a string of space-separated numbers into a packed floating-point vector (_data) with a maximum number of _maxDimension elements
void
parseVector
(
const
char
*
_
star
t
,
const
char
*
_end
,
int
_maxDimension
,
int
&
_dimension
,
float
*
_data
)
void
parseVector
(
const
char
*
_
i
t
,
const
char
*
_end
,
int
_maxDimension
,
int
&
_dimension
,
float
*
_data
)
{
const
char
*
it
=
_start
;
const
char
*
end
=
_end
;
const
char
*
found
;
_dimension
=
0
;
while
(
_dimension
<
_maxDimension
&&
it
<
end
)
while
(
_dimension
<
_maxDimension
&&
_
it
<
_
end
)
{
trim
(
it
);
found
=
nextObject
(
it
,
end
);
_data
[
_dimension
++
]
=
fastAtof
(
it
,
found
-
1
);
it
=
found
==
end
?
end
:
found
+
1
;
trim
(
_
it
);
found
=
nextObject
(
_
it
,
_
end
);
_data
[
_dimension
++
]
=
fastAtof
(
_
it
,
found
-
1
);
_
it
=
found
==
_
end
?
_
end
:
found
+
1
;
}
}
...
...
@@ -418,6 +415,7 @@ SharedGeometryData loadGeometryDataFromOBJ(const std::string& _filename, bool _c
data
->
setStrideSize
(
strideSize
);
data
->
setSize
(
abDataElements
*
sizeof
(
GLfloat
));
data
->
setData
((
GLubyte
*
)
abData
);
return
data
;
}
...
...
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