From 53a5394b4ac376fc75a3c0a8bf19867ba7eafd7d Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Thu, 22 Aug 2024 12:33:15 +0200 Subject: [PATCH] WIP --- .../Private/CesiumFeaturesMetadataComponent.cpp | 15 ++++++++++++++- .../Private/CesiumGltfComponent.cpp | 17 +++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/Source/CesiumRuntime/Private/CesiumFeaturesMetadataComponent.cpp b/Source/CesiumRuntime/Private/CesiumFeaturesMetadataComponent.cpp index 9b0212cb2..34c7663f3 100644 --- a/Source/CesiumRuntime/Private/CesiumFeaturesMetadataComponent.cpp +++ b/Source/CesiumRuntime/Private/CesiumFeaturesMetadataComponent.cpp @@ -274,9 +274,15 @@ void AutoFillPropertyTextureDescriptions( void AutoFillFeatureIdSetDescriptions( TArray& Descriptions, const FCesiumPrimitiveFeatures& Features, + const FCesiumInstanceFeatures* InstanceFeatures, const TArray& PropertyTables) { - const TArray featureIDSets = + TArray featureIDSets = UCesiumPrimitiveFeaturesBlueprintLibrary::GetFeatureIDSets(Features); + if (InstanceFeatures) { + featureIDSets.Append( + UCesiumInstanceFeaturesBlueprintLibrary::GetFeatureIDSets( + *InstanceFeatures)); + } int32 featureIDTextureCounter = 0; for (const FCesiumFeatureIdSet& featureIDSet : featureIDSets) { @@ -391,9 +397,16 @@ void UCesiumFeaturesMetadataComponent::AutoFill() { const TArray& propertyTables = UCesiumModelMetadataBlueprintLibrary::GetPropertyTables( modelMetadata); + const FCesiumInstanceFeatures* pInstanceFeatures = nullptr; + const auto* pInstancedComponent = + Cast(pChildComponent); + if (pInstancedComponent) { + pInstanceFeatures = pInstancedComponent->pInstanceFeatures.Get(); + } AutoFillFeatureIdSetDescriptions( this->FeatureIdSets, primitiveFeatures, + pInstanceFeatures, propertyTables); const FCesiumPrimitiveMetadata& primitiveMetadata = primData.Metadata; diff --git a/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp b/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp index 813828e04..1eb55100b 100644 --- a/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp +++ b/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp @@ -3170,6 +3170,23 @@ static void SetMetadataParameterValues_DEPRECATED( PRAGMA_ENABLE_DEPRECATION_WARNINGS #pragma endregion +namespace { +void addInstanceFeatureIds(UCesiumGltfInstancedComponent* pInstancedComponent) { + const FCesiumInstanceFeatures& instanceFeatures = + UCesiumInstanceFeaturesBlueprintLibrary::GetInstanceFeatures( + pInstancedComponent); + const TArray& featureIdSets = + UCesiumInstanceFeaturesBlueprintLibrary::GetFeatureIDSets(instanceFeatures); + int32 featureSetCount = featureIdSets.Num(); + if (featureSetCount == 0) { + return; + } + for (const auto& idSet : featureIdSets) { + } + +} +} // namespace + static void loadPrimitiveGameThreadPart( CesiumGltf::Model& model, UCesiumGltfComponent* pGltf,