Rerun C++ SDK
Loading...
Searching...
No Matches
line_grid3d.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_types/definitions/rerun/blueprint/archetypes/line_grid3d.fbs".
3
4#pragma once
5
6#include "../../blueprint/components/grid_spacing.hpp"
7#include "../../collection.hpp"
8#include "../../component_batch.hpp"
9#include "../../component_column.hpp"
10#include "../../components/color.hpp"
11#include "../../components/plane3d.hpp"
12#include "../../components/stroke_width.hpp"
13#include "../../components/visible.hpp"
14#include "../../result.hpp"
15
16#include <cstdint>
17#include <optional>
18#include <utility>
19#include <vector>
20
21namespace rerun::blueprint::archetypes {
22 /// **Archetype**: Configuration for the 3D line grid.
23 ///
24 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
25 ///
26 struct LineGrid3D {
27 /// Whether the grid is visible.
28 ///
29 /// Defaults to true.
30 std::optional<ComponentBatch> visible;
31
32 /// Space between grid lines spacing of one line to the next in scene units.
33 ///
34 /// As you zoom out, successively only every tenth line is shown.
35 /// This controls the closest zoom level.
36 std::optional<ComponentBatch> spacing;
37
38 /// In what plane the grid is drawn.
39 ///
40 /// Defaults to whatever plane is determined as the plane at zero units up/down as defined by `components::ViewCoordinates` if present.
41 std::optional<ComponentBatch> plane;
42
43 /// How thick the lines should be in ui units.
44 ///
45 /// Default is 1.0 ui unit.
46 std::optional<ComponentBatch> stroke_width;
47
48 /// Color used for the grid.
49 ///
50 /// Transparency via alpha channel is supported.
51 /// Defaults to a slightly transparent light gray.
52 std::optional<ComponentBatch> color;
53
54 public:
55 /// The name of the archetype as used in `ComponentDescriptor`s.
56 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.LineGrid3D";
57
58 /// `ComponentDescriptor` for the `visible` field.
59 static constexpr auto Descriptor_visible = ComponentDescriptor(
61 );
62 /// `ComponentDescriptor` for the `spacing` field.
63 static constexpr auto Descriptor_spacing = ComponentDescriptor(
64 ArchetypeName, "LineGrid3D:spacing",
66 );
67 /// `ComponentDescriptor` for the `plane` field.
68 static constexpr auto Descriptor_plane = ComponentDescriptor(
70 );
71 /// `ComponentDescriptor` for the `stroke_width` field.
73 ArchetypeName, "LineGrid3D:stroke_width",
75 );
76 /// `ComponentDescriptor` for the `color` field.
77 static constexpr auto Descriptor_color = ComponentDescriptor(
79 );
80
81 public:
82 LineGrid3D() = default;
83 LineGrid3D(LineGrid3D&& other) = default;
84 LineGrid3D(const LineGrid3D& other) = default;
85 LineGrid3D& operator=(const LineGrid3D& other) = default;
86 LineGrid3D& operator=(LineGrid3D&& other) = default;
87
88 /// Update only some specific fields of a `LineGrid3D`.
90 return LineGrid3D();
91 }
92
93 /// Clear all the fields of a `LineGrid3D`.
95
96 /// Whether the grid is visible.
97 ///
98 /// Defaults to true.
100 visible = ComponentBatch::from_loggable(_visible, Descriptor_visible).value_or_throw();
101 return std::move(*this);
102 }
103
104 /// Space between grid lines spacing of one line to the next in scene units.
105 ///
106 /// As you zoom out, successively only every tenth line is shown.
107 /// This controls the closest zoom level.
109 spacing = ComponentBatch::from_loggable(_spacing, Descriptor_spacing).value_or_throw();
110 return std::move(*this);
111 }
112
113 /// In what plane the grid is drawn.
114 ///
115 /// Defaults to whatever plane is determined as the plane at zero units up/down as defined by `components::ViewCoordinates` if present.
117 plane = ComponentBatch::from_loggable(_plane, Descriptor_plane).value_or_throw();
118 return std::move(*this);
119 }
120
121 /// How thick the lines should be in ui units.
122 ///
123 /// Default is 1.0 ui unit.
126 .value_or_throw();
127 return std::move(*this);
128 }
129
130 /// Color used for the grid.
131 ///
132 /// Transparency via alpha channel is supported.
133 /// Defaults to a slightly transparent light gray.
135 color = ComponentBatch::from_loggable(_color, Descriptor_color).value_or_throw();
136 return std::move(*this);
137 }
138
139 /// Partitions the component data into multiple sub-batches.
140 ///
141 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
142 /// instead, via `ComponentBatch::partitioned`.
143 ///
144 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
145 ///
146 /// The specified `lengths` must sum to the total length of the component batch.
148
149 /// Partitions the component data into unit-length sub-batches.
150 ///
151 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
152 /// where `n` is automatically guessed.
154 };
155
156} // namespace rerun::blueprint::archetypes
157
158namespace rerun {
159 /// \private
160 template <typename T>
161 struct AsComponents;
162
163 /// \private
164 template <>
165 struct AsComponents<blueprint::archetypes::LineGrid3D> {
166 /// Serialize all set component batches.
167 static Result<Collection<ComponentBatch>> as_batches(
168 const blueprint::archetypes::LineGrid3D& archetype
169 );
170 };
171} // 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: Configuration for the 3D line grid.
Definition line_grid3d.hpp:26
std::optional< ComponentBatch > spacing
Space between grid lines spacing of one line to the next in scene units.
Definition line_grid3d.hpp:36
static constexpr auto Descriptor_stroke_width
ComponentDescriptor for the stroke_width field.
Definition line_grid3d.hpp:72
std::optional< ComponentBatch > stroke_width
How thick the lines should be in ui units.
Definition line_grid3d.hpp:46
LineGrid3D with_spacing(const rerun::blueprint::components::GridSpacing &_spacing) &&
Space between grid lines spacing of one line to the next in scene units.
Definition line_grid3d.hpp:108
static LineGrid3D clear_fields()
Clear all the fields of a LineGrid3D.
static LineGrid3D update_fields()
Update only some specific fields of a LineGrid3D.
Definition line_grid3d.hpp:89
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
std::optional< ComponentBatch > color
Color used for the grid.
Definition line_grid3d.hpp:52
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
std::optional< ComponentBatch > plane
In what plane the grid is drawn.
Definition line_grid3d.hpp:41
static constexpr auto Descriptor_plane
ComponentDescriptor for the plane field.
Definition line_grid3d.hpp:68
std::optional< ComponentBatch > visible
Whether the grid is visible.
Definition line_grid3d.hpp:30
static constexpr auto Descriptor_visible
ComponentDescriptor for the visible field.
Definition line_grid3d.hpp:59
static constexpr auto Descriptor_color
ComponentDescriptor for the color field.
Definition line_grid3d.hpp:77
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition line_grid3d.hpp:56
LineGrid3D with_color(const rerun::components::Color &_color) &&
Color used for the grid.
Definition line_grid3d.hpp:134
LineGrid3D with_stroke_width(const rerun::components::StrokeWidth &_stroke_width) &&
How thick the lines should be in ui units.
Definition line_grid3d.hpp:124
LineGrid3D with_visible(const rerun::components::Visible &_visible) &&
Whether the grid is visible.
Definition line_grid3d.hpp:99
LineGrid3D with_plane(const rerun::components::Plane3D &_plane) &&
In what plane the grid is drawn.
Definition line_grid3d.hpp:116
static constexpr auto Descriptor_spacing
ComponentDescriptor for the spacing field.
Definition line_grid3d.hpp:63
Component: Space between grid lines of one line to the next in scene units.
Definition grid_spacing.hpp:17
Component: An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha.
Definition color.hpp:17
Component: An infinite 3D plane represented by a unit normal vector and a distance.
Definition plane3d.hpp:22
Component: The width of a stroke specified in UI points.
Definition stroke_width.hpp:14
Component: Whether the container, view, entity or instance is currently visible.
Definition visible.hpp:14