-
Notifications
You must be signed in to change notification settings - Fork 92
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
Pixi V8 Upgrade #1495
Draft
tannerwuster
wants to merge
65
commits into
main
Choose a base branch
from
pixi_v8
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Pixi V8 Upgrade #1495
Conversation
This file contains 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
Because Pixi init is async, we need to keep track of that promise, and delay many things until after it has settled.
The variables are a little different in v8. This is still hacky, but I'm not sure another way around it. The `TickerPlugin` code that adds the Ticker to `PIXI.Application` really wants to do `ticker.add(this.render, this, UPDATE_PRIORITY.LOW);` even if we were to replace it with a different Ticker. Our issue is we need to call `render` ourselves at the time of our choosing.
Our texture atlases seem to be getting corrupted. This will show up as either the Bitmap Fonts getting messed up, or leaking into the background tiles. I've tried commenting out the minimap for now, and also doing some other cleanups around the code to isolate whether textures are getting destroyed propertly.
This switches from using `@rapideditor/pixi-texture-allocator` "fork of the plugin" to just including the code we need in Rapid. The old code worked ok for v7, but the v8 upgrade was causing texture corruption, and it became easier to just massively simplify things than to debug and fix whatever was going on with the plugin code.
Also passing more options in the AtlasSource/TextureSource constructor, preferring to leave nothing to chance here. Also add some more comments and make sure everything has labels for better debug-ability.
This is an older trick that I removed in dd24e91 In pixi v7, we switched to using `SVGResource`, which did this for us In pixi v8, `SVGResource` is gone and there is now a SVG parser, but it doesn't fully support svg syntax, so we can go back to the old way for now.
- Uncomments the `PixiLayerLabels` layer - Restores both bitmap text (ascii text placed next to pins) and textured text (complex text next to pins or along ropes) - Moves the text-to-texture code from `PixiLayerLabels.getLabelSprite()` to `PixiTextures.textToTexture()` in the texture manager (there are other functions in texture manager like this) Todo: - Polygon labels remain commented out because we need to calculate the buffer inside the perimeter. We were (ab)using `PIXI.buildLine` for this, but maybe there is a better way now.. Also: - There was previously some code in `PixiLayerLabels` that would do `toGlobal(position, point, true)` to skip updating the transform We can not pass `true` for `skipUpdate` anymore in pixi v8, Probably related to pixijs/pixijs#10433
This was used before for calculating buffers around lines, which was used for hit testing and label placement.
…i has started, and change the allocator to send ImageBitmaps instead of raw pixel arrays.
I went back to doing things the old way: - Make a `PIXI.Graphic` using strokes, Then force generate it’s geometry, Then and extract the geometry into a `PIXI.Mesh`. The mesh works well for both hit testing and masking. Other approaches that didn't work: - In Pixi v8, stroke graphics can work for hit testing, but the hit test ignores `alignment` which we need when partial filling. - Tried using our `lineToPoly` buffer generating function to convert the stroke into a Graphic that would both hit test and mask, but it's too buggy. (it uses pixi's linebuilder, then walks the perimeter)
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.
Upgrade to Pixi v7 to v8 highlights several key changes that are expected to lead to significant performance improvements. These include:
Additionally, the description mentions that there are many other changes included in the update, which can be found in the here. Overall, the upgrade to Pixi v8 is expected to bring significant performance gains and improvements to the library.