Skip to content

Add stl support#99

Open
Rushmore75 wants to merge 8 commits into
orhun:mainfrom
Rushmore75:main
Open

Add stl support#99
Rushmore75 wants to merge 8 commits into
orhun:mainfrom
Rushmore75:main

Conversation

@Rushmore75

Copy link
Copy Markdown
  • STLs load
  • clippy is happy

Somewhat related to #78

Got slightly carried away in src/inline.rs and abstracted some logic into a from in src/model.rs. But besides that this just adds stl support. It looks like gltf support basically already exists, but I don't have a gltf model on hand to test it.

@orhun orhun left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just had a question about which library to use here.
I saw bevy_stl and thought that it might be used since we already use bevy. Additionally, I saw that we already depend on some code from it.

Also, can you do the following updates:

  • Update the RGP protocol spec based on this new support. Should be quick to do :)
  • Do you have a cool STL model that we can include in assets/objects for demo purposes?

Comment thread src/model.rs
let mut c = Cursor::new(reader);
let stl = stl_io::read_stl(&mut c)?;

// credit: bevy_stl (MIT)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just use bevy_stl in this implementation?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bevy_stl uses stl_io under the hood - So I just took the piece of the (albet, already small) library that this needed. This was because I didn't want to figure out if bevy_stl needed any custom loaders or whatnot. https://github.com/nilclass/bevy_stl/blob/73a0afb5d7d4f444a0e5bb95a7f4f83e6bf9f624/src/lib.rs#L61

This was just the first way I tried to solve it 🤷‍♂️

@orhun orhun left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another thing that I realized: I could not use a STL file in place of the cursor. I think this implementation only supports placing STL objects via RGP protocol.

Comment thread .gitignore Outdated
@@ -1,4 +1,5 @@
/target
assets/img
/widget/target

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we could just one entry such as */**/target (don't remember the exact syntax) instead of ignoring each target directory

@Rushmore75

Rushmore75 commented Jun 12, 2026

Copy link
Copy Markdown
Author
  • support stl for cursor
  • update RGP protocol spec
  • figure out target .gitignore
  • find / create demo stl

@Rushmore75

Copy link
Copy Markdown
Author

That should solve all those issues if you would like to test again

@orhun orhun left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good :)

I tried this STL file for the cursor: https://p.orhun.dev/teamug.stl

But couldn't get it to work properly:

Peek.2026-06-15.00-53.mp4

Any ideas?

P.S. can you resolve conflicts? 👼🏼

@Rushmore75

Copy link
Copy Markdown
Author

When I open that STL in blender it also has the large plane below it. So I think that it's rendering as-intended 🤔
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants