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