7#include "GenericPlatform/GenericPlatform.h"
8#include "Kismet/BlueprintFunctionLibrary.h"
10#include <CesiumGltf/KhrTextureTransform.h>
11#include <CesiumGltf/PropertyTexturePropertyView.h>
15#include "CesiumPropertyTextureProperty.generated.h"
44 GENERATED_USTRUCT_BODY()
53 template <
typename T,
bool Normalized>
56 const TSharedPtr<FCesiumMetadataEnum>& pEnumDefinition =
nullptr)
60 _normalized(Normalized),
61 _pEnumDefinition(pEnumDefinition) {
62 switch (property.status()) {
63 case CesiumGltf::PropertyTexturePropertyViewStatus::Valid:
64 _status = ECesiumPropertyTexturePropertyStatus::Valid;
66 case CesiumGltf::PropertyTexturePropertyViewStatus::
67 EmptyPropertyWithDefault:
68 _status = ECesiumPropertyTexturePropertyStatus::EmptyPropertyWithDefault;
70 case CesiumGltf::PropertyTexturePropertyViewStatus::
71 ErrorUnsupportedProperty:
72 _status = ECesiumPropertyTexturePropertyStatus::ErrorUnsupportedProperty;
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:
96 _status = ECesiumPropertyTexturePropertyStatus::ErrorInvalidPropertyData;
100 _valueType = TypeToMetadataValueType<T>(pEnumDefinition);
101 _normalized = Normalized;
107 const std::optional<CesiumGltf::KhrTextureTransform>
117 TSharedPtr<FCesiumMetadataEnum> _pEnumDefinition;
124 : public UBlueprintFunctionLibrary {
137 Category =
"Cesium|Metadata|PropertyTextureProperty")
151 Category =
"Cesium|Metadata|PropertyTextureProperty")
165 Category =
"Cesium|Metadata|PropertyTextureProperty")
179 Category =
"Cesium|Metadata|PropertyTextureProperty")
192 Category =
"Cesium|Metadata|PropertyTextureProperty")
208 Category =
"Cesium|Metadata|PropertyTextureProperty")
235 Category =
"Cesium|Metadata|PropertyTextureProperty")
237 const UPrimitiveComponent* Component,
250 Category =
"Cesium|Metadata|PropertyTextureProperty")
283 Category =
"Cesium|Metadata|PropertyTextureProperty")
287 uint8 DefaultValue = 0);
319 Category =
"Cesium|Metadata|PropertyTextureProperty")
323 int32 DefaultValue = 0);
357 Category =
"Cesium|Metadata|PropertyTextureProperty")
361 int64 DefaultValue = 0);
395 Category =
"Cesium|Metadata|PropertyTextureProperty")
399 float DefaultValue = 0.0f);
432 Category =
"Cesium|Metadata|PropertyTextureProperty")
436 double DefaultValue = 0.0);
476 Category =
"Cesium|Metadata|PropertyTextureProperty")
480 const FIntPoint& DefaultValue);
517 Category =
"Cesium|Metadata|PropertyTextureProperty")
521 const FVector2D& DefaultValue);
564 Category =
"Cesium|Metadata|PropertyTextureProperty")
568 const FIntVector& DefaultValue);
610 Category =
"Cesium|Metadata|PropertyTextureProperty")
614 const FVector& DefaultValue);
653 Category =
"Cesium|Metadata|PropertyTextureProperty")
657 const FVector4& DefaultValue);
678 Category =
"Cesium|Metadata|PropertyTextureProperty")
681 const FVector2D& UV);
701 Category =
"Cesium|Metadata|PropertyTextureProperty")
704 const FVector2D& UV);
720 Category =
"Cesium|Metadata|PropertyTextureProperty")
723 const FVector2D& UV);
735 Category =
"Cesium|Metadata|PropertyTextureProperty")
753 Category =
"Cesium|Metadata|PropertyTextureProperty")
771 Category =
"Cesium|Metadata|PropertyTextureProperty")
791 Category =
"Cesium|Metadata|PropertyTextureProperty")
811 Category =
"Cesium|Metadata|PropertyTextureProperty")
830 Category =
"Cesium|Metadata|PropertyTextureProperty")
847 Category =
"Cesium|Metadata|PropertyTextureProperty")
851 PRAGMA_DISABLE_DEPRECATION_WARNINGS
865 "Swizzles are no longer hardcoded in Unreal materials. To see what channels the property uses, use GetChannels instead."))
882 "Use GetChannels to get the channels array of a property texture property instead."))
885 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 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.
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
FCesiumPropertyTextureProperty()
const std::optional< CesiumGltf::KhrTextureTransform > getTextureTransform() const
friend class UCesiumPropertyTexturePropertyBlueprintLibrary
FCesiumPropertyTextureProperty(const CesiumGltf::PropertyTexturePropertyView< T, Normalized > &property, const TSharedPtr< FCesiumMetadataEnum > &pEnumDefinition=nullptr)