-
Notifications
You must be signed in to change notification settings - Fork 856
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
Lighting fixes #1929
Lighting fixes #1929
Conversation
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.
Sorry got sidetracked by other reviews! I've added a few comments but it looks good otherwise!
We'll merge this once you've addressed them.
In terms of performance, take a look at minimizing the number of calls to Math.sqrt/Math.hypot/Math.pow (or manually a*a) as it's fairly expensive when called repeatedly (for example, work with squared distance as much as possible, and take the square root only at the last step).
@4ian this dynamic polygon fix has made the light objects really good 😬. Earlier, having "floors" as light obstacles was a disaster, as the "floor" can be really long. Now, since the bounding box is dynamic, this case is handled as well :) Note that even if the bounding box is really large, the number of rays remain the same. So, the only extra performance cost here is the resizing of the polygon :) |
Indeed, I've never thought about this case - while it's very common.
We indeed keep the same number of rays which is great (performance will be limited by the number of objects and the complexity of their hitboxes, as before). So seems this "bugfix" has no adverse consequence on performance :) |
I asked for the opposite a while ago 😅 Was because of small screens. Otherwise we can use a responsive component. |
I guess we can use a split button in this case? EDIT: Let's do that in another PR (not to add unrelated ui stuff in this PR), we might as well define a new ui element to be used in IDE 😬. |
Yes let's do that in another PR! :) |
Merged! :) |
We have 4 fixes here,
gdjs.LightObstaclesManager
.Neither I understand why this happened, nor I'm sure about why this particular fix works 😓. All I did was randomly change the order of
lineTo
andmoveTo
calls, and it worked. I'm guessing this is really specific to pixi, as we've upgraded the version as well, but arguably it was a minor change.