33#include <NDEVR/Model.h>
34#include <NDEVR/SelectionInfo.h>
35#include <NDEVR/SnapLocation.h>
36#include <NDEVR/CameraBackground.h>
37#include <NDEVR/AutoZoomFocus.h>
38#include <NDEVR/CameraAnimation.h>
39#include <NDEVR/Resource.h>
40#include <NDEVR/Time.h>
41#include <NDEVR/TimeSpan.h>
42#include <NDEVR/BaseValues.h>
43#include <NDEVR/Vector.h>
44#include <NDEVR/Angle.h>
45#include <NDEVR/BasicResourceListener.h>
53 Resource<Vertex<3, fltp08>> offset;
54 Resource<Vector<3, Angle<fltp08>>> orientation;
55 Resource<Vertex<3, fltp08>> target;
57 Resource<fltp08> near_plane;
58 Resource<fltp08> far_plane;
59 Resource<fltp08> zoom_extent_mult;
61 Resource<Vector<2, Angle<fltp08>>> perspective_fov;
62 Resource<Vector<2, fltp08>> orthographic_fov;
64 Resource<Time> last_update_time;
65 Resource<bool> location_lock;
66 Resource<bool> rotation_lock;
67 Resource<bool> is_orthographic;
68 Resource<bool> is_exposed;
69 Resource<fltp08> plane_intercept_value;
70 Resource<fltp08> orthographic_perspective_ratio;
71 Resource<SelectionInfo> selection_info;
73 DynamicPointer<Dictionary<UUID, bool>> visible_items;
76 Camera(Model& camera);
77 Camera(
const Camera& camera);
78 const Ray<3, fltp08>& getLookat()
const;
79 bool refreshMovement(
const Time& current_time,
const DesignObjectLookup* lookup,
const TimeSpan& time_out = TimeSpan(0.2));
80 void refreshFocusBounds(
const DesignObjectLookup* lookup);
82 void clearAnimations();
83 void move(
const Ray<3, fltp08>& distance);
84 void move(
const Ray<3, fltp08>& distance,
const CameraAnimation& original);
85 void zoom(fltp08 distance_mult,
const CameraAnimation& original);
86 void moveForward(fltp08 distance);
87 void moveHorizontal(fltp08 distance);
88 void moveVertical(fltp08 distance);
89 void move(fltp08 horizontal_distance, fltp08 vertical_distance);
90 void move(fltp08 horizontal_distance, fltp08 vertical_distance,
const CameraAnimation& original);
91 void lookHorizontal(fltp08 percent);
92 void lookVertical(fltp08 percent);
93 void look(fltp08 horz_percent, fltp08 vert_percent);
94 void look(fltp08 horz_percent, fltp08 vert_percent,
const CameraAnimation& original);
96 void moveHorizontalPercent(fltp08 percent);
97 void moveVerticalPercent(fltp08 percent);
98 void movePercent(fltp08 horizontal_percent, fltp08 vertical_percent);
99 void movePercent(fltp08 horizontal_percent, fltp08 vertical_percent,
const CameraAnimation& original);
100 void panPercent(fltp08 horizontal_percent, fltp08 vertical_percent,
const CameraAnimation& original);
101 void addAnimation(CameraAnimation animation,
bool clear_current_animations =
true);
102 void addZoomAnimation(fltp08 distance_mult,
const TimeSpan& time,
bool clear_animations =
true);
103 void addLookatAnimation(Vector<3, fltp08> lookat,
const TimeSpan& time,
bool clear_animations =
true);
104 void addIsOrthographicAnimation(
bool is_orthographic,
const TimeSpan& time,
bool clear_animations =
true);
105 void addOrbitAnimation(Vector<3, fltp08> target, Vector<3, Angle<fltp08>> orient, fltp08 zoom,
bool face_target,
const TimeSpan& time,
bool clear_animations =
true);
106 void setAutoZoomFocus(AutoZoomFocus focus);
107 void addZoomToExtentsAnimation(SnapLocation location, Bounds<3, fltp08>
object,
const TimeSpan& time,
bool use_true_extents =
true,
bool clear_animations =
true, Vector<3, Angle<fltp08>> angle_offsets = Vector<3, Angle<fltp08>>(Angle<fltp08>(0)));
108 void addZoomToExtentsAnimation(Bounds<3, fltp08>
object,
const TimeSpan& time,
bool use_true_extents =
true,
bool clear_animations =
true, Vector<3, Angle<fltp08>> angle_offsets = Vector<3, Angle<fltp08>>(Angle<fltp08>(0)));
109 void addZoomToExtentsAnimation(Vector<3, Angle<fltp08>> orientation, Bounds<3, fltp08>
object,
const TimeSpan& time,
bool use_true_extents =
true,
bool clear_animations =
true);
110 void addZoomMultiplierAnimation(fltp08 multiplier,
const TimeSpan& time,
bool clear_animations =
true);
111 void postUpdateBackground();
112 void clearAutozoomFocus();
113 bool hasFullAutoFocus()
const;
115 void writeMetaData();
118 bool hasWorldGridAlignment()
const;
119 void copyFrom(
const Camera&
object);
120 void updateGridSpacing();
121 bool isUserCamera()
const;
122 void setupFromFormat(
const ViewportFormat& format);
123 ViewportFormat format()
const;
124 bool isObjectPotentiallyVisibleToCamera(
const UUID&
id)
const;
125 [[nodiscard]] Matrix<fltp08> getLookatTransform()
const;
126 void setLookatTransform(
const Matrix<fltp08>& transform);
128 Vertex<2, fltp08> toScreenSpace(
const Vector<2, fltp04>& pixel_location)
const;
129 Vertex<3, fltp08> toWorldSpaceFromPixelSpace(
const Vector<2, fltp04>& pixel_location, fltp08 depth_percent)
const;
130 Vertex<3, fltp08> toWorldSpaceFromViewSpace(
const Vector<2, fltp08>& view_location, fltp08 depth_percent)
const;
131 SelectionInfo createSelectionInfo()
const;
132 SelectionInfo createSelectionInfo(
const Vector<2, fltp04>& pixel_location)
const;
133 SelectionInfo createSelectionInfo(
const Bounds<2, fltp04>& pixel_location)
const;
134 SelectionInfo createSelectionInfo(
const Polygon<fltp04>& pixel_location)
const;
135 Vector<3, Angle<fltp08>> gotoOrientation()
const;
136 Vector<2, Angle<fltp08>> activeFOV()
const;
137 Vector<2, fltp08> activeOrthoSize()
const;
138 Vector<3, fltp08> gotoLocation()
const;
139 Bounds<3, fltp08> getOrthographicBounds()
const;
140 Bounds<2, Angle<fltp08>> getPerspectiveBounds()
const;
141 Vector<2, uint04> windowSize()
const;
142 fltp08 pixelThickness()
const;
143 void setPixelThickness(fltp08 thickness);
144 void setNearPlaneBounds(
const Bounds<1, fltp08>& near_plane_bounds) { m_near_plane_bounds = near_plane_bounds; }
145 void setFarPlaneBounds(
const Bounds<1, fltp08>& near_plane_bounds) { m_far_plane_bounds = near_plane_bounds; }
146 const Bounds<1, fltp08>& nearPlaneBounds()
const {
return m_near_plane_bounds; }
147 const Bounds<1, fltp08>& farPlaneBounds()
const {
return m_far_plane_bounds; }
149 Matrix<fltp08> projectionMatrix()
const;
150 void setWindowSize(
const Vector<2, uint04>& size);
151 void setUseReferenceSize(
bool use_reference_size);
152 fltp08 calculatedReferenceSize()
const;
153 void setReferenceSize(fltp08 size);
154 Vector<2, Angle<fltp08>> getRotateAroundPoint(
const Vector<3, fltp04>& vCenter)
const;
155 Bounds<3, fltp08> getFocusBounds()
const {
return m_autozoom_focus.bounds; }
156 void setFocusBounds(
const Bounds<3, fltp08>& bounds) { m_autozoom_focus.bounds = bounds; }
158 const CameraBackground& cameraBackground()
const {
return m_camera_background; }
159 CameraBackground& cameraBackground() {
return m_camera_background; }
161 void _zoomToTargetModel(
const Model& model,
const DesignObjectLookup* lookup);
162 void _setupListeners();
163 Bounds<3, fltp08> boundsOfTargets(
const DesignObjectLookup* lookup)
const;
165 Ray<2, uint04> m_window_size;
168 Bounds<1, fltp08> m_near_plane_bounds;
169 Bounds<1, fltp08> m_far_plane_bounds;
171 Ray<3, fltp08> m_lookat;
172 Ray<3, fltp08> m_up_direction;
174 Vertex<3, fltp08> m_goto_initial_offset;
175 Vertex<3, fltp08> m_goto_initial_target;
176 Vector<3, Angle<fltp08>> m_goto_initial_orientation;
177 Vector<2, fltp08> m_goto_initial_ortho_bounds;
178 fltp08 m_goto_initial_zoom_extent_mult;
179 AutoZoomFocus m_autozoom_focus;
180 CameraBackground m_camera_background;
181 Matrix<fltp08> m_custom_transform;
182 Buffer<CameraAnimation> m_animations;
183 BasicResourceListener m_units_listener;
185 bool m_use_reference_size =
true;
186 bool m_refresh_background =
false;
188 void executeAnimations(Time current_time);
SnapLocation
Definition ViewLocation.h:37
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:181