Cesium for Unreal 2.24.1
Loading...
Searching...
No Matches
CesiumCamera.h
Go to the documentation of this file.
1// Copyright 2020-2024 CesiumGS, Inc. and Contributors
2
3#pragma once
4
5#include "Camera/CameraComponent.h"
6#include "Math/Rotator.h"
7#include "Math/Vector.h"
8#include "Math/Vector2D.h"
9#include "UObject/ObjectMacros.h"
10
11#include "Cesium3DTilesSelection/ViewState.h"
12
13#include "CesiumCamera.generated.h"
14
15UENUM(BlueprintType)
16enum class ECameraParameterSource : uint8 {
17 /**
18 * Camera parameters are set explicitly by the user.
19 */
20 Manual UMETA(DisplayName = "Set Manually"),
21
22 /**
23 * Camera parameters come from a camera component
24 */
25 CameraComponent UMETA(DisplayName = "From Camera Component")
26};
27
28/**
29 * @brief A camera description that {@link ACesium3DTileset}s can use to decide
30 * what tiles need to be loaded to sufficiently cover the camera view.
31 */
32USTRUCT(BlueprintType)
33struct CESIUMRUNTIME_API FCesiumCamera {
34 GENERATED_USTRUCT_BODY()
35
36public:
37 /**
38 * @brief The desired source of camera parameters.
39 */
40 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium")
42
43 /**
44 * @brief The pixel dimensions of the viewport.
45 */
46 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium")
47 FVector2D ViewportSize;
48
49 /**
50 * @brief The camera component from which to retrieve parameters. Due to
51 * UI limitations, this property must be set through Blueprints or C++. Used
52 * when ParameterSource is set to Camera Component.
53 */
54 UPROPERTY(
55 EditAnywhere,
56 BlueprintReadWrite,
57 Category = "Cesium",
58 Meta =
59 (EditCondition =
60 "ParameterSource == ECameraParameterSource::CameraComponent"))
61 TSoftObjectPtr<UCameraComponent> CameraComponent;
62
63 /**
64 * @brief The Unreal location of the camera. Used when Parameter Source is set
65 * to Manual.
66 */
67 UPROPERTY(
68 EditAnywhere,
69 BlueprintReadWrite,
70 Category = "Cesium",
71 Meta =
72 (EditCondition = "ParameterSource == ECameraParameterSource::Manual"))
73 FVector Location;
74
75 /**
76 * @brief The Unreal rotation of the camera. Used when Parameter Source is set
77 * to Manual.
78 */
79 UPROPERTY(
80 EditAnywhere,
81 BlueprintReadWrite,
82 Category = "Cesium",
83 Meta =
84 (EditCondition = "ParameterSource == ECameraParameterSource::Manual"))
85 FRotator Rotation;
86
87 /**
88 * @brief The horizontal field of view of the camera in degrees. Used when
89 * Parameter Source is set to Manual.
90 */
91 UPROPERTY(
92 EditAnywhere,
93 BlueprintReadWrite,
94 Category = "Cesium",
95 Meta =
96 (EditCondition = "ParameterSource == ECameraParameterSource::Manual"))
98
99 /**
100 * @brief The overriden aspect ratio for this camera.
101 *
102 * When this is 0.0f, use the aspect ratio implied by ViewportSize.
103 *
104 * This may be different from the aspect ratio implied by the ViewportSize
105 * and black bars are added as needed in order to achieve this aspect ratio
106 * within a larger viewport.
107 */
108 UPROPERTY(BlueprintReadWrite, Category = "Cesium")
110
111 /**
112 * @brief Construct an uninitialized FCesiumCamera object.
113 */
115
116 /**
117 * @brief Construct a new FCesiumCamera object.
118 *
119 * @param ViewportSize The viewport pixel size.
120 * @param Location The Unreal location.
121 * @param Rotation The Unreal rotation.
122 * @param FieldOfViewDegrees The horizontal field of view in degrees.
123 */
125 const FVector2D& ViewportSize,
126 const FVector& Location,
127 const FRotator& Rotation,
128 double FieldOfViewDegrees);
129
130 /**
131 * @brief Construct a new FCesiumCamera object.
132 *
133 * @param ViewportSize The viewport pixel size.
134 * @param Location The Unreal location.
135 * @param Rotation The Unreal rotation.
136 * @param FieldOfViewDegrees The horizontal field of view in degrees.
137 * @param OverrideAspectRatio The overriden aspect ratio.
138 */
140 const FVector2D& ViewportSize,
141 const FVector& Location,
142 const FRotator& Rotation,
143 double FieldOfViewDegrees,
144 double OverrideAspectRatio);
145};
ECameraParameterSource
@ UMETA
Camera parameters are set explicitly by the user.
double OverrideAspectRatio
The overriden aspect ratio for this camera.
FVector Location
The Unreal location of the camera.
ECameraParameterSource ParameterSource
The desired source of camera parameters.
TSoftObjectPtr< UCameraComponent > CameraComponent
The camera component from which to retrieve parameters.
FRotator Rotation
The Unreal rotation of the camera.
FVector2D ViewportSize
The pixel dimensions of the viewport.
double FieldOfViewDegrees
The horizontal field of view of the camera in degrees.
FCesiumCamera()
Construct an uninitialized FCesiumCamera object.