Skip to content

Commit

Permalink
Merge branch 'main' into cmc/datastore/retire_component_tables
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc authored Apr 12, 2023
2 parents 6731434 + 668e56d commit 52c2321
Show file tree
Hide file tree
Showing 50 changed files with 1,149 additions and 996 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
with:
mode: minimum
count: 1
labels: "📊 analytics, 🪳 bug, 🧑‍💻 dev experience, 📖 documentation, 💬 discussion, examples, 📉 performance, 🐍 python API, ⛃ re_datastore, 📺 re_viewer, 🔺 re_renderer, ⛴ release, 🦀 rust SDK, 🔨 testing, ui, 🕸️ web"
labels: "📊 analytics, 🪳 bug, 🧑‍💻 dev experience, 📖 documentation, 💬 discussion, examples, 📉 performance, 🐍 python API, ⛃ re_datastore, 📺 re_viewer, 🔺 re_renderer, 🚜 refactor, ⛴ release, 🦀 rust SDK, 🔨 testing, ui, 🕸️ web"
11 changes: 11 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,17 @@ jobs:
- name: Run tests
run: cd rerun_py/tests && pytest

- name: Install requriements for e2e test
run: |
pip install -r examples/python/api_demo/requirements.txt
pip install -r examples/python/car/requirements.txt
pip install -r examples/python/multithreading/requirements.txt
pip install -r examples/python/plots/requirements.txt
pip install -r examples/python/text_logging/requirements.txt
- name: Run e2e test
run: scripts/run_python_e2e_test.py --no-build # rerun-sdk is already built and installed

- name: Unpack the wheel
shell: bash
run: |
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,16 @@ wgpu-hal = { version = "0.15.4", default-features = false }


[profile.dev]
opt-level = 1 # Make debug builds run faster
opt-level = 1 # Make debug builds run faster
panic = "abort" # This leads to better optimizations and smaller binaries (and is the default in Wasm anyways).

# Optimize all dependencies even in debug builds (does not affect workspace packages):
[profile.dev.package."*"]
opt-level = 2

[profile.release]
# debug = true # good for profilers
panic = "abort" # This leads to better optimizations and smaller binaries (and is the default in Wasm anyways).

[profile.bench]
debug = true
Expand Down
2 changes: 2 additions & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ disallowed-methods = [
"std::thread::spawn", # Use `std::thread::Builder` and name the thread

"sha1::Digest::new", # SHA1 is cryptographically broken

"std::panic::catch_unwind", # We compile with `panic = "abort"`
]

# https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_names
Expand Down
5 changes: 5 additions & 0 deletions crates/re_log/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ pub use {
setup::*,
};

/// Re-exports of other crates.
pub mod external {
pub use log;
}

/// Never log anything less serious than a `WARN` from these crates.
const CRATES_AT_WARN_LEVEL: [&str; 3] = [
// wgpu crates spam a lot on info level, which is really annoying
Expand Down
2 changes: 1 addition & 1 deletion crates/re_log_types/src/component_types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub use size::Size3D;
#[cfg(feature = "image")]
pub use tensor::TensorImageError;
pub use tensor::{
Tensor, TensorCastError, TensorData, TensorDataMeaning, TensorDimension, TensorId, TensorTrait,
Tensor, TensorCastError, TensorData, TensorDataMeaning, TensorDimension, TensorId,
};
pub use text_entry::TextEntry;
pub use transform::{Pinhole, Rigid3, Transform};
Expand Down
8 changes: 8 additions & 0 deletions crates/re_log_types/src/component_types/point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ impl From<Point2D> for glam::Vec2 {
}
}

#[cfg(feature = "glam")]
impl From<Point2D> for glam::Vec3 {
#[inline]
fn from(pt: Point2D) -> Self {
Self::new(pt.x, pt.y, 0.0)
}
}

/// A point in 3D space.
///
/// ```
Expand Down
32 changes: 10 additions & 22 deletions crates/re_log_types/src/component_types/tensor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@ use crate::{TensorDataType, TensorElement};

use super::arrow_convert_shims::BinaryBuffer;

pub trait TensorTrait {
fn id(&self) -> TensorId;
fn shape(&self) -> &[TensorDimension];
fn num_dim(&self) -> usize;
fn is_shaped_like_an_image(&self) -> bool;
fn is_vector(&self) -> bool;
fn meaning(&self) -> TensorDataMeaning;
fn get(&self, index: &[u64]) -> Option<TensorElement>;
fn dtype(&self) -> TensorDataType;
fn size_in_bytes(&self) -> usize;
}

// ----------------------------------------------------------------------------

/// A unique id per [`Tensor`].
Expand Down Expand Up @@ -365,23 +353,23 @@ pub struct Tensor {
pub meter: Option<f32>,
}

impl TensorTrait for Tensor {
impl Tensor {
#[inline]
fn id(&self) -> TensorId {
pub fn id(&self) -> TensorId {
self.tensor_id
}

#[inline]
fn shape(&self) -> &[TensorDimension] {
pub fn shape(&self) -> &[TensorDimension] {
self.shape.as_slice()
}

#[inline]
fn num_dim(&self) -> usize {
pub fn num_dim(&self) -> usize {
self.shape.len()
}

fn is_shaped_like_an_image(&self) -> bool {
pub fn is_shaped_like_an_image(&self) -> bool {
self.num_dim() == 2
|| self.num_dim() == 3 && {
matches!(
Expand All @@ -393,17 +381,17 @@ impl TensorTrait for Tensor {
}

#[inline]
fn is_vector(&self) -> bool {
pub fn is_vector(&self) -> bool {
let shape = &self.shape;
shape.len() == 1 || { shape.len() == 2 && (shape[0].size == 1 || shape[1].size == 1) }
}

#[inline]
fn meaning(&self) -> TensorDataMeaning {
pub fn meaning(&self) -> TensorDataMeaning {
self.meaning
}

fn get(&self, index: &[u64]) -> Option<TensorElement> {
pub fn get(&self, index: &[u64]) -> Option<TensorElement> {
let mut stride: usize = 1;
let mut offset: usize = 0;
for (TensorDimension { size, .. }, index) in self.shape.iter().zip(index).rev() {
Expand All @@ -429,11 +417,11 @@ impl TensorTrait for Tensor {
}
}

fn dtype(&self) -> TensorDataType {
pub fn dtype(&self) -> TensorDataType {
self.data.dtype()
}

fn size_in_bytes(&self) -> usize {
pub fn size_in_bytes(&self) -> usize {
self.data.size_in_bytes()
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/re_renderer/examples/2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl framework::Example for Render2D {
// Moving the windows to a high dpi screen makes the second one bigger.
// Also, it looks different under perspective projection.
// The third point is automatic thickness which is determined by the point renderer implementation.
let mut point_cloud_builder = PointCloudBuilder::<()>::new(re_ctx);
let mut point_cloud_builder = PointCloudBuilder::new(re_ctx);
point_cloud_builder
.batch("points")
.add_points_2d(
Expand Down
2 changes: 1 addition & 1 deletion crates/re_renderer/examples/depth_cloud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl RenderDepthClouds {
})
.multiunzip();

let mut builder = PointCloudBuilder::<()>::new(re_ctx);
let mut builder = PointCloudBuilder::new(re_ctx);
builder
.batch("backprojected point cloud")
.add_points(num_points as _, points.into_iter())
Expand Down
8 changes: 4 additions & 4 deletions crates/re_renderer/examples/framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ impl<E: Example + 'static> Application<E> {
Event::WindowEvent {
event: WindowEvent::CursorMoved { position, .. },
..
} => self.example.on_cursor_moved(glam::uvec2(
position.x.round() as u32,
position.y.round() as u32,
)),
} => self
.example
// Don't round the position: The entire range from 0 to excluding 1 should fall into pixel coordinate 0!
.on_cursor_moved(glam::uvec2(position.x as u32, position.y as u32)),
Event::WindowEvent {
event:
WindowEvent::ScaleFactorChanged {
Expand Down
2 changes: 1 addition & 1 deletion crates/re_renderer/examples/multiview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ impl Example for Multiview {
let skybox = GenericSkyboxDrawData::new(re_ctx);
let lines = build_lines(re_ctx, seconds_since_startup);

let mut builder = PointCloudBuilder::<()>::new(re_ctx);
let mut builder = PointCloudBuilder::new(re_ctx);
builder
.batch("Random Points")
.world_from_obj(glam::Mat4::from_rotation_x(seconds_since_startup))
Expand Down
2 changes: 1 addition & 1 deletion crates/re_renderer/examples/picking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl framework::Example for Picking {
.schedule_picking_rect(re_ctx, picking_rect, READBACK_IDENTIFIER, (), false)
.unwrap();

let mut point_builder = PointCloudBuilder::<()>::new(re_ctx);
let mut point_builder = PointCloudBuilder::new(re_ctx);
for (i, point_set) in self.point_sets.iter().enumerate() {
point_builder
.batch(format!("Random Points {i}"))
Expand Down
10 changes: 5 additions & 5 deletions crates/re_renderer/src/draw_phases/picking_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,18 @@ impl PickingLayerProcessor {
DepthReadbackWorkaround::new(ctx, picking_rect.extent, picking_depth_target.handle)
});

let rect_min = picking_rect.top_left_corner.as_vec2();
let rect_min = picking_rect.left_top.as_vec2();
let rect_max = rect_min + picking_rect.extent.as_vec2();
let screen_resolution = screen_resolution.as_vec2();
// y axis is flipped in NDC, therefore we need to flip the y axis of the rect.
let rect_min_ndc =
pixel_coord_to_ndc(glam::vec2(rect_min.x, rect_max.y), screen_resolution);
let rect_max_ndc =
pixel_coord_to_ndc(glam::vec2(rect_max.x, rect_min.y), screen_resolution);
let rect_center_ndc = (rect_min_ndc + rect_max_ndc) * 0.5;
let cropped_projection_from_projection =
glam::Mat4::from_scale(2.0 / (rect_max_ndc - rect_min_ndc).extend(1.0))
* glam::Mat4::from_translation(-rect_center_ndc.extend(0.0));
let scale = 2.0 / (rect_max_ndc - rect_min_ndc);
let translation = -0.5 * (rect_min_ndc + rect_max_ndc);
let cropped_projection_from_projection = glam::Mat4::from_scale(scale.extend(1.0))
* glam::Mat4::from_translation(translation.extend(0.0));

// Setup frame uniform buffer
let previous_projection_from_world: glam::Mat4 =
Expand Down
Loading

0 comments on commit 52c2321

Please sign in to comment.