-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Allow for creating a zero size plane #16052
Conversation
I have a use case for creating a plane with zero width/height and then updating it live. The current method of checking whether a size/width/height is passed does not allow this. These changes check if the value is defined instead of is truthy.
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
Snapshot stored with reference name: Test environment: To test a playground add it to the URL, for example: https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/16052/merge/index.html#WGZLGJ#4600 Links to test babylon tools with this snapshot: https://playground.babylonjs.com/?snapshot=refs/pull/16052/merge To test the snapshot in the playground with a playground ID add it after the snapshot query string: https://playground.babylonjs.com/?snapshot=refs/pull/16052/merge#BCU1XR#0 |
WebGL2 visualization test reporter: |
Visualization tests for WebGPU (Experimental) |
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.
This is a breaking change and I am not sure to understand why it is usefull if you update the values ?
Can you please explain what this breaks? I want to construct a plane of zero size. I cannot do this in the current implementation because 0 is falsy, so the code defaults to a size of 1, even though I passed size as an argument. In my opinion, this is a bug. |
It is a breaking change because users (like in NGE) can assume 0 as "default":
|
We have two ways here:
|
Actually option 2 is fine. THe CreatePlaneVertexData is not used by nge You can go ahead with just that slight change: there is no need to use typeof, simply check option.width !== undefined |
Thank you for this information; I made this change here: 45d9bbc. Please let me know if any further changes should be made. |
I have a use case for creating a plane with zero width/height and then updating it live. The current method of checking whether a size/width/height is passed does not allow this. These changes check if the value is defined instead of is truthy.