Skip to content

Commit

Permalink
Remove CesiumGltf usings to try to fix OSX build
Browse files Browse the repository at this point in the history
  • Loading branch information
azrogers committed Oct 30, 2024
1 parent 2ec8b60 commit da6f64c
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 76 deletions.
20 changes: 10 additions & 10 deletions Source/CesiumRuntime/Private/CesiumFeatureIdAttribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
#include <CesiumGltf/Accessor.h>
#include <CesiumGltf/Model.h>

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),
Expand All @@ -23,9 +21,9 @@ FCesiumFeatureIdAttribute::FCesiumFeatureIdAttribute(
return;
}

const Accessor* accessor =
Model.getSafe<Accessor>(&Model.accessors, featureID->second);
if (!accessor || accessor->type != Accessor::Type::SCALAR) {
const CesiumGltf::Accessor* accessor =
Model.getSafe<CesiumGltf::Accessor>(&Model.accessors, featureID->second);
if (!accessor || accessor->type != CesiumGltf::Accessor::Type::SCALAR) {
this->_status = ECesiumFeatureIdAttributeStatus::ErrorInvalidAccessor;
return;
}
Expand All @@ -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;
}

Expand All @@ -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);
}
15 changes: 7 additions & 8 deletions Source/CesiumRuntime/Private/CesiumFeatureIdSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -25,12 +23,13 @@ FCesiumFeatureIdSet::FCesiumFeatureIdSet(
FString propertyTableName;

// For backwards compatibility with GetFeatureTableName.
const ExtensionModelExtStructuralMetadata* pMetadata =
InModel.getExtension<ExtensionModelExtStructuralMetadata>();
const CesiumGltf::ExtensionModelExtStructuralMetadata* pMetadata =
InModel.getExtension<CesiumGltf::ExtensionModelExtStructuralMetadata>();
if (pMetadata && _propertyTableIndex >= 0) {
size_t index = static_cast<size_t>(_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());
}
Expand Down
16 changes: 7 additions & 9 deletions Source/CesiumRuntime/Private/CesiumFeatureIdTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,17 @@

#include <optional>

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") !=
Expand All @@ -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:
Expand Down
4 changes: 1 addition & 3 deletions Source/CesiumRuntime/Private/CesiumMetadataValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#include <CesiumGltf/MetadataConversions.h>
#include <CesiumGltf/PropertyTypeTraits.h>

using namespace CesiumGltf;

FCesiumMetadataValue::FCesiumMetadataValue(FCesiumMetadataValue&& rhs) =
default;

Expand All @@ -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<decltype(value)>::value) {
if constexpr (CesiumGltf::IsMetadataArray<decltype(value)>::value) {
if (!this->_storage.empty()) {
this->_value = decltype(value)(this->_storage);
} else {
Expand Down
6 changes: 2 additions & 4 deletions Source/CesiumRuntime/Private/CesiumModelMetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
10 changes: 4 additions & 6 deletions Source/CesiumRuntime/Private/CesiumPrimitiveFeatures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 1 addition & 3 deletions Source/CesiumRuntime/Private/CesiumPropertyArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#include "CesiumPropertyArray.h"
#include <CesiumGltf/PropertyTypeTraits.h>

using namespace CesiumGltf;

FCesiumPropertyArray::FCesiumPropertyArray(FCesiumPropertyArray&& rhs) =
default;

Expand All @@ -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<decltype(value)>::value) {
if constexpr (CesiumGltf::IsMetadataArray<decltype(value)>::value) {
if (!this->_storage.empty()) {
this->_value = decltype(value)(this->_storage);
} else {
Expand Down
10 changes: 4 additions & 6 deletions Source/CesiumRuntime/Private/CesiumPropertyTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 0 additions & 2 deletions Source/CesiumRuntime/Private/CesiumPropertyTableProperty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#include "UnrealMetadataConversions.h"
#include <utility>

using namespace CesiumGltf;

namespace {
/**
* Callback on a std::any, assuming that it contains a PropertyTablePropertyView
Expand Down
8 changes: 3 additions & 5 deletions Source/CesiumRuntime/Private/CesiumPropertyTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#include "CesiumGltf/PropertyTextureView.h"
#include "CesiumMetadataPickingBlueprintLibrary.h"

using namespace CesiumGltf;

static FCesiumPropertyTextureProperty EmptyPropertyTextureProperty;

FCesiumPropertyTexture::FCesiumPropertyTexture(
Expand All @@ -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:
Expand All @@ -35,7 +33,7 @@ FCesiumPropertyTexture::FCesiumPropertyTexture(
continue;
}

TextureViewOptions options;
CesiumGltf::TextureViewOptions options;
options.applyKhrTextureTransformExtension = true;

if (propertyPair->second.extras.find("makeImageCopy") !=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#include <cstdint>
#include <limits>

using namespace CesiumGltf;

namespace {
/**
* Callback on a std::any, assuming that it contains a
Expand Down
29 changes: 14 additions & 15 deletions Source/CesiumRuntime/Private/CesiumTextureUtility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#include <CesiumGltfReader/GltfReader.h>
#include <CesiumUtility/IntrusivePointer.h>

using namespace CesiumGltf;

namespace {

struct ExtensionUnrealTexture {
Expand Down Expand Up @@ -424,41 +422,42 @@ TextureAddress convertGltfWrapTToUnreal(int32_t wrapT) {
}

std::optional<EPixelFormat> getPixelFormatForImageAsset(
const ImageAsset& imageCesium,
const CesiumGltf::ImageAsset& imageCesium,
const std::optional<EPixelFormat> 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:
Expand Down
7 changes: 4 additions & 3 deletions Source/CesiumRuntime/Private/ExtensionImageAssetUnreal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
#include <CesiumGltfReader/GltfReader.h>

using namespace CesiumAsync;
using namespace CesiumGltf;
using namespace CesiumGltfReader;

namespace {

std::mutex createExtensionMutex;

std::pair<ExtensionImageAssetUnreal&, std::optional<Promise<void>>>
getOrCreateImageFuture(const AsyncSystem& asyncSystem, ImageAsset& imageCesium);
getOrCreateImageFuture(
const AsyncSystem& asyncSystem,
CesiumGltf::ImageAsset& imageCesium);

} // namespace

Expand Down Expand Up @@ -80,7 +81,7 @@ namespace {
std::pair<ExtensionImageAssetUnreal&, std::optional<Promise<void>>>
getOrCreateImageFuture(
const AsyncSystem& asyncSystem,
ImageAsset& imageCesium) {
CesiumGltf::ImageAsset& imageCesium) {
std::scoped_lock lock(createExtensionMutex);

ExtensionImageAssetUnreal* pExtension =
Expand Down

0 comments on commit da6f64c

Please sign in to comment.