Skip to content

Commit c5dca89

Browse files
authored
Rerun 0.21 (#5)
1 parent 510b422 commit c5dca89

File tree

8 files changed

+692
-118
lines changed

8 files changed

+692
-118
lines changed

Cargo.lock

Lines changed: 658 additions & 74 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]
2525

2626

2727
[dependencies]
28-
rerun = { version = "0.20", default-features = false, features = [
28+
rerun = { version = "0.21.0", default-features = false, features = [
2929
"sdk",
3030
"image",
3131
"glam",

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ https://github.com/rerun-io/revy/assets/2910679/cd096cbe-5e68-4acf-8010-e6c32c55
2525

2626
## Examples
2727

28-
|[Breakout](https://github.com/rerun-io/revy/blob/0.20.0/examples/breakout.rs#L69-L82)|[3D shapes](https://github.com/rerun-io/revy/blob/0.20.0/examples/3d_shapes.rs#L41-L54)|[Alien Cake Addict](https://github.com/rerun-io/revy/blob/0.20.0/examples/alien_cake_addict.rs#L39-L52)|
28+
|[Breakout](https://github.com/rerun-io/revy/blob/0.21.0/examples/breakout.rs#L69-L82)|[3D shapes](https://github.com/rerun-io/revy/blob/0.21.0/examples/3d_shapes.rs#L41-L54)|[Alien Cake Addict](https://github.com/rerun-io/revy/blob/0.21.0/examples/alien_cake_addict.rs#L39-L52)|
2929
| :----------------------------------------------------------------: | :-------------------------------------------------------------: | :--------------------------------------------------------------: |
30-
| [*Live demo*](https://rerun.io/viewer/version/0.20.0/?url=https://static.rerun.io/rrd/0.20.0/revy_breakout_3572dc5d61f77dc4fc9675a85c74035a6ee4b020.rrd) | [*Live demo*](https://rerun.io/viewer/version/0.20.0/?url=https://static.rerun.io/rrd/0.20.0/revy_3d_shapes_146ceeb1ab6e9bb69df6e3a39df6243579ed4f1d.rrd) | [*Live demo*](https://rerun.io/viewer/version/0.20.0/?url=https://static.rerun.io/rrd/0.20.0/revy_alien_cake_addict_cadb9e027130bade64c9d9352073fc7240dfc238.rrd) |
30+
| [*Live demo*](https://rerun.io/viewer/version/0.21.0/?url=https://static.rerun.io/rrd/0.20.0/revy_breakout_3572dc5d61f77dc4fc9675a85c74035a6ee4b020.rrd) | [*Live demo*](https://rerun.io/viewer/version/0.21.0/?url=https://static.rerun.io/rrd/0.20.0/revy_3d_shapes_146ceeb1ab6e9bb69df6e3a39df6243579ed4f1d.rrd) | [*Live demo*](https://rerun.io/viewer/version/0.21.0/?url=https://static.rerun.io/rrd/0.20.0/revy_alien_cake_addict_cadb9e027130bade64c9d9352073fc7240dfc238.rrd) |
3131
| <picture><img src="https://static.rerun.io/revy_breakout/de578dd0aee06c6ac2260da302b5e02ee4fdcdad/full.png" alt=""><source media="(max-width: 480px)" srcset="https://static.rerun.io/revy_breakout/de578dd0aee06c6ac2260da302b5e02ee4fdcdad/480w.png"><source media="(max-width: 768px)" srcset="https://static.rerun.io/revy_breakout/de578dd0aee06c6ac2260da302b5e02ee4fdcdad/768w.png"><source media="(max-width: 1024px)" srcset="https://static.rerun.io/revy_breakout/de578dd0aee06c6ac2260da302b5e02ee4fdcdad/1024w.png"><source media="(max-width: 1200px)" srcset="https://static.rerun.io/revy_breakout/de578dd0aee06c6ac2260da302b5e02ee4fdcdad/1200w.png"></picture> | <picture><img src="https://static.rerun.io/revy_3d_shapes/28870c94c4ffec871916890d8eaa8661da1b364e/full.png" alt=""><source media="(max-width: 480px)" srcset="https://static.rerun.io/revy_3d_shapes/28870c94c4ffec871916890d8eaa8661da1b364e/480w.png"><source media="(max-width: 768px)" srcset="https://static.rerun.io/revy_3d_shapes/28870c94c4ffec871916890d8eaa8661da1b364e/768w.png"><source media="(max-width: 1024px)" srcset="https://static.rerun.io/revy_3d_shapes/28870c94c4ffec871916890d8eaa8661da1b364e/1024w.png"><source media="(max-width: 1200px)" srcset="https://static.rerun.io/revy_3d_shapes/28870c94c4ffec871916890d8eaa8661da1b364e/1200w.png"></picture> |<picture><img src="https://static.rerun.io/revy_alien_cake_addict/8c6f1828dec207f86a887d1b180e9d92b38b4523/full.png" alt=""><source media="(max-width: 480px)" srcset="https://static.rerun.io/revy_alien_cake_addict/8c6f1828dec207f86a887d1b180e9d92b38b4523/480w.png"><source media="(max-width: 768px)" srcset="https://static.rerun.io/revy_alien_cake_addict/8c6f1828dec207f86a887d1b180e9d92b38b4523/768w.png"><source media="(max-width: 1024px)" srcset="https://static.rerun.io/revy_alien_cake_addict/8c6f1828dec207f86a887d1b180e9d92b38b4523/1024w.png"><source media="(max-width: 1200px)" srcset="https://static.rerun.io/revy_alien_cake_addict/8c6f1828dec207f86a887d1b180e9d92b38b4523/1200w.png"></picture> |
3232

3333
---
@@ -36,11 +36,11 @@ https://github.com/rerun-io/revy/assets/2910679/cd096cbe-5e68-4acf-8010-e6c32c55
3636

3737
## Usage
3838

39-
1. [Install the Rerun Viewer](https://www.rerun.io/docs/getting-started/installing-viewer) (`0.20`).
39+
1. [Install the Rerun Viewer](https://www.rerun.io/docs/getting-started/installing-viewer) (`0.21`).
4040

4141
2. Add `revy` to your dependencies:
4242
```toml
43-
revy = "0.20" # always matches the rerun version
43+
revy = "0.21" # always matches the rerun version
4444
```
4545

4646
3. Initialize the `rerun` plugin:
@@ -105,3 +105,4 @@ You can also register your own custom loggers by inserting a `RerunComponentLogg
105105
| [0.13](https://github.com/bevyengine/bevy/releases/tag/v0.13.0) | [0.16](https://github.com/rerun-io/revy/releases/tag/0.16.0) | [0.16](https://github.com/rerun-io/rerun/releases/tag/0.16.0) |
106106
| [0.14](https://github.com/bevyengine/bevy/releases/tag/v0.14.0) | [0.17](https://github.com/rerun-io/revy/releases/tag/0.17.0) | [0.17](https://github.com/rerun-io/rerun/releases/tag/0.17.0) |
107107
| [0.15](https://github.com/bevyengine/bevy/releases/tag/v0.15.0) | [0.20](https://github.com/rerun-io/revy/releases/tag/0.20.0) | [0.20](https://github.com/rerun-io/rerun/releases/tag/0.20.0) |
108+
| [0.15](https://github.com/bevyengine/bevy/releases/tag/v0.15.0) | [0.21](https://github.com/rerun-io/revy/releases/tag/0.21.0) | [0.21](https://github.com/rerun-io/rerun/releases/tag/0.21.0) |

deny.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ skip-tree = [
4848
"event-listener",
4949
"fixedbitset", # Bevy has internally several versions
5050
"glam", # Rerun is behind versus Bevy
51+
"indexmap",
5152
"itertools",
5253
"libloading",
5354
"nix",
@@ -56,9 +57,10 @@ skip-tree = [
5657
"regex-automata",
5758
"regex-syntax",
5859
"sysinfo", # rerun depends on 0.30, bevy on 0.32
60+
"tower",
5961
"ttf-parser", # cosmic-text 0.12.1 depends on one version directly and on another one via fontdb 0.16.2
60-
"windows-sys",
6162
"windows",
63+
"windows-sys",
6264
]
6365

6466

src/default_loggers.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use bevy::{
55
utils::HashMap,
66
};
77

8-
use crate::{compute_entity_path, rerun_logger::ManyAsComponents, Aliased, RerunLogger, ToRerun};
8+
use crate::{compute_entity_path, Aliased, RerunLogger, ToRerun};
99

1010
// ---
1111

@@ -108,11 +108,11 @@ fn bevy_global_transform<'w>(
108108
// TODO(cmc): once again the DataUi does the wrong thing... we really need to
109109
// go typeless.
110110
let data = entity.get::<GlobalTransform>().map(|transform| {
111-
Box::new(ManyAsComponents(vec![
111+
Box::new(vec![
112112
Box::new(Aliased::<rerun::datatypes::Vec3D>::new(
113113
"GlobalTransform3D.translation",
114114
transform.translation().to_rerun(),
115-
)),
115+
)) as Box<dyn rerun::AsComponents>,
116116
Box::new(Aliased::<rerun::datatypes::Quaternion>::new(
117117
"GlobalTransform3D.rotation",
118118
transform.rotation().to_rerun(),
@@ -121,7 +121,7 @@ fn bevy_global_transform<'w>(
121121
"GlobalTransform3D.scale",
122122
transform.scale().to_rerun(),
123123
)),
124-
])) as _
124+
]) as _
125125
});
126126

127127
(suffix, data)

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(rustdoc::bare_urls)]
2+
#![allow(clippy::doc_markdown)]
13
#![doc = include_str!("../README.md")]
24

35
use bevy::prelude::*;

src/rerun_logger.rs

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -191,56 +191,38 @@ use rerun::external::{arrow2, re_types_core};
191191
/// Helper to log any [`rerun::LoggableBatch`] as a [`rerun::Component`] with the specified name.
192192
#[derive(Debug)]
193193
pub struct Aliased<C: rerun::LoggableBatch> {
194-
name: rerun::ComponentName,
194+
descriptor: rerun::ComponentDescriptor,
195195
data: C,
196196
}
197197

198198
impl<C: rerun::LoggableBatch> Aliased<C> {
199199
pub fn new(name: impl Into<rerun::ComponentName>, data: impl Into<C>) -> Self {
200200
Self {
201-
name: name.into(),
201+
descriptor: rerun::ComponentDescriptor::new(name.into()),
202202
data: data.into(),
203203
}
204204
}
205205
}
206206

207207
impl<C: rerun::LoggableBatch> rerun::AsComponents for Aliased<C> {
208208
#[inline]
209-
fn as_component_batches(&self) -> Vec<rerun::MaybeOwnedComponentBatch<'_>> {
210-
vec![rerun::MaybeOwnedComponentBatch::Ref(self)]
209+
fn as_component_batches(&self) -> Vec<rerun::ComponentBatchCowWithDescriptor<'_>> {
210+
vec![rerun::ComponentBatchCowWithDescriptor::new(
211+
self as &dyn rerun::ComponentBatch,
212+
)]
211213
}
212214
}
213215

214216
impl<C: rerun::LoggableBatch> rerun::LoggableBatch for Aliased<C> {
215-
type Name = rerun::ComponentName;
216-
217217
#[inline]
218-
fn name(&self) -> Self::Name {
219-
self.name
220-
}
221-
222-
#[inline]
223-
fn to_arrow(&self) -> re_types_core::SerializationResult<Box<dyn arrow2::array::Array>> {
224-
self.data.to_arrow()
218+
fn to_arrow2(&self) -> re_types_core::SerializationResult<Box<dyn arrow2::array::Array>> {
219+
self.data.to_arrow2()
225220
}
226221
}
227222

228-
impl<C: rerun::LoggableBatch> rerun::ComponentBatch for Aliased<C> {}
229-
230-
// ---
231-
232-
// TODO(cmc): Rerun should provide tools for this.
233-
234-
/// Helper to merge any number of [`rerun::AsComponents`].
235-
#[allow(dead_code)]
236-
pub struct ManyAsComponents(pub Vec<Box<dyn rerun::AsComponents>>);
237-
238-
impl rerun::AsComponents for ManyAsComponents {
223+
impl<C: rerun::LoggableBatch> rerun::ComponentBatch for Aliased<C> {
239224
#[inline]
240-
fn as_component_batches(&self) -> Vec<rerun::MaybeOwnedComponentBatch<'_>> {
241-
self.0
242-
.iter()
243-
.flat_map(|data| data.as_component_batches())
244-
.collect()
225+
fn descriptor(&self) -> std::borrow::Cow<'_, rerun::ComponentDescriptor> {
226+
std::borrow::Cow::Borrowed(&self.descriptor)
245227
}
246228
}

src/sync.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,10 @@ fn sync_components(
225225

226226
for batches in &component_batches {
227227
for batch in batches {
228-
current_components.insert(batch.name(), entity_path.clone());
228+
current_components.insert(
229+
rerun::ComponentBatch::descriptor(batch).into_owned(),
230+
entity_path.clone(),
231+
);
229232
}
230233
}
231234

@@ -235,7 +238,7 @@ fn sync_components(
235238
component_batches
236239
.iter()
237240
.flatten()
238-
.map(|batch| batch.as_ref()),
241+
.map(|batch| batch as &dyn rerun::ComponentBatch),
239242
)
240243
.ok_or_log_error();
241244
}
@@ -245,8 +248,8 @@ fn sync_components(
245248
.get::<CurrentComponents>()
246249
.unwrap_or(&empty_components);
247250

248-
for (component_name, entity_path) in last_components.iter() {
249-
if !current_components.contains_key(component_name) {
251+
for (component_desc, entity_path) in last_components.iter() {
252+
if !current_components.contains_key(component_desc) {
250253
rec.log(entity_path.clone(), &rerun::Clear::flat())
251254
.ok_or_log_error();
252255
}
@@ -323,4 +326,4 @@ struct CurrentHashes(HashMap<ComponentId, u64>);
323326

324327
/// Keeps track of all components on an entity in order to `Clear` removed ones.
325328
#[derive(Component, Debug, Clone, Default, Deref, DerefMut)]
326-
struct CurrentComponents(HashMap<rerun::ComponentName, rerun::EntityPath>);
329+
struct CurrentComponents(HashMap<rerun::ComponentDescriptor, rerun::EntityPath>);

0 commit comments

Comments
 (0)