-
Notifications
You must be signed in to change notification settings - Fork 343
Add validation for projection dimensions in Camera2D + projections #2061
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
Merged
eruvanos
merged 16 commits into
pythonarcade:development
from
pushfoo:camera_immediate_error_on_0_dims
Apr 23, 2024
Merged
Add validation for projection dimensions in Camera2D + projections #2061
eruvanos
merged 16 commits into
pythonarcade:development
from
pushfoo:camera_immediate_error_on_0_dims
Apr 23, 2024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ojection bounds are equal
* Add ZeroProjectionDimension type to arcade.camera.data_types * Use it in the projection validation in from_raw_data
* Add new test for Camera2D.from_raw_data projection validation * Expand inheritance safety tests for Camera2D classmethods with parametrization
* Inline the validation logic to go fast * Update the docstring to be explicitly clear about this behavior
* Turn camera_class into a fixture * Add simple inline test for from_raw_data's near/far validation
0277038
to
760ae09
Compare
After discussion, consensus from @DragonMoffon and users who've tried 3.0 cameras seems to be:
|
DragonMoffon
approved these changes
Apr 20, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validation looks good, and renaming is good. There are issues, but they are with the code rather than the PR, and I will fix them later.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TL;DR:
ZeroDivisionError
which @MiCurry discoveredChanges
Camera2D.from_raw_data
*Data
attributes for clarity per Discord discussion_data
->_camera_data
_projection
->_projection_data
near
andfar
validation to__init__
.projection
Why?
left == right
top == bottom
near == far
Camera2D.use
for the first timeExample traceback sanitized from the Discord thread:
Questions
ShouldIt's aZeroProjectionDimension
subclassZeroDivisionError
orValueError
?ValueError
since the math hasn't taken place yet.Follow-up work