Skip to content
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

Feature/add ply support #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

NewProggie
Copy link

This PR adds PLY support.

@autopawn autopawn self-requested a review May 10, 2023 13:32
@autopawn
Copy link
Owner

Thank you very much for this PR. I don't know the PLY format very well (I just read wikipedia) so I am trusting that the way the format is read is correct enough.

I pointed out some comments though that I think should be addressed.

src/viewer.c Outdated Show resolved Hide resolved
src/model.c Outdated Show resolved Hide resolved

int vertex_count = 0;
int face_count = 0;

Copy link
Owner

Choose a reason for hiding this comment

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

My understanding is that all PLY files start with a ply line. I think we should check for that and throw an exit(1) printing "invalid format" to stderr if it is missing.

Also, I read that there are both a binary PLY format and a text PLY format. How can we check that this is indeed a text PLY file?

Copy link
Owner

Choose a reason for hiding this comment

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

It is still pending, but we should check for a line with

format ascii 1.0

in the header.

src/model.c Outdated Show resolved Hide resolved
src/model.c Outdated Show resolved Hide resolved
src/model.c Outdated Show resolved Hide resolved
README.md Outdated
@@ -32,6 +32,7 @@ $ ./3d-ascii-viewer --help

* [Fox and ShibaInu models](https://opengameart.org/content/fox-and-shiba) made by PixelMannen for the Public Domain (CC0).
* [Tree models](https://opengameart.org/content/fox-trees-pack) made by Lokesh Mehra (mehrasaur) for the Public Domain (CC0).
* [PLY models](https://people.sc.fsu.edu/~jburkardt/data/ply/ply.html) made by John Burkardt under the LGPL license.
Copy link
Owner

Choose a reason for hiding this comment

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

The LGPL license is less permissive than the MIT license. So, I think that it is not correct to distribute LGPL-protected content with this MIT licensed repository. Referring to it is fine though.

I am no expert in legal stuff, but my mediocre understanding is that the LGPL, like the GPL, protects with copyleft the content, but is a little more relaxed in the sense that it allows the content to be distributed in for-profit applications as long as some guarantees for the user are protected. The MIT license, on the other hand, allows the software to be used for any purpose, even commercial.

I choose the MIT license since this is a fairly small project and I would like it to be useful for as many people as possible, so I don't think we should change the license. Also, there is a contributor interested in FreeBSD portability (the BSD license is quite similar to the MIT license, also very permissive). See #1 .

Copy link
Owner

Choose a reason for hiding this comment

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

I removed the models from the commits for now. It would be nice if we could find some CC0 (public domain) PLY models, or export some CC0 models as PLY and include them in the repo.

README.md Outdated Show resolved Hide resolved
Comment on lines +368 to +544
vec.x = f1;
vec.y = f2;
vec.z = f3;
Copy link
Owner

Choose a reason for hiding this comment

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

I noticed that the models appear rotated so probably this is not the correct ordering for the axis. Perhaps vec.y should be f3 and vec.z should be f2 ?

Copy link
Owner

Choose a reason for hiding this comment

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

Actually, the ordering of the axes came inconsistent between the models PLY models. So the teapot.ply and the airplane.py had the wrong orientation.

Perhaps we should stick to the axes ordering used by blender when exporting .PLY files.

NewProggie and others added 2 commits June 10, 2023 16:40
Co-authored-by: Francisco Casas <[email protected]>
Co-authored-by: Francisco Casas <[email protected]>
@autopawn autopawn force-pushed the feature/add_ply_support branch from 6c43989 to 8661152 Compare June 10, 2023 20:43
@autopawn
Copy link
Owner

I rebased the PR on top of current master an addressed some of the comments. Some are still pending.

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