Cesium for Unreal 2.13.2
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 "CesiumEncodedMetadataComponent and its related description properties have been deprecated. Use CesiumEncodedFeaturesMetadata 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 =
101 bool Normalized = false;
102};
103
104struct UE_DEPRECATED(
105 5.0,
106 "CesiumEncodedMetadataComponent and its related description properties have been deprecated. Use CesiumEncodedFeaturesMetadata 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 =
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"))
148 TArray<FPropertyDescription> Properties;
149};
150
151struct UE_DEPRECATED(
152 5.0,
153 "CesiumEncodedMetadataComponent and its related properties have been deprecated. Use CesiumEncodedFeaturesMetadata 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 "CesiumEncodedMetadataComponent and its related description properties have been deprecated. Use CesiumEncodedFeaturesMetadata 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 "CesiumEncodedMetadataComponent and its related description properties have been deprecated. Use CesiumEncodedFeaturesMetadata instead.")
230
231struct UE_DEPRECATED(
232 5.0,
233 "CesiumEncodedMetadataComponent and its related description properties have been deprecated. Use CesiumEncodedFeaturesMetadata instead.")
235
236/**
237 * @brief Description of metadata from a glTF that should be uploaded to the
238 * GPU for access in materials.
239 */
240USTRUCT()
241struct CESIUMRUNTIME_API FMetadataDescription {
242 GENERATED_USTRUCT_BODY()
243
244 /**
245 * @brief Descriptions of feature tables to upload to the GPU.
246 */
247 UPROPERTY(
248 EditAnywhere,
249 Category = "EncodeMetadata",
250 Meta = (TitleProperty = "Name"))
251 TArray<FFeatureTableDescription> FeatureTables;
252
253 /**
254 * @brief Descriptions of feature textures to upload to the GPU.
255 */
256 UPROPERTY(
257 EditAnywhere,
258 Category = "EncodeMetadata",
259 Meta = (TitleProperty = "Name"))
260 TArray<FFeatureTextureDescription> FeatureTextures;
261};
262
263/**
264 * @brief An actor component that can be added to Cesium3DTileset actors to
265 * dictate what metadata to encode for access on the GPU. The selection can be
266 * automatically populated based on available metadata by clicking the
267 * "Auto Fill" button. Once a selection of desired metadata is made, the
268 * boiler-plate material code to access the selected properties can be
269 * auto-generated using the "Generate Material" button.
270 * @deprecated Use UCesiumFeaturesMetadataComponent instead.
271 */
272UCLASS(Deprecated)
274 : public UActorComponent {
275 GENERATED_BODY()
276
277public:
278#if WITH_EDITORONLY_DATA
279 /**
280 * @brief This is the target UMaterialFunctionMaterialLayer that the
281 * boiler-plate material generation will use. When pressing
282 * "Generate Material", nodes will be added to this material to enable access
283 * to the requested metadata. If this is left blank, a new material layer
284 * will be created in the /Game/ folder.
285 */
286 UPROPERTY(
287 EditAnywhere,
288 Category = "EncodeMetadata",
289 Meta =
290 (DeprecatedProperty,
291 DeprecationMessage =
292 "CesiumEncodedMetadataComponent is deprecated. Use CesiumFeaturesMetadataComponent instead."))
293 UMaterialFunctionMaterialLayer* TargetMaterialLayer = nullptr;
294#endif
295
296 // Note: Here, we avoid wrapping the feature tables and feature textures
297 // inside a FMetadataDescription to avoid further complicating the details
298 // panel UI for editing the hierarchy.
299
300 /**
301 * @brief Descriptions of feature tables to upload to the GPU.
302 */
303 UPROPERTY(
304 EditAnywhere,
305 Category = "EncodeMetadata",
306 Meta =
307 (TitleProperty = "Name",
308 DeprecatedProperty,
309 DeprecationMessage =
310 "CesiumEncodedMetadataComponent is deprecated. Use CesiumFeaturesMetadataComponent instead."))
311 TArray<FFeatureTableDescription> FeatureTables;
312
313 /**
314 * @brief Descriptions of feature textures to upload to the GPU.
315 */
316 UPROPERTY(
317 EditAnywhere,
318 Category = "EncodeMetadata",
319 Meta =
320 (TitleProperty = "Name",
321 DeprecatedProperty,
322 DeprecationMessage =
323 "CesiumEncodedMetadataComponent is deprecated. Use CesiumFeaturesMetadataComponent instead."))
324 TArray<FFeatureTextureDescription> FeatureTextures;
325
326 // virtual void Serialize(FArchive& Ar) override;
327};
328
329PRAGMA_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...
Description of a feature table containing properties to be encoded for access on the GPU.
Description of a feature texture with properties that should be uploaded to the GPU.
Description of a feature texture property that should be uploaded to the GPU.
Description of metadata from a glTF that should be uploaded to the GPU for access in materials.
Description of a feature table property that should be encoded for access on the GPU.