Cesium for Unreal 2.12.0
Loading...
Searching...
No Matches
CesiumPrimitiveFeatures.h
Go to the documentation of this file.
1// Copyright 2020-2024 CesiumGS, Inc. and Contributors
2
3#pragma once
4
6#include "Kismet/BlueprintFunctionLibrary.h"
7#include "UObject/ObjectMacros.h"
8#include <CesiumGltf/AccessorUtility.h>
9
10#include "CesiumPrimitiveFeatures.generated.h"
11
12namespace CesiumGltf {
13struct ExtensionExtMeshFeatures;
14struct ExtensionExtInstanceFeatures;
15} // namespace CesiumGltf
16
24USTRUCT(BlueprintType)
25struct CESIUMRUNTIME_API FCesiumPrimitiveFeatures {
26 GENERATED_USTRUCT_BODY()
27
28public:
32 FCesiumPrimitiveFeatures() : _vertexCount(0) {}
33
43 const CesiumGltf::Model& Model,
44 const CesiumGltf::MeshPrimitive& Primitive,
46
57 const CesiumGltf::Model& Model,
58 const CesiumGltf::Node& Node,
59 const CesiumGltf::ExtensionExtInstanceFeatures& InstanceFeatures);
60
61private:
62 TArray<FCesiumFeatureIdSet> _featureIdSets;
63 CesiumGltf::IndexAccessorType _indexAccessor;
64 // Vertex count = 0 and _primitiveMode = -1 indicates instance features
65 int64_t _vertexCount;
66 int32_t _primitiveMode;
67
69};
70
71UCLASS()
73 : public UBlueprintFunctionLibrary {
74 GENERATED_BODY()
75
76public:
83 UFUNCTION(
84 BlueprintCallable,
85 BlueprintPure,
86 Category = "Cesium|Primitive|Features")
87 static const FCesiumPrimitiveFeatures&
88 GetPrimitiveFeatures(const UPrimitiveComponent* component);
89
96 UFUNCTION(
97 BlueprintCallable,
98 BlueprintPure,
99 Category = "Cesium|Primitive|Features")
100 static const TArray<FCesiumFeatureIdSet>&
102 const FCesiumPrimitiveFeatures& PrimitiveFeatures);
103
111 UFUNCTION(
112 BlueprintCallable,
113 BlueprintPure,
114 Category = "Cesium|Primitive|Features")
116 UPARAM(ref) const FCesiumPrimitiveFeatures& PrimitiveFeatures,
118
124 UFUNCTION(
125 BlueprintCallable,
126 BlueprintPure,
127 Category = "Cesium|Primitive|Features")
128 static int64
129 GetVertexCount(UPARAM(ref) const FCesiumPrimitiveFeatures& PrimitiveFeatures);
130
138 UFUNCTION(
139 BlueprintCallable,
140 BlueprintPure,
141 Category = "Cesium|Primitive|Features")
143 UPARAM(ref) const FCesiumPrimitiveFeatures& PrimitiveFeatures,
144 int64 FaceIndex);
145
156 UFUNCTION(
157 BlueprintCallable,
158 BlueprintPure,
159 Category = "Cesium|Primitive|Features")
161 UPARAM(ref) const FCesiumPrimitiveFeatures& PrimitiveFeatures,
162 int64 FaceIndex,
163 int64 FeatureIDSetIndex = 0);
164
168 UFUNCTION(
169 BlueprintCallable,
170 BlueprintPure,
171 Category = "Cesium|Primitive|Features")
173 UPARAM(ref) const FCesiumPrimitiveFeatures& InstanceFeatures,
174 int64 InstanceIndex,
175 int64 FeatureIDSetIndex = 0);
176
188 UFUNCTION(
189 BlueprintCallable,
190 BlueprintPure,
191 Category = "Cesium|Primitive|Features")
193 UPARAM(ref) const FCesiumPrimitiveFeatures& PrimitiveFeatures,
194 const FHitResult& Hit,
195 int64 FeatureIDSetIndex = 0);
196};
ECesiumFeatureIdSetType
The type of a feature ID set.
static int64 GetFeatureIDFromFace(UPARAM(ref) const FCesiumPrimitiveFeatures &PrimitiveFeatures, int64 FaceIndex, int64 FeatureIDSetIndex=0)
Gets the feature ID associated with the given face.
static const FCesiumPrimitiveFeatures & GetPrimitiveFeatures(const UPrimitiveComponent *component)
Gets the primitive features of a glTF primitive component.
static int64 GetVertexCount(UPARAM(ref) const FCesiumPrimitiveFeatures &PrimitiveFeatures)
Get the number of vertices in the primitive.
static const TArray< FCesiumFeatureIdSet > & GetFeatureIDSets(UPARAM(ref) const FCesiumPrimitiveFeatures &PrimitiveFeatures)
Gets all the feature ID sets that are associated with the primitive.
static int64 GetFeatureIDFromInstance(UPARAM(ref) const FCesiumPrimitiveFeatures &InstanceFeatures, int64 InstanceIndex, int64 FeatureIDSetIndex=0)
Gets the feature ID associated with the instance at the given index.
static const TArray< FCesiumFeatureIdSet > GetFeatureIDSetsOfType(UPARAM(ref) const FCesiumPrimitiveFeatures &PrimitiveFeatures, ECesiumFeatureIdSetType Type)
Gets all the feature ID sets of the given type.
static int64 GetFirstVertexFromFace(UPARAM(ref) const FCesiumPrimitiveFeatures &PrimitiveFeatures, int64 FaceIndex)
Gets the index of the first vertex that makes up a given face of this primitive.
static int64 GetFeatureIDFromHit(UPARAM(ref) const FCesiumPrimitiveFeatures &PrimitiveFeatures, const FHitResult &Hit, int64 FeatureIDSetIndex=0)
Gets the feature ID from the given line trace hit, assuming it has hit a glTF primitive component con...
std::variant< std::monostate, AccessorView< uint8_t >, AccessorView< uint16_t >, AccessorView< uint32_t > > IndexAccessorType
A blueprint-accessible wrapper for a feature ID set from a glTF primitive.
A Blueprint-accessible wrapper for a glTF Primitive's mesh features.
FCesiumPrimitiveFeatures(const CesiumGltf::Model &Model, const CesiumGltf::MeshPrimitive &Primitive, const CesiumGltf::ExtensionExtMeshFeatures &Features)
Constructs a primitive features instance.
FCesiumPrimitiveFeatures()
Constructs an empty primitive features instance.
FCesiumPrimitiveFeatures(const CesiumGltf::Model &Model, const CesiumGltf::Node &Node, const CesiumGltf::ExtensionExtInstanceFeatures &InstanceFeatures)
Constructs an instance feature object.