Cesium for Unreal 2.18.0
Loading...
Searching...
No Matches
CesiumPrimitiveMetadata.h
Go to the documentation of this file.
1// Copyright 2020-2024 CesiumGS, Inc. and Contributors
2
3#pragma once
4
6#include "Kismet/BlueprintFunctionLibrary.h"
7#include "UObject/ObjectMacros.h"
8
9#include "CesiumPrimitiveMetadata.generated.h"
10
11namespace CesiumGltf {
12struct Model;
13struct MeshPrimitive;
16} // namespace CesiumGltf
17
18/**
19 * A Blueprint-accessible wrapper for a glTF Primitive's EXT_structural_metadata
20 * extension. It holds the property attributes used by the primitive, as well as
21 * the indices of the property textures associated with it, which index into the
22 * array of property textures in the model's EXT_structural_metadata extension.
23 */
24USTRUCT(BlueprintType)
25struct CESIUMRUNTIME_API FCesiumPrimitiveMetadata {
26 GENERATED_USTRUCT_BODY()
27
28public:
29 /**
30 * Construct an empty primitive metadata.
31 */
33
34 /**
35 * Constructs a primitive metadata instance.
36 *
37 * @param model The model containing the given mesh primitive.
38 * @param primitive The mesh primitive containing the EXT_structural_metadata
39 * extension
40 * @param metadata The EXT_structural_metadata of the glTF mesh primitive.
41 */
43 const CesiumGltf::Model& model,
44 const CesiumGltf::MeshPrimitive& primitive,
46
47private:
48 TArray<int64> _propertyTextureIndices;
49 TArray<FCesiumPropertyAttribute> _propertyAttributes;
50
51 // For backwards compatibility with GetPropertyAttributeIndices().
52 TArray<int64> _propertyAttributeIndices;
53
55};
56
57UCLASS()
59 : public UBlueprintFunctionLibrary {
60 GENERATED_BODY()
61
62public:
63 /**
64 * Gets the primitive metadata of a glTF primitive component. If component is
65 * not a Cesium glTF primitive component, the returned metadata is empty.
66 */
67 UFUNCTION(
68 BlueprintCallable,
69 BlueprintPure,
70 Category = "Cesium|Primitive|Metadata")
71 static const FCesiumPrimitiveMetadata&
72 GetPrimitiveMetadata(const UPrimitiveComponent* component);
73
74 /**
75 * Get the indices of the property textures that are associated with the
76 * primitive. This can be used to retrieve the actual property textures from
77 * the model's FCesiumModelMetadata.
78 */
79 UFUNCTION(
80 BlueprintCallable,
81 BlueprintPure,
82 Category = "Cesium|Primitive|Metadata")
83 static const TArray<int64>& GetPropertyTextureIndices(
84 UPARAM(ref) const FCesiumPrimitiveMetadata& PrimitiveMetadata);
85
86 /**
87 * Get the property attributes that are associated with the primitive.
88 */
89 UFUNCTION(
90 BlueprintCallable,
91 BlueprintPure,
92 Category = "Cesium|Primitive|Metadata")
93 static const TArray<FCesiumPropertyAttribute>&
95 const FCesiumPrimitiveMetadata& PrimitiveMetadata);
96
97 PRAGMA_DISABLE_DEPRECATION_WARNINGS
98 /**
99 * Get the indices of the property attributes that are associated with the
100 * primitive.
101 */
102 UFUNCTION(
103 Category = "Cesium|Primitive|Metadata",
104 Meta =
105 (DeprecatedFunction,
106 DeprecationMessage =
107 "Retrieve property attributes directly through GetPropertyAttributes instead."))
108 static const TArray<int64>& GetPropertyAttributeIndices(
109 UPARAM(ref) const FCesiumPrimitiveMetadata& PrimitiveMetadata);
110 PRAGMA_ENABLE_DEPRECATION_WARNINGS
111};
static const TArray< FCesiumPropertyAttribute > & GetPropertyAttributes(UPARAM(ref) const FCesiumPrimitiveMetadata &PrimitiveMetadata)
Get the property attributes that are associated with the primitive.
static const FCesiumPrimitiveMetadata & GetPrimitiveMetadata(const UPrimitiveComponent *component)
Gets the primitive metadata of a glTF primitive component.
static PRAGMA_DISABLE_DEPRECATION_WARNINGS const TArray< int64 > & GetPropertyAttributeIndices(UPARAM(ref) const FCesiumPrimitiveMetadata &PrimitiveMetadata)
Get the indices of the property attributes that are associated with the primitive.
static const TArray< int64 > & GetPropertyTextureIndices(UPARAM(ref) const FCesiumPrimitiveMetadata &PrimitiveMetadata)
Get the indices of the property textures that are associated with the primitive.
A Blueprint-accessible wrapper for a glTF Primitive's EXT_structural_metadata extension.
FCesiumPrimitiveMetadata()
Construct an empty primitive metadata.
FCesiumPrimitiveMetadata(const CesiumGltf::Model &model, const CesiumGltf::MeshPrimitive &primitive, const CesiumGltf::ExtensionMeshPrimitiveExtStructuralMetadata &metadata)
Constructs a primitive metadata instance.
friend class UCesiumPrimitiveMetadataBlueprintLibrary
A Blueprint-accessible wrapper for a glTF property attribute.