Skip to content

Commit

Permalink
Rename Material component to AlbedoFactor (#6841)
Browse files Browse the repository at this point in the history
### What
* Closes #6829

⚠️ This is a breaking change!

This renames the `Material` component to `AlbedoFactor`, which now
simply wraps a `datatypes.Rgba32`.

Consequently, the field `mesh_material` in `Mesh3D` is now named
`albedo_factor`

When constructing a `Mesh3D`:
* C++ & Rust: `.with_mesh_material(Material::from_albedo_factor(color))`
-> `with_albedo_factor(color)`
* Python: `mesh_material=rr.Material(albedo_factor=color)` ->
`albedo_factor=color`

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using examples from latest `main` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/6841?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/6841?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!
* [x] I have run the `raw_mesh` examples
* [x] I have asked for a final `@rerun-bot full-check` and checked the
results

- [PR Build Summary](https://build.rerun.io/pr/6841)
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

To run all checks from `main`, comment on the PR with `@rerun-bot
full-check`.
  • Loading branch information
emilk authored Jul 10, 2024
1 parent b277376 commit 29c9551
Show file tree
Hide file tree
Showing 74 changed files with 341 additions and 940 deletions.
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ To get an auto-generated PR description you can put "copilot:summary" or "copilo
* Using full set of examples from `nightly` build: [rerun.io/viewer](https://rerun.io/viewer/pr/{{pr.number}}?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [ ] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG
* [ ] If applicable, add a new check to the [release checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!
* [ ] If have noted any breaking changes to the log API in `CHANGELOG.md` and the migration guide

- [PR Build Summary](https://build.rerun.io/pr/{{pr.number}})
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## [Unreleased](https://github.com/rerun-io/rerun/compare/latest...HEAD)

# ⚠️ Breaking changes
* `mesh_material: Material` has been renamed to `albedo_factor: AlbedoFactor` [#6841](https://github.com/rerun-io/rerun/pull/6841)


## [0.17.0](https://github.com/rerun-io/rerun/compare/0.16.1...0.17.0) - More Blueprint features and better notebooks - 2024-07-08

Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ features = ["all"]


[features]
default = []
default = ["ecolor"]

## All features except `testing`.
all = ["ecolor", "egui_plot", "glam", "image", "mint", "serde"]
Expand Down
4 changes: 2 additions & 2 deletions crates/store/re_types/definitions/rerun/archetypes/mesh3d.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ table Mesh3D (
/// An optional uv texture coordinate for each vertex.
vertex_texcoords: [rerun.components.Texcoord2D] ("attr.rerun.component_optional", nullable, order: 3200);

/// Optional material properties for the mesh as a whole.
mesh_material: rerun.components.Material ("attr.rerun.component_optional", nullable, order: 3300);
/// A color multiplier applied to the whole mesh.
albedo_factor: rerun.components.AlbedoFactor ("attr.rerun.component_optional", nullable, order: 3300);

/// Optional albedo texture.
///
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/definitions/rerun/components.fbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include "./components/aggregation_policy.fbs";
include "./components/albedo_factor.fbs";
include "./components/annotation_context.fbs";
include "./components/axis_length.fbs";
include "./components/blob.fbs";
Expand All @@ -20,7 +21,6 @@ include "./components/line_strip3d.fbs";
include "./components/magnification_filter.fbs";
include "./components/marker_shape.fbs";
include "./components/marker_size.fbs";
include "./components/material.fbs";
include "./components/media_type.fbs";
include "./components/name.fbs";
include "./components/opacity.fbs";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
include "arrow/attributes.fbs";
include "python/attributes.fbs";
include "rust/attributes.fbs";

include "rerun/datatypes.fbs";
include "rerun/attributes.fbs";

namespace rerun.components;

// ---

/// A color multiplier, usually applied to a whole entity, e.g. a mesh.
table AlbedoFactor (
"attr.docs.unreleased",
"attr.rust.derive": "Copy, PartialEq, Eq, PartialOrd, Ord, Hash, bytemuck::Pod, bytemuck::Zeroable",
"attr.rust.repr": "transparent"
) {
albedo_factor: rerun.datatypes.Rgba32 (order: 100);
}

18 changes: 0 additions & 18 deletions crates/store/re_types/definitions/rerun/components/material.fbs

This file was deleted.

1 change: 0 additions & 1 deletion crates/store/re_types/definitions/rerun/datatypes.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ include "./datatypes/keypoint_id.fbs";
include "./datatypes/keypoint_pair.fbs";
include "./datatypes/mat3x3.fbs";
include "./datatypes/mat4x4.fbs";
include "./datatypes/material.fbs";
include "./datatypes/quaternion.fbs";
include "./datatypes/range1d.fbs";
include "./datatypes/range2d.fbs";
Expand Down
18 changes: 0 additions & 18 deletions crates/store/re_types/definitions/rerun/datatypes/material.fbs

This file was deleted.

33 changes: 17 additions & 16 deletions crates/store/re_types/src/archetypes/mesh3d.rs

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

2 changes: 1 addition & 1 deletion crates/store/re_types/src/components/.gitattributes

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

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

10 changes: 10 additions & 0 deletions crates/store/re_types/src/components/albedo_factor_ext.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use crate::datatypes::Rgba32;

use super::AlbedoFactor;

impl Default for AlbedoFactor {
#[inline]
fn default() -> Self {
Self(Rgba32::WHITE)
}
}
11 changes: 0 additions & 11 deletions crates/store/re_types/src/components/material_ext.rs

This file was deleted.

Loading

0 comments on commit 29c9551

Please sign in to comment.