-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rust SDK: raw 3D meshes and example #1010
Conversation
3dbe537
to
b3e3e65
Compare
examples/raw_mesh/src/main.rs
Outdated
// TODO(cmc): This should probably just be a compile flag of the SDK; if it's enabled, then the | ||
// global allocator is properly set by the SDK directly. | ||
#[global_allocator] | ||
static GLOBAL: AccountingAllocator<mimalloc::MiMalloc> = | ||
AccountingAllocator::new(mimalloc::MiMalloc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eeeeh then again in python it works nicely because it really only affects the SDK and not the user code (by virtue of the user code not being Rust to begin with), but in Rust it will affect everything, user code included, which seems too magical for Rust...
Scratch it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Though we will of course reexports all the needed libraries and types to make it easier for the user)
examples/raw_mesh/src/main.rs
Outdated
fn node_name(node: &gltf::Node<'_>) -> String { | ||
node.name() | ||
// TODO(cmc): now that index-paths and instance-keys are decorrelated, maybe we can use | ||
// those here. | ||
.map_or_else(|| format!("node_#{}", node.index()), ToOwned::to_owned) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: for e.g. Buggy.glb
I'm able to find names for the nodes when going through trimesh
, contrary to the current rust version which finds nothing... there's probably some missing logic here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a lot of TODO:s 😅
@@ -71,6 +70,7 @@ impl LoadedMesh { | |||
|
|||
let mut slf = Self::load_raw(name, *format, bytes, render_ctx)?; | |||
|
|||
// TODO(cmc): Why are we creating the matrix twice here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like some attempt to avoid shearing? But I really don't see the point.
For another PR: I think we should split Python examples from Rust examples, and not have them in the same folder.
|
let mesh_in = vec![Mesh3D::Encoded(EncodedMesh3D { | ||
mesh_id: MeshId::random(), | ||
format: MeshFormat::Glb, | ||
bytes: std::sync::Arc::new([5, 9, 13, 95, 38, 42, 98, 17]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe leave a note about the source of this data? Or is it random junk?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all junk
Co-authored-by: Emil Ernerfeldt <emil@rerun.io>
This implements triangle soups, but most importantly it identifies a lot of the pain points in our current Rust SDK, which I'll address in a PR that'll follow shortly.
Fixes #749 and fixes #809.
Test it with
cargo r -p raw_mesh