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

Method loadTexture2dGroup_

source/MRIOExtras/MR3mf.cpp:687–708  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

685}
686
687Expected<void> Node::loadTexture2dGroup_( ThreeMFLoader& loader, const tinyxml2::XMLElement* xmlNode )
688{
689 if ( tinyxml2::XML_SUCCESS != xmlNode->QueryIntAttribute( "texid", &texId_ ) )
690 return unexpected( std::string( "3DF model texture2d group node does not have 'texid' attribute" ) );
691
692 auto nodeRes = loader.getNodeById_( texId_ );
693 if ( !nodeRes.has_value() )
694 return unexpected( std::string( "3DF model has incorrect 'texid' attribute" ) );
695
696#if TINYXML2_MAJOR_VERSION > 10
697 uvGroup_.reserve( xmlNode->ChildElementCount( "m:tex2coord" ) );
698#endif
699 for ( auto coordNode = xmlNode->FirstChildElement( "m:tex2coord" ); coordNode; coordNode = coordNode->NextSiblingElement( "m:tex2coord" ) )
700 {
701 auto& uv = uvGroup_.emplace_back();
702 if ( tinyxml2::XML_SUCCESS != coordNode->QueryFloatAttribute( "u", &uv.x ) )
703 return unexpected( std::string( "3DF model tex2coord node does not have 'u' attribute" ) );
704 if ( tinyxml2::XML_SUCCESS != coordNode->QueryFloatAttribute( "v", &uv.y ) )
705 return unexpected( std::string( "3DF model tex2coord node does not have 'v' attribute" ) );
706 }
707 return {};
708}
709
710Expected<void> Node::loadMesh_( ThreeMFLoader& loader, const tinyxml2::XMLElement* meshNode, const ProgressCallback& callback )
711{

Callers

nothing calls this directly

Calls 3

getNodeById_Method · 0.80
unexpectedFunction · 0.50
reserveMethod · 0.45

Tested by

no test coverage detected