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