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/build/re_type_definitions/rerun/blueprint/archetypes/line_grid3d.def.rs".
3
4#pragma once
5
6#include "../../archetype_utils.hpp"
7#include "../../blueprint/components/grid_spacing.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 "../../components/visible.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 the plane at zero units along the up/down axis defined by `archetypes::SpatialInformation`'s axes property.
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 /// The name of the archetype as used in `ComponentDescriptor`s.
57 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.LineGrid3D";
58
59 /// `ComponentDescriptor` for the `visible` field.
60 static constexpr auto Descriptor_visible = ComponentDescriptor(
62 );
63 /// `ComponentDescriptor` for the `spacing` field.
64 static constexpr auto Descriptor_spacing = ComponentDescriptor(
65 ArchetypeName, "LineGrid3D:spacing",
67 );
68 /// `ComponentDescriptor` for the `plane` field.
69 static constexpr auto Descriptor_plane = ComponentDescriptor(
71 );
72 /// `ComponentDescriptor` for the `stroke_width` field.
74 ArchetypeName, "LineGrid3D:stroke_width",
76 );
77 /// `ComponentDescriptor` for the `color` field.
78 static constexpr auto Descriptor_color = ComponentDescriptor(
80 );
81
82 public:
83 LineGrid3D() = default;
84 LineGrid3D(LineGrid3D&& other) = default;
85 LineGrid3D(const LineGrid3D& other) = default;
86 LineGrid3D& operator=(const LineGrid3D& other) = default;
87 LineGrid3D& operator=(LineGrid3D&& other) = default;
88
89 /// Update only some specific fields of a `LineGrid3D`.
91 return LineGrid3D();
92 }
93
94 /// Clear all the fields of a `LineGrid3D`.
96
97 /// Whether the grid is visible.
98 ///
99 /// Defaults to true.
101 visible = ComponentBatch::from_loggable(_visible, Descriptor_visible).value_or_throw();
102 return std::move(*this);
103 }
104
105 /// Space between grid lines spacing of one line to the next in scene units.
106 ///
107 /// As you zoom out, successively only every tenth line is shown.
108 /// This controls the closest zoom level.
110 spacing = ComponentBatch::from_loggable(_spacing, Descriptor_spacing).value_or_throw();
111 return std::move(*this);
112 }
113
114 /// In what plane the grid is drawn.
115 ///
116 /// Defaults to the plane at zero units along the up/down axis defined by `archetypes::SpatialInformation`'s axes property.
118 plane = ComponentBatch::from_loggable(_plane, Descriptor_plane).value_or_throw();
119 return std::move(*this);
120 }
121
122 /// How thick the lines should be in ui units.
123 ///
124 /// Default is 1.0 ui unit.
127 .value_or_throw();
128 return std::move(*this);
129 }
130
131 /// Color used for the grid.
132 ///
133 /// Transparency via alpha channel is supported.
134 /// Defaults to a slightly transparent light gray.
136 color = ComponentBatch::from_loggable(_color, Descriptor_color).value_or_throw();
137 return std::move(*this);
138 }
139
140 /// Partitions the component data into multiple sub-batches.
141 ///
142 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
143 /// instead, via `ComponentBatch::partitioned`.
144 ///
145 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
146 ///
147 /// The specified `lengths` must sum to the total length of the component batch.
149 return detail::partition_batches(
151 lengths_
152 )
153 .value_or_throw();
154 }
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 return detail::partition_batches_of_unit_length(
163 )
164 .value_or_throw();
165 }
166 };
167
168} // namespace rerun::blueprint::archetypes
169
170namespace rerun {
171 /// \private
172 template <typename T>
173 struct AsComponents;
174
175 /// \private
176 template <>
177 struct AsComponents<blueprint::archetypes::LineGrid3D> {
178 /// Serialize all set component batches.
179 static Result<Collection<ComponentBatch>> as_batches(
180 const blueprint::archetypes::LineGrid3D& archetype
181 ) {
182 return detail::collect_batches(
183 {&archetype.visible,
184 &archetype.spacing,
185 &archetype.plane,
186 &archetype.stroke_width,
187 &archetype.color}
188 );
189 }
190 };
191} // 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: 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:73
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:109
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:90
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Definition line_grid3d.hpp:160
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.
Definition line_grid3d.hpp:148
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:69
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:60
static constexpr auto Descriptor_color
ComponentDescriptor for the color field.
Definition line_grid3d.hpp:78
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition line_grid3d.hpp:57
LineGrid3D with_color(const rerun::components::Color &_color) &&
Color used for the grid.
Definition line_grid3d.hpp:135
LineGrid3D with_stroke_width(const rerun::components::StrokeWidth &_stroke_width) &&
How thick the lines should be in ui units.
Definition line_grid3d.hpp:125
LineGrid3D with_visible(const rerun::components::Visible &_visible) &&
Whether the grid is visible.
Definition line_grid3d.hpp:100
LineGrid3D with_plane(const rerun::components::Plane3D &_plane) &&
In what plane the grid is drawn.
Definition line_grid3d.hpp:117
static constexpr auto Descriptor_spacing
ComponentDescriptor for the spacing field.
Definition line_grid3d.hpp:64
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