| 346 | } |
| 347 | |
| 348 | Expected<void> parseMtlColor( const std::string_view& str, Vector3f& color ) |
| 349 | { |
| 350 | using namespace boost::spirit::x3; |
| 351 | |
| 352 | auto r = [&] ( auto& ctx ) |
| 353 | { |
| 354 | color.x = _attr( ctx ); |
| 355 | }; |
| 356 | auto g = [&] ( auto& ctx ) |
| 357 | { |
| 358 | color.y = _attr( ctx ); |
| 359 | }; |
| 360 | auto b = [&] ( auto& ctx ) |
| 361 | { |
| 362 | color.z = _attr( ctx ); |
| 363 | }; |
| 364 | |
| 365 | bool res = phrase_parse( |
| 366 | str.begin(), |
| 367 | str.end(), |
| 368 | ( |
| 369 | char_( 'K' ) >> ( char_( 'a' ) | char_( 'd' ) | char_( 's' ) ) |
| 370 | >> ( |
| 371 | ( float_[r] >> float_[g] >> float_[b] ) | |
| 372 | ( lit( "spectral" ) >> no_skip[+char_] ) | |
| 373 | ( lit( "xyz" ) >> float_ >> float_ >> float_ ) |
| 374 | ) |
| 375 | ), |
| 376 | space |
| 377 | ); |
| 378 | if ( !res ) |
| 379 | return unexpected( "Failed to parse color in MTL-file" ); |
| 380 | |
| 381 | return {}; |
| 382 | } |
| 383 | |
| 384 | Expected<void> parseMtlTexture( const std::string_view& str, std::string& textureFile ) |
| 385 | { |
no test coverage detected