Skip to content

Commit

Permalink
eager LineStrips3D
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Jan 10, 2025
1 parent 55800f3 commit 71cc650
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 165 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace rerun.archetypes;
/// \example archetypes/line_strips3d_batch title="Many strips" image="https://static.rerun.io/line_strip3d_batch/15e8ff18a6c95a3191acb0eae6eb04adea3b4874/1200w.png"
/// \example archetypes/line_strips3d_ui_radius title="Lines with scene & UI radius each" image="https://static.rerun.io/line_strip3d_ui_radius/36b98f47e45747b5a3601511ff39b8d74c61d120/1200w.png"
table LineStrips3D (
"attr.rust.archetype_eager": "",
"attr.rust.derive": "PartialEq",
"attr.docs.category": "Spatial 3D",
"attr.docs.view_types": "Spatial3DView, Spatial2DView: if logged above active projection"
Expand Down
234 changes: 92 additions & 142 deletions crates/store/re_types/src/archetypes/line_strips3d.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 30 additions & 23 deletions crates/store/re_types/tests/types/line_strips3d.rs
Original file line number Diff line number Diff line change
@@ -1,34 +1,41 @@
use re_types::{
archetypes::LineStrips3D,
components::{ClassId, Color, LineStrip3D, Radius},
Archetype as _, AsComponents as _,
archetypes::LineStrips3D, components, Archetype as _, AsComponents as _, ComponentBatch,
};

#[test]
fn roundtrip() {
let expected = LineStrips3D {
#[rustfmt::skip]
strips: vec![
LineStrip3D::from_iter([[0., 0., 1.], [2., 1., 2.], [4., -1., 3.], [6., 0., 4.]]),
LineStrip3D::from_iter([[0., 3., 1.], [1., 4., 2.], [2., 2., 3.], [3., 4., 4.], [4., 2., 5.], [5., 4., 6.], [6., 3., 7.]]),
],
radii: Some(vec![
Radius::from(42.0), //
Radius::from(43.0),
]),
colors: Some(vec![
Color::from_unmultiplied_rgba(0xAA, 0x00, 0x00, 0xCC), //
Color::from_unmultiplied_rgba(0x00, 0xBB, 0x00, 0xDD),
]),
labels: Some(vec![
"hello".into(), //
"friend".into(), //
]),
class_ids: Some(vec![
ClassId::from(126), //
ClassId::from(127), //
]),
show_labels: Some(true.into()),
components::LineStrip3D::from_iter([[0., 0., 1.], [2., 1., 2.], [4., -1., 3.], [6., 0., 4.]]),
components::LineStrip3D::from_iter([[0., 3., 1.], [1., 4., 2.], [2., 2., 3.], [3., 4., 4.], [4., 2., 5.], [5., 4., 6.], [6., 3., 7.]]),
]
.serialized()
.map(|batch| batch.with_descriptor_override(LineStrips3D::descriptor_strips())),
radii: vec![
components::Radius::from(42.0), //
components::Radius::from(43.0),
]
.serialized()
.map(|batch| batch.with_descriptor_override(LineStrips3D::descriptor_radii())),
colors: vec![
components::Color::from_unmultiplied_rgba(0xAA, 0x00, 0x00, 0xCC), //
components::Color::from_unmultiplied_rgba(0x00, 0xBB, 0x00, 0xDD),
]
.serialized()
.map(|batch| batch.with_descriptor_override(LineStrips3D::descriptor_colors())),
labels: (vec!["hello".into(), "friend".into()] as Vec<components::Text>)
.serialized()
.map(|batch| batch.with_descriptor_override(LineStrips3D::descriptor_labels())),
class_ids: vec![
components::ClassId::from(126), //
components::ClassId::from(127), //
]
.serialized()
.map(|batch| batch.with_descriptor_override(LineStrips3D::descriptor_class_ids())),
show_labels: components::ShowLabels(true.into())
.serialized()
.map(|batch| batch.with_descriptor_override(LineStrips3D::descriptor_show_labels())),
};

#[rustfmt::skip]
Expand Down
Loading

0 comments on commit 71cc650

Please sign in to comment.