118class AI3DHConnector : public AActor
123 INSTANT3DHUB_API AI3DHConnector();
127 INSTANT3DHUB_API virtual void BeginPlay() override;
128 INSTANT3DHUB_API virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
130 INSTANT3DHUB_API virtual void Tick(float DeltaTime) override;
133 INSTANT3DHUB_API virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
136 // ----------------------------------------------------------
138 // ----------------------------------------------------------
147 INSTANT3DHUB_API TSharedPtr<FI3DHConnectorAPI> GetAPI() const;
149 // ----------------------------------------------------------
151 // ----------------------------------------------------------
159 UFUNCTION(BlueprintCallable, BlueprintPure = false, Category = "{instant3Dhub}|Connector
")
160 INSTANT3DHUB_API void AddNetworkCredentialCookie(const FString& CookieKey, const FString& CookieValue);
167 UFUNCTION(BlueprintCallable, BlueprintPure = false, Category = "{instant3Dhub}|Connector
")
168 INSTANT3DHUB_API void RemoveNetworkCredentialCookie(const FString& CookieKey);
176 UFUNCTION(BlueprintCallable, BlueprintPure = false, Category = "{instant3Dhub}|Connector
")
177 INSTANT3DHUB_API void AddNetworkCredentialToken(const FString& TokenKey, const FString& TokenValue);
184 UFUNCTION(BlueprintCallable, BlueprintPure = false, Category = "{instant3Dhub}|Connector
")
185 INSTANT3DHUB_API void RemoveNetworkCredentialToken(const FString& TokenKey);
192 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector
")
193 INSTANT3DHUB_API const TMap<FString, FString>& GetNetworkCredentialCookies() const { return NetworkCredentialCookies; }
200 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector
")
201 INSTANT3DHUB_API const TMap<FString, FString>& GetNetworkCredentialTokens() const { return NetworkCredentialTokens; }
238 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Connector
")
239 INSTANT3DHUB_API void ConnectToHub(const FString& HubURL, const FString& SessionId);
251 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Connector
")
252 INSTANT3DHUB_API void ConnectToHubWithOptions(const FString& HubURL, const FI3DHConnectOptions& Options);
255 void OnBackendConnected_Internal_GameThread(const FString& SessionId);
256 void OnBackendConnectError_Internal_GameThread(const FString& ErrorMessage);
257 void ReportConnectError_Internal_GameThread(const FString& ErrorMessage);
268 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Connector
")
269 INSTANT3DHUB_API void Disconnect();
277 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector
")
278 INSTANT3DHUB_API bool IsDisconnected() const;
286 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector
")
287 INSTANT3DHUB_API bool IsEstablishingConnectionToHub() const;
294 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector
")
295 INSTANT3DHUB_API bool IsConnectedToHub() const;
302 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector
")
303 INSTANT3DHUB_API FString GetHubURL() const;
310 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector
")
311 INSTANT3DHUB_API FString GetSessionId() const;
317 UPROPERTY(BlueprintAssignable, Transient, Category = "{instant3Dhub}|Connector
")
318 FConnectedDelegate OnConnectedDelegate;
324 UPROPERTY(BlueprintAssignable, Transient, Category = "{instant3Dhub}|Connector
")
325 FConnectErrorDelegate OnConnectErrorDelegate;
331 UPROPERTY(BlueprintAssignable, Transient, Category = "{instant3Dhub}|Connector
")
332 FDisconnectedDelegate OnDisconnectedDelegate;
339 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector
")
340 INSTANT3DHUB_API FMatrix GetOriginToWorldTransform() const;
347 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector
")
348 INSTANT3DHUB_API FMatrix GetWorldToOriginTransform() const;
353 INSTANT3DHUB_API AActor* GetOriginActor()
355 AActor* RootActor = this;
356 check(RootActor != nullptr);
363 INSTANT3DHUB_API const AActor* GetOriginActor() const
365 const AActor* RootActor = this;
366 check(RootActor != nullptr);
370 // ----------------------------------------------------------
372 // ----------------------------------------------------------
388 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Debugging
")
389 INSTANT3DHUB_API bool RequestRemoteCullerDebugStream();
403 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Debugging
")
404 INSTANT3DHUB_API UTexture2D* GetRemoteCullerDebugStreamTexture();
417 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Debugging
")
418 INSTANT3DHUB_API const TArray<FI3DHDebugMetric>& GetDebugMetrics();
420 // ----------------------------------------------------------
422 // ----------------------------------------------------------
436 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Progress
")
437 INSTANT3DHUB_API FI3DHClientProgress GetClientProgress();
439 // ----------------------------------------------------------
441 // ----------------------------------------------------------
447 UPROPERTY(BlueprintAssignable, Transient, Category = "{instant3Dhub}|Clip Plane API
")
448 FClipPlaneCreatedDelegate OnClipPlaneCreatedDelegate;
454 UPROPERTY(BlueprintAssignable, Transient, Category = "{instant3Dhub}|Clip Plane API
")
455 FClipPlaneRemovedDelegate OnClipPlaneRemovedDelegate;
461 UPROPERTY(EditAnywhere, meta = (ClampMin = "0.1
", ClampMax = "120.0
", UIMin = "0.1
", UIMax = "120.0
"), Category = "{instant3Dhub}|Clip Plane API
")
462 float ClipPlaneSyncHz = 1.0;
468 UPROPERTY(EditAnywhere, Category = "{instant3Dhub}|Clip Plane API
")
469 TSubclassOf<AActor> ClipPlaneActorClass = nullptr;
476 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Clip Plane API
")
477 INSTANT3DHUB_API TArray<int32> GetClipPlanes();
485 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Clip Plane API
")
486 INSTANT3DHUB_API AActor* FindClipPlaneActor(int32 ClipPlaneId);
493 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Clip Plane API
")
494 INSTANT3DHUB_API AActor* GetMainClipPlaneActor();
496 // ----------------------------------------------------------
498 // ----------------------------------------------------------
507 UPROPERTY(EditAnywhere, Category = "{instant3Dhub}|Drawing API
", AdvancedDisplay)
508 TObjectPtr<UMaterialInterface> DrawingBaseMaterial{nullptr};
517 UPROPERTY(EditAnywhere, Category = "{instant3Dhub}|Drawing API
", AdvancedDisplay)
518 TObjectPtr<class UStaticMesh> DrawingSegmentMesh{nullptr};
526 UPROPERTY(EditAnywhere, Category = "{instant3Dhub}|Drawing API
", AdvancedDisplay)
527 TObjectPtr<class UStaticMesh> DrawingJointMesh{nullptr};
536 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Drawing API
", meta = (DisplayName = "Create Drawing Material
"))
537 INSTANT3DHUB_API UMaterialInterface* GetDrawingMaterial(FLinearColor Color);
546 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Drawing API
")
547 INSTANT3DHUB_API class AI3DHDrawing* FindDrawingActor(int32 DrawingHandle);
555 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Drawing API
")
556 INSTANT3DHUB_API void SetClipDrawingsByClipPlane(const bool bClipDrawingsByClipPlaneEnabled);
564 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Drawing API
")
565 INSTANT3DHUB_API bool GetClipDrawingsByClipPlane();
567 // ----------------------------------------------------------
569 // ----------------------------------------------------------
584 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|
EditDrawing API
")
585 virtual void EditDrawing(int32 DrawingHandle, const TScriptInterface<class II3DHEditDrawingInterface>& EditDrawingInterface, bool bIsEditingCopy = false);
587 // ----------------------------------------------------------
589 // ----------------------------------------------------------
597 UFUNCTION(BlueprintPure, Category = "{instant3Dhub}|
Instance Graph API
")
598 INSTANT3DHUB_API int32 GetGlobalRootNodeId();
601 // ----------------------------------------------------------
603 // ----------------------------------------------------------
611 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Selection API
")
612 INSTANT3DHUB_API TArray<int32> GetSelection();
614 // ----------------------------------------------------------
615 // TransformAuthority API
616 // ----------------------------------------------------------
618 INSTANT3DHUB_EXPERIMENTAL(0.0.23, "TransformAuthorityAPI is a temporary solution suspect to changes or replacement.
")
627 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|
Transform Authority
", meta = (DisplayName = "Get WorldTransform With Authority (Experimental)
"))
628 INSTANT3DHUB_API bool GetWorldTransformWithAuthority(const FI3DHTransformAuthorityHandle TransformAuthorityHandle, int32 NodeId, FMatrix& OutWorldTransform);
630 INSTANT3DHUB_EXPERIMENTAL(0.0.23, "TransformAuthorityAPI is a temporary solution suspect to changes or replacement.
")
638 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|
Transform Authority
", meta = (DisplayName = "Set WorldTransform With Authority (Experimental)
"))
639 INSTANT3DHUB_API void SetWorldTransformWithAuthority(const FI3DHTransformAuthorityHandle TransformAuthorityHandle, int32 NodeId, const FMatrix& WorldTransform);
641 INSTANT3DHUB_EXPERIMENTAL(0.0.23, "TransformAuthorityAPI is a temporary solution suspect to changes or replacement.
")
648 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|
Transform Authority
", meta = (DisplayName = "Release TransformAuthority (Experimental)
"))
649 INSTANT3DHUB_API void ReleaseTransformAuthority(const FI3DHTransformAuthorityHandle TransformAuthorityHandle);
651 INSTANT3DHUB_EXPERIMENTAL(0.0.23, "TransformAuthorityAPI is a temporary solution suspect to changes or replacement.
")
657 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|
Transform Authority
", meta = (DisplayName = "Is TransformAuthority Active (Experimental)
"))
658 INSTANT3DHUB_API bool IsTransformAuthorityActive(const FI3DHTransformAuthorityHandle TransformAuthorityHandle) const;
665 UPROPERTY(EditAnywhere, Category = "{instant3Dhub}|Connector
")
666 TObjectPtr<class UMaterialParameterCollection> I3DHParameterCollection = nullptr;
668 PRAGMA_DISABLE_EXPERIMENTAL_WARNINGS
670 UPROPERTY(EditAnywhere, Category = "{instant3Dhub}|Connector
")
671 TSubclassOf<AI3DHGeometry> GeometryActorClass;
672 PRAGMA_ENABLE_EXPERIMENTAL_WARNINGS
675 UPROPERTY(EditAnywhere, Category = "{instant3Dhub}|Connector
")
676 bool bSpawnedGeometryCastsShadow = false;
679 UPROPERTY(EditAnywhere, Category = "{instant3Dhub}|Connector
")
680 int32 MaxComponentsCreatedPerTick = 2;
687 UPROPERTY(EditAnywhere, Category = "{instant3Dhub}|Connector
")
688 int32 TargetedTrianglesOnComponentsWithVisibility = 10000000;
691 UPROPERTY(EditAnywhere, meta = (ClampMin = "0.1
", ClampMax = "120.0
", UIMin = "0.1
", UIMax = "120.0
"), Category = "{instant3Dhub}|Connector
")
692 float ViewSyncHz = 5.0;
695 UPROPERTY(VisibleAnywhere, Category = "{instant3Dhub}|Connector
")
696 TObjectPtr<USceneComponent> RootComponentConnector;
699 // ----------------------------------------------------------
701 // ----------------------------------------------------------
703 FI3DHConnectorDrawingStorage& GetDrawingStorage();
704 const FI3DHConnectorDrawingStorage& GetDrawingStorage() const;
706 FI3DHConnectorRenderStorage& GetRenderStorage();
707 const FI3DHConnectorRenderStorage& GetRenderStorage() const;
709 const FI3DHConnectorRenderStats& GetRenderStats() const;
711 PRAGMA_DISABLE_EXPERIMENTAL_WARNINGS
713 AI3DHGeometry* FindGeometryActor(int32 RootNodeId);
714 PRAGMA_ENABLE_EXPERIMENTAL_WARNINGS
716 UMaterialParameterCollectionInstance* GetI3DHParameterCollectionInstance() const;
719 TMap<FString, FString> NetworkCredentialCookies;
720 TMap<FString, FString> NetworkCredentialTokens;
725 bool bReloadKeyPressedLastFrame = false;
726 bool bDebugStreamKeyPressedLastFrame = false;
728 // Timings for measuring time to first pixel.
729 // All values in seconds of platform time.
731 // Note that the camera position and orientation can influence the timings
732 // via effects on the remote culler. For accurate measurements the camera
733 // should be in a fixed position pointing at the scene.
735 double FirstVisibilityTime;
736 double FirstActorTime;
738 FTimerHandle ViewSyncTimer;
741 FI3DHConnectorDrawingStorage DrawingStorage;
744 FI3DHConnectorRenderStorage RenderStorage;
746 TArray<FI3DHDebugMetric> DebugMetrics;
747 int32 MetricTimingVisibility = 0;
748 int32 MetricTimingGeometry = 0;
751 // ----------------------------------------------------------
752 TSharedPtr<class FI3DHConnectorAPIImpl> APIImpl;
754 TSharedPtr<class FI3DHConnectionPromiseImpl> ConnectionPromise;
756 TSharedPtr<class FI3DHConnectorBackend> ConnectorBackend;
757 TSharedPtr<class FI3DHEventBackend> EventBackend;
758 TSharedPtr<class FI3DHRenderBackend> RenderBackend;
761 PRAGMA_DISABLE_EXPERIMENTAL_WARNINGS
769 AI3DHGeometry* SpawnGeometryActor(AActor* AttachActor, int32 RootNodeId, const struct FI3DHInstanceSpawnProperties& SpawnProperties);
770 PRAGMA_ENABLE_EXPERIMENTAL_WARNINGS
772 PRAGMA_DISABLE_EXPERIMENTAL_WARNINGS
780 UStaticMeshComponent* SpawnMeshComponentFromTask(FI3DHPageInstanceHandle PageInstanceHandle, AI3DHGeometry* AttachActor, const FI3DHPageToStaticMeshTask& Task);
781 PRAGMA_ENABLE_EXPERIMENTAL_WARNINGS
788 void FinishPhysicsAsyncCook(bool bSuccess, UBodySetup* FinishedBodySetup);
794 void SetAppearance_Internal(const FLinearColor& OverrideColor, EAppearanceURIMode OverrideMode, const TArray<int32>& RootNodeIds);
801 void SetTransforms_Internal(const TArray<FMatrix>& GlobalTransforms, const TArray<int32>& RootNodeIds);
809 void SetEnabled_Internal(bool bNewEnabled, const TArray<int32>& RootNodeIds);
817 void SetVariantEnabled_Internal(bool bNewVariantEnabled, const TArray<int32>& RootNodeIds);
824 void SetSelected_Internal(bool bNewSelected, const TArray<int32>& RootNodeIds);
827 PRAGMA_DISABLE_EXPERIMENTAL_WARNINGS
832 void UpdateMeshComponentVisibilityAfterActorHiddenInGameStateChange_Internal(AI3DHGeometry* GeometryActor);
833 PRAGMA_ENABLE_EXPERIMENTAL_WARNINGS
835 struct HubCameraParameters
839 FMatrix44f ViewMatrix;
840 FMatrix44f ProjectionMatrix;
847 HubCameraParameters GetHubCameraParamsForPlayer(const APlayerController* PlayerController);
849 void ViewSyncTimerCallback();
852 void AddCredentialHeaders(const FString& URL, TMap<FString, FString>& Headers);
853 void ToggleDebugStreamOverlayModeInternal();
854 void ToggleDebugStreamOverlayEnabledInteral();
856 TUniquePtr<class FI3DHDebugStreamConnector> DebugStreamConnector;
859 TObjectPtr<class AI3DHDebugStreamOverlay> DebugStreamOverlay;
862 static bool TestIsValidDrawingMaterial(const UMaterialInterface* DrawingMaterial);