Skip to content

Commit

Permalink
Merge branch 'main' into jleibs/buffer_for_u8_tensor
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Feb 24, 2023
2 parents a3b4b6d + 870b10b commit c41dba2
Show file tree
Hide file tree
Showing 48 changed files with 1,248 additions and 305 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

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

6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ Some shortcomings:


## Business model
Rerun uses an open core model. Everything in this repository will stay open source and free (as in beer), forever. In the future, Rerun will offer a commercial product that builds on top of the core free project.
Rerun uses an open-core model. Everything in this repository will stay open source and free (both as in beer and as in freedom).
In the future, Rerun will offer a commercial product that builds on top of the core free project.

The Rerun open source project targets the needs of individual developers. The commercial product targets the needs specific to teams that build and run computer vision and robotics products.
The Rerun open source project targets the needs of individual developers.
The commercial product targets the needs specific to teams that build and run computer vision and robotics products.


# Development
Expand Down
2 changes: 2 additions & 0 deletions crates/re_analytics/src/config_web.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::todo, clippy::unused_self)]

use std::collections::HashMap;

use uuid::Uuid;
Expand Down
5 changes: 5 additions & 0 deletions crates/re_analytics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ impl Analytics {
self.default_append_props.insert(name.into(), prop.into());
}

/// Deregister a property.
pub fn deregister_append_property(&mut self, name: &'static str) {
self.default_append_props.remove(name);
}

/// Record an event.
///
/// It will be extended with an `event_id` and, if this is an [`EventKind::Append`],
Expand Down
6 changes: 6 additions & 0 deletions crates/re_analytics/src/pipeline_web.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#![allow(
clippy::needless_pass_by_value,
clippy::unnecessary_wraps,
clippy::unused_self
)]

use std::time::Duration;

use crate::{Config, Event, PostHogSink};
Expand Down
3 changes: 0 additions & 3 deletions crates/re_analytics/src/sink_native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ use crate::{Event, Property};
// TODO(cmc): abstract away the concept of a `Sink` behind an actual trait when comes the time to
// support more than just PostHog.

#[cfg(debug_assertions)]
const PUBLIC_POSTHOG_PROJECT_KEY: &str = "phc_XD1QbqTGdPJbzdVCbvbA9zGOG38wJFTl8RAwqMwBvTY";
#[cfg(not(debug_assertions))]
const PUBLIC_POSTHOG_PROJECT_KEY: &str = "phc_sgKidIE4WYYFSJHd8LEYY1UZqASpnfQKeMqlJfSXwqg";

// ---
Expand Down
1 change: 1 addition & 0 deletions crates/re_data_store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ serde = ["dep:serde", "re_log_types/serde"]
re_arrow_store.workspace = true
re_log_types.workspace = true
re_log.workspace = true
re_smart_channel.workspace = true
re_string_interner.workspace = true

ahash = "0.8"
Expand Down
5 changes: 5 additions & 0 deletions crates/re_data_store/src/log_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ pub struct LogDb {
/// that are created after they were logged.
timeless_message_ids: Vec<MsgId>,

/// Set by whomever created this [`LogDb`].
pub data_source: Option<re_smart_channel::Source>,

/// Comes in a special message, [`LogMsg::BeginRecordingMsg`].
recording_info: Option<RecordingInfo>,

/// Where we store the entities.
Expand Down Expand Up @@ -266,6 +270,7 @@ impl LogDb {
chronological_message_ids,
log_messages,
timeless_message_ids,
data_source: _,
recording_info: _,
entity_db,
} = self;
Expand Down
4 changes: 3 additions & 1 deletion crates/re_log_types/src/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ fn test_encode_decode() {
recording_id: crate::RecordingId::random(),
is_official_example: true,
started: Time::now(),
recording_source: crate::RecordingSource::PythonSdk,
recording_source: crate::RecordingSource::RustSdk {
rust_version: env!("CARGO_PKG_RUST_VERSION").into(),
},
},
})];

Expand Down
41 changes: 39 additions & 2 deletions crates/re_log_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,46 @@ pub struct RecordingInfo {
pub recording_source: RecordingSource,
}

#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct PythonVersion {
/// e.g. 3
pub major: u8,

/// e.g. 11
pub minor: u8,

/// e.g. 0
pub patch: u8,

/// e.g. `a0` for alpha releases.
pub suffix: String,
}

impl std::fmt::Display for PythonVersion {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let Self {
major,
minor,
patch,
suffix,
} = self;
write!(f, "{major}.{minor}.{patch}{suffix}")
}
}

#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub enum RecordingSource {
Unknown,

/// The official Rerun Python Logging SDK
PythonSdk,
PythonSdk(PythonVersion),

/// The official Rerun Rust Logging SDK
RustSdk {
rust_version: String,
},

/// Perhaps from some manual data ingestion?
Other(String),
Expand All @@ -229,7 +264,9 @@ pub enum RecordingSource {
impl std::fmt::Display for RecordingSource {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::PythonSdk => "Python SDK".fmt(f),
Self::Unknown => "Unknown".fmt(f),
Self::PythonSdk(version) => write!(f, "Python {version} SDK"),
Self::RustSdk { rust_version } => write!(f, "Rust {rust_version} SDK"),
Self::Other(string) => format!("{string:?}").fmt(f), // put it in quotes
}
}
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::<()>::default();
let mut point_cloud_builder = PointCloudBuilder::<()>::new(re_ctx);
point_cloud_builder
.batch("points")
.add_points_2d(
Expand Down
4 changes: 3 additions & 1 deletion crates/re_renderer/examples/framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ struct Application<E> {
window: Window,
surface: wgpu::Surface,
surface_config: wgpu::SurfaceConfiguration,
re_ctx: RenderContext,
time: Time,

example: E,

re_ctx: RenderContext,
}

impl<E: Example + 'static> Application<E> {
Expand Down Expand Up @@ -277,6 +278,7 @@ impl<E: Example + 'static> Application<E> {
}
};

self.re_ctx.before_submit();
self.re_ctx.queue.submit(
draw_results
.into_iter()
Expand Down
52 changes: 30 additions & 22 deletions crates/re_renderer/examples/multiview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ use rand::Rng;
use re_renderer::{
renderer::{
GenericSkyboxDrawData, LineDrawData, LineStripFlags, MeshDrawData, MeshInstance,
PointCloudBatchFlags, PointCloudBatchInfo, PointCloudDrawData, PointCloudVertex,
TestTriangleDrawData,
},
resource_managers::ResourceLifeTime,
view_builder::{OrthographicCameraMode, Projection, TargetConfiguration, ViewBuilder},
Color32, LineStripSeriesBuilder, RenderContext, Rgba, Size,
Color32, LineStripSeriesBuilder, PointCloudBuilder, RenderContext, Rgba, Size,
};
use winit::event::{ElementState, VirtualKeyCode};

Expand Down Expand Up @@ -163,7 +162,8 @@ struct Multiview {
mesh_instance_positions_and_colors: Vec<(glam::Vec3, Color32)>,

// Want to have a large cloud of random points, but doing rng for all of them every frame is too slow
random_points: Vec<PointCloudVertex>,
random_points_positions: Vec<glam::Vec3>,
random_points_radii: Vec<Size>,
random_points_colors: Vec<Color32>,
}

Expand All @@ -188,17 +188,23 @@ impl Example for Multiview {

let mut rnd = <rand::rngs::StdRng as rand::SeedableRng>::seed_from_u64(42);
let random_point_range = -5.0_f32..5.0_f32;
let random_points = (0..500000)
.map(|_| PointCloudVertex {
position: glam::vec3(

let point_count = 500000;
let random_points_positions = (0..point_count)
.map(|_| {
glam::vec3(
rnd.gen_range(random_point_range.clone()),
rnd.gen_range(random_point_range.clone()),
rnd.gen_range(random_point_range.clone()),
),
radius: Size::new_scene(rnd.gen_range(0.005..0.05)),
)
})
.collect_vec();
let random_points_colors = (0..500000).map(|_| random_color(&mut rnd)).collect_vec();
let random_points_radii = (0..point_count)
.map(|_| Size::new_scene(rnd.gen_range(0.005..0.05)))
.collect_vec();
let random_points_colors = (0..point_count)
.map(|_| random_color(&mut rnd))
.collect_vec();

let model_mesh_instances = {
let reader = std::io::Cursor::new(include_bytes!("rerun.obj.zip"));
Expand Down Expand Up @@ -232,7 +238,8 @@ impl Example for Multiview {

model_mesh_instances,
mesh_instance_positions_and_colors,
random_points,
random_points_positions,
random_points_radii,
random_points_colors,
}
}
Expand Down Expand Up @@ -260,18 +267,19 @@ impl Example for Multiview {
let triangle = TestTriangleDrawData::new(re_ctx);
let skybox = GenericSkyboxDrawData::new(re_ctx);
let lines = build_lines(re_ctx, seconds_since_startup);
let point_cloud = PointCloudDrawData::new(
re_ctx,
&self.random_points,
&self.random_points_colors,
&[PointCloudBatchInfo {
label: "Random points".into(),
world_from_obj: glam::Mat4::from_rotation_x(seconds_since_startup),
point_count: self.random_points.len() as _,
flags: PointCloudBatchFlags::ENABLE_SHADING,
}],
)
.unwrap();

let mut builder = PointCloudBuilder::<()>::new(re_ctx);
builder
.batch("Random Points")
.world_from_obj(glam::Mat4::from_rotation_x(seconds_since_startup))
.add_points(
self.random_points_positions.len(),
self.random_points_positions.iter().cloned(),
)
.radii(self.random_points_radii.iter().cloned())
.colors(self.random_points_colors.iter().cloned());

let point_cloud = builder.to_draw_data(re_ctx).unwrap();
let meshes = build_mesh_instances(
re_ctx,
&self.model_mesh_instances,
Expand Down
Loading

0 comments on commit c41dba2

Please sign in to comment.