Rerun C++ SDK
Loading...
Searching...
No Matches
eye_controls3d.hpp
1// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs
2// Based on "crates/build/re_type_definitions/rerun/blueprint/archetypes/eye_controls3d.def.rs".
3
4#pragma once
5
6#include "../../archetype_utils.hpp"
7#include "../../blueprint/components/angular_speed.hpp"
8#include "../../blueprint/components/eye3d_kind.hpp"
9#include "../../collection.hpp"
10#include "../../component_batch.hpp"
11#include "../../component_column.hpp"
12#include "../../components/entity_path.hpp"
13#include "../../components/linear_speed.hpp"
14#include "../../components/position3d.hpp"
15#include "../../components/vector3d.hpp"
16#include "../../result.hpp"
17
18#include <cstdint>
19#include <optional>
20#include <utility>
21#include <vector>
22
23namespace rerun::blueprint::archetypes {
24 /// **Archetype**: The controls for the 3D eye in a spatial 3D view.
25 ///
26 /// This configures the camera through which the 3D scene is viewed.
27 ///
28 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
29 ///
31 /// The kind of the eye for the spatial 3D view.
32 ///
33 /// This controls how the eye movement behaves when the user interact with the view.
34 /// Defaults to orbital.
35 std::optional<ComponentBatch> kind;
36
37 /// The cameras current position.
38 std::optional<ComponentBatch> position;
39
40 /// The position the camera is currently looking at.
41 ///
42 /// If this is an orbital camera, this also is the center it orbits around.
43 ///
44 /// By default this is the center of the scene bounds.
45 std::optional<ComponentBatch> look_target;
46
47 /// The up-axis of the eye itself, in world-space.
48 ///
49 /// Initially, the up-axis of the eye will be the same as the up-axis of the scene (or +Z if
50 /// the scene has no up axis defined).
51 std::optional<ComponentBatch> eye_up;
52
53 /// Translation speed of the eye in the view (when using WASDQE keys to move in the 3D scene).
54 ///
55 /// The default depends on the control kind.
56 /// For orbit cameras it is derived from the distance to the orbit center.
57 /// For first person cameras it is derived from the scene size.
58 std::optional<ComponentBatch> speed;
59
60 /// Currently tracked entity.
61 ///
62 /// If this is a camera, it takes over the camera pose, otherwise follows the entity.
63 std::optional<ComponentBatch> tracking_entity;
64
65 /// What speed, if any, the camera should spin around the eye-up axis.
66 ///
67 /// Defaults to zero, meaning no spinning.
68 std::optional<ComponentBatch> spin_speed;
69
70 public:
71 /// The name of the archetype as used in `ComponentDescriptor`s.
72 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.EyeControls3D";
73
74 /// `ComponentDescriptor` for the `kind` field.
75 static constexpr auto Descriptor_kind = ComponentDescriptor(
76 ArchetypeName, "EyeControls3D:kind",
78 );
79 /// `ComponentDescriptor` for the `position` field.
81 ArchetypeName, "EyeControls3D:position",
83 );
84 /// `ComponentDescriptor` for the `look_target` field.
86 ArchetypeName, "EyeControls3D:look_target",
88 );
89 /// `ComponentDescriptor` for the `eye_up` field.
90 static constexpr auto Descriptor_eye_up = ComponentDescriptor(
91 ArchetypeName, "EyeControls3D:eye_up",
93 );
94 /// `ComponentDescriptor` for the `speed` field.
95 static constexpr auto Descriptor_speed = ComponentDescriptor(
96 ArchetypeName, "EyeControls3D:speed",
98 );
99 /// `ComponentDescriptor` for the `tracking_entity` field.
101 ArchetypeName, "EyeControls3D:tracking_entity",
103 );
104 /// `ComponentDescriptor` for the `spin_speed` field.
106 ArchetypeName, "EyeControls3D:spin_speed",
108 );
109
110 public:
111 EyeControls3D() = default;
112 EyeControls3D(EyeControls3D&& other) = default;
113 EyeControls3D(const EyeControls3D& other) = default;
114 EyeControls3D& operator=(const EyeControls3D& other) = default;
115 EyeControls3D& operator=(EyeControls3D&& other) = default;
116
117 /// Update only some specific fields of a `EyeControls3D`.
119 return EyeControls3D();
120 }
121
122 /// Clear all the fields of a `EyeControls3D`.
124
125 /// The kind of the eye for the spatial 3D view.
126 ///
127 /// This controls how the eye movement behaves when the user interact with the view.
128 /// Defaults to orbital.
129 EyeControls3D with_kind(const rerun::blueprint::components::Eye3DKind& _kind) && {
130 kind = ComponentBatch::from_loggable(_kind, Descriptor_kind).value_or_throw();
131 return std::move(*this);
132 }
133
134 /// The cameras current position.
136 position =
137 ComponentBatch::from_loggable(_position, Descriptor_position).value_or_throw();
138 return std::move(*this);
139 }
140
141 /// The position the camera is currently looking at.
142 ///
143 /// If this is an orbital camera, this also is the center it orbits around.
144 ///
145 /// By default this is the center of the scene bounds.
148 .value_or_throw();
149 return std::move(*this);
150 }
151
152 /// The up-axis of the eye itself, in world-space.
153 ///
154 /// Initially, the up-axis of the eye will be the same as the up-axis of the scene (or +Z if
155 /// the scene has no up axis defined).
157 eye_up = ComponentBatch::from_loggable(_eye_up, Descriptor_eye_up).value_or_throw();
158 return std::move(*this);
159 }
160
161 /// Translation speed of the eye in the view (when using WASDQE keys to move in the 3D scene).
162 ///
163 /// The default depends on the control kind.
164 /// For orbit cameras it is derived from the distance to the orbit center.
165 /// For first person cameras it is derived from the scene size.
167 speed = ComponentBatch::from_loggable(_speed, Descriptor_speed).value_or_throw();
168 return std::move(*this);
169 }
170
171 /// Currently tracked entity.
172 ///
173 /// If this is a camera, it takes over the camera pose, otherwise follows the entity.
175 ) && {
178 .value_or_throw();
179 return std::move(*this);
180 }
181
182 /// What speed, if any, the camera should spin around the eye-up axis.
183 ///
184 /// Defaults to zero, meaning no spinning.
186 ) && {
187 spin_speed =
188 ComponentBatch::from_loggable(_spin_speed, Descriptor_spin_speed).value_or_throw();
189 return std::move(*this);
190 }
191
192 /// Partitions the component data into multiple sub-batches.
193 ///
194 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
195 /// instead, via `ComponentBatch::partitioned`.
196 ///
197 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
198 ///
199 /// The specified `lengths` must sum to the total length of the component batch.
201 return detail::partition_batches(
202 {&kind,
203 &position,
205 &eye_up,
206 &speed,
208 &spin_speed},
209 lengths_
210 )
211 .value_or_throw();
212 }
213
214 /// Partitions the component data into unit-length sub-batches.
215 ///
216 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
217 /// where `n` is automatically guessed.
219 return detail::partition_batches_of_unit_length({&kind,
220 &position,
222 &eye_up,
223 &speed,
225 &spin_speed})
226 .value_or_throw();
227 }
228 };
229
230} // namespace rerun::blueprint::archetypes
231
232namespace rerun {
233 /// \private
234 template <typename T>
235 struct AsComponents;
236
237 /// \private
238 template <>
239 struct AsComponents<blueprint::archetypes::EyeControls3D> {
240 /// Serialize all set component batches.
241 static Result<Collection<ComponentBatch>> as_batches(
243 ) {
244 return detail::collect_batches(
245 {&archetype.kind,
246 &archetype.position,
247 &archetype.look_target,
248 &archetype.eye_up,
249 &archetype.speed,
250 &archetype.tracking_entity,
251 &archetype.spin_speed}
252 );
253 }
254 };
255} // namespace rerun
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
A class for representing either a usable value, or an error.
Definition result.hpp:14
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:26
static Result< ComponentBatch > from_loggable(const rerun::Collection< T > &components, const ComponentDescriptor &descriptor)
Creates a new component batch from a collection of component instances.
Definition component_batch.hpp:46
A ComponentDescriptor fully describes the semantics of a column of data.
Definition component_descriptor.hpp:16
The Loggable trait is used by all built-in implementation of rerun::AsComponents to serialize a colle...
Definition loggable.hpp:11
Archetype: The controls for the 3D eye in a spatial 3D view.
Definition eye_controls3d.hpp:30
static constexpr auto Descriptor_kind
ComponentDescriptor for the kind field.
Definition eye_controls3d.hpp:75
std::optional< ComponentBatch > kind
The kind of the eye for the spatial 3D view.
Definition eye_controls3d.hpp:35
EyeControls3D with_position(const rerun::components::Position3D &_position) &&
The cameras current position.
Definition eye_controls3d.hpp:135
static constexpr auto Descriptor_tracking_entity
ComponentDescriptor for the tracking_entity field.
Definition eye_controls3d.hpp:100
std::optional< ComponentBatch > look_target
The position the camera is currently looking at.
Definition eye_controls3d.hpp:45
std::optional< ComponentBatch > eye_up
The up-axis of the eye itself, in world-space.
Definition eye_controls3d.hpp:51
static EyeControls3D clear_fields()
Clear all the fields of a EyeControls3D.
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition eye_controls3d.hpp:72
static constexpr auto Descriptor_position
ComponentDescriptor for the position field.
Definition eye_controls3d.hpp:80
EyeControls3D with_kind(const rerun::blueprint::components::Eye3DKind &_kind) &&
The kind of the eye for the spatial 3D view.
Definition eye_controls3d.hpp:129
EyeControls3D with_speed(const rerun::components::LinearSpeed &_speed) &&
Translation speed of the eye in the view (when using WASDQE keys to move in the 3D scene).
Definition eye_controls3d.hpp:166
EyeControls3D with_eye_up(const rerun::components::Vector3D &_eye_up) &&
The up-axis of the eye itself, in world-space.
Definition eye_controls3d.hpp:156
static constexpr auto Descriptor_eye_up
ComponentDescriptor for the eye_up field.
Definition eye_controls3d.hpp:90
std::optional< ComponentBatch > speed
Translation speed of the eye in the view (when using WASDQE keys to move in the 3D scene).
Definition eye_controls3d.hpp:58
static EyeControls3D update_fields()
Update only some specific fields of a EyeControls3D.
Definition eye_controls3d.hpp:118
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Definition eye_controls3d.hpp:200
static constexpr auto Descriptor_look_target
ComponentDescriptor for the look_target field.
Definition eye_controls3d.hpp:85
EyeControls3D with_look_target(const rerun::components::Position3D &_look_target) &&
The position the camera is currently looking at.
Definition eye_controls3d.hpp:146
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Definition eye_controls3d.hpp:218
static constexpr auto Descriptor_spin_speed
ComponentDescriptor for the spin_speed field.
Definition eye_controls3d.hpp:105
static constexpr auto Descriptor_speed
ComponentDescriptor for the speed field.
Definition eye_controls3d.hpp:95
std::optional< ComponentBatch > position
The cameras current position.
Definition eye_controls3d.hpp:38
EyeControls3D with_spin_speed(const rerun::blueprint::components::AngularSpeed &_spin_speed) &&
What speed, if any, the camera should spin around the eye-up axis.
Definition eye_controls3d.hpp:185
std::optional< ComponentBatch > tracking_entity
Currently tracked entity.
Definition eye_controls3d.hpp:63
EyeControls3D with_tracking_entity(const rerun::components::EntityPath &_tracking_entity) &&
Currently tracked entity.
Definition eye_controls3d.hpp:174
std::optional< ComponentBatch > spin_speed
What speed, if any, the camera should spin around the eye-up axis.
Definition eye_controls3d.hpp:68
Component: Angular speed, used for rotation speed for example.
Definition angular_speed.hpp:17
Component: A path to an entity, usually to reference some data that is part of the target entity.
Definition entity_path.hpp:16
Component: Linear speed, used for translation speed for example.
Definition linear_speed.hpp:14
Component: A position in 3D space.
Definition position3d.hpp:15
Component: A vector in 3D space.
Definition vector3d.hpp:15