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>
58 Resource<Vertex<3, fltp08>> offset;
59 Resource<Vector<3, Angle<fltp08>>> orientation;
60 Resource<Vertex<3, fltp08>> target;
62 Resource<fltp08> near_plane;
63 Resource<fltp08> far_plane;
64 Resource<fltp08> zoom_extent_mult;
66 Resource<Vector<2, Angle<fltp08>>> perspective_fov;
67 Resource<Vector<2, fltp08>> orthographic_fov;
69 Resource<Time> last_update_time;
70 Resource<bool> location_lock;
71 Resource<bool> rotation_lock;
72 Resource<bool> is_orthographic;
73 Resource<bool> is_exposed;
74 Resource<fltp08> plane_intercept_value;
75 Resource<fltp08> orthographic_perspective_ratio;
76 Resource<SelectionInfo> selection_info;
78 DynamicPointer<Dictionary<UUID, bool>> visible_items;
81 Camera(Model& camera);
82 Camera(
const Camera& camera);
83 const Ray<3, fltp08>& getLookat()
const;
84 bool refreshMovement(
const Time& current_time,
const DesignObjectLookup* lookup,
const TimeSpan& time_out = TimeSpan(0.2));
85 void refreshFocusBounds(
const DesignObjectLookup* lookup);
87 void clearAnimations();
88 void move(
const Ray<3, fltp08>& distance);
89 void move(
const Ray<3, fltp08>& distance,
const CameraAnimation& original);
90 void zoom(fltp08 distance_mult,
const CameraAnimation& original);
91 void moveForward(fltp08 distance);
92 void moveHorizontal(fltp08 distance);
93 void moveVertical(fltp08 distance);
94 void move(fltp08 horizontal_distance, fltp08 vertical_distance);
95 void move(fltp08 horizontal_distance, fltp08 vertical_distance,
const CameraAnimation& original);
96 void lookHorizontal(fltp08 percent);
97 void lookVertical(fltp08 percent);
98 void look(fltp08 horz_percent, fltp08 vert_percent);
99 void look(fltp08 horz_percent, fltp08 vert_percent,
const CameraAnimation& original);
101 void moveHorizontalPercent(fltp08 percent);
102 void moveVerticalPercent(fltp08 percent);
103 void movePercent(fltp08 horizontal_percent, fltp08 vertical_percent);
104 void movePercent(fltp08 horizontal_percent, fltp08 vertical_percent,
const CameraAnimation& original);
105 void panPercent(fltp08 horizontal_percent, fltp08 vertical_percent,
const CameraAnimation& original);
106 void addAnimation(CameraAnimation animation,
bool clear_current_animations =
true);
107 void addZoomAnimation(fltp08 distance_mult,
const TimeSpan& time,
bool clear_animations =
true);
108 void addLookatAnimation(Vector<3, fltp08> lookat,
const TimeSpan& time,
bool clear_animations =
true);
109 void addIsOrthographicAnimation(
bool is_orthographic,
const TimeSpan& time,
bool clear_animations =
true);
110 void addOrbitAnimation(Vector<3, fltp08> target, Vector<3, Angle<fltp08>> orient, fltp08 zoom,
bool face_target,
const TimeSpan& time,
bool clear_animations =
true);
111 void setAutoZoomFocus(AutoZoomFocus focus);
112 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)));
113 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)));
114 void addZoomToExtentsAnimation(Vector<3, Angle<fltp08>> orientation, Bounds<3, fltp08>
object,
const TimeSpan& time,
bool use_true_extents =
true,
bool clear_animations =
true);
115 void addZoomMultiplierAnimation(fltp08 multiplier,
const TimeSpan& time,
bool clear_animations =
true);
116 void postUpdateBackground();
117 void clearAutozoomFocus();
118 bool hasFullAutoFocus()
const;
120 void writeMetaData();
123 bool hasWorldGridAlignment()
const;
124 void copyFrom(
const Camera&
object);
125 void updateGridSpacing();
126 bool isUserCamera()
const;
127 void setupFromFormat(
const ViewportFormat& format);
128 ViewportFormat format()
const;
129 bool isObjectPotentiallyVisibleToCamera(
const UUID&
id)
const;
130 [[nodiscard]] Matrix<fltp08> getLookatTransform()
const;
131 void setLookatTransform(
const Matrix<fltp08>& transform);
133 Vertex<2, fltp08> toScreenSpace(
const Vector<2, fltp04>& pixel_location)
const;
134 Vertex<3, fltp08> toWorldSpaceFromPixelSpace(
const Vector<2, fltp04>& pixel_location, fltp08 depth_percent)
const;
135 Vertex<3, fltp08> toWorldSpaceFromViewSpace(
const Vector<2, fltp08>& view_location, fltp08 depth_percent)
const;
136 SelectionInfo createSelectionInfo()
const;
137 SelectionInfo createSelectionInfo(
const Vector<2, fltp04>& pixel_location)
const;
138 SelectionInfo createSelectionInfo(
const Bounds<2, fltp04>& pixel_location)
const;
139 SelectionInfo createSelectionInfo(
const Polygon<fltp04>& pixel_location)
const;
140 Vector<3, Angle<fltp08>> gotoOrientation()
const;
141 Vector<2, Angle<fltp08>> activeFOV()
const;
142 Vector<2, fltp08> activeOrthoSize()
const;
143 Vector<3, fltp08> gotoLocation()
const;
144 Bounds<3, fltp08> getOrthographicBounds()
const;
145 Bounds<2, Angle<fltp08>> getPerspectiveBounds()
const;
146 Vector<2, uint04> windowSize()
const;
147 fltp08 pixelThickness()
const;
148 void setPixelThickness(fltp08 thickness);
149 void setNearPlaneBounds(
const Bounds<1, fltp08>& near_plane_bounds) { m_near_plane_bounds = near_plane_bounds; }
150 void setFarPlaneBounds(
const Bounds<1, fltp08>& near_plane_bounds) { m_far_plane_bounds = near_plane_bounds; }
151 const Bounds<1, fltp08>& nearPlaneBounds()
const {
return m_near_plane_bounds; }
152 const Bounds<1, fltp08>& farPlaneBounds()
const {
return m_far_plane_bounds; }
154 Matrix<fltp08> projectionMatrix()
const;
155 void setWindowSize(
const Vector<2, uint04>& size);
156 void setUseReferenceSize(
bool use_reference_size);
157 fltp08 calculatedReferenceSize()
const;
158 void setReferenceSize(fltp08 size);
159 Vector<2, Angle<fltp08>> getRotateAroundPoint(
const Vector<3, fltp04>& vCenter)
const;
160 Bounds<3, fltp08> getFocusBounds()
const {
return m_autozoom_focus.bounds; }
161 void setFocusBounds(
const Bounds<3, fltp08>& bounds) { m_autozoom_focus.bounds = bounds; }
163 const CameraBackground& cameraBackground()
const {
return m_camera_background; }
164 CameraBackground& cameraBackground() {
return m_camera_background; }
166 void _zoomToTargetModel(
const Model& model,
const DesignObjectLookup* lookup);
167 void _setupListeners();
168 Bounds<3, fltp08> boundsOfTargets(
const DesignObjectLookup* lookup)
const;
170 Ray<2, uint04> m_window_size;
173 Bounds<1, fltp08> m_near_plane_bounds;
174 Bounds<1, fltp08> m_far_plane_bounds;
176 Ray<3, fltp08> m_lookat;
177 Ray<3, fltp08> m_up_direction;
179 Vertex<3, fltp08> m_goto_initial_offset;
180 Vertex<3, fltp08> m_goto_initial_target;
181 Vector<3, Angle<fltp08>> m_goto_initial_orientation;
182 Vector<2, fltp08> m_goto_initial_ortho_bounds;
183 fltp08 m_goto_initial_zoom_extent_mult;
184 AutoZoomFocus m_autozoom_focus;
185 CameraBackground m_camera_background;
186 Matrix<fltp08> m_custom_transform;
187 Buffer<CameraAnimation> m_animations;
188 BasicResourceListener m_units_listener;
190 bool m_use_reference_size =
true;
191 bool m_refresh_background =
false;
193 void executeAnimations(Time current_time);
SnapLocation
A list of directions that a view can be pointed relative to an object or scene.
Definition ViewLocation.h:40
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:149