MCPcopy Create free account
hub / github.com/NVIDIA-RTX/RTXNTC / LoadImages

Function LoadImages

tools/cli/NtcCommandLine.cpp:701–1353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

699}
700
701ntc::ITextureSet* LoadImages(ntc::IContext* context, Manifest& manifest, bool manifestIsGenerated)
702{
703 ntc::TextureSetDesc textureSetDesc{};
704 textureSetDesc.mips = 1;
705
706 ntc::LatentShape latentShape;
707 if (!PickLatentShape(latentShape))
708 return nullptr;
709
710 // Count the number of MIP 0 images in the manifest
711 int numMipZeroImages = 0;
712 for (auto const& entry : manifest.textures)
713 {
714 if (entry.mipLevel == 0)
715 ++numMipZeroImages;
716 }
717
718 if (numMipZeroImages > NTC_MAX_CHANNELS)
719 {
720 if (g_options.loadImagesPath)
721 {
722 fprintf(stderr, "Too many images (%d) found in the input folder. At most %d channels are supported.\n"
723 "Note: when loading images from a folder, a single material with all images is created. "
724 "To load a material with only some images from a folder, use manifest files or specify each image "
725 "on the command line separately.",
726 int(manifest.textures.size()), NTC_MAX_CHANNELS);
727 }
728 else
729 {
730 fprintf(stderr, "Too many images (%d) specified in the manifest. At most %d channels are supported.\n",
731 int(manifest.textures.size()), NTC_MAX_CHANNELS);
732 }
733 return nullptr;
734 }
735
736 struct SourceImageData
737 {
738 int width = 0;
739 int height = 0;
740 int channels = 0;
741 int storedChannels = 0;
742 int alphaMaskChannel = -1;
743 int firstChannel = -1;
744 int manifestIndex = 0;
745 bool verticalFlip = false;
746 std::string channelSwizzle;
747 std::array<stbi_uc*, NTC_MAX_MIPS> data {};
748 std::string name;
749 ntc::ChannelFormat channelFormat = ntc::ChannelFormat::UNORM8;
750 ntc::BlockCompressedFormat bcFormat = ntc::BlockCompressedFormat::None;
751 bool isSRGB = false;
752 std::vector<float> lossFunctionScales;
753
754 SourceImageData()
755 { }
756
757 SourceImageData(SourceImageData& other) = delete;
758 SourceImageData(SourceImageData&& other) = delete;

Callers 1

mainFunction · 0.85

Calls 8

PickLatentShapeFunction · 0.85
StartAsyncTaskFunction · 0.85
LowercaseStringFunction · 0.85
WaitForAllTasksFunction · 0.85
GuessImageSemanticsFunction · 0.85
OverrideTextureBcFormatFunction · 0.85
CreateTextureSetMethod · 0.80
AddTextureMethod · 0.80

Tested by

no test coverage detected