Repository navigation
feat(html5): add the experimental view_set_viewport (non-rectangular viewports) #806
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
+594
−5
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
77f59d4
feat(html5): add the experimental view_set_viewport (non-rectangular …
c97a94b
fix(html5): view_set_viewport keeps left-out fields, rebuilds the cam…
7bb05ba
fix(html5): free the view_set_viewport surface when the game sets its…
fdc06e4
fix(html5): remake a lost or resized view_set_viewport surface each f…
c33acbb
fix(html5): view_set_viewport ear clip drops collinear vertices, as t…
919d9e5
fix(html5): view_set_viewport rejects polygons that cross themselves …
f56d224
view_set_viewport: a corner on a candidate ear's edge blocks it
39aefa3
fix(html5): view_set_viewport takes a method or a script function for…
89315d3
fix(html5): tell the view_set_viewport surface from a later surface t…
1084c17
fix(html5): a view_set_viewport surface stays the view's when the gam…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
Oops, something went wrong.
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.
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.
The surface
view_set_viewportmade is only freed here, when leaving a non-persistent room.game_restartfrom a persistent room skips this block.What happens:
game_restartsetsROOM_RESTARTGAME, which runsRun_EndGame→ResetAll→StartGame→StartRoom(startRoom, true).g_RunRoom.m_persistentis true,ResetPolygonnever runs._startingthen forcesispersistent = false, soCreateRoomFromStoragecallsInit(), which doesm_Views = [].yyView, and the only record ofm_polygonSurface, are dropped. The surface stays allocated ing_Surfaces(a WebGL framebuffer and texture) and nothing can free it anymore.Result: each restart leaks one surface per polygon view.
Fix: free the polygons wherever a room's views get replaced, not only on this path. For example, at the top of
yyRoom.prototype.CreateRoomFromStorage(beforethis.Init()), runResetPolygon(v)on each existingthis.m_Views[v], inside the same@if function("view_set_viewport")block. Another option is to also run this loop when_startingis true.