diff --git a/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp b/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp index b2781a59a..ae6d3ca00 100644 --- a/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp +++ b/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp @@ -1522,9 +1522,7 @@ static void loadPrimitive( material.emissiveTexture, gltfToUnrealTexCoordMap); - for (size_t i = 0; - i < primitiveResult.overlayTextureCoordinateIDToUVIndex.size(); - ++i) { + for (size_t i = 0; i < 3; ++i) { std::string attributeName = "_CESIUMOVERLAY_" + std::to_string(i); auto overlayIt = primitive.attributes.find(attributeName); if (overlayIt != primitive.attributes.end()) { @@ -3404,6 +3402,10 @@ void UCesiumGltfComponent::AttachRasterTile( rasterTile.getOverlay().getName(), "_TranslationScale"), translationAndScale); + check( + primData.overlayTextureCoordinateIDToUVIndex.find( + textureCoordinateID) != + primData.overlayTextureCoordinateIDToUVIndex.end()); pMaterial->SetScalarParameterValue( createSafeName( rasterTile.getOverlay().getName(), diff --git a/Source/CesiumRuntime/Private/CesiumRasterOverlays.h b/Source/CesiumRuntime/Private/CesiumRasterOverlays.h index 545e24a3d..7c868916a 100644 --- a/Source/CesiumRuntime/Private/CesiumRasterOverlays.h +++ b/Source/CesiumRuntime/Private/CesiumRasterOverlays.h @@ -8,5 +8,4 @@ constexpr size_t maximumOverlayTextureCoordinateIDs = 2; * @brief Maps an overlay texture coordinate ID to the index of the * corresponding texture coordinates in the static mesh's UVs array. */ -using OverlayTextureCoordinateIDMap = - std::array; +using OverlayTextureCoordinateIDMap = std::map;