97class AI3DHConnector : public AActor
102 INSTANT3DHUB_API AI3DHConnector();
106 INSTANT3DHUB_API virtual void BeginPlay() override;
107 INSTANT3DHUB_API virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
109 INSTANT3DHUB_API virtual void Tick(float DeltaTime) override;
111 // ----------------------------------------------------------
113 // ----------------------------------------------------------
122 INSTANT3DHUB_API TSharedPtr<FI3DHConnectorAPI> GetAPI() const;
124 // ----------------------------------------------------------
126 // ----------------------------------------------------------
134 UFUNCTION(BlueprintCallable, BlueprintPure = false, Category = "{instant3Dhub}|Connector
")
135 INSTANT3DHUB_API void AddNetworkCredentialCookie(const FString& CookieKey, const FString& CookieValue);
142 UFUNCTION(BlueprintCallable, BlueprintPure = false, Category = "{instant3Dhub}|Connector
")
143 INSTANT3DHUB_API void RemoveNetworkCredentialCookie(const FString& CookieKey);
151 UFUNCTION(BlueprintCallable, BlueprintPure = false, Category = "{instant3Dhub}|Connector
")
152 INSTANT3DHUB_API void AddNetworkCredentialToken(const FString& TokenKey, const FString& TokenValue);
159 UFUNCTION(BlueprintCallable, BlueprintPure = false, Category = "{instant3Dhub}|Connector
")
160 INSTANT3DHUB_API void RemoveNetworkCredentialToken(const FString& TokenKey);
167 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector
")
168 INSTANT3DHUB_API const TMap<FString, FString>& GetNetworkCredentialCookies() const { return NetworkCredentialCookies; }
175 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector
")
176 INSTANT3DHUB_API const TMap<FString, FString>& GetNetworkCredentialTokens() const { return NetworkCredentialTokens; }
217 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Connector
")
218 INSTANT3DHUB_API void ConnectToHub(const FString& HubURL, const FString& SessionId);
230 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Connector
")
231 INSTANT3DHUB_API void ConnectToHubWithOptions(const FString& HubURL, const FI3DHConnectOptions& Options);
234 void OnBackendConnected_Internal_GameThread(const FString& SessionId);
235 void OnBackendConnectError_Internal_GameThread(const FString& ErrorMessage);
246 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Connector
")
247 INSTANT3DHUB_API void Disconnect();
255 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector
")
256 INSTANT3DHUB_API bool IsDisconnected() const;
264 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector
")
265 INSTANT3DHUB_API bool IsEstablishingConnectionToHub() const;
272 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector
")
273 INSTANT3DHUB_API bool IsConnectedToHub() const;
280 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector
")
281 INSTANT3DHUB_API FString GetHubURL() const;
288 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector
")
289 INSTANT3DHUB_API FString GetSessionId() const;
295 UPROPERTY(BlueprintAssignable, Transient, Category = "{instant3Dhub}|Connector
")
296 FConnectedDelegate OnConnectedDelegate;
302 UPROPERTY(BlueprintAssignable, Transient, Category = "{instant3Dhub}|Connector
")
303 FConnectErrorDelegate OnConnectErrorDelegate;
309 UPROPERTY(BlueprintAssignable, Transient, Category = "{instant3Dhub}|Connector
")
310 FDisconnectedDelegate OnDisconnectedDelegate;
317 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector
")
318 INSTANT3DHUB_API FMatrix GetOriginToWorldTransform() const;
325 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "{instant3Dhub}|Connector
")
326 INSTANT3DHUB_API FMatrix GetWorldToOriginTransform() const;
331 INSTANT3DHUB_API AActor* GetOriginActor()
333 AActor* RootActor = this;
334 check(RootActor != nullptr);
341 INSTANT3DHUB_API const AActor* GetOriginActor() const
343 const AActor* RootActor = this;
344 check(RootActor != nullptr);
348 // ----------------------------------------------------------
350 // ----------------------------------------------------------
356 UPROPERTY(BlueprintAssignable, Transient, Category = "{instant3Dhub}|Clip Plane API
")
357 FClipPlaneCreatedDelegate OnClipPlaneCreatedDelegate;
363 UPROPERTY(BlueprintAssignable, Transient, Category = "{instant3Dhub}|Clip Plane API
")
364 FClipPlaneRemovedDelegate OnClipPlaneRemovedDelegate;
370 UPROPERTY(EditAnywhere, meta = (ClampMin = "0.1
", ClampMax = "120.0
", UIMin = "0.1
", UIMax = "120.0
"), Category = "{instant3Dhub}|Clip Plane API
")
371 float ClipPlaneSyncHz = 1.0;
377 UPROPERTY(EditAnywhere, Category = "{instant3Dhub}|Clip Plane API
")
378 TSubclassOf<AActor> ClipPlaneActorClass = nullptr;
385 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Clip Plane API
")
386 INSTANT3DHUB_API TArray<int32> GetClipPlanes();
394 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Clip Plane API
")
395 INSTANT3DHUB_API AActor* FindClipPlaneActor(int32 ClipPlaneId);
402 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Clip Plane API
")
403 INSTANT3DHUB_API AActor* GetMainClipPlaneActor();
405 // ----------------------------------------------------------
407 // ----------------------------------------------------------
414 UPROPERTY(EditAnywhere, Category = "{instant3Dhub}|Drawing API
")
415 TObjectPtr<UMaterialInterface> DrawingBaseMaterial{nullptr};
421 UPROPERTY(EditAnywhere, meta = (ClampMin = "0.1
", ClampMax = "120.0
", UIMin = "0.1
", UIMax = "120.0
"), Category = "{instant3Dhub}|Drawing API
")
422 float DrawingSyncHz = 1.0;
432 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Drawing API
")
433 INSTANT3DHUB_API UMaterialInterface* GetDrawingMaterial(FLinearColor Color);
442 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Drawing API
")
443 INSTANT3DHUB_API class AI3DHDrawing* FindDrawingActor(int DrawingHandle);
451 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Drawing API
")
452 INSTANT3DHUB_API void SetClipDrawingsByClipPlane(const bool bClipDrawingsByClipPlaneEnabled);
460 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Drawing API
")
461 INSTANT3DHUB_API bool GetClipDrawingsByClipPlane();
463 // ----------------------------------------------------------
465 // ----------------------------------------------------------
473 UFUNCTION(BlueprintPure, Category = "{instant3Dhub}|
Instance Graph API
")
474 INSTANT3DHUB_API int32 GetGlobalRootNodeId();
477 // ----------------------------------------------------------
479 // ----------------------------------------------------------
487 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|Selection API
")
488 INSTANT3DHUB_API TArray<int32> GetSelection();
490 // ----------------------------------------------------------
491 // TransformAuthority API
492 // ----------------------------------------------------------
494 INSTANT3DHUB_EXPERIMENTAL(0.0.23, "TransformAuthorityAPI is a temporary solution suspect to changes or replacement.
")
503 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|
Transform Authority
", meta = (DisplayName = "Get WorldTransform With Authority (Experimental)
"))
504 INSTANT3DHUB_API bool GetWorldTransformWithAuthority(const FI3DHTransformAuthorityHandle TransformAuthorityHandle, int NodeId, FMatrix& OutWorldTransform);
506 INSTANT3DHUB_EXPERIMENTAL(0.0.23, "TransformAuthorityAPI is a temporary solution suspect to changes or replacement.
")
514 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|
Transform Authority
", meta = (DisplayName = "Set WorldTransform With Authority (Experimental)
"))
515 INSTANT3DHUB_API void SetWorldTransformWithAuthority(const FI3DHTransformAuthorityHandle TransformAuthorityHandle, int NodeId, const FMatrix& WorldTransform);
517 INSTANT3DHUB_EXPERIMENTAL(0.0.23, "TransformAuthorityAPI is a temporary solution suspect to changes or replacement.
")
524 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|
Transform Authority
", meta = (DisplayName = "Release TransformAuthority (Experimental)
"))
525 INSTANT3DHUB_API void ReleaseTransformAuthority(const FI3DHTransformAuthorityHandle TransformAuthorityHandle);
527 INSTANT3DHUB_EXPERIMENTAL(0.0.23, "TransformAuthorityAPI is a temporary solution suspect to changes or replacement.
")
533 UFUNCTION(BlueprintCallable, Category = "{instant3Dhub}|
Transform Authority
", meta = (DisplayName = "Is TransformAuthority Active (Experimental)
"))
534 INSTANT3DHUB_API bool IsTransformAuthorityActive(const FI3DHTransformAuthorityHandle TransformAuthorityHandle) const;
541 UPROPERTY(EditAnywhere, Category = "{instant3Dhub}|Connector
")
542 TObjectPtr<class UMaterialParameterCollection> I3DHParameterCollection = nullptr;
545 UPROPERTY(EditAnywhere, Category = "{instant3Dhub}|Connector
")
546 TSubclassOf<AI3DHGeometry> GeometryActorClass;
549 UPROPERTY(EditAnywhere, Category = "{instant3Dhub}|Connector
")
550 bool bSpawnedGeometryCastsShadow = false;
553 UPROPERTY(EditAnywhere, Category = "{instant3Dhub}|Connector
")
554 int MaxComponentsCreatedPerTick = 2;
561 UPROPERTY(EditAnywhere, Category = "{instant3Dhub}|Connector
")
562 int32 TargetedTrianglesOnComponentsWithVisibility = 10000000;
565 UPROPERTY(EditAnywhere, meta = (ClampMin = "0.1
", ClampMax = "120.0
", UIMin = "0.1
", UIMax = "120.0
"), Category = "{instant3Dhub}|Connector
")
566 float ViewSyncHz = 5.0;
569 UPROPERTY(VisibleAnywhere, Category = "{instant3Dhub}|Connector
")
570 TObjectPtr<USceneComponent> RootComponentConnector;
573 // ----------------------------------------------------------
575 // ----------------------------------------------------------
577 FI3DHConnectorDrawingStorage& GetDrawingStorage();
578 const FI3DHConnectorDrawingStorage& GetDrawingStorage() const;
580 FI3DHConnectorRenderStorage& GetRenderStorage();
581 const FI3DHConnectorRenderStorage& GetRenderStorage() const;
584 AI3DHGeometry* FindGeometryActor(int32 RootNodeId);
586 UMaterialParameterCollectionInstance* GetI3DHParameterCollectionInstance() const;
589 TMap<FString, FString> NetworkCredentialCookies;
590 TMap<FString, FString> NetworkCredentialTokens;
595 bool bReloadKeyPressedLastFrame = false;
597 // Timings for measuring time to first pixel.
598 // All values in seconds of platform time.
600 // Note that the camera position and orientation can influence the timings
601 // via effects on the remote culler. For accurate measurements the camera
602 // should be in a fixed position pointing at the scene.
604 double FirstVisibilityTime;
605 double FirstActorTime;
607 FTimerHandle ViewSyncTimer;
610 FI3DHConnectorDrawingStorage DrawingStorage;
613 FI3DHConnectorRenderStorage RenderStorage;
616 // ----------------------------------------------------------
617 TSharedPtr<class FI3DHConnectorAPIImpl> APIImpl;
619 TSharedPtr<class FI3DHConnectionPromiseImpl> ConnectionPromise;
621 TSharedPtr<class FI3DHConnectorBackend> ConnectorBackend;
622 TSharedPtr<class FI3DHEventBackend> EventBackend;
623 TSharedPtr<class FI3DHRenderBackend> RenderBackend;
633 AI3DHGeometry* SpawnGeometryActor(AActor* AttachActor, int32 RootNodeId, const struct FI3DHInstanceSpawnProperties& SpawnProperties);
642 UStaticMeshComponent* SpawnMeshComponentFromTask(FI3DHPageInstanceHandle PageInstanceHandle, AI3DHGeometry* AttachActor, const FI3DHPageToStaticMeshTask& Task);
649 void FinishPhysicsAsyncCook(bool bSuccess, UBodySetup* FinishedBodySetup);
655 void SetAppearance_Internal(const FLinearColor& OverrideColor, EAppearanceURIMode OverrideMode, const TArray<int32>& RootNodeIds);
662 void SetTransforms_Internal(const TArray<FMatrix>& GlobalTransforms, const TArray<int32>& RootNodeIds);
670 void SetEnabled_Internal(bool bNewEnabled, const TArray<int32>& RootNodeIds);
678 void SetVariantEnabled_Internal(bool bNewVariantEnabled, const TArray<int32>& RootNodeIds);
685 void SetSelected_Internal(bool bNewSelected, const TArray<int32>& RootNodeIds);
692 void UpdateMeshComponentVisibilityAfterActorHiddenInGameStateChange_Internal(AI3DHGeometry* GeometryActor);
694 struct HubCameraParameters
698 FMatrix44f ViewMatrix;
699 FMatrix44f ProjectionMatrix;
706 HubCameraParameters GetHubCameraParamsForPlayer(const APlayerController* PlayerController);
708 void ViewSyncTimerCallback();