MCPcopy Create free account
hub / github.com/Kitware/VTK / LoadImage

Method LoadImage

IO/Geometry/vtkGLTFDocumentLoaderInternals.cxx:610–648  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

608
609//------------------------------------------------------------------------------
610bool vtkGLTFDocumentLoaderInternals::LoadImage(
611 const nlohmann::json& root, vtkGLTFDocumentLoader::Image& image)
612{
613 if (root.empty() || !root.is_object())
614 {
615 return false;
616 }
617
618 image.Name = "";
619 vtkGLTFUtils::GetStringValue(root, "name", image.Name);
620
621 if (!vtkGLTFUtils::GetStringValue(root, "mimeType", image.MimeType))
622 {
623 image.MimeType.clear();
624 }
625
626 // Read the bufferView index value, if it exists.
627 image.BufferView = -1;
628 if (vtkGLTFUtils::GetIntValue(root, "bufferView", image.BufferView))
629 {
630 if (image.MimeType.empty())
631 {
632 vtkErrorWithObjectMacro(this->Self,
633 "Invalid image.mimeType value. It is required as image.bufferView is set for image "
634 << image.Name);
635 return false;
636 }
637 }
638 else // Don't look for uri when bufferView is specified
639 {
640 // Read the image uri value if it exists
641 if (!vtkGLTFUtils::GetStringValue(root, "uri", image.Uri))
642 {
643 vtkErrorWithObjectMacro(this->Self, "Invalid image.uri value for image " << image.Name);
644 return false;
645 }
646 }
647 return true;
648}
649
650//------------------------------------------------------------------------------
651bool vtkGLTFDocumentLoaderInternals::LoadMaterial(

Callers 1

LoadModelMetaDataMethod · 0.95

Calls 4

GetStringValueFunction · 0.70
GetIntValueFunction · 0.70
emptyMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected