7#include "GenericPlatform/GenericPlatform.h"
8#include "Kismet/BlueprintFunctionLibrary.h"
9#include <CesiumGltf/KhrTextureTransform.h>
10#include <CesiumGltf/PropertyTexturePropertyView.h>
13#include "CesiumPropertyTextureProperty.generated.h"
42 GENERATED_USTRUCT_BODY()
51 template <
typename T,
bool Normalized>
54 const TSharedPtr<FCesiumMetadataEnum>& pEnumDefinition =
nullptr)
58 _normalized(Normalized),
59 _pEnumDefinition(pEnumDefinition) {
60 switch (Property.status()) {
61 case CesiumGltf::PropertyTexturePropertyViewStatus::Valid:
62 _status = ECesiumPropertyTexturePropertyStatus::Valid;
64 case CesiumGltf::PropertyTexturePropertyViewStatus::
65 EmptyPropertyWithDefault:
66 _status = ECesiumPropertyTexturePropertyStatus::EmptyPropertyWithDefault;
68 case CesiumGltf::PropertyTexturePropertyViewStatus::
69 ErrorUnsupportedProperty:
70 _status = ECesiumPropertyTexturePropertyStatus::ErrorUnsupportedProperty;
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:
94 _status = ECesiumPropertyTexturePropertyStatus::ErrorInvalidPropertyData;
98 _valueType = TypeToMetadataValueType<T>(pEnumDefinition);
99 _normalized = Normalized;
105 const std::optional<CesiumGltf::KhrTextureTransform>
115 TSharedPtr<FCesiumMetadataEnum> _pEnumDefinition;
122 : public UBlueprintFunctionLibrary {
135 Category =
"Cesium|Metadata|PropertyTextureProperty")
149 Category =
"Cesium|Metadata|PropertyTextureProperty")
163 Category =
"Cesium|Metadata|PropertyTextureProperty")
177 Category =
"Cesium|Metadata|PropertyTextureProperty")
190 Category =
"Cesium|Metadata|PropertyTextureProperty")
206 Category =
"Cesium|Metadata|PropertyTextureProperty")
233 Category =
"Cesium|Metadata|PropertyTextureProperty")
235 const UPrimitiveComponent* Component,
248 Category =
"Cesium|Metadata|PropertyTextureProperty")
281 Category =
"Cesium|Metadata|PropertyTextureProperty")
285 uint8 DefaultValue = 0);
317 Category =
"Cesium|Metadata|PropertyTextureProperty")
321 int32 DefaultValue = 0);
355 Category =
"Cesium|Metadata|PropertyTextureProperty")
359 float DefaultValue = 0.0f);
392 Category =
"Cesium|Metadata|PropertyTextureProperty")
396 double DefaultValue = 0.0);
436 Category =
"Cesium|Metadata|PropertyTextureProperty")
440 const FIntPoint& DefaultValue);
477 Category =
"Cesium|Metadata|PropertyTextureProperty")
481 const FVector2D& DefaultValue);
524 Category =
"Cesium|Metadata|PropertyTextureProperty")
528 const FIntVector& DefaultValue);
570 Category =
"Cesium|Metadata|PropertyTextureProperty")
574 const FVector& DefaultValue);
613 Category =
"Cesium|Metadata|PropertyTextureProperty")
617 const FVector4& DefaultValue);
638 Category =
"Cesium|Metadata|PropertyTextureProperty")
641 const FVector2D& UV);
661 Category =
"Cesium|Metadata|PropertyTextureProperty")
664 const FVector2D& UV);
680 Category =
"Cesium|Metadata|PropertyTextureProperty")
683 const FVector2D& UV);
695 Category =
"Cesium|Metadata|PropertyTextureProperty")
713 Category =
"Cesium|Metadata|PropertyTextureProperty")
731 Category =
"Cesium|Metadata|PropertyTextureProperty")
751 Category =
"Cesium|Metadata|PropertyTextureProperty")
771 Category =
"Cesium|Metadata|PropertyTextureProperty")
790 Category =
"Cesium|Metadata|PropertyTextureProperty")
807 Category =
"Cesium|Metadata|PropertyTextureProperty")
811 PRAGMA_DISABLE_DEPRECATION_WARNINGS
825 "Swizzles are no longer hardcoded in Unreal materials. To see what channels the property uses, use GetChannels instead."))
842 "Use GetChannels to get the channels array of a property texture property instead."))
845 PRAGMA_ENABLE_DEPRECATION_WARNINGS
@ EmptyPropertyWithDefault
@ ErrorInvalidPropertyData
ECesiumPropertyTexturePropertyStatus
Reports the status of a FCesiumPropertyTextureProperty.
@ ErrorUnsupportedProperty
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.
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
FCesiumPropertyTextureProperty()
const std::optional< CesiumGltf::KhrTextureTransform > getTextureTransform() const
friend class UCesiumPropertyTexturePropertyBlueprintLibrary