Cesium for Unreal 2.13.2
Loading...
Searching...
No Matches
CesiumPropertyTexture.h
Go to the documentation of this file.
1// Copyright 2020-2024 CesiumGS, Inc. and Contributors
2
3#pragma once
4
5#include "CesiumGltf/PropertyTextureView.h"
7#include "Containers/Array.h"
8#include "Kismet/BlueprintFunctionLibrary.h"
9#include "Kismet/GameplayStatics.h"
10#include "CesiumPropertyTexture.generated.h"
11
12namespace CesiumGltf {
13struct Model;
14struct PropertyTexture;
15}; // namespace CesiumGltf
16
17UENUM(BlueprintType)
18enum class ECesiumPropertyTextureStatus : uint8 {
19 /* The property texture is valid. */
20 Valid = 0,
21 /* The property texture instance was not initialized from an actual glTF
22 property texture. */
24 /* The property texture's class could be found in the schema of the metadata
25 extension. */
27};
28
29/**
30 * @brief A blueprint-accessible wrapper of a property texture from a glTF.
31 * Provides access to {@link FCesiumPropertyTextureProperty} views of texture
32 * metadata.
33 */
34USTRUCT(BlueprintType)
35struct CESIUMRUNTIME_API FCesiumPropertyTexture {
36 GENERATED_USTRUCT_BODY()
37
38public:
41
43 const CesiumGltf::Model& model,
44 const CesiumGltf::PropertyTexture& PropertyTexture);
45
46 /**
47 * Gets the name of the metadata class that this property table conforms to.
48 */
49 FString getClassName() const { return _className; }
50
51private:
53 FString _name;
54 FString _className;
55
56 TMap<FString, FCesiumPropertyTextureProperty> _properties;
57
59};
60
61UCLASS()
63 : public UBlueprintFunctionLibrary {
64 GENERATED_BODY()
65
66public:
67 /**
68 * Gets the status of the property texture. If the property texture is invalid
69 * in any way, this briefly indicates why.
70 *
71 * @param PropertyTexture The property texture.
72 */
73 UFUNCTION(
74 BlueprintCallable,
75 BlueprintPure,
76 Category = "Cesium|Metadata|PropertyTexture")
79 const FCesiumPropertyTexture& PropertyTexture);
80
81 /**
82 * Gets the name of the property texture.
83 *
84 * @param PropertyTexture The property texture.
85 */
86 UFUNCTION(
87 BlueprintCallable,
88 BlueprintPure,
89 Category = "Cesium|Metadata|PropertyTexture")
90 static const FString&
92 const FCesiumPropertyTexture& PropertyTexture);
93
94 /**
95 * Gets all the properties of the property texture, mapped by property name.
96 *
97 * @param PropertyTexture The property texture.
98 */
99 UFUNCTION(
100 BlueprintCallable,
101 BlueprintPure,
102 Category = "Cesium|Metadata|PropertyTexture")
103 static const TMap<FString, FCesiumPropertyTextureProperty>
104 GetProperties(UPARAM(ref) const FCesiumPropertyTexture& PropertyTexture);
105
106 /**
107 * Gets the names of the properties in this property texture. If the property
108 * texture is invalid, this returns an empty array.
109 *
110 * @param PropertyTexture The property texture.
111 */
112 UFUNCTION(
113 BlueprintCallable,
114 BlueprintPure,
115 Category = "Cesium|Metadata|PropertyTexture")
116 static const TArray<FString>
117 GetPropertyNames(UPARAM(ref) const FCesiumPropertyTexture& PropertyTexture);
118
119 /**
120 * Retrieve a FCesiumPropertyTextureProperty by name. If the property texture
121 * does not contain a property with that name, this returns an invalid
122 * FCesiumPropertyTextureProperty.
123 *
124 * @param PropertyTexture The property texture.
125 * @param PropertyName The name of the property to find.
126 */
127 UFUNCTION(
128 BlueprintCallable,
129 BlueprintPure,
130 Category = "Cesium|Metadata|PropertyTexture")
132 UPARAM(ref) const FCesiumPropertyTexture& PropertyTexture,
133 const FString& PropertyName);
134
135 /**
136 * Gets all of the property values at the given texture coordinates, mapped by
137 * property name. This will only include values from valid property texture
138 * properties.
139 *
140 * In EXT_structural_metadata, individual properties can specify different
141 * texture coordinate sets to be sampled from. This method uses the same
142 * coordinates to sample each property, regardless of its intended texture
143 * coordinate set. Use GetMetadataValuesForHit instead to sample the property
144 * texture's properties with their respective texture coordinate sets.
145 *
146 * @param PropertyTexture The property texture.
147 * @param UV The texture coordinates.
148 * @return The property values mapped by property name.
149 */
150 UFUNCTION(
151 BlueprintCallable,
152 BlueprintPure,
153 Category = "Cesium|Metadata|PropertyTexture")
155 UPARAM(ref) const FCesiumPropertyTexture& PropertyTexture,
156 const FVector2D& UV);
157
158 /**
159 * Given a trace hit result, gets all of the property values from property
160 * texture on the hit component, mapped by property name. This will only
161 * include values from valid property texture properties.
162 *
163 * In EXT_structural_metadata, individual properties can specify different
164 * texture coordinate sets to be sampled from. This method uses the
165 * corresponding texture coordinate sets to sample each property.
166 *
167 * @param PropertyTexture The property texture.
168 * @param Hit The trace hit result
169 * @return The property values mapped by property name.
170 */
171 UFUNCTION(
172 BlueprintCallable,
173 BlueprintPure,
174 Category = "Cesium|Metadata|PropertyTexture")
176 UPARAM(ref) const FCesiumPropertyTexture& PropertyTexture,
177 const FHitResult& Hit);
178};
ECesiumPropertyTextureStatus
static const ECesiumPropertyTextureStatus GetPropertyTextureStatus(UPARAM(ref) const FCesiumPropertyTexture &PropertyTexture)
Gets the status of the property texture.
static TMap< FString, FCesiumMetadataValue > GetMetadataValuesFromHit(UPARAM(ref) const FCesiumPropertyTexture &PropertyTexture, const FHitResult &Hit)
Given a trace hit result, gets all of the property values from property texture on the hit component,...
static const FString & GetPropertyTextureName(UPARAM(ref) const FCesiumPropertyTexture &PropertyTexture)
Gets the name of the property texture.
static const FCesiumPropertyTextureProperty & FindProperty(UPARAM(ref) const FCesiumPropertyTexture &PropertyTexture, const FString &PropertyName)
Retrieve a FCesiumPropertyTextureProperty by name.
static const TMap< FString, FCesiumPropertyTextureProperty > GetProperties(UPARAM(ref) const FCesiumPropertyTexture &PropertyTexture)
Gets all the properties of the property texture, mapped by property name.
static TMap< FString, FCesiumMetadataValue > GetMetadataValuesForUV(UPARAM(ref) const FCesiumPropertyTexture &PropertyTexture, const FVector2D &UV)
Gets all of the property values at the given texture coordinates, mapped by property name.
static const TArray< FString > GetPropertyNames(UPARAM(ref) const FCesiumPropertyTexture &PropertyTexture)
Gets the names of the properties in this property texture.
A Blueprint-accessible wrapper for a glTF metadata value.
A blueprint-accessible wrapper for a property texture property from a glTF.
A blueprint-accessible wrapper of a property texture from a glTF.
FString getClassName() const
Gets the name of the metadata class that this property table conforms to.
FCesiumPropertyTexture(const CesiumGltf::Model &model, const CesiumGltf::PropertyTexture &PropertyTexture)