From da6f64cd2f29db29474e28330edf2898ad12d8e7 Mon Sep 17 00:00:00 2001 From: Ashley Rogers Date: Wed, 30 Oct 2024 16:50:20 -0400 Subject: [PATCH] Remove CesiumGltf usings to try to fix OSX build --- .../Private/CesiumFeatureIdAttribute.cpp | 20 ++++++------- .../Private/CesiumFeatureIdSet.cpp | 15 +++++----- .../Private/CesiumFeatureIdTexture.cpp | 16 +++++----- .../Private/CesiumMetadataValue.cpp | 4 +-- .../Private/CesiumModelMetadata.cpp | 6 ++-- .../Private/CesiumPrimitiveFeatures.cpp | 10 +++---- .../Private/CesiumPropertyArray.cpp | 4 +-- .../Private/CesiumPropertyTable.cpp | 10 +++---- .../Private/CesiumPropertyTableProperty.cpp | 2 -- .../Private/CesiumPropertyTexture.cpp | 8 ++--- .../Private/CesiumPropertyTextureProperty.cpp | 2 -- .../Private/CesiumTextureUtility.cpp | 29 +++++++++---------- .../Private/ExtensionImageAssetUnreal.cpp | 7 +++-- 13 files changed, 57 insertions(+), 76 deletions(-) diff --git a/Source/CesiumRuntime/Private/CesiumFeatureIdAttribute.cpp b/Source/CesiumRuntime/Private/CesiumFeatureIdAttribute.cpp index 4b0b07d1c..919f6f47a 100644 --- a/Source/CesiumRuntime/Private/CesiumFeatureIdAttribute.cpp +++ b/Source/CesiumRuntime/Private/CesiumFeatureIdAttribute.cpp @@ -4,11 +4,9 @@ #include #include -using namespace CesiumGltf; - FCesiumFeatureIdAttribute::FCesiumFeatureIdAttribute( - const Model& Model, - const MeshPrimitive& Primitive, + const CesiumGltf::Model& Model, + const CesiumGltf::MeshPrimitive& Primitive, const int64 FeatureIDAttribute, const FString& PropertyTableName) : _status(ECesiumFeatureIdAttributeStatus::ErrorInvalidAttribute), @@ -23,9 +21,9 @@ FCesiumFeatureIdAttribute::FCesiumFeatureIdAttribute( return; } - const Accessor* accessor = - Model.getSafe(&Model.accessors, featureID->second); - if (!accessor || accessor->type != Accessor::Type::SCALAR) { + const CesiumGltf::Accessor* accessor = + Model.getSafe(&Model.accessors, featureID->second); + if (!accessor || accessor->type != CesiumGltf::Accessor::Type::SCALAR) { this->_status = ECesiumFeatureIdAttributeStatus::ErrorInvalidAccessor; return; } @@ -37,7 +35,7 @@ FCesiumFeatureIdAttribute::FCesiumFeatureIdAttribute( this->_status = std::visit( [](auto view) { - if (view.status() != AccessorViewStatus::Valid) { + if (view.status() != CesiumGltf::AccessorViewStatus::Valid) { return ECesiumFeatureIdAttributeStatus::ErrorInvalidAccessor; } @@ -59,13 +57,15 @@ UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureIDAttributeStatus( int64 UCesiumFeatureIdAttributeBlueprintLibrary::GetVertexCount( UPARAM(ref) const FCesiumFeatureIdAttribute& FeatureIDAttribute) { - return std::visit(CountFromAccessor{}, FeatureIDAttribute._featureIdAccessor); + return std::visit( + CesiumGltf::CountFromAccessor{}, + FeatureIDAttribute._featureIdAccessor); } int64 UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureIDForVertex( UPARAM(ref) const FCesiumFeatureIdAttribute& FeatureIDAttribute, int64 VertexIndex) { return std::visit( - FeatureIdFromAccessor{VertexIndex}, + CesiumGltf::FeatureIdFromAccessor{VertexIndex}, FeatureIDAttribute._featureIdAccessor); } diff --git a/Source/CesiumRuntime/Private/CesiumFeatureIdSet.cpp b/Source/CesiumRuntime/Private/CesiumFeatureIdSet.cpp index 4adc304ab..6f846a6c6 100644 --- a/Source/CesiumRuntime/Private/CesiumFeatureIdSet.cpp +++ b/Source/CesiumRuntime/Private/CesiumFeatureIdSet.cpp @@ -7,15 +7,13 @@ #include "CesiumGltf/Model.h" #include "CesiumGltfPrimitiveComponent.h" -using namespace CesiumGltf; - static FCesiumFeatureIdAttribute EmptyFeatureIDAttribute; static FCesiumFeatureIdTexture EmptyFeatureIDTexture; FCesiumFeatureIdSet::FCesiumFeatureIdSet( - const Model& InModel, - const MeshPrimitive& Primitive, - const FeatureId& FeatureID) + const CesiumGltf::Model& InModel, + const CesiumGltf::MeshPrimitive& Primitive, + const CesiumGltf::FeatureId& FeatureID) : _featureID(), _featureIDSetType(ECesiumFeatureIdSetType::None), _featureCount(FeatureID.featureCount), @@ -25,12 +23,13 @@ FCesiumFeatureIdSet::FCesiumFeatureIdSet( FString propertyTableName; // For backwards compatibility with GetFeatureTableName. - const ExtensionModelExtStructuralMetadata* pMetadata = - InModel.getExtension(); + const CesiumGltf::ExtensionModelExtStructuralMetadata* pMetadata = + InModel.getExtension(); if (pMetadata && _propertyTableIndex >= 0) { size_t index = static_cast(_propertyTableIndex); if (index < pMetadata->propertyTables.size()) { - const PropertyTable& propertyTable = pMetadata->propertyTables[index]; + const CesiumGltf::PropertyTable& propertyTable = + pMetadata->propertyTables[index]; std::string name = propertyTable.name.value_or(""); propertyTableName = FString(name.c_str()); } diff --git a/Source/CesiumRuntime/Private/CesiumFeatureIdTexture.cpp b/Source/CesiumRuntime/Private/CesiumFeatureIdTexture.cpp index 7b5125dcb..8ee2edb37 100644 --- a/Source/CesiumRuntime/Private/CesiumFeatureIdTexture.cpp +++ b/Source/CesiumRuntime/Private/CesiumFeatureIdTexture.cpp @@ -8,19 +8,17 @@ #include -using namespace CesiumGltf; - FCesiumFeatureIdTexture::FCesiumFeatureIdTexture( - const Model& Model, - const MeshPrimitive& Primitive, - const FeatureIdTexture& FeatureIdTexture, + const CesiumGltf::Model& Model, + const CesiumGltf::MeshPrimitive& Primitive, + const CesiumGltf::FeatureIdTexture& FeatureIdTexture, const FString& PropertyTableName) : _status(ECesiumFeatureIdTextureStatus::ErrorInvalidTexture), _featureIdTextureView(), _texCoordAccessor(), _textureCoordinateSetIndex(FeatureIdTexture.texCoord), _propertyTableName(PropertyTableName) { - TextureViewOptions options; + CesiumGltf::TextureViewOptions options; options.applyKhrTextureTransformExtension = true; if (FeatureIdTexture.extras.find("makeImageCopy") != @@ -30,13 +28,13 @@ FCesiumFeatureIdTexture::FCesiumFeatureIdTexture( } this->_featureIdTextureView = - FeatureIdTextureView(Model, FeatureIdTexture, options); + CesiumGltf::FeatureIdTextureView(Model, FeatureIdTexture, options); switch (_featureIdTextureView.status()) { - case FeatureIdTextureViewStatus::Valid: + case CesiumGltf::FeatureIdTextureViewStatus::Valid: this->_status = ECesiumFeatureIdTextureStatus::Valid; break; - case FeatureIdTextureViewStatus::ErrorInvalidChannels: + case CesiumGltf::FeatureIdTextureViewStatus::ErrorInvalidChannels: this->_status = ECesiumFeatureIdTextureStatus::ErrorInvalidTextureAccess; return; default: diff --git a/Source/CesiumRuntime/Private/CesiumMetadataValue.cpp b/Source/CesiumRuntime/Private/CesiumMetadataValue.cpp index 42d351535..f27e6d28d 100644 --- a/Source/CesiumRuntime/Private/CesiumMetadataValue.cpp +++ b/Source/CesiumRuntime/Private/CesiumMetadataValue.cpp @@ -6,8 +6,6 @@ #include #include -using namespace CesiumGltf; - FCesiumMetadataValue::FCesiumMetadataValue(FCesiumMetadataValue&& rhs) = default; @@ -18,7 +16,7 @@ FCesiumMetadataValue::FCesiumMetadataValue(const FCesiumMetadataValue& rhs) : _value(), _valueType(rhs._valueType), _storage(rhs._storage) { swl::visit( [this](const auto& value) { - if constexpr (IsMetadataArray::value) { + if constexpr (CesiumGltf::IsMetadataArray::value) { if (!this->_storage.empty()) { this->_value = decltype(value)(this->_storage); } else { diff --git a/Source/CesiumRuntime/Private/CesiumModelMetadata.cpp b/Source/CesiumRuntime/Private/CesiumModelMetadata.cpp index 63866a624..4deb6615b 100644 --- a/Source/CesiumRuntime/Private/CesiumModelMetadata.cpp +++ b/Source/CesiumRuntime/Private/CesiumModelMetadata.cpp @@ -6,16 +6,14 @@ #include "CesiumGltfComponent.h" #include "CesiumGltfPrimitiveComponent.h" -using namespace CesiumGltf; - static FCesiumModelMetadata EmptyModelMetadata; static FCesiumPropertyTable EmptyPropertyTable; static FCesiumPropertyTexture EmptyPropertyTexture; FCesiumModelMetadata::FCesiumModelMetadata( - const Model& InModel, - const ExtensionModelExtStructuralMetadata& Metadata) { + const CesiumGltf::Model& InModel, + const CesiumGltf::ExtensionModelExtStructuralMetadata& Metadata) { this->_propertyTables.Reserve(Metadata.propertyTables.size()); for (const auto& propertyTable : Metadata.propertyTables) { this->_propertyTables.Emplace(FCesiumPropertyTable(InModel, propertyTable)); diff --git a/Source/CesiumRuntime/Private/CesiumPrimitiveFeatures.cpp b/Source/CesiumRuntime/Private/CesiumPrimitiveFeatures.cpp index ee31b4e58..f0ec01c09 100644 --- a/Source/CesiumRuntime/Private/CesiumPrimitiveFeatures.cpp +++ b/Source/CesiumRuntime/Private/CesiumPrimitiveFeatures.cpp @@ -5,20 +5,18 @@ #include "CesiumGltf/Model.h" #include "CesiumGltfPrimitiveComponent.h" -using namespace CesiumGltf; - static FCesiumPrimitiveFeatures EmptyPrimitiveFeatures; FCesiumPrimitiveFeatures::FCesiumPrimitiveFeatures( - const Model& Model, - const MeshPrimitive& Primitive, - const ExtensionExtMeshFeatures& Features) + const CesiumGltf::Model& Model, + const CesiumGltf::MeshPrimitive& Primitive, + const CesiumGltf::ExtensionExtMeshFeatures& Features) : _vertexCount(0), _primitiveMode(Primitive.mode) { this->_indexAccessor = CesiumGltf::getIndexAccessorView(Model, Primitive); auto positionIt = Primitive.attributes.find("POSITION"); if (positionIt != Primitive.attributes.end()) { - const Accessor& positionAccessor = + const CesiumGltf::Accessor& positionAccessor = Model.getSafe(Model.accessors, positionIt->second); _vertexCount = positionAccessor.count; } diff --git a/Source/CesiumRuntime/Private/CesiumPropertyArray.cpp b/Source/CesiumRuntime/Private/CesiumPropertyArray.cpp index a40fc0c7e..9003116c3 100644 --- a/Source/CesiumRuntime/Private/CesiumPropertyArray.cpp +++ b/Source/CesiumRuntime/Private/CesiumPropertyArray.cpp @@ -3,8 +3,6 @@ #include "CesiumPropertyArray.h" #include -using namespace CesiumGltf; - FCesiumPropertyArray::FCesiumPropertyArray(FCesiumPropertyArray&& rhs) = default; @@ -15,7 +13,7 @@ FCesiumPropertyArray::FCesiumPropertyArray(const FCesiumPropertyArray& rhs) : _value(), _elementType(rhs._elementType), _storage(rhs._storage) { swl::visit( [this](const auto& value) { - if constexpr (IsMetadataArray::value) { + if constexpr (CesiumGltf::IsMetadataArray::value) { if (!this->_storage.empty()) { this->_value = decltype(value)(this->_storage); } else { diff --git a/Source/CesiumRuntime/Private/CesiumPropertyTable.cpp b/Source/CesiumRuntime/Private/CesiumPropertyTable.cpp index 9f803e9f6..83a16af47 100644 --- a/Source/CesiumRuntime/Private/CesiumPropertyTable.cpp +++ b/Source/CesiumRuntime/Private/CesiumPropertyTable.cpp @@ -3,21 +3,19 @@ #include "CesiumPropertyTable.h" #include "CesiumGltf/PropertyTableView.h" -using namespace CesiumGltf; - static FCesiumPropertyTableProperty EmptyPropertyTableProperty; FCesiumPropertyTable::FCesiumPropertyTable( - const Model& Model, - const PropertyTable& PropertyTable) + const CesiumGltf::Model& Model, + const CesiumGltf::PropertyTable& PropertyTable) : _status(ECesiumPropertyTableStatus::ErrorInvalidPropertyTableClass), _name(PropertyTable.name.value_or("").c_str()), _className(PropertyTable.classProperty.c_str()), _count(PropertyTable.count), _properties() { - PropertyTableView propertyTableView{Model, PropertyTable}; + CesiumGltf::PropertyTableView propertyTableView{Model, PropertyTable}; switch (propertyTableView.status()) { - case PropertyTableViewStatus::Valid: + case CesiumGltf::PropertyTableViewStatus::Valid: _status = ECesiumPropertyTableStatus::Valid; break; default: diff --git a/Source/CesiumRuntime/Private/CesiumPropertyTableProperty.cpp b/Source/CesiumRuntime/Private/CesiumPropertyTableProperty.cpp index 6e086f752..794ce3810 100644 --- a/Source/CesiumRuntime/Private/CesiumPropertyTableProperty.cpp +++ b/Source/CesiumRuntime/Private/CesiumPropertyTableProperty.cpp @@ -6,8 +6,6 @@ #include "UnrealMetadataConversions.h" #include -using namespace CesiumGltf; - namespace { /** * Callback on a std::any, assuming that it contains a PropertyTablePropertyView diff --git a/Source/CesiumRuntime/Private/CesiumPropertyTexture.cpp b/Source/CesiumRuntime/Private/CesiumPropertyTexture.cpp index e69be7349..ffefd3e3b 100644 --- a/Source/CesiumRuntime/Private/CesiumPropertyTexture.cpp +++ b/Source/CesiumRuntime/Private/CesiumPropertyTexture.cpp @@ -6,8 +6,6 @@ #include "CesiumGltf/PropertyTextureView.h" #include "CesiumMetadataPickingBlueprintLibrary.h" -using namespace CesiumGltf; - static FCesiumPropertyTextureProperty EmptyPropertyTextureProperty; FCesiumPropertyTexture::FCesiumPropertyTexture( @@ -16,9 +14,9 @@ FCesiumPropertyTexture::FCesiumPropertyTexture( : _status(ECesiumPropertyTextureStatus::ErrorInvalidPropertyTextureClass), _name(PropertyTexture.name.value_or("").c_str()), _className(PropertyTexture.classProperty.c_str()) { - PropertyTextureView propertyTextureView(Model, PropertyTexture); + CesiumGltf::PropertyTextureView propertyTextureView(Model, PropertyTexture); switch (propertyTextureView.status()) { - case PropertyTextureViewStatus::Valid: + case CesiumGltf::PropertyTextureViewStatus::Valid: _status = ECesiumPropertyTextureStatus::Valid; break; default: @@ -35,7 +33,7 @@ FCesiumPropertyTexture::FCesiumPropertyTexture( continue; } - TextureViewOptions options; + CesiumGltf::TextureViewOptions options; options.applyKhrTextureTransformExtension = true; if (propertyPair->second.extras.find("makeImageCopy") != diff --git a/Source/CesiumRuntime/Private/CesiumPropertyTextureProperty.cpp b/Source/CesiumRuntime/Private/CesiumPropertyTextureProperty.cpp index ce122edc1..0c3e93efa 100644 --- a/Source/CesiumRuntime/Private/CesiumPropertyTextureProperty.cpp +++ b/Source/CesiumRuntime/Private/CesiumPropertyTextureProperty.cpp @@ -8,8 +8,6 @@ #include #include -using namespace CesiumGltf; - namespace { /** * Callback on a std::any, assuming that it contains a diff --git a/Source/CesiumRuntime/Private/CesiumTextureUtility.cpp b/Source/CesiumRuntime/Private/CesiumTextureUtility.cpp index cc94b1946..4522422c1 100644 --- a/Source/CesiumRuntime/Private/CesiumTextureUtility.cpp +++ b/Source/CesiumRuntime/Private/CesiumTextureUtility.cpp @@ -28,8 +28,6 @@ #include #include -using namespace CesiumGltf; - namespace { struct ExtensionUnrealTexture { @@ -424,41 +422,42 @@ TextureAddress convertGltfWrapTToUnreal(int32_t wrapT) { } std::optional getPixelFormatForImageAsset( - const ImageAsset& imageCesium, + const CesiumGltf::ImageAsset& imageCesium, const std::optional overridePixelFormat) { - if (imageCesium.compressedPixelFormat != GpuCompressedPixelFormat::NONE) { + if (imageCesium.compressedPixelFormat != + CesiumGltf::GpuCompressedPixelFormat::NONE) { switch (imageCesium.compressedPixelFormat) { - case GpuCompressedPixelFormat::ETC1_RGB: + case CesiumGltf::GpuCompressedPixelFormat::ETC1_RGB: return EPixelFormat::PF_ETC1; break; - case GpuCompressedPixelFormat::ETC2_RGBA: + case CesiumGltf::GpuCompressedPixelFormat::ETC2_RGBA: return EPixelFormat::PF_ETC2_RGBA; break; - case GpuCompressedPixelFormat::BC1_RGB: + case CesiumGltf::GpuCompressedPixelFormat::BC1_RGB: return EPixelFormat::PF_DXT1; break; - case GpuCompressedPixelFormat::BC3_RGBA: + case CesiumGltf::GpuCompressedPixelFormat::BC3_RGBA: return EPixelFormat::PF_DXT5; break; - case GpuCompressedPixelFormat::BC4_R: + case CesiumGltf::GpuCompressedPixelFormat::BC4_R: return EPixelFormat::PF_BC4; break; - case GpuCompressedPixelFormat::BC5_RG: + case CesiumGltf::GpuCompressedPixelFormat::BC5_RG: return EPixelFormat::PF_BC5; break; - case GpuCompressedPixelFormat::BC7_RGBA: + case CesiumGltf::GpuCompressedPixelFormat::BC7_RGBA: return EPixelFormat::PF_BC7; break; - case GpuCompressedPixelFormat::ASTC_4x4_RGBA: + case CesiumGltf::GpuCompressedPixelFormat::ASTC_4x4_RGBA: return EPixelFormat::PF_ASTC_4x4; break; - case GpuCompressedPixelFormat::PVRTC2_4_RGBA: + case CesiumGltf::GpuCompressedPixelFormat::PVRTC2_4_RGBA: return EPixelFormat::PF_PVRTC2; break; - case GpuCompressedPixelFormat::ETC2_EAC_R11: + case CesiumGltf::GpuCompressedPixelFormat::ETC2_EAC_R11: return EPixelFormat::PF_ETC2_R11_EAC; break; - case GpuCompressedPixelFormat::ETC2_EAC_RG11: + case CesiumGltf::GpuCompressedPixelFormat::ETC2_EAC_RG11: return EPixelFormat::PF_ETC2_RG11_EAC; break; default: diff --git a/Source/CesiumRuntime/Private/ExtensionImageAssetUnreal.cpp b/Source/CesiumRuntime/Private/ExtensionImageAssetUnreal.cpp index 9f2120a9b..3675cd21c 100644 --- a/Source/CesiumRuntime/Private/ExtensionImageAssetUnreal.cpp +++ b/Source/CesiumRuntime/Private/ExtensionImageAssetUnreal.cpp @@ -5,7 +5,6 @@ #include using namespace CesiumAsync; -using namespace CesiumGltf; using namespace CesiumGltfReader; namespace { @@ -13,7 +12,9 @@ namespace { std::mutex createExtensionMutex; std::pair>> -getOrCreateImageFuture(const AsyncSystem& asyncSystem, ImageAsset& imageCesium); +getOrCreateImageFuture( + const AsyncSystem& asyncSystem, + CesiumGltf::ImageAsset& imageCesium); } // namespace @@ -80,7 +81,7 @@ namespace { std::pair>> getOrCreateImageFuture( const AsyncSystem& asyncSystem, - ImageAsset& imageCesium) { + CesiumGltf::ImageAsset& imageCesium) { std::scoped_lock lock(createExtensionMutex); ExtensionImageAssetUnreal* pExtension =