Cesium for Unreal 2.28.0
Loading...
Searching...
No Matches
CesiumPropertyTextureProperty.h
Go to the documentation of this file.
1// Copyright 2020-2024 CesiumGS, Inc. and Contributors
2
3#pragma once
4
7#include "GenericPlatform/GenericPlatform.h"
8#include "Kismet/BlueprintFunctionLibrary.h"
9
10THIRD_PARTY_INCLUDES_START
11#include <CesiumGltf/PropertyTexturePropertyView.h>
12THIRD_PARTY_INCLUDES_END
13#include <any>
14#include <optional>
15
16#include "CesiumPropertyTextureProperty.generated.h"
17
18namespace CesiumGltf {
20struct Sampler;
21} // namespace CesiumGltf
22
23namespace CesiumImage {
24struct ImageAsset;
25}
26
27/**
28 * @brief Reports the status of a FCesiumPropertyTextureProperty. If the
29 * property texture property cannot be accessed, this briefly indicates why.
30 */
31UENUM(BlueprintType)
33 /* The property texture property is valid. */
34 Valid = 0,
35 /* The property texture property is empty but has a specified default value.
36 */
38 /* The property texture property does not exist in the glTF, or the property
39 definition itself contains errors. */
41 /* The data associated with the property texture property is malformed and
42 cannot be retrieved. */
44 /* The type of this property texture property is not supported. */
46};
47
48/**
49 * @brief A blueprint-accessible wrapper for a property texture property from a
50 * glTF. Provides per-pixel access to metadata encoded in a property texture.
51 */
52USTRUCT(BlueprintType)
53struct CESIUMRUNTIME_API FCesiumPropertyTextureProperty {
54 GENERATED_USTRUCT_BODY()
55
56public:
59 _property(),
60 _valueType(),
61 _normalized(false) {}
62
63 template <typename T, bool Normalized>
66 const TSharedPtr<FCesiumMetadataEnum>& pEnumDefinition = nullptr)
68 _property(property),
69 _valueType(),
70 _normalized(Normalized),
71 _pEnumDefinition(pEnumDefinition) {
72 switch (property.status()) {
73 case CesiumGltf::PropertyTexturePropertyViewStatus::Valid:
74 _status = ECesiumPropertyTexturePropertyStatus::Valid;
75 break;
76 case CesiumGltf::PropertyTexturePropertyViewStatus::
77 EmptyPropertyWithDefault:
78 _status = ECesiumPropertyTexturePropertyStatus::EmptyPropertyWithDefault;
79 break;
80 case CesiumGltf::PropertyTexturePropertyViewStatus::
81 ErrorUnsupportedProperty:
82 _status = ECesiumPropertyTexturePropertyStatus::ErrorUnsupportedProperty;
83 return;
84 case CesiumGltf::PropertyTexturePropertyViewStatus::
85 ErrorInvalidPropertyTexture:
86 case CesiumGltf::PropertyTexturePropertyViewStatus::
87 ErrorNonexistentProperty:
88 case CesiumGltf::PropertyTexturePropertyViewStatus::ErrorTypeMismatch:
89 case CesiumGltf::PropertyTexturePropertyViewStatus::
90 ErrorComponentTypeMismatch:
91 case CesiumGltf::PropertyTexturePropertyViewStatus::ErrorArrayTypeMismatch:
92 case CesiumGltf::PropertyTexturePropertyViewStatus::
93 ErrorInvalidNormalization:
94 case CesiumGltf::PropertyTexturePropertyViewStatus::
95 ErrorNormalizationMismatch:
96 case CesiumGltf::PropertyTexturePropertyViewStatus::ErrorInvalidOffset:
97 case CesiumGltf::PropertyTexturePropertyViewStatus::ErrorInvalidScale:
98 case CesiumGltf::PropertyTexturePropertyViewStatus::ErrorInvalidMax:
99 case CesiumGltf::PropertyTexturePropertyViewStatus::ErrorInvalidMin:
100 case CesiumGltf::PropertyTexturePropertyViewStatus::ErrorInvalidNoDataValue:
101 case CesiumGltf::PropertyTexturePropertyViewStatus::
102 ErrorInvalidDefaultValue:
103 // The status was already set in the initializer list.
104 return;
105 default:
106 _status = ECesiumPropertyTexturePropertyStatus::ErrorInvalidPropertyData;
107 return;
108 }
109
110 _valueType = TypeToMetadataValueType<T>(pEnumDefinition);
111 _normalized = Normalized;
112 }
113
114 const int64 getTexCoordSetIndex() const;
116 const CesiumImage::ImageAsset* getImage() const;
117 const std::optional<CesiumGltf::KhrTextureTransform>
119
120private:
122
123 std::any _property;
124
125 FCesiumMetadataValueType _valueType;
126 bool _normalized;
127 TSharedPtr<FCesiumMetadataEnum> _pEnumDefinition;
128
130};
131
132UCLASS()
134 : public UBlueprintFunctionLibrary {
135 GENERATED_BODY()
136
137public:
138 /**
139 * Gets the status of the property texture property. If this property texture
140 * property is invalid in any way, this will briefly indicate why.
141 *
142 * @param Property The property texture property.
143 */
144 UFUNCTION(
145 BlueprintCallable,
146 BlueprintPure,
147 Category = "Cesium|Metadata|PropertyTextureProperty")
149 UPARAM(ref) const FCesiumPropertyTextureProperty& Property);
150
151 /**
152 * Gets the best-fitting type for the property that is accessible from
153 * Blueprints. For the most precise representation of the values possible in
154 * Blueprints, you should retrieve it using this type.
155 *
156 * @param Property The property texture property.
157 */
158 UFUNCTION(
159 BlueprintCallable,
160 BlueprintPure,
161 Category = "Cesium|Metadata|PropertyTextureProperty")
164
165 /**
166 * Gets the best-fitting Blueprints type for the elements in this property's
167 * array values. If the given property does not contain array values, this
168 * returns None.
169 *
170 * @param Property The property texture property.
171 */
172 UFUNCTION(
173 BlueprintCallable,
174 BlueprintPure,
175 Category = "Cesium|Metadata|PropertyTextureProperty")
177 UPARAM(ref) const FCesiumPropertyTextureProperty& Property);
178
179 /**
180 * Gets the type of the metadata value as defined in the
181 * EXT_structural_metadata extension. Many of these types are not accessible
182 * from Blueprints, but can be converted to a Blueprint-accessible type.
183 *
184 * @param Property The property texture property.
185 */
186 UFUNCTION(
187 BlueprintCallable,
188 BlueprintPure,
189 Category = "Cesium|Metadata|PropertyTextureProperty")
191 GetValueType(UPARAM(ref) const FCesiumPropertyTextureProperty& Property);
192
193 /**
194 * Gets the number of elements in an array of this property. Only
195 * applicable when the property is a fixed-length array type.
196 *
197 * @param Property The property texture property.
198 */
199 UFUNCTION(
200 BlueprintCallable,
201 BlueprintPure,
202 Category = "Cesium|Metadata|PropertyTextureProperty")
203 static int64 GetArraySize(UPARAM(ref)
204 const FCesiumPropertyTextureProperty& Property);
205
206 /**
207 * Gets the glTF texture coordinate set index used by the property texture
208 * property. This is the index N corresponding to the "TEXCOORD_N" attribute
209 * on the glTF primitive that samples this texture.
210 *
211 * If the property texture property is invalid, this returns -1.
212 *
213 * @param Property The property texture property.
214 */
215 UFUNCTION(
216 BlueprintCallable,
217 BlueprintPure,
218 Category = "Cesium|Metadata|PropertyTextureProperty")
220 UPARAM(ref) const FCesiumPropertyTextureProperty& Property);
221
222 /**
223 * Gets the UV channel containing the texture coordinate set that is used by
224 * the property texture property on the given component. This refers to the UV
225 * channel it uses on the primitive's static mesh, which is not necessarily
226 * equal to value of GetGltfTextureCoordinateSetIndex.
227 *
228 * This function may be used with FindCollisionUV to get the feature ID from a
229 * line trace hit. However, in order for this function to work, the feature ID
230 * texture should be listed under the CesiumFeaturesMetadataComponent of the
231 * owner Cesium3DTileset. Otherwise, its texture coordinate set may not be
232 * included in the Unreal mesh data. To avoid using
233 * CesiumFeaturesMetadataComponent, use GetFeatureIDFromHit instead.
234 *
235 * This returns -1 if the property texture property is invalid, or if the
236 * specified texture coordinate set is not present in the component's mesh
237 * data.
238 *
239 * @param Component The component to get the texture coordinate set from.
240 * @param Property The property texture property.
241 */
242 UFUNCTION(
243 BlueprintCallable,
244 BlueprintPure,
245 Category = "Cesium|Metadata|PropertyTextureProperty")
246 static int64 GetUnrealUVChannel(
247 const UPrimitiveComponent* Component,
248 UPARAM(ref) const FCesiumPropertyTextureProperty& Property);
249
250 /**
251 * @brief Get the channels array of this property. This contains the indices
252 * of the meaningful texel channels that will be used when sampling the
253 * property texture.
254 *
255 * @param Property The property texture property.
256 */
257 UFUNCTION(
258 BlueprintCallable,
259 BlueprintPure,
260 Category = "Cesium|Metadata|PropertyTextureProperty")
261 static TArray<int64>
262 GetChannels(UPARAM(ref) const FCesiumPropertyTextureProperty& Property);
263
264 /**
265 * Attempts to retrieve the value at the given texture coordinates as an
266 * unsigned 8-bit integer.
267 *
268 * For numeric properties, the raw value for the given coordinates will be
269 * transformed by the property's normalization, scale, and offset before it is
270 * further converted. If the raw value is equal to the property's "no data"
271 * value, then the property's default value will be converted if possible. If
272 * the property-defined default value cannot be converted, or does not exist,
273 * then the user-defined default value is returned.
274 *
275 * Property values are converted as follows:
276 *
277 * - If the value is an integer between 0 and 255, it is returned as-is.
278 * - If the value is a floating-point number in the aforementioned range, it
279 * is truncated (rounded toward zero) and returned.
280 *
281 * In all other cases, the user-defined default value is returned. If the
282 * property texture property is somehow invalid, the user-defined default
283 * value is returned.
284 *
285 * @param Property The property texture property.
286 * @param UV The texture coordinates.
287 * @param DefaultValue The default value to fall back on.
288 * @return The property value as a Byte.
289 */
290 UFUNCTION(
291 BlueprintCallable,
292 BlueprintPure,
293 Category = "Cesium|Metadata|PropertyTextureProperty")
294 static uint8 GetByte(
295 UPARAM(ref) const FCesiumPropertyTextureProperty& Property,
296 const FVector2D& UV,
297 uint8 DefaultValue = 0);
298
299 /**
300 * Attempts to retrieve the value at the given texture coordinates as a signed
301 * 32-bit integer.
302 *
303 * For numeric properties, the raw value for the given coordinates will be
304 * transformed by the property's normalization, scale, and offset before it is
305 * further converted. If the raw value is equal to the property's "no data"
306 * value, then the property's default value will be converted if
307 * possible. If the property-defined default value cannot be converted, or
308 * does not exist, then the user-defined default value is returned.
309 *
310 * Property values are converted as follows:
311 *
312 * - If the value is an integer between -2,147,483,648 and 2,147,483,647, it
313 * is returned as-is.
314 * - If the value is a floating-point number in the aforementioned range, it
315 * is truncated (rounded toward zero) and returned.
316 *
317 * In all other cases, the user-defined default value is returned. If the
318 * property texture property is somehow invalid, the user-defined default
319 * value is returned.
320 *
321 * @param Property The property texture property.
322 * @param UV The texture coordinates.
323 * @param DefaultValue The default value to fall back on.
324 * @return The property value as an Integer.
325 */
326 UFUNCTION(
327 BlueprintCallable,
328 BlueprintPure,
329 Category = "Cesium|Metadata|PropertyTextureProperty")
330 static int32 GetInteger(
331 UPARAM(ref) const FCesiumPropertyTextureProperty& Property,
332 const FVector2D& UV,
333 int32 DefaultValue = 0);
334
335 /**
336 * Attempts to retrieve the value for the given feature as a signed 64-bit
337 * integer. Although property texture properties do not directly support
338 * 64-bit integers, this can be used to losslessly retrieve values from
339 * unsigned 32-bit integer properties.
340 *
341 * For numeric properties, the raw value for a given feature will be
342 * transformed by the property's normalization, scale, and offset before it is
343 * further converted. If the raw value is equal to the property's "no data"
344 * value, then the property's default value will be converted if possible. If
345 * the property-defined default value cannot be converted, or does not exist,
346 * then the user-defined default value is returned.
347 *
348 * Property values are converted as follows:
349 *
350 * - If the value is an integer and between -2^63 and (2^63 - 1), it is
351 * returned as-is.
352 * - If the value is a floating-point number in the aforementioned range, it
353 * is truncated (rounded toward zero) and returned.
354 *
355 * In all other cases, the user-defined default value is returned. If the
356 * property texture property is somehow invalid, the user-defined default
357 * value is returned.
358 *
359 * @param Property The property texture property.
360 * @param UV The texture coordinates.
361 * @param DefaultValue The default value to fall back on.
362 * @return The property value as an Integer64.
363 */
364 UFUNCTION(
365 BlueprintCallable,
366 BlueprintPure,
367 Category = "Cesium|Metadata|PropertyTextureProperty")
368 static int64 GetInteger64(
369 UPARAM(ref) const FCesiumPropertyTextureProperty& Property,
370 const FVector2D& UV,
371 int64 DefaultValue = 0);
372
373 /**
374 * Attempts to retrieve the value at the given texture coordinates as a
375 * single-precision floating-point number.
376 *
377 * For numeric properties, the raw value for the given coordinates will be
378 * transformed by the property's normalization, scale, and offset before it is
379 * further converted. If the raw value is equal to the property's "no data"
380 * value, then the property's default value will be converted if possible. If
381 * the property-defined default value cannot be converted, or does not exist,
382 * then the user-defined default value is returned.
383 *
384 * Property values are converted as follows:
385 *
386 * - If the value is already a single-precision floating-point
387 * number, it is returned as-is.
388 *
389 * - If the value is a scalar of any other type within the range of values
390 * that a single-precision float can represent, it is converted to its closest
391 * representation as a single-precision float and returned.
392 *
393 * In all other cases, the user-defined default value is returned. If the
394 * property texture property is somehow invalid, the user-defined default
395 * value is returned.
396 *
397 * @param Property The property texture property.
398 * @param UV The texture coordinates.
399 * @param DefaultValue The default value to fall back on.
400 * @return The property value as a Float.
401 */
402 UFUNCTION(
403 BlueprintCallable,
404 BlueprintPure,
405 Category = "Cesium|Metadata|PropertyTextureProperty")
406 static float GetFloat(
407 UPARAM(ref) const FCesiumPropertyTextureProperty& Property,
408 const FVector2D& UV,
409 float DefaultValue = 0.0f);
410
411 /**
412 * Attempts to retrieve the value at the given texture coordinates as a
413 * double-precision floating-point number.
414 *
415 * For numeric properties, the raw value for the given coordinates will be
416 * transformed by the property's normalization, scale, and offset before it is
417 * further converted. If the raw value is equal to the property's "no data"
418 * value, then the property's default value will be converted if possible. If
419 * the property-defined default value cannot be converted, or does not exist,
420 * then the user-defined default value is returned.
421 *
422 * Property values are converted as follows:
423 *
424 * - If the value is a single- or double-precision floating-point number, it
425 * is returned as-is.
426 *
427 * - If the value is an integer, it is converted to the closest representable
428 * double-precision floating-point number.
429 *
430 * In all other cases, the user-defined default value is returned. If the
431 * property texture property is somehow invalid, the user-defined default
432 * value is returned.
433 *
434 * @param Property The property texture property.
435 * @param UV The texture coordinates.
436 * @param DefaultValue The default value to fall back on.
437 * @return The property value as a Float.
438 */
439 UFUNCTION(
440 BlueprintCallable,
441 BlueprintPure,
442 Category = "Cesium|Metadata|PropertyTextureProperty")
443 static double GetFloat64(
444 UPARAM(ref) const FCesiumPropertyTextureProperty& Property,
445 const FVector2D& UV,
446 double DefaultValue = 0.0);
447
448 /**
449 * Attempts to retrieve the value at the given texture coordinates as a
450 * FIntPoint.
451 *
452 * For numeric properties, the raw value for the given coordinates will be
453 * transformed by the property's normalization, scale, and offset before it is
454 * further converted. If the raw value is equal to the property's "no data"
455 * value, then the property's default value will be converted if possible. If
456 * the property-defined default value cannot be converted, or does not exist,
457 * then the user-defined default value is returned.
458 *
459 * Property values are converted as follows:
460 *
461 * - If the value is a 2-dimensional vector, its components will be converted
462 * to 32-bit signed integers if possible.
463 *
464 * - If the value is a 3- or 4-dimensional vector, it will use the first two
465 * components to construct the FIntPoint.
466 *
467 * - If the value is a scalar that can be converted to a 32-bit signed
468 * integer, the resulting FIntPoint will have this value in both of its
469 * components.
470 *
471 * In all other cases, the user-defined default value is returned. In all
472 * vector cases, if any of the relevant components cannot be represented as a
473 * 32-bit signed, the default value is returned.
474 *
475 * If the property texture property is somehow invalid, the user-defined
476 * default value is returned.
477 *
478 * @param Property The property texture property.
479 * @param UV The texture coordinates.
480 * @param DefaultValue The default value to fall back on.
481 * @return The property value as a FIntPoint.
482 */
483 UFUNCTION(
484 BlueprintCallable,
485 BlueprintPure,
486 Category = "Cesium|Metadata|PropertyTextureProperty")
487 static FIntPoint GetIntPoint(
488 UPARAM(ref) const FCesiumPropertyTextureProperty& Property,
489 const FVector2D& UV,
490 const FIntPoint& DefaultValue);
491
492 /**
493 * Attempts to retrieve the value at the given texture coordinates as a
494 * FVector2D.
495 *
496 * For numeric properties, the raw value for the given coordinates will be
497 * transformed by the property's normalization, scale, and offset before it is
498 * further converted. If the raw value is equal to the property's "no data"
499 * value, then the property's default value will be converted if possible. If
500 * the property-defined default value cannot be converted, or does not exist,
501 * then the user-defined default value is returned.
502 *
503 * Property values are converted as follows:
504 *
505 * - If the value is a 2-dimensional vector, its components will be converted
506 * to double-precision floating-point numbers.
507 *
508 * - If the value is a 3- or 4-dimensional vector, it will use the first two
509 * components to construct the FVector2D.
510 *
511 * - If the value is a scalar that can be converted to a 32-bit signed
512 * integer, the resulting FVector2D will have this value in both of its
513 * components.
514 *
515 * In all other cases, the user-defined default value is returned. If the
516 * property texture property is somehow invalid, the user-defined default
517 * value is returned.
518 *
519 * @param Property The property texture property.
520 * @param UV The texture coordinates.
521 * @param DefaultValue The default value to fall back on.
522 * @return The property value as a FVector2D.
523 */
524 UFUNCTION(
525 BlueprintCallable,
526 BlueprintPure,
527 Category = "Cesium|Metadata|PropertyTextureProperty")
528 static FVector2D GetVector2D(
529 UPARAM(ref) const FCesiumPropertyTextureProperty& Property,
530 const FVector2D& UV,
531 const FVector2D& DefaultValue);
532
533 /**
534 * Attempts to retrieve the value at the given texture coordinates as a
535 * FIntVector.
536 *
537 * For numeric properties, the raw value for the given coordinates will be
538 * transformed by the property's normalization, scale, and offset before it is
539 * further converted. If the raw value is equal to the property's "no data"
540 * value, then the property's default value will be converted if possible. If
541 * the property-defined default value cannot be converted, or does not exist,
542 * then the user-defined default value is returned.
543 *
544 * Property values are converted as follows:
545 *
546 * - If the value is a 3-dimensional vector, its components will be converted
547 * to 32-bit signed integers if possible.
548 *
549 * - If the value is a 4-dimensional vector, it will use the first three
550 * components to construct the FIntVector.
551 *
552 * - If the value is a 2-dimensional vector, it will become the XY-components
553 * of the FIntVector. The Z component will be set to zero.
554 *
555 * - If the value is a scalar that can be converted to a 32-bit signed
556 * integer, the resulting FIntVector will have this value in all of its
557 * components.
558 *
559 * In all other cases, the user-defined default value is returned. In all
560 * vector cases, if any of the relevant components cannot be represented as a
561 * 32-bit signed integer, the default value is returned.
562 *
563 * If the property texture property is somehow invalid, the user-defined
564 * default value is returned.
565 *
566 * @param Property The property texture property.
567 * @param UV The texture coordinates.
568 * @param DefaultValue The default value to fall back on.
569 * @return The property value as a FIntVector.
570 */
571 UFUNCTION(
572 BlueprintCallable,
573 BlueprintPure,
574 Category = "Cesium|Metadata|PropertyTextureProperty")
575 static FIntVector GetIntVector(
576 UPARAM(ref) const FCesiumPropertyTextureProperty& Property,
577 const FVector2D& UV,
578 const FIntVector& DefaultValue);
579
580 /**
581 * Attempts to retrieve the value at the given texture coordinates as a
582 * FVector.
583 *
584 * For numeric properties, the raw value for the given coordinates will be
585 * transformed by the property's normalization, scale, and offset before it is
586 * further converted. If the raw value is equal to the property's "no data"
587 * value, then the property's default value will be converted if possible. If
588 * the property-defined default value cannot be converted, or does not exist,
589 * then the user-defined default value is returned.
590 *
591 * Property values are converted as follows:
592 *
593 * - If the value is a 3-dimensional vector, its components will be converted
594 * to double-precision floating-point numbers.
595 *
596 * - If the value is a 4-dimensional vector, a FVector containing the first
597 * three components will be returned.
598 *
599 * - If the value is a 2-dimensional vector, it will become the XY-components
600 * of the FVector. The Z-component will be set to zero.
601 *
602 * - If the value is a scalar, then the resulting FVector will have this value
603 * as a double-precision floating-point number in all of its components.
604 *
605 * In all other cases, the user-defined default value is returned. In all
606 * vector cases, if any of the relevant components cannot be represented as a
607 * single-precision float, the default value is returned.
608 *
609 * If the property texture property is somehow invalid, the user-defined
610 * default value is returned.
611 *
612 * @param Property The property texture property.
613 * @param UV The texture coordinates.
614 * @param DefaultValue The default value to fall back on.
615 * @return The property value as a FVector.
616 */
617 UFUNCTION(
618 BlueprintCallable,
619 BlueprintPure,
620 Category = "Cesium|Metadata|PropertyTextureProperty")
621 static FVector GetVector(
622 UPARAM(ref) const FCesiumPropertyTextureProperty& Property,
623 const FVector2D& UV,
624 const FVector& DefaultValue);
625
626 /**
627 * Attempts to retrieve the value at the given texture coordinates as a
628 * FVector4.
629 *
630 * For numeric properties, the raw value for the given coordinates will be
631 * transformed by the property's normalization, scale, and offset before it is
632 * further converted. If the raw value is equal to the property's "no data"
633 * value, then the property's default value will be converted if possible. If
634 * the property-defined default value cannot be converted, or does not exist,
635 * then the user-defined default value is returned.
636 *
637 * Property values are converted as follows:
638 *
639 * - If the value is a 4-dimensional vector, its components will be converted
640 * to double-precision floating-point numbers.
641 *
642 * - If the value is a 3-dimensional vector, it will become the XYZ-components
643 * of the FVector4. The W-component will be set to zero.
644 *
645 * - If the value is a 2-dimensional vector, it will become the XY-components
646 * of the FVector4. The Z- and W-components will be set to zero.
647 *
648 * - If the value is a scalar, then the resulting FVector4 will have this
649 * value as a double-precision floating-point number in all of its components.
650 *
651 * In all other cases, the user-defined default value is returned. If the
652 * property texture property is somehow invalid, the user-defined default
653 * value is returned.
654 *
655 * @param Property The property texture property.
656 * @param UV The texture coordinates.
657 * @param DefaultValue The default value to fall back on.
658 * @return The property value as a FVector4.
659 */
660 UFUNCTION(
661 BlueprintCallable,
662 BlueprintPure,
663 Category = "Cesium|Metadata|PropertyTextureProperty")
664 static FVector4 GetVector4(
665 UPARAM(ref) const FCesiumPropertyTextureProperty& Property,
666 const FVector2D& UV,
667 const FVector4& DefaultValue);
668
669 /**
670 * Attempts to retrieve the value for the given texture coordinates as a
671 * FCesiumPropertyArray. If the property is not an array type, this returns an
672 * empty array.
673 *
674 * For numeric array properties, the raw array value for a given coordinates
675 * will be transformed by the property's normalization, scale, and offset
676 * before it is further converted. If the raw value is equal to the property's
677 * "no data" value, then the property's default value will be converted if
678 * possible. If the property-defined default value cannot be converted, or
679 * does not exist, then the user-defined default value is returned.
680 *
681 * @param Property The property texture property.
682 * @param UV The texture coordinates.
683 * @return The property value as a FCesiumPropertyArray.
684 */
685 UFUNCTION(
686 BlueprintCallable,
687 BlueprintPure,
688 Category = "Cesium|Metadata|PropertyTextureProperty")
690 UPARAM(ref) const FCesiumPropertyTextureProperty& Property,
691 const FVector2D& UV);
692
693 /**
694 * Retrieves the value of the property for the given texture coordinates. This
695 * allows the value to be acted on more generically; its true value can be
696 * retrieved later as a specific Blueprints type.
697 *
698 * For numeric properties, the raw value for a given feature will be
699 * transformed by the property's normalization, scale, and offset before it is
700 * returned. If the raw value is equal to the property's "no data" value, an
701 * empty value will be returned. However, if the property itself specifies a
702 * default value, then the property-defined default value will be returned.
703 *
704 * @param Property The property texture property.
705 * @param UV The texture coordinates.
706 * @return The property value.
707 */
708 UFUNCTION(
709 BlueprintCallable,
710 BlueprintPure,
711 Category = "Cesium|Metadata|PropertyTextureProperty")
713 UPARAM(ref) const FCesiumPropertyTextureProperty& Property,
714 const FVector2D& UV);
715
716 /**
717 * Retrieves the raw value of the property for the given feature. This is the
718 * value of the property without normalization, offset, or scale applied.
719 *
720 * If this property specifies a "no data" value, and the raw value is equal to
721 * this "no data" value, the value is returned as-is.
722 *
723 * @param Property The property texture property.
724 * @param UV The texture coordinates.
725 * @return The raw property value.
726 */
727 UFUNCTION(
728 BlueprintCallable,
729 BlueprintPure,
730 Category = "Cesium|Metadata|PropertyTextureProperty")
732 UPARAM(ref) const FCesiumPropertyTextureProperty& Property,
733 const FVector2D& UV);
734
735 /**
736 * Whether this property is normalized. Only applicable when this property
737 * has an integer component type.
738 *
739 * @param Property The property texture property.
740 * @return Whether this property is normalized.
741 */
742 UFUNCTION(
743 BlueprintCallable,
744 BlueprintPure,
745 Category = "Cesium|Metadata|PropertyTextureProperty")
746 static bool IsNormalized(UPARAM(ref)
747 const FCesiumPropertyTextureProperty& Property);
748
749 /**
750 * Gets the offset of this property. This can be defined by the class property
751 * that it implements, or overridden by the instance of the property itself.
752 *
753 * This is only applicable to properties with floating-point or normalized
754 * integer component types. If an offset is not defined or applicable, this
755 * returns an empty value.
756 *
757 * @param Property The property texture property.
758 * @return The offset of the property.
759 */
760 UFUNCTION(
761 BlueprintCallable,
762 BlueprintPure,
763 Category = "Cesium|Metadata|PropertyTextureProperty")
765 GetOffset(UPARAM(ref) const FCesiumPropertyTextureProperty& Property);
766
767 /**
768 * Gets the scale of this property. This can be defined by the class property
769 * that it implements, or overridden by the instance of the property itself.
770 *
771 * This is only applicable to properties with floating-point or normalized
772 * integer component types. If a scale is not defined or applicable, this
773 * returns an empty value.
774 *
775 * @param Property The property texture property.
776 * @return The scale of the property.
777 */
778 UFUNCTION(
779 BlueprintCallable,
780 BlueprintPure,
781 Category = "Cesium|Metadata|PropertyTextureProperty")
783 GetScale(UPARAM(ref) const FCesiumPropertyTextureProperty& Property);
784
785 /**
786 * Gets the minimum value of this property. This can be defined by the class
787 * property that it implements, or overridden by the instance of the property
788 * itself.
789 *
790 * This is only applicable to scalar, vecN and matN properties. It represents
791 * the component-wise minimum of all property values with normalization,
792 * offset, and scale applied. If a minimum value is not defined or
793 * applicable, this returns an empty value.
794 *
795 * @param Property The property texture property.
796 * @return The minimum value of the property.
797 */
798 UFUNCTION(
799 BlueprintCallable,
800 BlueprintPure,
801 Category = "Cesium|Metadata|PropertyTextureProperty")
804
805 /**
806 * Gets the maximum value of this property. This can be defined by the class
807 * property that it implements, or overridden by the instance of the property
808 * itself.
809 *
810 * This is only applicable to scalar, vecN and matN properties. It represents
811 * the component-wise maximum of all property values with normalization,
812 * offset, and scale applied. If a maximum value is not defined or applicable,
813 * this returns an empty value.
814 *
815 * @param Property The property texture property.
816 * @return The maximum value of the property.
817 */
818 UFUNCTION(
819 BlueprintCallable,
820 BlueprintPure,
821 Category = "Cesium|Metadata|PropertyTextureProperty")
824
825 /**
826 * Gets the "no data" value of this property, as defined by its class
827 * property. This value functions a sentinel value, indicating missing data
828 * wherever it appears. The value is compared against the property's raw data,
829 * without normalization, offset, or scale applied.
830 *
831 * This is not applicable to boolean properties. If a "no data" value is
832 * not defined or applicable, this returns an empty value.
833 *
834 * @param Property The property texture property.
835 * @return The "no data" value of the property.
836 */
837 UFUNCTION(
838 BlueprintCallable,
839 BlueprintPure,
840 Category = "Cesium|Metadata|PropertyTextureProperty")
842 GetNoDataValue(UPARAM(ref) const FCesiumPropertyTextureProperty& Property);
843
844 /**
845 * Gets the default value of this property, as defined by its class
846 * property. This default value is used use when encountering a "no data"
847 * value in the property.
848 *
849 * If a default value is not defined, this returns an empty value.
850 *
851 * @param Property The property texture property.
852 * @return The default value of the property.
853 */
854 UFUNCTION(
855 BlueprintCallable,
856 BlueprintPure,
857 Category = "Cesium|Metadata|PropertyTextureProperty")
860
861 PRAGMA_DISABLE_DEPRECATION_WARNINGS
862 /**
863 * @brief Get the string representing how the metadata is encoded into a
864 * pixel color. This is useful to unpack the correct order of the metadata
865 * components from the pixel color.
866 *
867 * @param Property The property texture property.
868 */
869 UFUNCTION(
870 BlueprintCallable,
871 BlueprintPure,
872 Meta =
873 (DeprecatedFunction,
874 DeprecationMessage =
875 "Swizzles are no longer hardcoded in Unreal materials. To see what channels the property uses, use GetChannels instead."))
876 static FString GetSwizzle(UPARAM(ref)
877 const FCesiumPropertyTextureProperty& Property);
878
879 /**
880 * @brief Get the component count of this property. Since the metadata is
881 * encoded as pixel color, this is also the number of meaningful channels
882 * it will use.
883 *
884 * @param Property The property texture property.
885 */
886 UFUNCTION(
887 BlueprintCallable,
888 BlueprintPure,
889 Meta =
890 (DeprecatedFunction,
891 DeprecationMessage =
892 "Use GetChannels to get the channels array of a property texture property instead."))
893 static int64
895 PRAGMA_ENABLE_DEPRECATION_WARNINGS
896};
ECesiumMetadataBlueprintType
The Blueprint type that can losslessly represent values of a given property.
ECesiumPropertyTexturePropertyStatus
Reports the status of a FCesiumPropertyTextureProperty.
USTRUCT() struct FCesiumVoxelClassDescription
Description of the metadata properties available in the class used by the 3DTILES_content_voxels exte...
static int64 GetGltfTextureCoordinateSetIndex(UPARAM(ref) const FCesiumPropertyTextureProperty &Property)
Gets the glTF texture coordinate set index used by the property texture property.
static FVector2D GetVector2D(UPARAM(ref) const FCesiumPropertyTextureProperty &Property, const FVector2D &UV, const FVector2D &DefaultValue)
Attempts to retrieve the value at the given texture coordinates as a FVector2D.
static ECesiumPropertyTexturePropertyStatus GetPropertyTexturePropertyStatus(UPARAM(ref) const FCesiumPropertyTextureProperty &Property)
Gets the status of the property texture property.
static uint8 GetByte(UPARAM(ref) const FCesiumPropertyTextureProperty &Property, const FVector2D &UV, uint8 DefaultValue=0)
Attempts to retrieve the value at the given texture coordinates as an unsigned 8-bit integer.
static ECesiumMetadataBlueprintType GetBlueprintType(UPARAM(ref) const FCesiumPropertyTextureProperty &Property)
Gets the best-fitting type for the property that is accessible from Blueprints.
static float GetFloat(UPARAM(ref) const FCesiumPropertyTextureProperty &Property, const FVector2D &UV, float DefaultValue=0.0f)
Attempts to retrieve the value at the given texture coordinates as a single-precision floating-point ...
static FCesiumMetadataValue GetMaximumValue(UPARAM(ref) const FCesiumPropertyTextureProperty &Property)
Gets the maximum value of this property.
static int64 GetComponentCount(UPARAM(ref) const FCesiumPropertyTextureProperty &Property)
Get the component count of this property.
static int64 GetArraySize(UPARAM(ref) const FCesiumPropertyTextureProperty &Property)
Gets the number of elements in an array of this property.
static FVector4 GetVector4(UPARAM(ref) const FCesiumPropertyTextureProperty &Property, const FVector2D &UV, const FVector4 &DefaultValue)
Attempts to retrieve the value at the given texture coordinates as a FVector4.
static FCesiumMetadataValue GetScale(UPARAM(ref) const FCesiumPropertyTextureProperty &Property)
Gets the scale of this property.
static FCesiumMetadataValue GetRawValue(UPARAM(ref) const FCesiumPropertyTextureProperty &Property, const FVector2D &UV)
Retrieves the raw value of the property for the given feature.
static FCesiumMetadataValue GetOffset(UPARAM(ref) const FCesiumPropertyTextureProperty &Property)
Gets the offset of this property.
static FCesiumPropertyArray GetArray(UPARAM(ref) const FCesiumPropertyTextureProperty &Property, const FVector2D &UV)
Attempts to retrieve the value for the given texture coordinates as a FCesiumPropertyArray.
static FCesiumMetadataValue GetMinimumValue(UPARAM(ref) const FCesiumPropertyTextureProperty &Property)
Gets the minimum value of this property.
static FIntVector GetIntVector(UPARAM(ref) const FCesiumPropertyTextureProperty &Property, const FVector2D &UV, const FIntVector &DefaultValue)
Attempts to retrieve the value at the given texture coordinates as a FIntVector.
static int64 GetUnrealUVChannel(const UPrimitiveComponent *Component, UPARAM(ref) const FCesiumPropertyTextureProperty &Property)
Gets the UV channel containing the texture coordinate set that is used by the property texture proper...
static int32 GetInteger(UPARAM(ref) const FCesiumPropertyTextureProperty &Property, const FVector2D &UV, int32 DefaultValue=0)
Attempts to retrieve the value at the given texture coordinates as a signed 32-bit integer.
static FCesiumMetadataValue GetNoDataValue(UPARAM(ref) const FCesiumPropertyTextureProperty &Property)
Gets the "no data" value of this property, as defined by its class property.
static FCesiumMetadataValueType GetValueType(UPARAM(ref) const FCesiumPropertyTextureProperty &Property)
Gets the type of the metadata value as defined in the EXT_structural_metadata extension.
static FIntPoint GetIntPoint(UPARAM(ref) const FCesiumPropertyTextureProperty &Property, const FVector2D &UV, const FIntPoint &DefaultValue)
Attempts to retrieve the value at the given texture coordinates as a FIntPoint.
static TArray< int64 > GetChannels(UPARAM(ref) const FCesiumPropertyTextureProperty &Property)
Get the channels array of this property.
static FCesiumMetadataValue GetValue(UPARAM(ref) const FCesiumPropertyTextureProperty &Property, const FVector2D &UV)
Retrieves the value of the property for the given texture coordinates.
static PRAGMA_DISABLE_DEPRECATION_WARNINGS FString GetSwizzle(UPARAM(ref) const FCesiumPropertyTextureProperty &Property)
Get the string representing how the metadata is encoded into a pixel color.
static bool IsNormalized(UPARAM(ref) const FCesiumPropertyTextureProperty &Property)
Whether this property is normalized.
static ECesiumMetadataBlueprintType GetArrayElementBlueprintType(UPARAM(ref) const FCesiumPropertyTextureProperty &Property)
Gets the best-fitting Blueprints type for the elements in this property's array values.
static double GetFloat64(UPARAM(ref) const FCesiumPropertyTextureProperty &Property, const FVector2D &UV, double DefaultValue=0.0)
Attempts to retrieve the value at the given texture coordinates as a double-precision floating-point ...
static FVector GetVector(UPARAM(ref) const FCesiumPropertyTextureProperty &Property, const FVector2D &UV, const FVector &DefaultValue)
Attempts to retrieve the value at the given texture coordinates as a FVector.
static int64 GetInteger64(UPARAM(ref) const FCesiumPropertyTextureProperty &Property, const FVector2D &UV, int64 DefaultValue=0)
Attempts to retrieve the value for the given feature as a signed 64-bit integer.
static FCesiumMetadataValue GetDefaultValue(UPARAM(ref) const FCesiumPropertyTextureProperty &Property)
Gets the default value of this property, as defined by its class property.
Represents the true value type of a metadata value, akin to the property types in EXT_structural_meta...
A Blueprint-accessible wrapper for a glTF metadata value.
A Blueprint-accessible wrapper for an array value from 3D Tiles or glTF metadata.
A blueprint-accessible wrapper for a property texture property from a glTF.
const int64 getTexCoordSetIndex() const
const CesiumGltf::Sampler * getSampler() const
const std::optional< CesiumGltf::KhrTextureTransform > getTextureTransform() const
const CesiumImage::ImageAsset * getImage() const
FCesiumPropertyTextureProperty(const CesiumGltf::PropertyTexturePropertyView< T, Normalized > &property, const TSharedPtr< FCesiumMetadataEnum > &pEnumDefinition=nullptr)