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