Cesium for Unreal 2.12.0
Loading...
Searching...
No Matches
CesiumFeatureIdTexture.h
Go to the documentation of this file.
1// Copyright 2020-2024 CesiumGS, Inc. and Contributors
2
3#pragma once
4
5#include "Containers/UnrealString.h"
6#include "Kismet/BlueprintFunctionLibrary.h"
7
8#include <CesiumGltf/AccessorUtility.h>
9#include <CesiumGltf/FeatureIdTextureView.h>
10
11#include "CesiumFeatureIdTexture.generated.h"
12
13namespace CesiumGltf {
14struct Model;
15struct FeatureIdTexture;
16} // namespace CesiumGltf
17
22UENUM(BlueprintType)
24 /* The feature ID texture is valid. */
25 Valid = 0,
26 /* The feature ID texture cannot be found in the glTF, or the texture itself
27 has errors. */
29 /* The feature ID texture is being read in an invalid way -- for example,
30 trying to read nonexistent image channels. */
32};
33
39USTRUCT(BlueprintType)
40struct CESIUMRUNTIME_API FCesiumFeatureIdTexture {
41 GENERATED_USTRUCT_BODY()
42
43public:
52
63 const CesiumGltf::Model& Model,
64 const CesiumGltf::MeshPrimitive& Primitive,
65 const CesiumGltf::FeatureIdTexture& FeatureIdTexture,
66 const FString& PropertyTableName);
67
73 return this->_featureIdTextureView;
74 }
75
76private:
78 CesiumGltf::FeatureIdTextureView _featureIdTextureView;
79 CesiumGltf::TexCoordAccessorType _texCoordAccessor;
80 int64 _textureCoordinateSetIndex;
81
82 // For backwards compatibility.
83 FString _propertyTableName;
84
86};
87
88UCLASS()
90 : public UBlueprintFunctionLibrary {
91 GENERATED_BODY()
92
93public:
94 PRAGMA_DISABLE_DEPRECATION_WARNINGS
100 UFUNCTION(
101 BlueprintCallable,
102 BlueprintPure,
103 Category = "Cesium|Metadata|FeatureIdTexture",
104 Meta =
105 (DeprecatedFunction,
106 DeprecationMessage =
107 "Use GetPropertyTableIndex on a CesiumFeatureIdSet instead."))
108 static const FString&
110 const FCesiumFeatureIdTexture& FeatureIDTexture);
111 PRAGMA_ENABLE_DEPRECATION_WARNINGS
112
117 UFUNCTION(
118 BlueprintCallable,
119 BlueprintPure,
120 Category = "Cesium|Features|FeatureIDTexture")
122 UPARAM(ref) const FCesiumFeatureIdTexture& FeatureIDTexture);
123
135 UFUNCTION(
136 BlueprintCallable,
137 BlueprintPure,
138 Category = "Cesium|Features|FeatureIDTexture")
140 UPARAM(ref) const FCesiumFeatureIdTexture& FeatureIDTexture);
141
158 UFUNCTION(
159 BlueprintCallable,
160 BlueprintPure,
161 Category = "Cesium|Features|FeatureIDTexture")
162 static int64 GetUnrealUVChannel(
163 const UPrimitiveComponent* Component,
164 UPARAM(ref) const FCesiumFeatureIdTexture& FeatureIDTexture);
165
166 PRAGMA_DISABLE_DEPRECATION_WARNINGS
176 UFUNCTION(
177 BlueprintCallable,
178 BlueprintPure,
179 Category = "Cesium|Features|FeatureIDTexture")
181 UPARAM(ref) const FCesiumFeatureIdTexture& FeatureIDTexture,
182 float U,
183 float V);
184 PRAGMA_ENABLE_DEPRECATION_WARNINGS
185
193 UFUNCTION(
194 BlueprintCallable,
195 BlueprintPure,
196 Category = "Cesium|Features|FeatureIDTexture")
197 static int64 GetFeatureIDForUV(
198 UPARAM(ref) const FCesiumFeatureIdTexture& FeatureIDTexture,
199 const FVector2D& UV);
200
211 UFUNCTION(
212 BlueprintCallable,
213 BlueprintPure,
214 Category = "Cesium|Features|FeatureIDTexture")
216 UPARAM(ref) const FCesiumFeatureIdTexture& FeatureIDTexture,
217 int64 VertexIndex);
218
226 UFUNCTION(
227 BlueprintCallable,
228 BlueprintPure,
229 Category = "Cesium|Features|FeatureIDTexture")
231 UPARAM(ref) const FCesiumFeatureIdTexture& FeatureIDTexture,
232 const FHitResult& Hit);
233};
ECesiumFeatureIdTextureStatus
Reports the status of a FCesiumFeatureIdTexture.
@ ErrorInvalidTexture
@ ErrorInvalidTextureAccess
static PRAGMA_ENABLE_DEPRECATION_WARNINGS int64 GetFeatureIDForUV(UPARAM(ref) const FCesiumFeatureIdTexture &FeatureIDTexture, const FVector2D &UV)
Gets the feature ID corresponding to the pixel specified by the UV texture coordinates.
static int64 GetGltfTextureCoordinateSetIndex(UPARAM(ref) const FCesiumFeatureIdTexture &FeatureIDTexture)
Gets the glTF texture coordinate set index used by the feature ID texture.
static PRAGMA_DISABLE_DEPRECATION_WARNINGS const FString & GetFeatureTableName(UPARAM(ref) const FCesiumFeatureIdTexture &FeatureIDTexture)
Gets the name of the feature table corresponding to this feature ID texture.
static int64 GetUnrealUVChannel(const UPrimitiveComponent *Component, UPARAM(ref) const FCesiumFeatureIdTexture &FeatureIDTexture)
Gets the UV channel containing the texture coordinate set that is used by the feature ID texture on t...
static PRAGMA_DISABLE_DEPRECATION_WARNINGS int64 GetFeatureIDForTextureCoordinates(UPARAM(ref) const FCesiumFeatureIdTexture &FeatureIDTexture, float U, float V)
Gets the feature ID corresponding to the pixel specified by the texture coordinates.
static int64 GetFeatureIDFromHit(UPARAM(ref) const FCesiumFeatureIdTexture &FeatureIDTexture, const FHitResult &Hit)
Gets the feature ID from a given line trace hit on the primitive containing this feature ID texture.
static int64 GetFeatureIDForVertex(UPARAM(ref) const FCesiumFeatureIdTexture &FeatureIDTexture, int64 VertexIndex)
Gets the feature ID associated with the given vertex.
static PRAGMA_ENABLE_DEPRECATION_WARNINGS ECesiumFeatureIdTextureStatus GetFeatureIDTextureStatus(UPARAM(ref) const FCesiumFeatureIdTexture &FeatureIDTexture)
Gets the status of the feature ID texture.
std::variant< AccessorView< AccessorTypes::VEC2< uint8_t > >, AccessorView< AccessorTypes::VEC2< uint16_t > >, AccessorView< AccessorTypes::VEC2< float > > > TexCoordAccessorType
A blueprint-accessible wrapper for a feature ID texture from a glTF primitive.
constexpr const CesiumGltf::FeatureIdTextureView & getFeatureIdTextureView() const
Gets the underlying view of this feature ID texture.
FCesiumFeatureIdTexture(const CesiumGltf::Model &Model, const CesiumGltf::MeshPrimitive &Primitive, const CesiumGltf::FeatureIdTexture &FeatureIdTexture, const FString &PropertyTableName)
Constructs a feature ID texture instance.
FCesiumFeatureIdTexture()
Constructs an empty feature ID texture instance.