obj-rs
obj-rs copied to clipboard
Document how to use and customize `Obj` in detail
I'm trying to load an OBJ file that has been exported from FreeCAD. When doing so, I get the following error message:
LoadError { kind: InsufficientData, desc: "Tried to extract normal data which are not contained in the model" }
What does that mean? FreeCAD can open those files fine, are these normals required to load the file?
(Note: I'm only getting started with the OBJ format and don't have a lot of knowledge about it yet.)
The same thing happens when loading the file tests/fixtures/pot.obj
in the repository from the glium
example.
Same happens with own cube.obj in the fixutres tests: https://github.com/simnalamburt/obj-rs/blob/master/tests/fixtures/cube.obj
Looks like some fork has a patch to have optional normals.
https://github.com/ojhunt/obj-rs/commit/fe7b3c71a22ec531ce995f077385a7439bb34f2d
I think making a new type like VertexWithoutNormal
would be better, since Option
type in Vertex
struct is hard to handle with GPU.
Wait, a type called Position
already exists. If your Obj file does not contains normal data, this will work:
https://github.com/simnalamburt/obj-rs/blob/a9213b00794641a003456c3cbb77228d99f26ee5/examples/no-normal.rs#L15-L20
I do understand that this is not documented very well. Let's change the title of this issue to state the problem clearer!