Cesium for Unreal 2.13.2
Loading...
Searching...
No Matches
CesiumCameraManager.h
Go to the documentation of this file.
1// Copyright 2020-2024 CesiumGS, Inc. and Contributors
2
3#pragma once
4
5#include "CesiumCamera.h"
6#include "Containers/Map.h"
7#include "GameFramework/Actor.h"
8
9#include "CesiumCameraManager.generated.h"
10
11/**
12 * @brief Manages custom {@link FCesiumCamera}s for all
13 * {@link ACesium3DTileset}s in the world.
14 */
15UCLASS()
16class CESIUMRUNTIME_API ACesiumCameraManager : public AActor {
17 GENERATED_BODY()
18
19public:
20 /**
21 * @brief Get the camera manager for this world.
22 */
23 UFUNCTION(
24 BlueprintCallable,
25 Category = "CesiumCameraManager",
26 meta = (WorldContext = "WorldContextObject"))
28 GetDefaultCameraManager(const UObject* WorldContextObject);
29
31
32 /**
33 * @brief Register a new camera with the camera manager.
34 *
35 * @param Camera The current state for the new camera.
36 * @return The generated ID for this camera. Use this ID to refer to the
37 * camera in the future when calling UpdateCamera.
38 */
39 UFUNCTION(BlueprintCallable, Category = "Cesium")
40 int32 AddCamera(UPARAM(ref) const FCesiumCamera& Camera);
41
42 /**
43 * @brief Unregister an existing camera with the camera manager.
44 *
45 * @param CameraId The ID of the camera, as returned by AddCamera during
46 * registration.
47 * @return Whether the updating was successful. If false, the CameraId was
48 * invalid.
49 */
50 UFUNCTION(BlueprintCallable, Category = "Cesium")
51 bool RemoveCamera(int32 CameraId);
52
53 /**
54 * @brief Update the state of the specified camera.
55 *
56 * @param CameraId The ID of the camera, as returned by AddCamera during
57 * registration.
58 * @param Camera The new, updated state of the camera.
59 * @return Whether the updating was successful. If false, the CameraId was
60 * invalid.
61 */
62 UFUNCTION(BlueprintCallable, Category = "Cesium")
63 bool UpdateCamera(int32 CameraId, UPARAM(ref) const FCesiumCamera& Camera);
64
65 /**
66 * @brief Get a read-only map of the current camera IDs to cameras.
67 */
68 UFUNCTION(BlueprintCallable, Category = "Cesium")
69 const TMap<int32, FCesiumCamera>& GetCameras() const;
70
71 virtual bool ShouldTickIfViewportsOnly() const override;
72
73 virtual void Tick(float DeltaTime) override;
74
75private:
76 int32 _currentCameraId = 0;
77 TMap<int32, FCesiumCamera> _cameras;
78
79 static FName DEFAULT_CAMERAMANAGER_TAG;
80};
Manages custom FCesiumCameras for all ACesium3DTilesets in the world.
static ACesiumCameraManager * GetDefaultCameraManager(const UObject *WorldContextObject)
Get the camera manager for this world.
A camera description that ACesium3DTilesets can use to decide what tiles need to be loaded to suffici...