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

Add infinite perspective matrix #318

Merged
merged 3 commits into from
Jun 9, 2018
Merged

Add infinite perspective matrix #318

merged 3 commits into from
Jun 9, 2018

Conversation

d07RiV
Copy link
Contributor

@d07RiV d07RiV commented Jun 9, 2018

Support for zFar = infinity for projection matrix.

Dunno why dist build ended up so different.

@stefnotch
Copy link
Collaborator

@d07RiV Wouldn't it be cleaner to simply modify

export function perspective(out, fovy, aspect, near, far) {
to support setting the far value to Math.Infinity?

@d07RiV
Copy link
Contributor Author

d07RiV commented Jun 9, 2018

That seems less intuitive to me (Infinity is not a valid value in any API, and anywhere else in the library), but if you think that's better then maybe.

Null/undefined is probably a better choice, especially since it's the last argument.

@stefnotch
Copy link
Collaborator

stefnotch commented Jun 9, 2018

@d07RiV I'd prefer to not add a ton of functions that might not be used as often.
less intuitive: Well, other than adding another function, how could you make it more intuitive?

@d07RiV
Copy link
Contributor Author

d07RiV commented Jun 9, 2018

You think null value for far is better?

@stefnotch
Copy link
Collaborator

@d07RiV That seems equally good/bad. I'd say, let's just go with Math.Infinity and add a note in the documentation. Something like @param {number} far Far bound of the frustum, supports Math.Infinity

out[15] = 0;
if (far != null && far !== Infinity) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

That's also fine. 🙂 If anyone has an issue with it, they can just open an issue.

@d07RiV
Copy link
Contributor Author

d07RiV commented Jun 9, 2018

Why not both?

@d07RiV
Copy link
Contributor Author

d07RiV commented Jun 9, 2018

Also I'm not sure why build was changed so much, and I didn't generate docs because it would put my time/timezone in every file.

@stefnotch
Copy link
Collaborator

@d07RiV Well, the checks passed and the PR adds some useful functionality, so, merging this!
Thank you! 👍

@stefnotch stefnotch merged commit 8226d77 into toji:master Jun 9, 2018
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