I3DHConnector.h Source File

I3DHConnector.h Source File#

instant3Dhub: I3DHConnector.h Source File
instant3Dhub
I3DHConnector.h
Go to the documentation of this file.
1
5
6#pragma once
7
8#include "CoreMinimal.h"
9
10#include "I3DHConnectorAPI.h"
11#include "I3DHDataTypes.h"
12#include "I3DHVersion.h"
13
14#include "Engine/Texture2D.h"
15#include "GameFramework/Actor.h"
16#include "Misc/EngineVersionComparison.h"
17
18#if UE_VERSION_OLDER_THAN(5, 5, 0)
19#include "StructView.h"
20#else
21#include "StructUtils/StructView.h"
22#endif
23
24#include "I3DHConnector.generated.h"
25
26class AI3DHGeometry;
28class UBodySetup;
29
31DECLARE_DYNAMIC_MULTICAST_DELEGATE(FConnectedDelegate);
33DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FConnectErrorDelegate, const FString&, ErrorMessage);
35DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FErrorDelegate, const FString&, ErrorMessage);
37DECLARE_DYNAMIC_MULTICAST_DELEGATE(FDisconnectedDelegate);
38
48DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FClipPlaneCreatedDelegate, int32, ClipPlaneId, AActor*, ClipPlaneActor, bool, OwnEvent);
49
56DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FClipPlaneRemovedDelegate, int32, ClipPlaneId, bool, OwnEvent);
57
65
75
85
99
140
147USTRUCT(BlueprintType, Category = "{instant3Dhub}|Connector")
149{
150 GENERATED_BODY()
151
152
160 INSTANT3DHUB_DEPRECATED(1.4.0, "Use SpaceId instead.")
161 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "{instant3Dhub}|ConnectOptions", meta = (DisplayName = "SessionId (Deprecated)", DeprecatedProperty, DeprecationMessage = "Use SpaceId instead."))
163
171 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "{instant3Dhub}|ConnectOptions")
173
181 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "{instant3Dhub}|ConnectOptions")
183
193 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "{instant3Dhub}|ConnectOptions")
194 bool bCloneIntoNewSpace = false;
195
204 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "{instant3Dhub}|ConnectOptions")
206};
207
212UCLASS(ClassGroup = "instant3Dhub", MinimalAPI)
213class AI3DHConnector : public AActor
214{
215 GENERATED_BODY()
216
217public:
218 INSTANT3DHUB_API AI3DHConnector();
219
220protected:
222 INSTANT3DHUB_API virtual void BeginPlay() override;
223 INSTANT3DHUB_API virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
224
225public:
226 INSTANT3DHUB_API virtual void Tick(float DeltaTime) override;
227
228#if WITH_EDITOR
229 INSTANT3DHUB_API virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
230#endif
231
232 // ----------------------------------------------------------
233 // API Accessor
234 // ----------------------------------------------------------
235public:
243 INSTANT3DHUB_API TSharedPtr<FI3DHConnectorAPI> GetAPI() const;
244
245 // ----------------------------------------------------------
246 // ConnectorAPI
247 // ----------------------------------------------------------
248public:
255 UFUNCTION(BlueprintCallable, BlueprintPure = false, Category = "{instant3Dhub}|Connector")
256 INSTANT3DHUB_API void AddNetworkCredentialCookie(const FString& CookieKey, const FString& CookieValue);
257
263 UFUNCTION(BlueprintCallable, BlueprintPure = false, Category = "{instant3Dhub}|Connector")
264 INSTANT3DHUB_API void RemoveNetworkCredentialCookie(const FString& CookieKey);
265
272 UFUNCTION(BlueprintCallable, BlueprintPure = false, Category = "{instant3Dhub}|Connector")
273 INSTANT3DHUB_API void AddNetworkCredentialToken(const FString& TokenKey, const FString& TokenValue);
274
280 UFUNCTION(BlueprintCallable, BlueprintPure = false, Category = "{instant3Dhub}|Connector")
281 INSTANT3DHUB_API void RemoveNetworkCredentialToken(const FString& TokenKey);
282
288 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector")
289 INSTANT3DHUB_API const TMap<FString, FString>& GetNetworkCredentialCookies() const { return NetworkCredentialCookies; }
290
296 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector")
297 INSTANT3DHUB_API const TMap<FString, FString>& GetNetworkCredentialTokens() const { return NetworkCredentialTokens; }
298
316 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Connector")
317 static INSTANT3DHUB_API bool ParseConnectLink(const FString& Link, FString& HubURL, FI3DHConnectOptions& ConnectOptions);
318
358 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Connector")
359 INSTANT3DHUB_API void ConnectToHub(const FString& HubURL, const FString& SpaceId);
360
375 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Connector")
376 INSTANT3DHUB_API void ConnectToHubWithLink(const FString& Link);
377
388 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Connector")
389 INSTANT3DHUB_API void ConnectToHubWithOptions(const FString& HubURL, const FI3DHConnectOptions& Options);
390
403 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Connector")
404 INSTANT3DHUB_API void Disconnect();
405
412 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector")
413 INSTANT3DHUB_API bool IsDisconnected() const;
414
421 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector")
422 INSTANT3DHUB_API bool IsEstablishingConnectionToHub() const;
423
429 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector")
430 INSTANT3DHUB_API bool IsConnectedToHub() const;
431
437 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector")
438 INSTANT3DHUB_API FString GetHubURL() const;
439
445 INSTANT3DHUB_DEPRECATED(1.4.0, "Use GetSpaceId() instead.")
446 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector", meta = (DisplayName = "GetSessionId (Deprecated)", DeprecatedFunction, DeprecationMessage = "Use GetSpaceId() instead."))
447 INSTANT3DHUB_API FString GetSessionId() const;
448
454 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector")
455 INSTANT3DHUB_API FString GetSpaceId() const;
456
464 UPROPERTY(BlueprintAssignable, Transient, Category = "{instant3Dhub}|Connector")
466
473 UPROPERTY(BlueprintAssignable, Transient, Category = "{instant3Dhub}|Connector")
475
484 UPROPERTY(BlueprintAssignable, Transient, Category = "{instant3Dhub}|Connector")
486
493 UPROPERTY(BlueprintAssignable, Transient, Category = "{instant3Dhub}|Connector")
495
501 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector")
502 INSTANT3DHUB_API FMatrix GetOriginToWorldTransform() const;
503
509 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector")
510 INSTANT3DHUB_API FMatrix GetWorldToOriginTransform() const;
511
515 INSTANT3DHUB_API AActor* GetOriginActor()
516 {
517 AActor* RootActor = this;
518 check(RootActor != nullptr);
519 return RootActor;
520 }
521
525 INSTANT3DHUB_API const AActor* GetOriginActor() const
526 {
527 const AActor* RootActor = this;
528 check(RootActor != nullptr);
529 return RootActor;
530 }
531
533 // ----------------------------------------------------------
534 // Internal Connection Helper Functions
535 // ----------------------------------------------------------
536public:
537 void OnBackendConnected_Internal_GameThread(const FString& SpaceId);
538 void OnBackendSpaceIdChanged_Internal_GameThread(const FString& SpaceId);
539 void OnBackendError_Internal_GameThread(const FString& ErrorMessage);
540
541private:
542 void ReportError_Internal_GameThread(const FString& ErrorMessage);
543 void ReportConnectError_Internal_GameThread(const FString& ErrorMessage);
544 bool Disconnect_Internal_GameThread();
546
547 // ----------------------------------------------------------
548 // Debugging Tools
549 // ----------------------------------------------------------
550
551public:
565 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Debugging")
566 INSTANT3DHUB_API bool RequestRemoteCullerDebugStream();
567
580 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Debugging")
582
594 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Debugging")
595 INSTANT3DHUB_API const TArray<FI3DHDebugMetric>& GetDebugMetrics();
596
608 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Debugging")
609 INSTANT3DHUB_API FString GetDebugSessionInfo();
610
611 // ----------------------------------------------------------
612 // Progress
613 // ----------------------------------------------------------
614
615public:
627 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Progress")
629
630 // ----------------------------------------------------------
631 // ClipPlane API
632 // ----------------------------------------------------------
633public:
638 UPROPERTY(BlueprintAssignable, Transient, Category = "{instant3Dhub}|Clip Plane API")
640
645 UPROPERTY(BlueprintAssignable, Transient, Category = "{instant3Dhub}|Clip Plane API")
647
653 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.1", ClampMax = "120.0", UIMin = "0.1", UIMax = "120.0"), Category = "{instant3Dhub}|Clip Plane API")
654 float ClipPlaneSyncHz = 1.0;
655
660 UPROPERTY(EditAnywhere, Category = "{instant3Dhub}|Clip Plane API")
662
668 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Clip Plane API")
669 INSTANT3DHUB_API TArray<int32> GetClipPlanes();
670
677 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Clip Plane API")
678 INSTANT3DHUB_API AActor* FindClipPlaneActor(int32 ClipPlaneId);
679
685 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Clip Plane API")
686 INSTANT3DHUB_API AActor* GetMainClipPlaneActor();
687
688 // ----------------------------------------------------------
689 // Drawing API
690 // ----------------------------------------------------------
691public:
699 UPROPERTY(EditAnywhere, Category = "{instant3Dhub}|Drawing API", AdvancedDisplay)
701
709 UPROPERTY(EditAnywhere, Category = "{instant3Dhub}|Drawing API", AdvancedDisplay)
711
718 UPROPERTY(EditAnywhere, Category = "{instant3Dhub}|Drawing API", AdvancedDisplay)
720
728 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Drawing API", meta = (DisplayName = "Create Drawing Material"))
730
738 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Drawing API")
739 INSTANT3DHUB_API class AI3DHDrawing* FindDrawingActor(int32 DrawingHandle);
740
747 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Drawing API")
748 INSTANT3DHUB_API void SetClipDrawingsByClipPlane(const bool bClipDrawingsByClipPlaneEnabled);
749
756 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Drawing API")
757 INSTANT3DHUB_API bool GetClipDrawingsByClipPlane();
758
759 // ----------------------------------------------------------
760 // EditDrawing API
761 // ----------------------------------------------------------
762public:
776 I3DH_PRAGMA_DISABLE_EXPERIMENTAL_WARNINGS
777 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|EditDrawing API")
778 virtual void EditDrawing(int32 DrawingHandle, const TScriptInterface<class II3DHEditDrawingInterface>& EditDrawingInterface, bool bIsEditingCopy = false);
779 I3DH_PRAGMA_ENABLE_EXPERIMENTAL_WARNINGS
780
781 // ----------------------------------------------------------
782 // InstanceGraph API
783 // ----------------------------------------------------------
784public:
790 UFUNCTION(BlueprintPure, Category = "{instant3Dhub}|InstanceGraph API")
791 INSTANT3DHUB_API int32 GetGlobalRootNodeId();
792
793 // ----------------------------------------------------------
794 // Selection API
795 // ----------------------------------------------------------
796public:
803 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Selection API")
804 INSTANT3DHUB_API TArray<int32> GetSelection();
805
806 // ----------------------------------------------------------
807 // Hover API
808 // ----------------------------------------------------------
809public:
819 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Hover API")
820 INSTANT3DHUB_API void SetHoveredNode(int32 NodeId);
821
828 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Hover API")
829 INSTANT3DHUB_API void AddToHoveredNodes(int32 NodeId);
830
836 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Hover API")
837 INSTANT3DHUB_API void ClearHoveredNodes();
838
845 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Hover API")
846 INSTANT3DHUB_API TArray<int32> GetHoveredNodes();
847
848 // ----------------------------------------------------------
849 // TransformAuthority API
850 // ----------------------------------------------------------
851public:
852 INSTANT3DHUB_EXPERIMENTAL(0.0.23, "TransformAuthorityAPI is a temporary solution suspect to changes or replacement.")
861 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Transform Authority", meta = (DisplayName = "Get WorldTransform With Authority (Experimental)"))
862 INSTANT3DHUB_API bool GetWorldTransformWithAuthority(const FI3DHTransformAuthorityHandle TransformAuthorityHandle, int32 NodeId, FMatrix& OutWorldTransform);
863
864 INSTANT3DHUB_EXPERIMENTAL(0.0.23, "TransformAuthorityAPI is a temporary solution suspect to changes or replacement.")
872 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Transform Authority", meta = (DisplayName = "Set WorldTransform With Authority (Experimental)"))
873 INSTANT3DHUB_API void SetWorldTransformWithAuthority(const FI3DHTransformAuthorityHandle TransformAuthorityHandle, int32 NodeId, const FMatrix& WorldTransform);
874
875 INSTANT3DHUB_EXPERIMENTAL(0.0.23, "TransformAuthorityAPI is a temporary solution suspect to changes or replacement.")
882 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Transform Authority", meta = (DisplayName = "Release TransformAuthority (Experimental)"))
883 INSTANT3DHUB_API void ReleaseTransformAuthority(const FI3DHTransformAuthorityHandle TransformAuthorityHandle);
884
885 INSTANT3DHUB_EXPERIMENTAL(0.0.23, "TransformAuthorityAPI is a temporary solution suspect to changes or replacement.")
891 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Transform Authority", meta = (DisplayName = "Is TransformAuthority Active (Experimental)"))
892 INSTANT3DHUB_API bool IsTransformAuthorityActive(const FI3DHTransformAuthorityHandle TransformAuthorityHandle) const;
893
894 // ----------------------------------------------------------
895 // MaterialAPI / UnrealMaterialAPI
896 // ----------------------------------------------------------
897public:
905
910 FORCEINLINE const FI3DHGeometryMaterials& GetL3DMaterials() const { return L3DDefaultMaterials; }
911
917
923
924 // ----------------------------------------------------------
925 // Runtime adjustable performance parameters
926 // ----------------------------------------------------------
927public:
929 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "{instant3Dhub}|Connector", meta = (ClampMin = 1, UIMin = 1))
931
933 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "{instant3Dhub}|Connector", meta = (ClampMin = 1, UIMin = 1))
935
941 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "{instant3Dhub}|Connector", meta = (ClampMin = 0, UIMin = 0, Delta = 1000000))
943
948 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.1", ClampMax = "100.0", UIMin = "0.1", UIMax = "100.0"), Category = "{instant3Dhub}|Connector")
950
955 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ClampMin = "0.1", ClampMax = "120.0", UIMin = "0.1", UIMax = "120.0"), Category = "{instant3Dhub}|Connector")
956 float ViewSyncHz = 5.0;
957
958protected:
964 UPROPERTY(EditAnywhere, Category = "{instant3Dhub}|Appearance")
966
979 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "{instant3Dhub}|Appearance")
981
990 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "{instant3Dhub}|Appearance", meta = (DisplayName = "Default Materials"))
992
1000 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "{instant3Dhub}|Appearance", meta = (DisplayName = "Appearance Materials"))
1002
1012 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "{instant3Dhub}|Appearance", meta = (DisplayName = "MaterialAPI Materials"), Experimental)
1014
1015 I3DH_PRAGMA_DISABLE_EXPERIMENTAL_WARNINGS
1032 UPROPERTY(EditAnywhere, Instanced, Category = "{instant3Dhub}|Appearance", meta = (ForceInlineRow, ShowInnerProperties, DisplayName = "Custom Material URN Resolver Bindings"))
1034 I3DH_PRAGMA_ENABLE_EXPERIMENTAL_WARNINGS
1035
1036 I3DH_PRAGMA_DISABLE_EXPERIMENTAL_WARNINGS
1041 UPROPERTY(EditAnywhere, Category = "{instant3Dhub}|Appearance")
1043 I3DH_PRAGMA_ENABLE_EXPERIMENTAL_WARNINGS
1044
1049 UPROPERTY(EditAnywhere, Category = "{instant3Dhub}|Appearance")
1051
1052protected:
1054 UPROPERTY(VisibleAnywhere, Category = "{instant3Dhub}|Connector")
1056
1058 // ----------------------------------------------------------
1059 // Internal
1060 // ----------------------------------------------------------
1061public:
1062 struct FI3DHConnectorDrawingStorage& GetDrawingStorage();
1063 const struct FI3DHConnectorDrawingStorage& GetDrawingStorage() const;
1064
1065 struct FI3DHConnectorRenderStorage& GetRenderStorage();
1066 const struct FI3DHConnectorRenderStorage& GetRenderStorage() const;
1067
1068 const struct FI3DHConnectorRenderStats& GetRenderStats() const;
1069
1075 struct FI3DHInstance* FindInstance(int32 RootNodeId);
1081 const struct FI3DHInstance* FindInstance(int32 RootNodeId) const;
1087 FStructView FindInstanceView(int32 RootNodeId);
1093 FConstStructView FindInstanceView(int32 RootNodeId) const;
1094
1100 struct FI3DHInstance& FindOrCreateInstance(int32 RootNodeId);
1106 FStructView FindOrCreateInstanceView(int32 RootNodeId);
1107
1114 void RequestStructureMapping(int32 RootNodeId);
1115
1116 bool RequiresSubMeshAddressing(FI3DHPageInstanceHandle PageInstanceHandle) const;
1117
1118 UMaterialParameterCollectionInstance* GetI3DHParameterCollectionInstance() const;
1119
1120 UMaterialInterface* FindMaterialInterface(const FI3DHResolvedAppearance& ResolvedAppearance, bool bIsSelected, bool bIsHovered) const;
1121 void RegisterMaterialConsumer(int32 MaterialId, int32 RootNodeId);
1122 void UnregisterMaterialConsumer(int32 MaterialId, int32 RootNodeId);
1123 void UpdateMaterialConsumerAppearance(int32 MaterialId);
1124
1125private:
1126 bool ResolveCustomMaterialURN_GameThread(FStringView CustomMaterialURN, FI3DHGeometryMaterials& OutMaterials) const;
1127 const FI3DHGeometryMaterials* FindResolvedMaterials(int32 MaterialId) const;
1128 void ValidateCustomMaterialURNResolverBindings();
1129
1130private:
1131 TMap<FString, FString> NetworkCredentialCookies;
1132 TMap<FString, FString> NetworkCredentialTokens;
1133
1134 FString HubURL;
1135 FString SpaceId;
1136
1137 // Updated in ConnectToHubWithOptions().
1138 // While connected, contain the values of the current connection.
1139 EI3DHCullingStrategy CullingStrategy = EI3DHCullingStrategy::Remote;
1140
1141 bool bReloadKeyPressedLastFrame = false;
1142 bool bDebugStreamKeyPressedLastFrame = false;
1143
1144 // Timings for measuring time to first pixel.
1145 // All values in seconds of platform time.
1146 //
1147 // Note that the camera position and orientation can influence the timings
1148 // via effects on the remote culler. For accurate measurements the camera
1149 // should be in a fixed position pointing at the scene.
1150 double ConnectTime;
1151 double FirstVisibilityTime;
1152 double FirstInstanceTime;
1153
1154 // Time estimates for CreatePageInstances budgeting.
1155 // The estimates are updated using exponential moving averages.
1156 // For the physics build we assume (based on our tests) that
1157 // the constant overhead is negligible and the time is
1158 // fully dependent on the per-triangle cost.
1159 // Initial values are based on measurements on my computer.
1160 double EstimatedSpawnInstanceTime = 0.180e-3; // seconds
1161 double EstimatedSpawnPageInstanceStaticTime = 0.600e-3; // seconds
1162 double EstimatedPhysicsBuildTimePerTriangle = 0.240e-6; // seconds per triangle
1163
1164 FTimerHandle ViewSyncTimer;
1165
1166 UPROPERTY(Transient)
1167 FInstancedStruct DrawingStorageContainer;
1168
1169 UPROPERTY(Transient)
1170 FInstancedStruct RenderStorageContainer;
1171
1172 TArray<FI3DHDebugMetric> DebugMetrics;
1173 // Timing metrics in milliseconds.
1174 int32 MetricTimingVisibilityMs = 0;
1175 int32 MetricTimingGeometryMs = 0;
1176
1177 // API and Backend
1178 // ----------------------------------------------------------
1179 TSharedPtr<class FI3DHConnectorAPIImpl> APIImpl;
1180
1181 TUniquePtr<struct FI3DHBackendStorage> BackendStorage;
1182
1183 TUniquePtr<class FI3DHLocalCuller> LocalCuller;
1184
1185 TSharedPtr<class FI3DHConnectionPromiseImpl> ConnectionPromise;
1186
1187 TSharedPtr<class FI3DHConnectorBackend> ConnectorBackend;
1188 TSharedPtr<class FI3DHEventBackend> EventBackend;
1189 TSharedPtr<class FI3DHRenderBackend> RenderBackend;
1190 TSharedPtr<class FI3DHCullingBackend> CullingBackend;
1191
1192private:
1200 FStructView CreateAndSpawnPageInstance(FStructView InstanceView, const FI3DHPageInstanceHandle PageInstanceHandle, class UI3DHPageMesh* PageMesh);
1201
1202public:
1210 void SetAppearanceURI_Internal(const FString& AppearanceURI, const TArray<int32>& RootNodeIds, const TArray<struct FI3DHSubMeshEntry>& SubMeshEntries);
1211
1219 void SetTransforms_Internal(const TArray<FMatrix>& GlobalTransforms, const TArray<FMatrix>& LeafNodeLocalToInstanceTransforms, const TArray<int32>& RootNodeIds, const TArray<struct FI3DHSubMeshEntry>& SubMeshEntries);
1220
1228 void SetEnabled_Internal(EI3DHEnabledState EnabledState, const TArray<int32>& RootNodeIds, const TArray<struct FI3DHSubMeshEntry>& SubMeshEntries);
1229
1238 void SetEnabled_Internal(const TArray<EI3DHEnabledState>& Enabled, const TArray<bool>& LeafNodeEnabled, const TArray<int32>& RootNodeIds, const TArray<struct FI3DHSubMeshEntry>& SubMeshEntries);
1239
1248 void SetVariantEnabled_Internal(const TArray<bool>& VariantEnabled, const TArray<bool>& LeafNodeVariantEnabled, const TArray<int32>& RootNodeIds, const TArray<struct FI3DHSubMeshEntry>& SubMeshEntries);
1249
1256 void SetSelected_Internal(bool bNewSelected, const TArray<int32>& RootNodeIds, const TArray<struct FI3DHSubMeshEntry>& SubMeshEntries);
1257
1264 void SetHovered_Internal(bool bNewHovered, const TArray<int32>& RootNodeIds, const TArray<struct FI3DHSubMeshEntry>& SubMeshEntries);
1265
1270 void RemoveInstances_Internal(const TArray<int32>& RootNodeIds);
1271
1277 void SetInstanceProperties_Internal(int32 RootNodeId, const struct FI3DHInstanceProperties& Properties);
1278
1279private:
1280 void UpdatePageInstanceVisibilityAfterInstanceVisibilityChange_Internal(struct FI3DHInstance& Instance);
1281
1282 void ViewSyncTimerCallback();
1283
1284private:
1285 void AddCredentialHeaders(const FString& URL, TMap<FString, FString>& Headers);
1286
1287 TSharedPtr<class FI3DHEventStreamConnector> EventStreamConnector;
1288 TSharedPtr<class FI3DHDebugStreamConnector> DebugStreamConnector;
1289
1290 UPROPERTY(Transient)
1291 TObjectPtr<class AI3DHDebugStreamOverlay> DebugStreamOverlay;
1292
1293 void ToggleDebugStreamOverlayModeInternal();
1294 void ToggleDebugStreamOverlayEnabledInteral();
1295
1296private:
1297 static bool TestIsValidDrawingMaterial(const UMaterialInterface* DrawingMaterial);
1298
1300};
DECLARE_DYNAMIC_MULTICAST_DELEGATE void FErrorDelegate(const FString &ErrorMessage)
Error Delegate Type.
DECLARE_DYNAMIC_MULTICAST_DELEGATE void FClipPlaneCreatedDelegate(int32 ClipPlaneId, AActor *ClipPlaneActor, bool OwnEvent)
Delegate type invoked when a clip plane is created.
DECLARE_DYNAMIC_MULTICAST_DELEGATE void FDisconnectedDelegate()
Disconnected Delegate Type.
DECLARE_DYNAMIC_MULTICAST_DELEGATE void FClipPlaneRemovedDelegate(int32 ClipPlaneId, bool OwnEvent)
Delegate type invoked when a clip plane is removed.
DECLARE_DYNAMIC_MULTICAST_DELEGATE void FConnectErrorDelegate(const FString &ErrorMessage)
Connect Error Delegate Type.
DECLARE_DYNAMIC_MULTICAST_DELEGATE void FConnectedDelegate()
Connected Delegate Type.
@ Enabled
Specifies whether a node is enabled.
Definition I3DHDataTypes.h:250
@ AppearanceURI
The appearance URI of a node.
Definition I3DHDataTypes.h:136
EI3DHEnabledState
Describes, if a node is (partially) enabled.
Definition I3DHDataTypes.h:1262
virtual void BeginPlay() override
Called when play begins for the instant3Dhub Connector actor.
int32 MaxPageInstancesCreatedPerTick
Limits the number of page instances created per frame to avoid hitches in frame rate.
Definition I3DHConnector.h:934
float ViewSyncHz
Frequency to sync the camera with Hub.
Definition I3DHConnector.h:956
int32 TargetedTrianglesOnVisiblePageInstances
A target budget for the number of triangles accumulated over all page instances concurrently visible ...
Definition I3DHConnector.h:942
float CreatePageInstancesBudgetMs
Time budget (in milliseconds per tick) for creating page instances.
Definition I3DHConnector.h:949
FMatrix GetOriginToWorldTransform() const
Gets origin to world transform.
FMatrix GetWorldToOriginTransform() const
Gets world to origin transform.
const AActor * GetOriginActor() const
Definition I3DHConnector.h:525
int32 MaxConversionTasksCreatedPerTick
Limits the number of page conversion tasks created per frame to avoid hitches in frame rate.
Definition I3DHConnector.h:930
TObjectPtr< USceneComponent > RootComponentConnector
Expose the RootComponent as Visible to allow its properties to be modified in Details Panel.
Definition I3DHConnector.h:1055
static bool ParseConnectLink(const FString &Link, FString &HubURL, FI3DHConnectOptions &ConnectOptions)
Parses the provided connection link and extracts the hub URL and relevant connection options.
AActor * GetOriginActor()
Definition I3DHConnector.h:515
This actor is the scene representation of drawings in the session.
Definition I3DHDrawing.h:47
Actor containing mesh components used to represent instant3Dhub geometry.
Definition I3DHGeometry.h:66
Interface that can be implemented to provide drawing editing functionality.
Definition I3DHDataTypes.h:2261
Base class for resolver objects bound to Custom Material URN namespaces on an AI3DHConnector.
Definition I3DHMaterialURNResolver.h:32
TObjectPtr< class UMaterialInterface > GlobalHighlightMaterial
Global fallback material used when geometry enters hover or selection state without a dedicated highl...
Definition I3DHConnector.h:980
FI3DHGeometryMaterials MaterialAPIMaterials
Default Unreal material set used when urn:X-l3d:material:<id>.
Definition I3DHConnector.h:1013
TObjectPtr< class UMaterialParameterCollection > I3DHParameterCollection
Material parameter collection used for Hub features such as clipping plane.
Definition I3DHConnector.h:965
TSubclassOf< AI3DHGeometry > GeometryActorClass
The geometry actor class to use for instances.
Definition I3DHConnector.h:1042
const FI3DHGeometryMaterials & GetL3DAppearanceMaterials() const
Returns geometry materials used for urn:X-l3d:color overrides.
Definition I3DHConnector.h:916
const FI3DHGeometryMaterials & GetMaterialAPIMaterials() const
Returns fallback geometry materials used for MaterialAPI-backed rendering.
Definition I3DHConnector.h:922
FI3DHGeometryMaterials L3DDefaultMaterials
These materials are expected to work with instant3Dhub vertex colors.
Definition I3DHConnector.h:991
bool bSpawnedGeometryCastsShadow
The value bCastShadow is set to on spawned mesh components.
Definition I3DHConnector.h:1050
const FI3DHGeometryMaterials & GetL3DMaterials() const
Returns geometry materials used for default urn:X-l3d:color:property:default handling.
Definition I3DHConnector.h:910
FI3DHGeometryMaterials L3DAppearanceMaterials
These materials are expected to work with instant3Dhub vertex colors and appearance color overrides.
Definition I3DHConnector.h:1001
float ClipPlaneSyncHz
Frequency to sync the clip planes with the Hub.
Definition I3DHConnector.h:654
TSubclassOf< AActor > ClipPlaneActorClass
Actor class used to render a clip plane.
Definition I3DHConnector.h:661
AActor * FindClipPlaneActor(int32 ClipPlaneId)
Gets clip plane actor for a specific clip plane.
FClipPlaneCreatedDelegate OnClipPlaneCreatedDelegate
Multicast Delegate that is invoked when a clip plane is created.
Definition I3DHConnector.h:639
AActor * GetMainClipPlaneActor()
Gets the main clip plane actor.
FClipPlaneRemovedDelegate OnClipPlaneRemovedDelegate
Multicast Delegate that is invoked when a clip plane is removed.
Definition I3DHConnector.h:646
TArray< int32 > GetClipPlanes()
Returns the IDs of the currently existing clip planes.
FConnectErrorDelegate OnConnectErrorDelegate
Multicast delegate that is invoked when a connection attempt fails.
Definition I3DHConnector.h:474
bool IsDisconnected() const
Query if this HubConnector is currently disconnected.
void Disconnect()
Disconnects from the connected instant3Dhub session.
void RemoveNetworkCredentialCookie(const FString &CookieKey)
Removes the network credential cookie identified by CookieKey.
FErrorDelegate OnErrorDelegate
Multicast delegate that is invoked when a critical error is encountered while connected.
Definition I3DHConnector.h:485
void RemoveNetworkCredentialToken(const FString &TokenKey)
Removes the network credential token identified by TokenKey.
bool IsEstablishingConnectionToHub() const
Query if this HubConnector is currently establishing a connection.
FString GetSessionId() const
Returns the SessionId of the current session.
FConnectedDelegate OnConnectedDelegate
Multicast delegate that is invoked when a connection to the instant3Dhub is successfully established.
Definition I3DHConnector.h:465
bool IsConnectedToHub() const
Query if this HubConnector is connected to an instant3Dhub session.
FString GetSpaceId() const
Returns the SpaceId of the currently open 3D space.
void AddNetworkCredentialToken(const FString &TokenKey, const FString &TokenValue)
Adds a network credential token.
void ConnectToHubWithOptions(const FString &HubURL, const FI3DHConnectOptions &Options)
Connects to an instant3Dhub instance using the provided options.
const TMap< FString, FString > & GetNetworkCredentialTokens() const
Returns the current network credential tokens used to authenticate hub requests.
Definition I3DHConnector.h:297
const TMap< FString, FString > & GetNetworkCredentialCookies() const
Returns the current network credential cookies used to authenticate hub requests.
Definition I3DHConnector.h:289
void AddNetworkCredentialCookie(const FString &CookieKey, const FString &CookieValue)
Adds a network credential cookie.
void ConnectToHub(const FString &HubURL, const FString &SpaceId)
Connects to an instant3Dhub instance and opens a 3D space.
void ConnectToHubWithLink(const FString &Link)
Connects to an instant3Dhub instance using the provided connection link.
FString GetHubURL() const
Returns the HubURL of the current session.
FDisconnectedDelegate OnDisconnectedDelegate
Multicast delegate that is invoked when the connection to the instant3Dhub is closed.
Definition I3DHConnector.h:494
const TArray< FI3DHDebugMetric > & GetDebugMetrics()
Returns a list of metrics describing the internal state of the connector.
UTexture2D * GetRemoteCullerDebugStreamTexture()
Returns a texture containing the current remote culler debug image.
bool RequestRemoteCullerDebugStream()
Establishes a connection to the remote culler service and continuously streams debug images from the ...
FString GetDebugSessionInfo()
Returns a short description of the current connection for advanced troubleshooting.
void SetClipDrawingsByClipPlane(const bool bClipDrawingsByClipPlaneEnabled)
Use to globally control whether Drawings are clipped by ClipPlanes.
TObjectPtr< UMaterialInterface > DrawingBaseMaterial
Default material to render drawings.
Definition I3DHConnector.h:700
TObjectPtr< class UStaticMesh > DrawingSegmentMesh
Mesh used to render a line segment in LineStrip drawings.
Definition I3DHConnector.h:710
TObjectPtr< class UStaticMesh > DrawingJointMesh
Mesh used to render joints of LineStrip drawings.
Definition I3DHConnector.h:719
UMaterialInterface * GetDrawingMaterial(FLinearColor Color)
Returns a new Dynamic Material Instance of the AI3DHConnector::DrawingBaseMaterial with the specified...
class AI3DHDrawing * FindDrawingActor(int32 DrawingHandle)
Search the Drawing Actor for the provided DrawingHandle.
bool GetClipDrawingsByClipPlane()
Whether Drawings are clipped by ClipPlanes.
virtual void EditDrawing(int32 DrawingHandle, const TScriptInterface< class II3DHEditDrawingInterface > &EditDrawingInterface, bool bIsEditingCopy=false)
Edit a drawing matching the specified handle using the provided edit drawing interface.
void AddToHoveredNodes(int32 NodeId)
Adds the given node to the set of hovered nodes.
TArray< int32 > GetHoveredNodes()
Returns the current list of hovered nodes.
void ClearHoveredNodes()
Clears the set of hovered nodes.
void SetHoveredNode(int32 NodeId)
Replaces the set of hovered nodes with the given node.
#define INSTANT3DHUB_DEPRECATED(Version, Message)
Macro for marking up deprecated code, functions and types.
Definition I3DHVersion.h:203
#define INSTANT3DHUB_EXPERIMENTAL(Version, Message)
Macro for marking up experimental code, functions and types.
Definition I3DHVersion.h:246
TSharedPtr< FI3DHConnectorAPI > GetAPI() const
Returns a shared pointer to the ConnectorAPI.
int32 GetGlobalRootNodeId()
Returns the NodeId of the (implicit) top-level node of the instance graph.
FI3DHClientProgress GetClientProgress()
Gives an indication of the local rendering progress.
TArray< int32 > GetSelection()
Returns a copy of the active selection.
bool GetWorldTransformWithAuthority(const FI3DHTransformAuthorityHandle TransformAuthorityHandle, int32 NodeId, FMatrix &OutWorldTransform)
Returns the World Transform as currently managed by the Transform Authority.
void ReleaseTransformAuthority(const FI3DHTransformAuthorityHandle TransformAuthorityHandle)
Releases the Transform Authority of the Unreal Client.
void SetWorldTransformWithAuthority(const FI3DHTransformAuthorityHandle TransformAuthorityHandle, int32 NodeId, const FMatrix &WorldTransform)
Immediately sets the World Transform of Actors representing the NodeId (and its child nodes) Unreal c...
bool IsTransformAuthorityActive(const FI3DHTransformAuthorityHandle TransformAuthorityHandle) const
Returns whether a TransformAuthority is still active.
const class UI3DHCustomMaterialURNResolver * FindCustomMaterialURNResolver(const FI3DHNamespaceIdentifier &NID) const
Returns the resolver object bound to a Custom Material URN namespace.
TMap< FI3DHNamespaceIdentifier, TObjectPtr< class UI3DHCustomMaterialURNResolver > > CustomMaterialURNResolvers
Binds Custom Material URN namespaces to resolver objects.
Definition I3DHConnector.h:1033
Gives an indication of the local rendering progress.
Definition I3DHDataTypes.h:2356
Contains optional parameters for connecting to the hub.
Definition I3DHConnector.h:149
FString RoleKey
If set, requests a specific member role when opening the 3D space.
Definition I3DHConnector.h:182
FString RestoreSessionId
Identifier of a stored session.
Definition I3DHConnector.h:205
FString SpaceId
If set, opens the specified 3D space.
Definition I3DHConnector.h:172
bool bCloneIntoNewSpace
If set, immediately clones the 3D space specified by SpaceId into a new space after opening it.
Definition I3DHConnector.h:194
FString SessionId
If set, connect to the specified session.
Definition I3DHConnector.h:162
Material set applied to 3D data after built-in appearance handling or Custom Material URN resolution.
Definition I3DHDataTypes.h:2431
Namespace Identifier (NID) segment of a URN urn:NID:NSS.
Definition I3DHDataTypes.h:1587
Handle obtained when acquiring transform authority over a set of Nodes.
Definition I3DHDataTypes.h:2311