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/store/re_sdk_types/definitions/rerun/blueprint/archetypes/eye_controls3d.fbs".
3
4#pragma once
5
6#include "../../blueprint/components/angular_speed.hpp"
7#include "../../blueprint/components/eye3d_kind.hpp"
8#include "../../collection.hpp"
9#include "../../component_batch.hpp"
10#include "../../component_column.hpp"
11#include "../../components/entity_path.hpp"
12#include "../../components/linear_speed.hpp"
13#include "../../components/position3d.hpp"
14#include "../../components/vector3d.hpp"
15#include "../../result.hpp"
16
17#include <cstdint>
18#include <optional>
19#include <utility>
20#include <vector>
21
22namespace rerun::blueprint::archetypes {
23 /// **Archetype**: The controls for the 3D eye in a spatial 3D view.
24 ///
25 /// This configures the camera through which the 3D scene is viewed.
26 ///
27 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
28 ///
30 /// The kind of the eye for the spatial 3D view.
31 ///
32 /// This controls how the eye movement behaves when the user interact with the view.
33 /// Defaults to orbital.
34 std::optional<ComponentBatch> kind;
35
36 /// The cameras current position.
37 std::optional<ComponentBatch> position;
38
39 /// The position the camera is currently looking at.
40 ///
41 /// If this is an orbital camera, this also is the center it orbits around.
42 ///
43 /// By default this is the center of the scene bounds.
44 std::optional<ComponentBatch> look_target;
45
46 /// The up-axis of the eye itself, in world-space.
47 ///
48 /// Initially, the up-axis of the eye will be the same as the up-axis of the scene (or +Z if
49 /// the scene has no up axis defined).
50 std::optional<ComponentBatch> eye_up;
51
52 /// Translation speed of the eye in the view (when using WASDQE keys to move in the 3D scene).
53 ///
54 /// The default depends on the control kind.
55 /// For orbit cameras it is derived from the distance to the orbit center.
56 /// For first person cameras it is derived from the scene size.
57 std::optional<ComponentBatch> speed;
58
59 /// Currently tracked entity.
60 ///
61 /// If this is a camera, it takes over the camera pose, otherwise follows the entity.
62 std::optional<ComponentBatch> tracking_entity;
63
64 /// What speed, if any, the camera should spin around the eye-up axis.
65 ///
66 /// Defaults to zero, meaning no spinning.
67 std::optional<ComponentBatch> spin_speed;
68
69 public:
70 /// The name of the archetype as used in `ComponentDescriptor`s.
71 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.EyeControls3D";
72
73 /// `ComponentDescriptor` for the `kind` field.
74 static constexpr auto Descriptor_kind = ComponentDescriptor(
75 ArchetypeName, "EyeControls3D:kind",
77 );
78 /// `ComponentDescriptor` for the `position` field.
80 ArchetypeName, "EyeControls3D:position",
82 );
83 /// `ComponentDescriptor` for the `look_target` field.
85 ArchetypeName, "EyeControls3D:look_target",
87 );
88 /// `ComponentDescriptor` for the `eye_up` field.
89 static constexpr auto Descriptor_eye_up = ComponentDescriptor(
90 ArchetypeName, "EyeControls3D:eye_up",
92 );
93 /// `ComponentDescriptor` for the `speed` field.
94 static constexpr auto Descriptor_speed = ComponentDescriptor(
95 ArchetypeName, "EyeControls3D:speed",
97 );
98 /// `ComponentDescriptor` for the `tracking_entity` field.
100 ArchetypeName, "EyeControls3D:tracking_entity",
102 );
103 /// `ComponentDescriptor` for the `spin_speed` field.
105 ArchetypeName, "EyeControls3D:spin_speed",
107 );
108
109 public:
110 EyeControls3D() = default;
111 EyeControls3D(EyeControls3D&& other) = default;
112 EyeControls3D(const EyeControls3D& other) = default;
113 EyeControls3D& operator=(const EyeControls3D& other) = default;
114 EyeControls3D& operator=(EyeControls3D&& other) = default;
115
116 /// Update only some specific fields of a `EyeControls3D`.
118 return EyeControls3D();
119 }
120
121 /// Clear all the fields of a `EyeControls3D`.
123
124 /// The kind of the eye for the spatial 3D view.
125 ///
126 /// This controls how the eye movement behaves when the user interact with the view.
127 /// Defaults to orbital.
128 EyeControls3D with_kind(const rerun::blueprint::components::Eye3DKind& _kind) && {
129 kind = ComponentBatch::from_loggable(_kind, Descriptor_kind).value_or_throw();
130 return std::move(*this);
131 }
132
133 /// The cameras current position.
135 position =
136 ComponentBatch::from_loggable(_position, Descriptor_position).value_or_throw();
137 return std::move(*this);
138 }
139
140 /// The position the camera is currently looking at.
141 ///
142 /// If this is an orbital camera, this also is the center it orbits around.
143 ///
144 /// By default this is the center of the scene bounds.
147 .value_or_throw();
148 return std::move(*this);
149 }
150
151 /// The up-axis of the eye itself, in world-space.
152 ///
153 /// Initially, the up-axis of the eye will be the same as the up-axis of the scene (or +Z if
154 /// the scene has no up axis defined).
156 eye_up = ComponentBatch::from_loggable(_eye_up, Descriptor_eye_up).value_or_throw();
157 return std::move(*this);
158 }
159
160 /// Translation speed of the eye in the view (when using WASDQE keys to move in the 3D scene).
161 ///
162 /// The default depends on the control kind.
163 /// For orbit cameras it is derived from the distance to the orbit center.
164 /// For first person cameras it is derived from the scene size.
166 speed = ComponentBatch::from_loggable(_speed, Descriptor_speed).value_or_throw();
167 return std::move(*this);
168 }
169
170 /// Currently tracked entity.
171 ///
172 /// If this is a camera, it takes over the camera pose, otherwise follows the entity.
174 ) && {
177 .value_or_throw();
178 return std::move(*this);
179 }
180
181 /// What speed, if any, the camera should spin around the eye-up axis.
182 ///
183 /// Defaults to zero, meaning no spinning.
185 ) && {
186 spin_speed =
187 ComponentBatch::from_loggable(_spin_speed, Descriptor_spin_speed).value_or_throw();
188 return std::move(*this);
189 }
190
191 /// Partitions the component data into multiple sub-batches.
192 ///
193 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
194 /// instead, via `ComponentBatch::partitioned`.
195 ///
196 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
197 ///
198 /// The specified `lengths` must sum to the total length of the component batch.
200
201 /// Partitions the component data into unit-length sub-batches.
202 ///
203 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
204 /// where `n` is automatically guessed.
206 };
207
208} // namespace rerun::blueprint::archetypes
209
210namespace rerun {
211 /// \private
212 template <typename T>
213 struct AsComponents;
214
215 /// \private
216 template <>
217 struct AsComponents<blueprint::archetypes::EyeControls3D> {
218 /// Serialize all set component batches.
219 static Result<Collection<ComponentBatch>> as_batches(
221 );
222 };
223} // 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:23
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:29
static constexpr auto Descriptor_kind
ComponentDescriptor for the kind field.
Definition eye_controls3d.hpp:74
std::optional< ComponentBatch > kind
The kind of the eye for the spatial 3D view.
Definition eye_controls3d.hpp:34
EyeControls3D with_position(const rerun::components::Position3D &_position) &&
The cameras current position.
Definition eye_controls3d.hpp:134
static constexpr auto Descriptor_tracking_entity
ComponentDescriptor for the tracking_entity field.
Definition eye_controls3d.hpp:99
std::optional< ComponentBatch > look_target
The position the camera is currently looking at.
Definition eye_controls3d.hpp:44
std::optional< ComponentBatch > eye_up
The up-axis of the eye itself, in world-space.
Definition eye_controls3d.hpp:50
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:71
static constexpr auto Descriptor_position
ComponentDescriptor for the position field.
Definition eye_controls3d.hpp:79
EyeControls3D with_kind(const rerun::blueprint::components::Eye3DKind &_kind) &&
The kind of the eye for the spatial 3D view.
Definition eye_controls3d.hpp:128
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:165
EyeControls3D with_eye_up(const rerun::components::Vector3D &_eye_up) &&
The up-axis of the eye itself, in world-space.
Definition eye_controls3d.hpp:155
static constexpr auto Descriptor_eye_up
ComponentDescriptor for the eye_up field.
Definition eye_controls3d.hpp:89
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:57
static EyeControls3D update_fields()
Update only some specific fields of a EyeControls3D.
Definition eye_controls3d.hpp:117
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
static constexpr auto Descriptor_look_target
ComponentDescriptor for the look_target field.
Definition eye_controls3d.hpp:84
EyeControls3D with_look_target(const rerun::components::Position3D &_look_target) &&
The position the camera is currently looking at.
Definition eye_controls3d.hpp:145
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
static constexpr auto Descriptor_spin_speed
ComponentDescriptor for the spin_speed field.
Definition eye_controls3d.hpp:104
static constexpr auto Descriptor_speed
ComponentDescriptor for the speed field.
Definition eye_controls3d.hpp:94
std::optional< ComponentBatch > position
The cameras current position.
Definition eye_controls3d.hpp:37
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:184
std::optional< ComponentBatch > tracking_entity
Currently tracked entity.
Definition eye_controls3d.hpp:62
EyeControls3D with_tracking_entity(const rerun::components::EntityPath &_tracking_entity) &&
Currently tracked entity.
Definition eye_controls3d.hpp:173
std::optional< ComponentBatch > spin_speed
What speed, if any, the camera should spin around the eye-up axis.
Definition eye_controls3d.hpp:67
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