8000 Issue 29a: errors when no object or group specified by quillaja · Pull Request #116 · g3n/engine · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Issue 29a: errors when no object or group specified #116

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

8000
Merged
merged 10 commits into from
Mar 14, 2019

Conversation

quillaja
Copy link
Contributor

While working on #29, I used some OBJs with geometry defined not using object (o) or group (g) lines. Apparently these are also optional in the OBJ format. In the case when a file does not have an o or g specified, a nil-pointer error is encountered at dec.objCurrent in parseFace(), as it assume a group is made previously via the parseObject() method.

To protect against this, basically just made a group unnamed###. I also pulled the creation of obj.Object out into a private func because I thought I'd have to call it from multiple places (I didn't need to, but it may be useful down the road).

quillaja added 10 commits March 6, 2019 09:28
…file can be found and when no materials are specified in the OBJ file.
…de. added default material defined in 1 location.
object (o) and group (g) lines are optional in OBJ. the parser doesn't create a group if
these lines are not present, which breaks parsing of face and usemtl lines. I added checks
to create 'default' groups when first encountering a usemtl or face line if no group or
object was created.
DecodeReader() will try the io.Reader first, then the mtllib file
in the OBJ, if present. If all else fails, a default material is
applied. DecodeReader() produces no error for materials.
Merge branch 'issue-29-obj-default-mat' into issue-29-handle-no-groups
@quillaja quillaja mentioned this pull request Mar 12, 2019
@danaugrs danaugrs merged commit 70eaa04 into g3n:master Mar 14, 2019
@danaugrs
Copy link
Member

Merged! 😄

uzudil pushed a commit to uzudil/engine that referenced this pull request Dec 16, 2020
Issue 29a: errors when no object or group specified
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
0