Skip to content

Commit

Permalink
feature flagging and TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Dec 14, 2023
1 parent bc08cff commit ee7012b
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 9 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ itertools = "0.11" # updating it
js-sys = "0.3"
# No lazy_static - use `std::sync::OnceLock` or `once_cell` instead
libc = "0.2"
linked-hash-map = { version = "0.5", default-features = false }
log = "0.4"
log-once = "0.4"
lz4_flex = "0.11"
Expand All @@ -165,6 +166,7 @@ ordered-float = "4.2"
parking_lot = "0.12"
pathdiff = "0.2"
pico-args = "0.5"
ply-rs = { version = "0.1", default-features = false }
polars-core = "0.29"
polars-lazy = "0.29"
polars-ops = "0.29"
Expand Down
2 changes: 1 addition & 1 deletion crates/re_data_source/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ re_log_types.workspace = true
re_log.workspace = true
re_smart_channel.workspace = true
re_tracing.workspace = true
re_types = { workspace = true, features = ["image"] }
re_types = { workspace = true, features = ["image", "ply"] }
re_ws_comms = { workspace = true, features = ["client"] }

ahash.workspace = true
Expand Down
9 changes: 5 additions & 4 deletions crates/re_data_source/src/data_loader/loader_archetype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ fn load_mesh(
DataRow::from_archetype(RowId::new(), timepoint, entity_path.clone(), &arch)?
},
{
// TODO(cmc): Completely arbitrary but anything's better than nothing I figure?
// Blueprint should make this configurable directly from the viewer very soon anyway.
let arch = re_types::archetypes::ViewCoordinates::RIGHT_HAND_Z_UP;
DataRow::from_archetype(RowId::new(), TimePoint::timeless(), entity_path, &arch)?
},
Expand All @@ -176,14 +178,13 @@ fn load_point_cloud(

let rows = [
{
// TODO: see #1571 -> "log_mesh_file does not support PLY files"
// TODO: can a ply be 2D??! cant see why not, uh...
// TODO(#4532): `.ply` data loader should support 2D point cloud & meshes
let points3d = re_types::archetypes::Points3D::from_file_contents(contents)?;
DataRow::from_archetype(RowId::new(), timepoint, entity_path.clone(), &points3d)?
},
{
// TODO: literally anything is better than none.
// TODO: this seems to... not work?!
// TODO(cmc): Completely arbitrary but anything's better than nothing I figure?
// Blueprint should make this configurable directly from the viewer very soon anyway.
let arch = re_types::archetypes::ViewCoordinates::RIGHT_HAND_Z_UP;
DataRow::from_archetype(RowId::new(), TimePoint::timeless(), entity_path, &arch)?
},
Expand Down
10 changes: 6 additions & 4 deletions crates/re_types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ features = ["all"]
default = []

## All features except `testing`.
all = ["ecolor", "glam", "serde"]
all = ["ecolor", "glam", "ply", "serde"]

## Enables the `datagen` module, which exposes a number of tools for generating random data for
## tests and benchmarks.
Expand All @@ -38,6 +38,9 @@ glam = ["dep:glam"]
## Integration with the [`image`](https://crates.io/crates/image/) crate, plus JPEG support.
image = ["dep:ecolor", "dep:image", "dep:zune-core", "dep:zune-jpeg"]

## Integration with the [`ply-rs`](https://crates.io/crates/ply-rs/) crate for 3D point cloud support.
ply = ["dep:ply-rs", "dep:linked-hash-map"]

## Enable (de)serialization using serde.
serde = ["dep:serde"]

Expand Down Expand Up @@ -71,14 +74,13 @@ once_cell.workspace = true
smallvec.workspace = true
thiserror.workspace = true
uuid = { workspace = true, features = ["serde", "v4", "js"] }
# TODO
linked-hash-map = "0.5"
ply-rs = "0.1"

# External (optional)
ecolor = { workspace = true, optional = true }
glam = { workspace = true, optional = true }
image = { workspace = true, optional = true, default-features = false }
linked-hash-map = { workspace = true, optional = true }
ply-rs = { workspace = true, optional = true }
rand = { workspace = true, optional = true, features = ["std", "std_rng"] }
serde = { workspace = true, optional = true, features = ["derive", "rc"] }
zune-core = { workspace = true, optional = true }
Expand Down
3 changes: 3 additions & 0 deletions crates/re_types/src/archetypes/points3d_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ impl Points3D {
/// - (Optional) Labels of the points: `"label"`.
///
/// The media type will be inferred from the path (extension), or the contents if that fails.
#[cfg(feature = "ply")]
#[cfg(not(target_arch = "wasm32"))]
pub fn from_file(filepath: &std::path::Path) -> anyhow::Result<Self> {
use anyhow::Context as _;
Expand All @@ -29,6 +30,7 @@ impl Points3D {
/// Creates a new [`Points3D`] from the contents of a `.ply` file.
///
/// If unspecified, he media type will be inferred from the contents.
#[cfg(feature = "ply")]
pub fn from_file_contents(contents: &[u8]) -> anyhow::Result<Self> {
let parser = ply_rs::parser::Parser::<ply_rs::ply::DefaultElement>::new();
let mut contents = std::io::Cursor::new(contents);
Expand All @@ -37,6 +39,7 @@ impl Points3D {
}
}

#[cfg(feature = "ply")]
fn from_ply(ply: &ply_rs::ply::Ply<ply_rs::ply::DefaultElement>) -> Points3D {
use std::borrow::Cow;

Expand Down
1 change: 1 addition & 0 deletions crates/rerun-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ rerun = { workspace = true, features = [
"analytics",
"glam",
"image",
"ply",
"server",
] }

Expand Down
3 changes: 3 additions & 0 deletions crates/rerun/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ log = ["dep:env_logger", "dep:log"]
## This adds a lot of extra dependencies, so only enable this feature if you need it!
native_viewer = ["dep:re_viewer"]

## Integration with the [`ply-rs`](https://crates.io/crates/ply-rs/) crate for 3D point cloud support.
ply = ["re_types?/ply"]

## Support for running a TCP server that listens to incoming log messages from a Rerun SDK.
server = ["re_sdk_comms/server"]

Expand Down

0 comments on commit ee7012b

Please # to comment.