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 a lookat matrix constructor #28

Closed
wants to merge 1 commit into from
Closed

Add a lookat matrix constructor #28

wants to merge 1 commit into from

Conversation

TestingPlant
Copy link

No description provided.

@ghost
Copy link

ghost commented Dec 19, 2020

Works for my purposes, though @sgorsten provided a more compact version in #29. There is also the question of generality: I see one use of the ternary operator (?) while frustum_matrix uses it twice (though I don't know what it's doing).

@TestingPlant
Copy link
Author

The ternary operator I put on line 717 is designed to handle some edge cases.
Assuming up is (0, 1, 0), if z is exactly (0, 1, 0), (0, 1, 0) × (0, 1, 0) would evaluate to (0, 0, 0). Normalizing this would make each component of x nan, which means the resulting matrix wouldn't be really helpful.
I'm not exactly sure how using (z.z, z.x, z.y) fixes it, but it made it work in those edge cases in my testing.

@TestingPlant
Copy link
Author

Commit 105866d seems to have added lookat_matrix, so I'm closing this now.

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