Original paint fill method used was very slow.#3635
Open
fuzorsilverbolt wants to merge 1 commit into
Open
Conversation
…each mesh face into a coverage mask instead.
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
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.
What was wrong:
Filling a mesh face drew one tiny 1×1 square per pixel — millions of draw commands on a big texture — so Blockbench hung for minutes or crashed on large textures. I understand why the original fill was done the way it was but its too slow.
The fix:
Now it fills the shape in horizontal strips (one rectangle per row) instead of pixel-by-pixel. Same result, but draw commands go from millions to a few thousand. So fill is completed in seconds at almost any texture size.
New helper:
Added
Painter.scanlineConvexPolygon(), which walks a face row by row to produce those strips. Unusual (concave) faces fall back to the old method, so nothing breaks.Changed Files:
One file updated: painter.js
I've tested this for about a week after workin on this for a while. I also worked on testing the town model, on github ticket 3487,
which was impossible to fill with the paint bucket and now it can be filled!
I dont want credit for patch, new code is CC0 for Janis to use or not use at his discretion.