Cesium for Unreal 2.12.0
Loading...
Searching...
No Matches
CesiumFeaturesMetadataComponent.h
Go to the documentation of this file.
1// Copyright 2020-2024 CesiumGS, Inc. and Contributors
2
3#pragma once
4
8#include "Components/ActorComponent.h"
9#include "Containers/Array.h"
10#include "Containers/UnrealString.h"
11#include "Misc/Guid.h"
12
13#if WITH_EDITOR
14#include "Materials/MaterialFunctionMaterialLayer.h"
15#endif
16
17#include "CesiumFeaturesMetadataComponent.generated.h"
18
19#pragma region Features descriptions
20
24USTRUCT()
25struct CESIUMRUNTIME_API FCesiumFeatureIdSetDescription {
26 GENERATED_USTRUCT_BODY()
27
28
47 UPROPERTY(EditAnywhere, Category = "Cesium")
48 FString Name;
49
53 UPROPERTY(EditAnywhere, Category = "Cesium")
55
60 UPROPERTY(
61 EditAnywhere,
62 Category = "Cesium",
63 Meta = (EditCondition = "Type == ECesiumFeatureIdSetType::Texture"))
64 bool bHasKhrTextureTransform = false;
65
69 UPROPERTY(EditAnywhere, Category = "Cesium")
70 FString PropertyTableName;
71
78 UPROPERTY(EditAnywhere, Category = "Cesium")
79 bool bHasNullFeatureId = false;
80};
81
90USTRUCT()
91struct CESIUMRUNTIME_API FCesiumPrimitiveFeaturesDescription {
92 GENERATED_USTRUCT_BODY()
93
94
100 UPROPERTY(
101 EditAnywhere,
102 Category = "Features",
103 Meta = (TitleProperty = "Name"))
104 TArray<FCesiumFeatureIdSetDescription> FeatureIdSets;
105};
106#pragma endregion
107
108#pragma region Metadata descriptions
109
110// These don't exhaustively cover the possibilities of glTF metadata
111// classes, they only cover the subset that can be encoded into textures. The
112// following types are excluded:
113// - enums
114// - strings that cannot be parsed as numbers or colors
115// - matrices
116// - variable length arrays
117// - arrays of non-scalar, non-boolean elements
118//
119// Additionally, if a property contains fixed-length arrays, only the first four
120// elements can be encoded.
121
126USTRUCT()
128 GENERATED_USTRUCT_BODY()
129
130
134 UPROPERTY(EditAnywhere, Category = "Cesium")
135 FString Name;
136
142 UPROPERTY(EditAnywhere, Category = "Cesium")
144
148 UPROPERTY(EditAnywhere, Category = "Cesium")
150};
151
156USTRUCT()
157struct CESIUMRUNTIME_API FCesiumPropertyTableDescription {
158 GENERATED_USTRUCT_BODY()
159
160
165 UPROPERTY(EditAnywhere, Category = "Cesium")
166 FString Name;
167
171 UPROPERTY(EditAnywhere, Category = "Cesium", Meta = (TitleProperty = "Name"))
173};
174
181USTRUCT()
183 GENERATED_USTRUCT_BODY()
184
185
189 UPROPERTY(EditAnywhere, Category = "Cesium")
190 FString Name;
191
196 UPROPERTY(EditAnywhere, Category = "Cesium")
198
203 UPROPERTY(EditAnywhere, Category = "Cesium")
204 bool bHasKhrTextureTransform = false;
205};
206
211USTRUCT()
212struct CESIUMRUNTIME_API FCesiumPropertyTextureDescription {
213 GENERATED_USTRUCT_BODY()
214
215
218 UPROPERTY(EditAnywhere, Category = "Cesium")
219 FString Name;
220
224 UPROPERTY(EditAnywhere, Category = "Cesium", Meta = (TitleProperty = "Name"))
226};
227
237USTRUCT()
238struct CESIUMRUNTIME_API FCesiumPrimitiveMetadataDescription {
239 GENERATED_USTRUCT_BODY()
240
241
250 UPROPERTY(
251 EditAnywhere,
252 Category = "Metadata",
253 Meta = (TitleProperty = "Name"))
254 TSet<FString> PropertyTextureNames;
255};
256
261USTRUCT()
262struct CESIUMRUNTIME_API FCesiumModelMetadataDescription {
263 GENERATED_USTRUCT_BODY()
264
265
269 UPROPERTY(
270 EditAnywhere,
271 Category = "Metadata",
272 Meta = (TitleProperty = "Name"))
273 TArray<FCesiumPropertyTableDescription> PropertyTables;
274
279 UPROPERTY(
280 EditAnywhere,
281 Category = "Metadata",
282 Meta = (TitleProperty = "Name"))
283 TArray<FCesiumPropertyTextureDescription> PropertyTextures;
284};
285
286#pragma endregion
287
294USTRUCT()
317
326UCLASS(ClassGroup = (Cesium), Meta = (BlueprintSpawnableComponent))
327class CESIUMRUNTIME_API UCesiumFeaturesMetadataComponent
328 : public UActorComponent {
329 GENERATED_BODY()
330
331public:
332#if WITH_EDITOR
341 UFUNCTION(CallInEditor, Category = "Cesium")
342 void AutoFill();
343
351 UFUNCTION(CallInEditor, Category = "Cesium")
352 void GenerateMaterial();
353#endif
354
355#if WITH_EDITORONLY_DATA
363 UPROPERTY(EditAnywhere, Category = "Cesium")
364 UMaterialFunctionMaterialLayer* TargetMaterialLayer = nullptr;
365#endif
366
367 // Using the FCesiumPrimitiveFeaturesDescription and
368 // FCesiumModelMetadataDescription structs makes the UI less readable, so the
369 // component uses arrays directly to help flatten the UI.
370
375 UPROPERTY(
376 EditAnywhere,
377 Category = "Cesium|Primitive Features",
378 Meta = (TitleProperty = "Name"))
379 TArray<FCesiumFeatureIdSetDescription> FeatureIdSets;
380
390 UPROPERTY(
391 EditAnywhere,
392 Category = "Cesium|Primitive Metadata",
393 Meta = (TitleProperty = "Name"))
394 TSet<FString> PropertyTextureNames;
395
400 UPROPERTY(
401 EditAnywhere,
402 Category = "Cesium|Model Metadata",
403 Meta = (TitleProperty = "Name"))
404 TArray<FCesiumPropertyTableDescription> PropertyTables;
405
410 UPROPERTY(
411 EditAnywhere,
412 Category = "Cesium|Model Metadata",
413 Meta = (TitleProperty = "Name"))
414 TArray<FCesiumPropertyTextureDescription> PropertyTextures;
415};
ECesiumFeatureIdSetType
The type of a feature ID set.
Description of a feature ID set from EXT_mesh_features.
Description of both feature IDs and metadata from a glTF via the EXT_mesh_Features and EXT_structural...
FCesiumPrimitiveFeaturesDescription Features
Description of the feature ID sets available from the EXT_mesh_features on a glTF's primitives.
FCesiumPrimitiveMetadataDescription PrimitiveMetadata
Description of the metadata used by the EXT_structural_metadata on a glTF's primitives.
FCesiumModelMetadataDescription ModelMetadata
Description of metadata from a glTF's EXT_structural_metadata extension.
Describes how a property from EXT_structural_metadata will be encoded for access in Unreal materials.
Represents information about a metadata property according to how the property is defined in EXT_stru...
Description of metadata from a glTF's EXT_structural_metadata extension that should be uploaded to th...
Description of the feature ID sets available from the EXT_mesh_features on a glTF's primitives.
Names of the metadata entities referenced by the EXT_structural_metadata on a glTF's primitives.
Description of a property table containing properties to be encoded for access in Unreal materials.
Description of a property table property that should be encoded for access on the GPU.
Description of a property texture with properties that should be made accessible to Unreal materials.
Description of a property texture property that should be made accessible to Unreal materials.