| 200 | } |
| 201 | |
| 202 | Expected<void> parseObjTextureVertex( const std::string_view& str, UVCoord& vt ) |
| 203 | { |
| 204 | using namespace boost::spirit::x3; |
| 205 | |
| 206 | std::array<float, 3> coords{ 0.f, 0.f, 0.f }; |
| 207 | int i = 0; |
| 208 | auto coord = [&] ( auto& ctx ) |
| 209 | { |
| 210 | coords[i++] = _attr( ctx ); |
| 211 | }; |
| 212 | |
| 213 | bool r = phrase_parse( |
| 214 | str.begin(), |
| 215 | str.end(), |
| 216 | ( lit( "vt" ) >> float_[coord] >> -( float_[coord] >> -( float_[coord] ) ) ), |
| 217 | ascii::space |
| 218 | ); |
| 219 | |
| 220 | static constexpr int MaxErrorStringLen = 80; |
| 221 | if ( !r ) |
| 222 | return unexpected( "Failed to parse vertex in OBJ-file: " + std::string( trimRight( str.substr( 0, MaxErrorStringLen ) ) ) ); |
| 223 | |
| 224 | vt = { coords[0], coords[1] }; |
| 225 | return {}; |
| 226 | } |
| 227 | |
| 228 | struct ObjFaceInfo |
| 229 | { |
no test coverage detected