Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

World grid part 2/2: Integrate into Viewer #8234

Merged
merged 31 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e39fad1
first modelling of LineGrid3D
Wumpf Nov 27, 2024
9eb7b37
add line grid to spatial3d definition
Wumpf Nov 27, 2024
3338bb9
expose in ui
Wumpf Nov 27, 2024
0e85137
fallbacks for new grid config values
Wumpf Nov 27, 2024
82a4abb
enable grid in 3d views, some tweaks, make alpha picker always show up
Wumpf Nov 27, 2024
f149015
introduce plane offset to the world grid
Wumpf Nov 27, 2024
3cdd772
lint fix
Wumpf Nov 27, 2024
8f97060
infinite cardinal scales
Wumpf Nov 28, 2024
2037074
improve handling of large scenes
Wumpf Nov 28, 2024
8d10baf
add plane 3d datatype & component (no extensions, no python serializa…
Wumpf Dec 3, 2024
c12484f
remove plane offset & orientation again, add Rust extensions to Plane3D
Wumpf Dec 3, 2024
8c890e4
wip ui for plane 3d
Wumpf Dec 3, 2024
d257fd6
multi line edit for plane
Wumpf Dec 3, 2024
95ca76b
fix every color having an alpha channel picker
Wumpf Dec 3, 2024
e95b715
remove wiki link for hesse normal form
Wumpf Dec 3, 2024
48230d9
fix missing unreleased markers
Wumpf Dec 3, 2024
6706a92
add plane to all components check
Wumpf Dec 3, 2024
dec853d
remove RadiusUi again in favor of StrokeWidth add 'pt' suffix for ui …
Wumpf Dec 3, 2024
9dae905
make grid more transparent
Wumpf Dec 3, 2024
06b55da
make the world grid shader actually use the plane equation we're usin…
Wumpf Dec 3, 2024
e464ba4
extend spatial view example, implement python extensions, fix doc links
Wumpf Dec 3, 2024
87aff22
fix botched link fix
Wumpf Dec 3, 2024
c078cba
fix multiline uis not being indented
Wumpf Dec 5, 2024
b4ef81c
fix plane3d use in check_all_components_ui
Wumpf Dec 5, 2024
472b84a
improved plane3d ui
Wumpf Dec 5, 2024
6edb4f0
rename line_grid3d file
Wumpf Dec 5, 2024
7f67a28
Merge remote-tracking branch 'origin/main' into andreas/world-grid2
Wumpf Dec 5, 2024
3cdbed5
better plane init in python
Wumpf Dec 6, 2024
103a6ab
comment on why custom grid3d view property
Wumpf Dec 6, 2024
487412c
codegen harder
Wumpf Dec 6, 2024
5fe5dfd
Merge remote-tracking branch 'origin/main' into andreas/world-grid2
Wumpf Dec 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6499,6 +6499,7 @@ dependencies = [
"re_format",
"re_log",
"re_log_types",
"re_math",
"re_tracing",
"re_types_builder",
"re_types_core",
Expand Down
5 changes: 3 additions & 2 deletions crates/store/re_types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ ecolor = ["dep:ecolor"]
## Enable conversions to plot primitives
egui_plot = ["dep:egui_plot"]

## Add support for some math operations using [`glam`](https://crates.io/crates/glam/).
glam = ["dep:glam"]
## Add support for some math operations using [`glam`](https://crates.io/crates/glam/) and [`re_math`](https://crates.io/crates/re_math/).
glam = ["dep:glam", "dep:re_math"]

## Integration with the [`image`](https://crates.io/crates/image/) crate, plus JPEG support.
image = ["dep:ecolor", "dep:image"]
Expand Down Expand Up @@ -92,6 +92,7 @@ image = { workspace = true, optional = true, default-features = false, features
"jpeg",
] }
mint = { workspace = true, optional = true }
re_math = { workspace = true, optional = true }
serde = { workspace = true, optional = true, features = ["derive", "rc"] }


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace rerun.archetypes;
///
/// Currently, many visualizers support only a single instance transform per entity.
/// Check archetype documentations for details - if not otherwise specified, only the first instance transform is applied.
/// Some visualizers like the mesh visualizer used for [`archetype.Mesh3D`],
/// Some visualizers like the mesh visualizer used for [archetypes.Mesh3D],
/// will draw an object for every pose, a behavior also known as "instancing".
///
/// \example archetypes/instance_poses3d_combined title="Regular & instance transforms in tandem" image="https://static.rerun.io/leaf_transform3d/41674f0082d6de489f8a1cd1583f60f6b5820ddf/1200w.png"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ table Pinhole (

/// Sets the view coordinates for the camera.
///
/// All common values are available as constants on the `components.ViewCoordinates` class.
/// All common values are available as constants on the [components.ViewCoordinates] class.
///
/// The default is `ViewCoordinates::RDF`, i.e. X=Right, Y=Down, Z=Forward, and this is also the recommended setting.
/// This means that the camera frustum will point along the positive Z axis of the parent space,
Expand Down

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
namespace rerun.blueprint.archetypes;

/// Configuration for the 3D line grid.
table LineGrid3D (
"attr.rerun.scope": "blueprint"
) {
/// Whether the grid is visible.
///
/// Defaults to true.
visible: rerun.blueprint.components.Visible ("attr.rerun.component_optional", nullable, order: 1000);

/// Space between grid lines spacing of one line to the next in scene units.
///
/// As you zoom out, successively only every tenth line is shown.
/// This controls the closest zoom level.
spacing: rerun.blueprint.components.GridSpacing ("attr.rerun.component_optional", nullable, order: 2000);

/// In what plane the grid is drawn.
///
/// Defaults to whatever plane is determined as the plane at zero units up/down as defined by [components.ViewCoordinates] if present.
plane: rerun.components.Plane3D ("attr.rerun.component_optional", nullable, order: 3000);

/// How thick the lines should be in ui units.
///
/// Default is 1.0 ui unit.
stroke_width: rerun.components.StrokeWidth ("attr.rerun.component_optional", nullable, order: 5000);

/// Color used for the grid.
///
/// Transparency via alpha channel is supported.
/// Defaults to a slightly transparent light gray.
color: rerun.components.Color ("attr.rerun.component_optional", nullable, order: 6000);
}

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace rerun.blueprint.components;

/// Space between grid lines of one line to the next in scene units.
table GridSpacing (
"attr.python.aliases": "float",
"attr.python.array_aliases": "npt.ArrayLike",
"attr.rerun.scope": "blueprint"
) {
/// Space between grid lines of one line to the next in scene units.
distance: rerun.datatypes.Float32 (order: 100);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ table Spatial3DView (
/// Configuration for the background of the view.
background: rerun.blueprint.archetypes.Background (order: 1000);

/// Configuration for the 3D line grid.
line_grid: rerun.blueprint.archetypes.LineGrid3D (order: 2000);

/// Configures which range on each timeline is shown by this view (unless specified differently per entity).
///
/// If not specified, the default is to show the latest state of each component.
Expand Down
1 change: 1 addition & 0 deletions crates/store/re_types/definitions/rerun/components.fbs

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

18 changes: 18 additions & 0 deletions crates/store/re_types/definitions/rerun/components/plane3d.fbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace rerun.components;

/// An infinite 3D plane represented by a unit normal vector and a distance.
///
/// Any point P on the plane fulfills the equation `dot(xyz, P) - d = 0`,
/// where `xyz` is the plane's normal and `d` the distance of the plane from the origin.
/// This representation is also known as the Hesse normal form.
///
/// Note: although the normal will be passed through to the
/// datastore as provided, when used in the Viewer, planes will always be normalized.
/// I.e. the plane with xyz = (2, 0, 0), d = 1 is equivalent to xyz = (1, 0, 0), d = 0.5
struct Plane3D (
"attr.docs.unreleased",
"attr.rust.derive": "Copy, PartialEq, bytemuck::Pod, bytemuck::Zeroable",
"attr.rust.repr": "transparent"
) {
xyzd: rerun.datatypes.Plane3D (order: 100);
}
1 change: 1 addition & 0 deletions crates/store/re_types/definitions/rerun/datatypes.fbs

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

22 changes: 22 additions & 0 deletions crates/store/re_types/definitions/rerun/datatypes/plane3d.fbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace rerun.datatypes;

/// An infinite 3D plane represented by a unit normal vector and a distance.
///
/// Any point P on the plane fulfills the equation `dot(xyz, P) - d = 0`,
/// where `xyz` is the plane's normal and `d` the distance of the plane from the origin.
/// This representation is also known as the Hesse normal form.
///
/// Note: although the normal will be passed through to the
/// datastore as provided, when used in the Viewer, planes will always be normalized.
/// I.e. the plane with xyz = (2, 0, 0), d = 1 is equivalent to xyz = (1, 0, 0), d = 0.5
struct Plane3D (
"attr.docs.unreleased",
"attr.arrow.transparent",
"attr.python.array_aliases": "npt.NDArray[Any], npt.ArrayLike, Sequence[Sequence[float]]",
"attr.rust.derive": "Copy, PartialEq, PartialOrd, bytemuck::Pod, bytemuck::Zeroable",
"attr.rust.tuple_struct",
"attr.rust.repr": "C",
"attr.cpp.no_field_ctors" // Always be explicit about the values of the fields.
) {
xyzd: [float: 4] (order: 100);
}
2 changes: 1 addition & 1 deletion crates/store/re_types/src/archetypes/instance_poses3d.rs

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

4 changes: 2 additions & 2 deletions crates/store/re_types/src/archetypes/pinhole.rs

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

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

Loading
Loading