------------------------------------------------------------------------------
| 608 | |
| 609 | //------------------------------------------------------------------------------ |
| 610 | bool 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 | //------------------------------------------------------------------------------ |
| 651 | bool vtkGLTFDocumentLoaderInternals::LoadMaterial( |
no test coverage detected