3
0

StreamingImagePoolAssetCreator.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <Atom/RPI.Reflect/Image/StreamingImagePoolAssetCreator.h>
  9. #include <AzCore/Asset/AssetManager.h>
  10. namespace AZ
  11. {
  12. namespace RPI
  13. {
  14. void StreamingImagePoolAssetCreator::Begin(const Data::AssetId& assetId)
  15. {
  16. BeginCommon(assetId);
  17. }
  18. void StreamingImagePoolAssetCreator::SetPoolDescriptor(AZStd::unique_ptr<RHI::StreamingImagePoolDescriptor>&& descriptor)
  19. {
  20. if (!ValidateIsReady())
  21. {
  22. return;
  23. }
  24. if (!descriptor)
  25. {
  26. ReportError("You must provide a valid pool descriptor instance.");
  27. return;
  28. }
  29. m_asset->m_poolDescriptor = AZStd::move(descriptor);
  30. }
  31. void StreamingImagePoolAssetCreator::SetPoolName(AZStd::string_view poolName)
  32. {
  33. if (ValidateIsReady())
  34. {
  35. m_asset->m_poolName = poolName;
  36. }
  37. }
  38. bool StreamingImagePoolAssetCreator::End(Data::Asset<StreamingImagePoolAsset>& result)
  39. {
  40. if (!ValidateIsReady())
  41. {
  42. return false;
  43. }
  44. if (!m_asset->m_poolDescriptor)
  45. {
  46. ReportError("Streaming image pool was not assigned a pool descriptor.");
  47. return false;
  48. }
  49. m_asset->SetReady();
  50. return EndCommon(result);
  51. }
  52. }
  53. }