@@ -440,7 +440,7 @@ void main()
440
440
const auto imageIDString = makeImageIDString (i, colorFileNameBundle);
441
441
442
442
auto color_image_bundle = am->getAsset (colorFileNameBundle[i].value (), lp); decltype (color_image_bundle) albedo_image_bundle, normal_image_bundle;
443
- if (color_image_bundle.isEmpty ())
443
+ if (color_image_bundle.getContents (). empty ())
444
444
{
445
445
os::Printer::log (" ERROR (" + std::to_string (__LINE__) + " line): Could not load the image from file: " + imageIDString + " !" , ELL_ERROR);
446
446
continue ;
@@ -453,7 +453,7 @@ void main()
453
453
454
454
auto getImageAssetGivenChannelName = [](asset::SAssetBundle& assetBundle, const std::optional<std::string>& channelName) -> core::smart_refctd_ptr<ICPUImage>
455
455
{
456
- if (assetBundle.isEmpty ())
456
+ if (assetBundle.getContents (). empty ())
457
457
return nullptr ;
458
458
459
459
// calculate a score for how much each channel name matches the requested
@@ -464,14 +464,16 @@ void main()
464
464
for (auto & asset : contents)
465
465
{
466
466
assert (asset);
467
+
468
+ const auto * bundleMeta = assetBundle.getMetadata ();
469
+ const auto * exrmeta = static_cast <const COpenEXRMetadata*>(bundleMeta);
470
+ const auto * metadata = static_cast <const COpenEXRMetadata::CImage*>(exrmeta->getAssetSpecificMetadata (core::smart_refctd_ptr_static_cast<ICPUImage>(asset).get ()));
467
471
468
- auto metadata = asset->getMetadata ();
469
- const auto exrmeta = static_cast <const COpenEXRImageMetadata*>(metadata);
470
- if (strcmp (metadata->getLoaderName (), COpenEXRImageMetadata::LoaderName) != 0 )
472
+ if (strcmp (exrmeta->getLoaderName (), COpenEXRMetadata::LoaderName) != 0 )
471
473
continue ;
472
474
else
473
475
{
474
- const auto & assetMetaChannelName = exrmeta-> getName () ;
476
+ const auto & assetMetaChannelName = metadata-> m_name ;
475
477
auto found = assetMetaChannelName.find (channelName.value ());
476
478
if (found >= firstChannelNameOccurence)
477
479
continue ;
@@ -487,7 +489,7 @@ void main()
487
489
decltype (color)& albedo = getImageAssetGivenChannelName (albedo_image_bundle,albedoChannelNameBundle[i]);
488
490
decltype (color)& normal = getImageAssetGivenChannelName (normal_image_bundle,normalChannelNameBundle[i]);
489
491
490
- auto putImageIntoImageToDenoise = [&](core::smart_refctd_ptr<ICPUImage>&& queriedImage, E_IMAGE_INPUT defaultEII, const std::optional<std::string>& actualWantedChannel)
492
+ auto putImageIntoImageToDenoise = [&](asset::SAssetBundle& queriedBundle, core::smart_refctd_ptr<ICPUImage>&& queriedImage, E_IMAGE_INPUT defaultEII, const std::optional<std::string>& actualWantedChannel)
491
493
{
492
494
outParam.image [defaultEII] = nullptr ;
493
495
if (!queriedImage)
@@ -506,22 +508,24 @@ void main()
506
508
return ;
507
509
}
508
510
509
- auto metadata = queriedImage->getMetadata ();
510
- auto exrmeta = static_cast <const COpenEXRImageMetadata*>(metadata);
511
- if (strcmp (metadata->getLoaderName (),COpenEXRImageMetadata::LoaderName)!=0 )
511
+ const auto * bundleMeta = queriedBundle.getMetadata ();
512
+ const auto * exrmeta = static_cast <const COpenEXRMetadata*>(bundleMeta);
513
+ const auto * metadata = static_cast <const COpenEXRMetadata::CImage*>(exrmeta->getAssetSpecificMetadata (queriedImage.get ()));
514
+
515
+ if (strcmp (exrmeta->getLoaderName (), COpenEXRMetadata::LoaderName)!=0 )
512
516
os::Printer::log (" WARNING (" + std::to_string (__LINE__) + " ): " + imageIDString+" is not an EXR file, so there are no multiple layers of channels." , ELL_WARNING);
513
517
else if (!actualWantedChannel.has_value ())
514
518
os::Printer::log (" WARNING (" + std::to_string (__LINE__) + " ): User did not specify channel choice for " + imageIDString+" using the default (first)." , ELL_WARNING);
515
- else if (exrmeta-> getName () !=actualWantedChannel.value ())
519
+ else if (metadata-> m_name !=actualWantedChannel.value ())
516
520
{
517
- os::Printer::log (" WARNING (" + std::to_string (__LINE__) + " ): Using best fit channel \" " +exrmeta-> getName () +" \" for requested \" " +actualWantedChannel.value ()+" \" out of " + imageIDString+" !" , ELL_WARNING);
521
+ os::Printer::log (" WARNING (" + std::to_string (__LINE__) + " ): Using best fit channel \" " + metadata-> m_name +" \" for requested \" " +actualWantedChannel.value ()+" \" out of " + imageIDString+" !" , ELL_WARNING);
518
522
}
519
523
outParam.image [defaultEII] = std::move (queriedImage);
520
524
};
521
525
522
- putImageIntoImageToDenoise (std::move (color), EII_COLOR, colorChannelNameBundle[i]);
523
- putImageIntoImageToDenoise (std::move (albedo), EII_ALBEDO, albedoChannelNameBundle[i]);
524
- putImageIntoImageToDenoise (std::move (normal), EII_NORMAL, normalChannelNameBundle[i]);
526
+ putImageIntoImageToDenoise (color_image_bundle, std::move (color), EII_COLOR, colorChannelNameBundle[i]);
527
+ putImageIntoImageToDenoise (albedo_image_bundle, std::move (albedo), EII_ALBEDO, albedoChannelNameBundle[i]);
528
+ putImageIntoImageToDenoise (normal_image_bundle, std::move (normal), EII_NORMAL, normalChannelNameBundle[i]);
525
529
}
526
530
// check inputs and set-up
527
531
for (size_t i=0 ; i<inputFilesAmount; i++)
@@ -1055,7 +1059,7 @@ void main()
1055
1059
CONVERSION_FILTER::state_type state;
1056
1060
1057
1061
auto ditheringBundle = am->getAsset (" ../../media/blueNoiseDithering/LDR_RGBA.png" , {});
1058
- const auto ditheringStatus = ditheringBundle.isEmpty ();
1062
+ const auto ditheringStatus = ditheringBundle.getContents (). empty ();
1059
1063
if (ditheringStatus)
1060
1064
{
1061
1065
os::Printer::log (" ERROR (" + std::to_string (__LINE__) + " line): Could not load the dithering image!" , ELL_ERROR);
0 commit comments