MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / parseObjFace

Function parseObjFace

source/MRMesh/MRMeshLoadObj.cpp:316–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314};
315
316void parseObjFace( const std::string_view& str, size_t f, ObjFaces & target )
317{
318 using namespace boost::spirit::x3;
319
320 int nextVert = target.face2vert[f];
321 int nextTexv = target.face2texv[f];
322 auto v = [&] ( auto& ctx )
323 {
324 target.vertices[nextVert++] = _attr( ctx );
325 };
326 auto vt = [&] ( auto& ctx )
327 {
328 target.textures[nextTexv++] = _attr( ctx );
329 };
330 auto vn = [&] ( auto& )
331 {
332 // normals are not used currently
333 };
334
335 [[maybe_unused]] bool r = phrase_parse(
336 str.begin(),
337 str.end(),
338 // NOTE: actions are not being reverted after backtracking
339 // https://github.com/boostorg/spirit/issues/378
340 ( 'f' >> *( int_[v] >> -( '/' >> ( ( int_[vt] >> -( '/' >> int_[vn] ) ) | ( '/' >> int_[vn] ) ) ) ) ),
341 ascii::space
342 );
343 assert( r );
344 assert( nextVert == target.face2vert[f + 1] );
345 assert( nextTexv == target.face2texv[f + 1] );
346}
347
348Expected<void> parseMtlColor( const std::string_view& str, Vector3f& color )
349{

Callers 1

loadModelsFromObjFunction · 0.85

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected