Skip to content

Conversation

@jordan-bonecutter
Copy link

It would be nice to be able to load an obj file from an io.ReadCloser for scenarios when you don't have an OS file and don't want to write one to disk just to load it.

@jordan-bonecutter jordan-bonecutter changed the title Add LoadOBJReader function to load an obj from an io.ReadCloser Support loading from non-os.File readers and add tests for loading meshes Jan 24, 2026
@jordan-bonecutter
Copy link
Author

jordan-bonecutter commented Jan 24, 2026

Hey @fogleman, I'm sure you're busy and maybe don't have time to look at MRs on this repo but I hope you may find this one useful, I did a few things:

  1. Support loading meshes from io.Readers instead of os.Files. This was useful for me because I am writing a service which receives a mesh from the networks and wants to render an image of it on-the-fly.
  2. Add tests to the mesh loaders to attempt to ensure that I haven't broken anything
  3. Added go.mod and go.sum so that you can run go test .
  4. Fixed a panic in loading obj meshes, I found a mesh on the internet I was using for a test with a reference to a non existant face vertex (I think). The code made an out of bounds array access which could be undesirable
  5. Added cmd/render to manually spot check different mesh types, each supported file type seemed to work
  6. Tried to keep the interface as similar to what you had so that anyone downstream shouldn't have compatability issues

Thanks for an awesome repo, it's very useful!

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.

1 participant