Allow SceneObject to be scaled by different amounts in each dimension #4
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.
Description
I have extended the capability of scaling a
SceneObjectto allow for scaling by different amounts in each dimension. If the user sets the scaling parameter to a scalar then it will still behave as expected, scaling all dimensions equally. However, if amitsuba.Vector3fis passed in, then the object will be scaled by the x, y and z dimensions in the coordinate system of the object. This does make the setter for scaling more expensive, however it also adds additional functionality so I think the trade off is worth while personally (open to suggestions though).I have additionally added tests to ensure that no other behaviour is broken. Please note that I do not have a GPU so I have only been able to run the tests on the CPU using the
--cpuflag forpytest.This is my first time making a pull request so I am very open to criticism and fixing things up as needed. Thanks!
Fixes a bug?
NA.
Adds a new Feature?
This feature allows a user to scale
SceneObjects by different amounts in each dimension.Introduces API changes?
It changes the value returned by the "getter" of scaling from a scalar float to a
mitsuba.Vector3fto show the scaling in each direction. The setter signature is also changed to additionally supportmitsuba.Vector3fas well asmitsuba.Float. The setter should not be a breaking change though, given scalar values are still supported.Other contributions
NA
I have supplied a short program that highlights this feature in use below:
Checklist