Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
jleibs committed Jul 31, 2024
2 parents 2558ccd + aa17ab4 commit 400bb8b
Show file tree
Hide file tree
Showing 184 changed files with 3,795 additions and 4,687 deletions.
4 changes: 4 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5012,6 +5012,7 @@ dependencies = [
"re_viewport_blueprint",
"serde",
"smallvec",
"vec1",
"web-time",
]

Expand Down Expand Up @@ -6975,6 +6976,9 @@ name = "vec1"
version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bda7c41ca331fe9a1c278a9e7ee055f4be7f5eb1c2b72f079b4ff8b5fce9d5c"
dependencies = [
"smallvec",
]

[[package]]
name = "version_check"
Expand Down
6 changes: 4 additions & 2 deletions crates/store/re_chunk/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,13 @@ impl UnitChunkShared {
/// The maximum value amongst all components is what's returned.
#[inline]
pub fn num_instances(&self) -> u64 {
debug_assert!(self.num_rows() == 1);
self.components
.values()
.map(|list_array| {
list_array.validity().map_or_else(
|| list_array.len(),
let array = list_array.value(0);
array.validity().map_or_else(
|| array.len(),
|validity| validity.len() - validity.unset_bits(),
)
})
Expand Down
1 change: 1 addition & 0 deletions crates/store/re_types/definitions/rerun/archetypes.fbs

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

13 changes: 4 additions & 9 deletions crates/store/re_types/definitions/rerun/archetypes/asset3d.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ namespace rerun.archetypes;
///
/// See also [archetypes.Mesh3D].
///
/// If there are multiple [archetypes.LeafTransforms3D] instances logged to the same entity as a mesh,
/// an instance of the mesh will be drawn for each transform.
///
/// \example archetypes/asset3d_simple title="Simple 3D asset" image="https://static.rerun.io/asset3d_simple/af238578188d3fd0de3e330212120e2842a8ddb2/1200w.png"
/// \example archetypes/asset3d_out_of_tree !api title="3D asset with out-of-tree transform"
table Asset3D (
"attr.rust.derive": "PartialEq",
"attr.rust.derive": "PartialEq, Eq",
"attr.docs.category": "Spatial 3D",
"attr.docs.view_types": "Spatial3DView, Spatial2DView: if logged above active projection"
) {
Expand All @@ -31,11 +33,4 @@ table Asset3D (
/// If omitted, the viewer will try to guess from the data blob.
/// If it cannot guess, it won't be able to render the asset.
media_type: rerun.components.MediaType ("attr.rerun.component_recommended", nullable, order: 2000);

// --- Optional ---

/// An out-of-tree transform.
///
/// Applies a transformation to the asset itself without impacting its children.
transform: rerun.components.OutOfTreeTransform3D ("attr.rerun.component_optional", nullable, order: 3000);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
namespace rerun.archetypes;


/// One or more transforms between the parent and the current entity which are *not* propagated in the transform hierarchy.
///
/// For transforms that are propagated in the transform hierarchy, see [archetypes.Transform3D].
///
/// If both [archetypes.LeafTransforms3D] and [archetypes.Transform3D] are present,
/// first the tree propagating [archetypes.Transform3D] is applied, then [archetypes.LeafTransforms3D].
///
/// Currently, most visualizers support only a single leaf transform per entity.
/// Check archetype documentations for details - if not otherwise specified, only the first leaf transform is applied.
///
/// From the point of view of the entity's coordinate system,
/// all components are applied in the inverse order they are listed here.
/// E.g. if both a translation and a max3x3 transform are present,
/// the 3x3 matrix is applied first, followed by the translation.
///
/// \example archetypes/leaf_transforms3d_combined title="Regular & leaf transform in tandom" image="https://static.rerun.io/leaf_transform3d/41674f0082d6de489f8a1cd1583f60f6b5820ddf/1200w.png"
table LeafTransforms3D (
"attr.rust.derive": "Default, PartialEq",
"attr.rust.generate_field_info",
"attr.docs.category": "Spatial 3D",
"attr.docs.view_types": "Spatial3DView, Spatial2DView: if logged above active projection"
) {
/// Translation vectors.
translations: [rerun.components.LeafTranslation3D] ("attr.rerun.component_optional", nullable, order: 1100);

/// Rotations via axis + angle.
rotation_axis_angles: [rerun.components.LeafRotationAxisAngle] ("attr.rerun.component_optional", nullable, order: 1200);

/// Rotations via quaternion.
quaternions: [rerun.components.LeafRotationQuat] ("attr.rerun.component_optional", nullable, order: 1300);

/// Scaling factors.
scales: [rerun.components.LeafScale3D] ("attr.rerun.component_optional", nullable, order: 1400);

/// 3x3 transformation matrices.
mat3x3: [rerun.components.LeafTransformMat3x3] ("attr.rerun.component_optional", nullable, order: 1500);

// TODO(andreas): Support TransformRelation?
// TODO(andreas): Support axis_length?
}
4 changes: 4 additions & 0 deletions crates/store/re_types/definitions/rerun/archetypes/mesh3d.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ namespace rerun.archetypes;
///
/// See also [archetypes.Asset3D].
///
/// If there are multiple [archetypes.LeafTransforms3D] instances logged to the same entity as a mesh,
/// an instance of the mesh will be drawn for each transform.
///
/// \example archetypes/mesh3d_indexed title="Simple indexed 3D mesh" image="https://static.rerun.io/mesh3d_simple/e1e5fd97265daf0d0bc7b782d862f19086fd6975/1200w.png"
/// \example archetypes/mesh3d_partial_updates !api title="3D mesh with partial updates" image="https://static.rerun.io/mesh3d_partial_updates/a11e4accb0257dcd9531867b7e1d6fd5e3bee5c3/1200w.png"
/// \example archetypes/mesh3d_leaf_transforms3d title="3D mesh with leaf transforms" image="https://static.rerun.io/mesh3d_leaf_transforms3d/c2d0ee033129da53168f5705625a9b033f3a3d61/1200w.png"
table Mesh3D (
"attr.rust.derive": "PartialEq",
"attr.docs.category": "Spatial 3D",
Expand Down
2 changes: 0 additions & 2 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.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,12 @@ table RotationAxisAngle (
) {
rotation: rerun.datatypes.RotationAxisAngle (order: 100);
}

/// 3D rotation represented by a rotation around a given axis that doesn't propagate in the transform hierarchy.
table LeafRotationAxisAngle (
"attr.docs.unreleased",
"attr.rust.derive": "Default, Copy, PartialEq",
"attr.rust.repr": "transparent"
) {
rotation: rerun.datatypes.RotationAxisAngle (order: 100);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,23 @@ namespace rerun.components;
/// A 3D rotation expressed as a quaternion.
///
/// Note: although the x,y,z,w components of the quaternion will be passed through to the
/// datastore as provided, when used in the Viewer Quaternions will always be normalized.
/// datastore as provided, when used in the Viewer, quaternions will always be normalized.
struct RotationQuat (
"attr.docs.unreleased",
"attr.rust.derive": "Default, Copy, PartialEq, bytemuck::Pod, bytemuck::Zeroable",
"attr.rust.repr": "transparent"
) {
quaternion: rerun.datatypes.Quaternion (order: 100);
}

/// A 3D rotation expressed as a quaternion that doesn't propagate in the transform hierarchy.
///
/// Note: although the x,y,z,w components of the quaternion will be passed through to the
/// datastore as provided, when used in the Viewer, quaternions will always be normalized.
struct LeafRotationQuat (
"attr.docs.unreleased",
"attr.rust.derive": "Default, Copy, PartialEq, bytemuck::Pod, bytemuck::Zeroable",
"attr.rust.repr": "transparent"
) {
quaternion: rerun.datatypes.Quaternion (order: 100);
}
13 changes: 13 additions & 0 deletions crates/store/re_types/definitions/rerun/components/scale3d.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,16 @@ struct Scale3D (
) {
scale: rerun.datatypes.Vec3D (order: 100);
}

/// A 3D scale factor that doesn't propagate in the transform hierarchy.
///
/// A scale of 1.0 means no scaling.
/// A scale of 2.0 means doubling the size.
/// Each component scales along the corresponding axis.
struct LeafScale3D (
"attr.docs.unreleased",
"attr.rust.derive": "Copy, PartialEq, bytemuck::Pod, bytemuck::Zeroable",
"attr.rust.repr": "transparent"
) {
scale: rerun.datatypes.Vec3D (order: 100);
}
11 changes: 0 additions & 11 deletions crates/store/re_types/definitions/rerun/components/transform3d.fbs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,46 @@ struct TransformMat3x3 (
matrix: rerun.datatypes.Mat3x3 (order: 100);
}


/// A 3x3 transformation matrix Matrix that doesn't propagate in the transform hierarchy.
///
/// 3x3 matrixes are able to represent any affine transformation in 3D space,
/// i.e. rotation, scaling, shearing, reflection etc.
///
/// Matrices in Rerun are stored as flat list of coefficients in column-major order:
/// ```text
/// column 0 column 1 column 2
/// -------------------------------------------------
/// row 0 | flat_columns[0] flat_columns[3] flat_columns[6]
/// row 1 | flat_columns[1] flat_columns[4] flat_columns[7]
/// row 2 | flat_columns[2] flat_columns[5] flat_columns[8]
/// ```
///
/// \py However, construction is done from a list of rows, which follows NumPy's convention:
/// \py ```python
/// \py np.testing.assert_array_equal(
/// \py rr.components.LeafTransformMat3x3([1, 2, 3, 4, 5, 6, 7, 8, 9]).flat_columns, np.array([1, 4, 7, 2, 5, 8, 3, 6, 9], dtype=np.float32)
/// \py )
/// \py np.testing.assert_array_equal(
/// \py rr.components.LeafTransformMat3x3([[1, 2, 3], [4, 5, 6], [7, 8, 9]]).flat_columns,
/// \py np.array([1, 4, 7, 2, 5, 8, 3, 6, 9], dtype=np.float32),
/// \py )
/// \py ```
/// \py If you want to construct a matrix from a list of columns instead, use the named `columns` parameter:
/// \py ```python
/// \py np.testing.assert_array_equal(
/// \py rr.components.LeafTransformMat3x3(columns=[1, 2, 3, 4, 5, 6, 7, 8, 9]).flat_columns,
/// \py np.array([1, 2, 3, 4, 5, 6, 7, 8, 9], dtype=np.float32),
/// \py )
/// \py np.testing.assert_array_equal(
/// \py rr.components.LeafTransformMat3x3(columns=[[1, 2, 3], [4, 5, 6], [7, 8, 9]]).flat_columns,
/// \py np.array([1, 2, 3, 4, 5, 6, 7, 8, 9], dtype=np.float32),
/// \py )
/// \py ```
struct LeafTransformMat3x3 (
"attr.docs.unreleased",
"attr.rust.derive": "Default, Copy, PartialEq, bytemuck::Pod, bytemuck::Zeroable",
"attr.rust.repr": "transparent"
) {
matrix: rerun.datatypes.Mat3x3 (order: 100);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ enum TransformRelation: byte (
) {
/// The transform describes how to transform into the parent entity's space.
///
/// E.g. a translation of (0, 1, 0) with this `TransformRelation` logged at `parent/child` means
/// E.g. a translation of (0, 1, 0) with this [components.TransformRelation] logged at `parent/child` means
/// that from the point of view of `parent`, `parent/child` is translated 1 unit along `parent`'s Y axis.
/// From perspective of `parent/child`, the `parent` entity is translated -1 unit along `parent/child`'s Y axis.
ParentFromChild(default),

/// The transform describes how to transform into the child entity's space.
///
/// E.g. a translation of (0, 1, 0) with this `TransformRelation` logged at `parent/child` means
/// E.g. a translation of (0, 1, 0) with this [components.TransformRelation] logged at `parent/child` means
/// that from the point of view of `parent`, `parent/child` is translated -1 unit along `parent`'s Y axis.
/// From perspective of `parent/child`, the `parent` entity is translated 1 unit along `parent/child`'s Y axis.
ChildFromParent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,12 @@ struct Translation3D (
) {
vector: rerun.datatypes.Vec3D (order: 100);
}

/// A translation vector in 3D space that doesn't propagate in the transform hierarchy.
struct LeafTranslation3D (
"attr.docs.unreleased",
"attr.rust.derive": "Default, Copy, PartialEq, bytemuck::Pod, bytemuck::Zeroable",
"attr.rust.repr": "transparent"
) {
vector: rerun.datatypes.Vec3D (order: 100);
}
3 changes: 0 additions & 3 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.

27 changes: 0 additions & 27 deletions crates/store/re_types/definitions/rerun/datatypes/scale3d.fbs

This file was deleted.

16 changes: 0 additions & 16 deletions crates/store/re_types/definitions/rerun/datatypes/transform3d.fbs

This file was deleted.

This file was deleted.

Loading

0 comments on commit 400bb8b

Please sign in to comment.