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