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