Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename vertex-specific functions in FCesiumFeatureIdAttribute #1574

Merged
merged 7 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
##### Breaking Changes :mega:

- Removed support for Unreal Engine 5.2. Unreal Engine 5.3 or later is now required.
- Renamed `FCesiumFeatureIdAttribute::GetFeatureIDForVertex` to `FCesiumFeatureIdAttribute::GetFeatureID`.
- Renamed `FCesiumFeatureIdAttribute::GetVertexCount` to `FCesiumFeatureIdAttribute::GetFeatureIDCount`.

### v2.11.0 - 2024-12-02

Expand Down
6 changes: 5 additions & 1 deletion Config/Engine.ini
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,8 @@ AspectRatioAxisConstraint=AspectRatio_MaintainXFOV
+PropertyRedirects=(OldName="CesiumWebMapTileServiceRasterOverlay.South", NewName="CesiumWebMapTileServiceRasterOverlay.RectangleSouth")
+PropertyRedirects=(OldName="CesiumWebMapTileServiceRasterOverlay.East", NewName="CesiumWebMapTileServiceRasterOverlay.RectangleEast")
+PropertyRedirects=(OldName="CesiumWebMapTileServiceRasterOverlay.North", NewName="CesiumWebMapTileServiceRasterOverlay.RectangleNorth")
+PropertyRedirects=(OldName="CesiumWebMapTileServiceRasterOverlay.UseWebMercatorProjection", NewName="CesiumWebMapTileServiceRasterOverlay.UseWebMercatorProjection_DEPRECATED")
+PropertyRedirects=(OldName="CesiumWebMapTileServiceRasterOverlay.UseWebMercatorProjection", NewName="CesiumWebMapTileServiceRasterOverlay.UseWebMercatorProjection_DEPRECATED")

+FunctionRedirects=(OldName="CesiumFeatureIdAttributeBlueprintLibrary.GetFeatureIDForVertex", NewName="CesiumFeatureIdAttributeBlueprintLibrary.GetFeatureID")
+PropertyRedirects=(OldName="CesiumFeatureIdAttributeBlueprintLibrary.GetFeatureIDForVertex.VertexIndex", NewName="CesiumFeatureIdAttributeBlueprintLibrary.GetFeatureID.Index")
+FunctionRedirects=(OldName="CesiumFeatureIdAttributeBlueprintLibrary.GetVertexCount", NewName="CesiumFeatureIdAttributeBlueprintLibrary.GetFeatureIDCount")
4 changes: 2 additions & 2 deletions Source/CesiumRuntime/Private/CesiumFeatureIdAttribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureIDAttributeStatus(
return FeatureIDAttribute._status;
}

int64 UCesiumFeatureIdAttributeBlueprintLibrary::GetVertexCount(
int64 UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureIDCount(
UPARAM(ref) const FCesiumFeatureIdAttribute& FeatureIDAttribute) {
return std::visit(
CesiumGltf::CountFromAccessor{},
FeatureIDAttribute._featureIdAccessor);
}

int64 UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureIDForVertex(
int64 UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureID(
UPARAM(ref) const FCesiumFeatureIdAttribute& FeatureIDAttribute,
int64 VertexIndex) {
return std::visit(
Expand Down
6 changes: 3 additions & 3 deletions Source/CesiumRuntime/Private/CesiumFeatureIdSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ int64 UCesiumFeatureIdSetBlueprintLibrary::GetFeatureIDForVertex(
if (FeatureIDSet._featureIDSetType == ECesiumFeatureIdSetType::Attribute) {
FCesiumFeatureIdAttribute attribute =
std::get<FCesiumFeatureIdAttribute>(FeatureIDSet._featureID);
return UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureIDForVertex(
return UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureID(
attribute,
VertexIndex);
}
Expand Down Expand Up @@ -189,7 +189,7 @@ int64 UCesiumFeatureIdSetBlueprintLibrary::GetFeatureIDForInstance(
}
const auto& featureIdAttribute =
std::get<FCesiumFeatureIdAttribute>(FeatureIDSet._featureID);
return UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureIDForVertex(
return UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureID(
featureIdAttribute,
InstanceIndex);
}
Expand Down Expand Up @@ -239,7 +239,7 @@ int64 UCesiumFeatureIdSetBlueprintLibrary::GetFeatureIDFromHit(
if (FeatureIDSet._featureIDSetType == ECesiumFeatureIdSetType::Attribute) {
FCesiumFeatureIdAttribute attribute =
std::get<FCesiumFeatureIdAttribute>(FeatureIDSet._featureID);
return UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureIDForVertex(
return UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureID(
attribute,
VertexIndex);
}
Expand Down
24 changes: 14 additions & 10 deletions Source/CesiumRuntime/Private/CesiumGltfComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ static void updateTextureCoordinatesForFeaturesMetadata(
featureIDSet);

int64 vertexCount =
UCesiumFeatureIdAttributeBlueprintLibrary::GetVertexCount(
UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureIDCount(
featureIDAttribute);

// We encode unsigned integer feature ids as floats in the u-channel of
Expand All @@ -731,8 +731,9 @@ static void updateTextureCoordinatesForFeaturesMetadata(
uint32 vertexIndex = indices[i];
if (vertexIndex >= 0 && vertexIndex < vertexCount) {
float featureId = static_cast<float>(
UCesiumFeatureIdAttributeBlueprintLibrary::
GetFeatureIDForVertex(featureIDAttribute, vertexIndex));
UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureID(
featureIDAttribute,
vertexIndex));
vertex.UVs[textureCoordinateIndex] = TMeshVector2(featureId, 0.0f);
} else {
vertex.UVs[textureCoordinateIndex] = TMeshVector2(0.0f, 0.0f);
Expand All @@ -743,8 +744,9 @@ static void updateTextureCoordinatesForFeaturesMetadata(
FStaticMeshBuildVertex& vertex = vertices[i];
if (i < vertexCount) {
float featureId = static_cast<float>(
UCesiumFeatureIdAttributeBlueprintLibrary::
GetFeatureIDForVertex(featureIDAttribute, i));
UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureID(
featureIDAttribute,
i));
vertex.UVs[textureCoordinateIndex] = TMeshVector2(featureId, 0.0f);
} else {
vertex.UVs[textureCoordinateIndex] = TMeshVector2(0.0f, 0.0f);
Expand Down Expand Up @@ -877,7 +879,7 @@ static void updateTextureCoordinatesForMetadata_DEPRECATED(
textureCoordinateIndex);

int64 vertexCount =
UCesiumFeatureIdAttributeBlueprintLibrary::GetVertexCount(
UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureIDCount(
featureIdAttribute);

// We encode unsigned integer feature ids as floats in the u-channel of
Expand All @@ -888,8 +890,9 @@ static void updateTextureCoordinatesForMetadata_DEPRECATED(
uint32 vertexIndex = indices[i];
if (vertexIndex >= 0 && vertexIndex < vertexCount) {
float featureId = static_cast<float>(
UCesiumFeatureIdAttributeBlueprintLibrary::
GetFeatureIDForVertex(featureIdAttribute, vertexIndex));
UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureID(
featureIdAttribute,
vertexIndex));
vertex.UVs[textureCoordinateIndex] = TMeshVector2(featureId, 0.0f);
} else {
vertex.UVs[textureCoordinateIndex] = TMeshVector2(0.0f, 0.0f);
Expand All @@ -900,8 +903,9 @@ static void updateTextureCoordinatesForMetadata_DEPRECATED(
FStaticMeshBuildVertex& vertex = vertices[i];
if (i < vertexCount) {
float featureId = static_cast<float>(
UCesiumFeatureIdAttributeBlueprintLibrary::
GetFeatureIDForVertex(featureIdAttribute, i));
UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureID(
featureIdAttribute,
i));
vertex.UVs[textureCoordinateIndex] = TMeshVector2(featureId, 0.0f);
} else {
vertex.UVs[textureCoordinateIndex] = TMeshVector2(0.0f, 0.0f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ int64 UCesiumMetadataUtilityBlueprintLibrary::GetFeatureIDFromFaceID(
UPARAM(ref) const FCesiumMetadataPrimitive& Primitive,
UPARAM(ref) const FCesiumFeatureIdAttribute& FeatureIDAttribute,
int64 FaceID) {
return UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureIDForVertex(
return UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureID(
FeatureIDAttribute,
UCesiumMetadataPrimitiveBlueprintLibrary::GetFirstVertexIDFromFaceID(
Primitive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void FCesiumFeatureIdAttributeSpec::Define() {
});
});

Describe("GetVertexCount", [this]() {
Describe("GetFeatureIDCount", [this]() {
BeforeEach([this]() {
model = CesiumGltf::Model();
CesiumGltf::Mesh& mesh = model.meshes.emplace_back();
Expand All @@ -149,7 +149,7 @@ void FCesiumFeatureIdAttributeSpec::Define() {
ECesiumFeatureIdAttributeStatus::ErrorInvalidAccessor);
TestEqual(
"VertexCount",
UCesiumFeatureIdAttributeBlueprintLibrary::GetVertexCount(
UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureIDCount(
featureIDAttribute),
0);
});
Expand Down Expand Up @@ -177,13 +177,13 @@ void FCesiumFeatureIdAttributeSpec::Define() {
ECesiumFeatureIdAttributeStatus::Valid);
TestEqual(
"VertexCount",
UCesiumFeatureIdAttributeBlueprintLibrary::GetVertexCount(
UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureIDCount(
featureIDAttribute),
vertexCount);
});
});

Describe("GetFeatureIDForVertex", [this]() {
Describe("GetFeatureID", [this]() {
BeforeEach([this]() {
model = CesiumGltf::Model();
CesiumGltf::Mesh& mesh = model.meshes.emplace_back();
Expand All @@ -206,7 +206,7 @@ void FCesiumFeatureIdAttributeSpec::Define() {
ECesiumFeatureIdAttributeStatus::ErrorInvalidAccessor);
TestEqual(
"FeatureIDForVertex",
UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureIDForVertex(
UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureID(
featureIDAttribute,
0),
-1);
Expand Down Expand Up @@ -234,13 +234,13 @@ void FCesiumFeatureIdAttributeSpec::Define() {
ECesiumFeatureIdAttributeStatus::Valid);
TestEqual(
"FeatureIDForNegativeVertex",
UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureIDForVertex(
UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureID(
featureIDAttribute,
-1),
-1);
TestEqual(
"FeatureIDForOutOfBoundsVertex",
UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureIDForVertex(
UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureID(
featureIDAttribute,
10),
-1);
Expand Down Expand Up @@ -269,7 +269,7 @@ void FCesiumFeatureIdAttributeSpec::Define() {
for (size_t i = 0; i < featureIDs.size(); i++) {
TestEqual(
"FeatureIDForVertex",
UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureIDForVertex(
UCesiumFeatureIdAttributeBlueprintLibrary::GetFeatureID(
featureIDAttribute,
static_cast<int64>(i)),
featureIDs[i]);
Expand Down
22 changes: 11 additions & 11 deletions Source/CesiumRuntime/Public/CesiumFeatureIdAttribute.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ enum class ECesiumFeatureIdAttributeStatus : uint8 {

/**
* @brief A blueprint-accessible wrapper for a feature ID attribute from a glTF
* primitive. Provides access to per-vertex feature IDs which can be used with
* the corresponding {@link FCesiumPropertyTable} to access per-vertex metadata.
* model. Provides access to feature IDs which can be used with the
* corresponding {@link FCesiumPropertyTable} to access metadata.
*/
USTRUCT(BlueprintType)
struct CESIUMRUNTIME_API FCesiumFeatureIdAttribute {
Expand Down Expand Up @@ -131,27 +131,27 @@ class CESIUMRUNTIME_API UCesiumFeatureIdAttributeBlueprintLibrary
UPARAM(ref) const FCesiumFeatureIdAttribute& FeatureIDAttribute);

/**
* Get the number of vertices in the primitive containing the feature
* ID attribute. If the feature ID attribute is invalid, this returns 0.
* Get the number of feature IDs in this attribute. If the feature ID
* attribute is invalid, this returns 0.
*/
UFUNCTION(
BlueprintCallable,
BlueprintPure,
Category = "Cesium|Features|FeatureIDAttribute")
static int64
GetVertexCount(UPARAM(ref)
const FCesiumFeatureIdAttribute& FeatureIDAttribute);
GetFeatureIDCount(UPARAM(ref)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be a bit confusing on second glance -- I don't want this to convey the # of actual unique feature IDs versus. the length of the attribute. Let me tweak this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Settled on GetCount with some additional documentation. Open to other alternatives too.

const FCesiumFeatureIdAttribute& FeatureIDAttribute);

/**
* Gets the feature ID associated with the given vertex. The feature ID can be
* used with a FCesiumFeatureTable to retrieve the per-vertex metadata. If
* the feature ID attribute is invalid, this returns -1.
* Gets the feature ID at the given index. A feature ID can be used with a
* FCesiumPropertyTable to retrieve the metadata for that ID. If the feature
* ID attribute is invalid, this returns -1.
*/
UFUNCTION(
BlueprintCallable,
BlueprintPure,
Category = "Cesium|Features|FeatureIDAttribute")
static int64 GetFeatureIDForVertex(
static int64 GetFeatureID(
UPARAM(ref) const FCesiumFeatureIdAttribute& FeatureIDAttribute,
int64 VertexIndex);
int64 Index);
};
Loading