Cesium for Unreal 2.16.0
Loading...
Searching...
No Matches
CesiumEncodedMetadataComponent.h
Go to the documentation of this file.
1// Copyright 2020-2024 CesiumGS, Inc. and Contributors
2
3#pragma once
4
5#include "Components/ActorComponent.h"
6#include "Containers/Array.h"
7#include "Containers/UnrealString.h"
8#include "Misc/Guid.h"
9
10#if WITH_EDITOR
11#include "Materials/MaterialFunctionMaterialLayer.h"
12#endif
13
14#include "CesiumEncodedMetadataComponent.generated.h"
15
16PRAGMA_DISABLE_DEPRECATION_WARNINGS
17
18/**
19 * @brief The GPU component type to coerce this property to.
20 *
21 */
22UENUM()
27
28/**
29 * @brief The property type.
30 */
31UENUM()
38
39/**
40 * @brief Describes how this feature table is accessed. Either through feature
41 * id textures, feature id attributes, mixed, or neither.
42 */
43UENUM()
50
51// Note that these don't exhaustively cover the possibilities of glTF metadata
52// classes, they only cover the subset that can be encoded into textures. For
53// example, arbitrary size arrays and enums are excluded. Other un-encoded
54// types like strings will be coerced.
55
56struct UE_DEPRECATED(
57 5.0,
58 "FPropertyDescription has been deprecated. Use FCesiumPropertyTablePropertyDescription instead.")
60
61/**
62 * @brief Description of a feature table property that should be encoded for
63 * access on the GPU.
64 */
65USTRUCT()
66struct CESIUMRUNTIME_API FPropertyDescription {
67 GENERATED_USTRUCT_BODY()
68
69 /**
70 * @brief The name of this property as it will be referenced in the
71 * material.
72 */
73 UPROPERTY(EditAnywhere, Category = "Cesium")
74 FString Name;
75
76 /**
77 * @brief The GPU component type to coerce this property to.
78 *
79 */
80 UPROPERTY(EditAnywhere, Category = "Cesium")
83
84 /**
85 * @brief The property type.
86 */
87 UPROPERTY(EditAnywhere, Category = "Cesium")
90
91 /**
92 * @brief If ComponentType==Uint8, this indicates whether to normalize into a
93 * [0-1] range before accessing on the GPU.
94 */
95 UPROPERTY(
96 EditAnywhere,
97 Category = "Cesium",
98 Meta =
99 (EditCondition =
100 "ComponentType==ECesiumPropertyComponentType_DEPRECATED::Uint8_DEPRECATED"))
101 bool Normalized = false;
102};
103
104struct UE_DEPRECATED(
105 5.0,
106 "FFeatureTableDescription has been deprecated. Use FCesiumPropertyTableDescription instead.")
108
109/**
110 * @brief Description of a feature table containing properties to be encoded
111 * for access on the GPU.
112 */
113USTRUCT()
114struct CESIUMRUNTIME_API FFeatureTableDescription {
115 GENERATED_USTRUCT_BODY()
116
117 /**
118 * @brief The name of this feature table.
119 *
120 */
121 UPROPERTY(EditAnywhere, Category = "Cesium")
122 FString Name;
123
124 /**
125 * @brief Describes how this feature table is accessed. Either through feature
126 * id textures, feature id attributes, mixed, or neither.
127 */
128 UPROPERTY(EditAnywhere, Category = "Cesium")
131
132 /**
133 * @brief If the AccessType==Texture, this string represents the channel of
134 * the feature id texture that will be used to index into this feature table.
135 */
136 UPROPERTY(
137 EditAnywhere,
138 Category = "Cesium",
139 Meta =
140 (EditCondition =
141 "AccessType==ECesiumFeatureTableAccessType_DEPRECATED::Texture_DEPRECATED"))
142 FString Channel;
143
144 /**
145 * @brief Descriptions of the properties to upload to the GPU.
146 */
147 UPROPERTY(EditAnywhere, Category = "Cesium", Meta = (TitleProperty = "Name"))
149};
150
151struct UE_DEPRECATED(
152 5.0,
153 "FFeatureTexturePropertyDescription has been deprecated. Use FCesiumPropertyTexturePropertyDescription instead.")
155
156/**
157 * @brief Description of a feature texture property that should be uploaded to
158 * the GPU.
159 */
160USTRUCT()
161struct CESIUMRUNTIME_API FFeatureTexturePropertyDescription {
162 GENERATED_USTRUCT_BODY()
163
164 /**
165 * @brief The name of this property as it will be referenced in the
166 * material.
167 */
168 UPROPERTY(EditAnywhere, Category = "Cesium")
169 FString Name;
170
171 // For now, always assumes it is Uint8
172 /*
173 UPROPERTY(EditAnywhere, Category = "Cesium")
174 ECesiumPropertyComponentType ComponentType =
175 ECesiumPropertyComponentType::Uint8;*/
176
177 /**
178 * @brief The property type.
179 */
180 UPROPERTY(EditAnywhere, Category = "Cesium")
183
184 /**
185 * @brief If ComponentType==Uint8, this indicates whether to normalize into a
186 * [0-1] range before accessing on the GPU.
187 */
188 UPROPERTY(EditAnywhere, Category = "Cesium")
189 bool Normalized = false;
190
191 /**
192 * @brief This string describes the channel order of the incoming feature
193 * texture property (e.g., "rgb", "bgra", etc.). This helps us fix the
194 * channel order when accessing on the GPU.
195 */
196 UPROPERTY(EditAnywhere, Category = "Cesium")
197 FString Swizzle;
198};
199
200struct UE_DEPRECATED(
201 5.0,
202 "FFeatureTextureDescription has been deprecated. Use FCesiumPropertyTextureDescription instead.")
204
205/**
206 * @brief Description of a feature texture with properties that should be
207 * uploaded to the GPU.
208 */
209USTRUCT()
210struct CESIUMRUNTIME_API FFeatureTextureDescription {
211 GENERATED_USTRUCT_BODY()
212
213 /**
214 * @brief The name of this feature texture.
215 */
216 UPROPERTY(EditAnywhere, Category = "Cesium")
217 FString Name;
218
219 /**
220 * @brief Descriptions of the properties to upload to the GPU.
221 */
222 UPROPERTY(EditAnywhere, Category = "Cesium", Meta = (TitleProperty = "Name"))
224};
225
226struct UE_DEPRECATED(
227 5.0,
228 "FMetadataDescription has been deprecated. Use FCesiumModelMetadataDescription instead.")
230
231/**
232 * @brief Description of metadata from a glTF that should be uploaded to the
233 * GPU for access in materials.
234 */
235USTRUCT()
236struct CESIUMRUNTIME_API FMetadataDescription {
237 GENERATED_USTRUCT_BODY()
238
239 /**
240 * @brief Descriptions of feature tables to upload to the GPU.
241 */
242 UPROPERTY(
243 EditAnywhere,
244 Category = "EncodeMetadata",
245 Meta = (TitleProperty = "Name"))
247
248 /**
249 * @brief Descriptions of feature textures to upload to the GPU.
250 */
251 UPROPERTY(
252 EditAnywhere,
253 Category = "EncodeMetadata",
254 Meta = (TitleProperty = "Name"))
256};
257
258/**
259 * @brief An actor component that can be added to Cesium3DTileset actors to
260 * dictate what metadata to encode for access on the GPU. The selection can be
261 * automatically populated based on available metadata by clicking the
262 * "Auto Fill" button. Once a selection of desired metadata is made, the
263 * boiler-plate material code to access the selected properties can be
264 * auto-generated using the "Generate Material" button.
265 * @deprecated Use UCesiumFeaturesMetadataComponent instead.
266 */
267UCLASS(Deprecated)
269 : public UActorComponent {
270 GENERATED_BODY()
271
272public:
273#if WITH_EDITORONLY_DATA
274 /**
275 * @brief This is the target UMaterialFunctionMaterialLayer that the
276 * boiler-plate material generation will use. When pressing
277 * "Generate Material", nodes will be added to this material to enable access
278 * to the requested metadata. If this is left blank, a new material layer
279 * will be created in the /Game/ folder.
280 */
281 UPROPERTY(
282 EditAnywhere,
283 Category = "EncodeMetadata",
284 Meta =
285 (DeprecatedProperty,
286 DeprecationMessage =
287 "CesiumEncodedMetadataComponent is deprecated. Use CesiumFeaturesMetadataComponent instead."))
288 UMaterialFunctionMaterialLayer* TargetMaterialLayer = nullptr;
289#endif
290
291 // Note: Here, we avoid wrapping the feature tables and feature textures
292 // inside a FMetadataDescription to avoid further complicating the details
293 // panel UI for editing the hierarchy.
294
295 /**
296 * @brief Descriptions of feature tables to upload to the GPU.
297 */
298 UPROPERTY(
299 EditAnywhere,
300 Category = "EncodeMetadata",
301 Meta =
302 (TitleProperty = "Name",
303 DeprecatedProperty,
304 DeprecationMessage =
305 "CesiumEncodedMetadataComponent is deprecated. Use CesiumFeaturesMetadataComponent instead."))
307
308 /**
309 * @brief Descriptions of feature textures to upload to the GPU.
310 */
311 UPROPERTY(
312 EditAnywhere,
313 Category = "EncodeMetadata",
314 Meta =
315 (TitleProperty = "Name",
316 DeprecatedProperty,
317 DeprecationMessage =
318 "CesiumEncodedMetadataComponent is deprecated. Use CesiumFeaturesMetadataComponent instead."))
320
321 // virtual void Serialize(FArchive& Ar) override;
322};
323
324PRAGMA_ENABLE_DEPRECATION_WARNINGS
ECesiumFeatureTableAccessType_DEPRECATED
Describes how this feature table is accessed.
ECesiumPropertyType_DEPRECATED
The property type.
ECesiumPropertyComponentType_DEPRECATED
The GPU component type to coerce this property to.
An actor component that can be added to Cesium3DTileset actors to dictate what metadata to encode for...
TArray< FFeatureTextureDescription > FeatureTextures
Descriptions of feature textures to upload to the GPU.
TArray< FFeatureTableDescription > FeatureTables
Descriptions of feature tables to upload to the GPU.
Description of a feature table containing properties to be encoded for access on the GPU.
FString Channel
If the AccessType==Texture, this string represents the channel of the feature id texture that will be...
TArray< FPropertyDescription > Properties
Descriptions of the properties to upload to the GPU.
FString Name
The name of this feature table.
ECesiumFeatureTableAccessType_DEPRECATED AccessType
Describes how this feature table is accessed.
Description of a feature texture with properties that should be uploaded to the GPU.
FString Name
The name of this feature texture.
TArray< FFeatureTexturePropertyDescription > Properties
Descriptions of the properties to upload to the GPU.
Description of a feature texture property that should be uploaded to the GPU.
ECesiumPropertyType_DEPRECATED Type
The property type.
FString Name
The name of this property as it will be referenced in the material.
bool Normalized
If ComponentType==Uint8, this indicates whether to normalize into a [0-1] range before accessing on t...
FString Swizzle
This string describes the channel order of the incoming feature texture property (e....
Description of metadata from a glTF that should be uploaded to the GPU for access in materials.
TArray< FFeatureTextureDescription > FeatureTextures
Descriptions of feature textures to upload to the GPU.
TArray< FFeatureTableDescription > FeatureTables
Descriptions of feature tables to upload to the GPU.
Description of a feature table property that should be encoded for access on the GPU.
ECesiumPropertyType_DEPRECATED Type
The property type.
bool Normalized
If ComponentType==Uint8, this indicates whether to normalize into a [0-1] range before accessing on t...
FString Name
The name of this property as it will be referenced in the material.
ECesiumPropertyComponentType_DEPRECATED ComponentType
The GPU component type to coerce this property to.