You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 56535d3
Browse filesBrowse the repository at this point in the historyBrowse files
TextureAtlas: compute quad UVs from the image size instead of caching them
drawImage and drawPattern now work a source rectangle's UVs out with
four divisions by the image size, into a per-atlas scratch array: no
string key, no allocation, and nothing stored per rectangle.
- a page whose JSON size differs from its image (or whose frames were
normalised by several sizes) keeps its frames' own UVs, found through
an x -> y -> size index built by addUVs
- the size is read when the pixels go to the GPU: on the first draw, and
again after CanvasRenderTarget#invalidate (through the new
TextureCache#sizeChanged); videos and 0x0 images are read every draw
- getUVs(x, y, w, h) returns a frame's own UVs for a frame of the active
page and a new array otherwise; a "x,y,w,h" string is no longer read
as a rectangle, and frames no longer get "x,y,w,h" alias keys
- both drawPattern implementations compute the UVs last, right before
addQuad, since the scratch array is only valid until the next call
Bit-identical to 20.10.1's UVs on every shipped atlas (fuzzed against
the old implementation); the example sweep adds no new warning, error
or "x,y,w,h" region.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SeWCkETjW35ZbXDRswV1hx
Copy file name to clipboardExpand all lines: packages/melonjs/CHANGELOG.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,13 @@
1
1
# Changelog
2
2
3
-
## _unreleased_
3
+
## [20.11.0] (melonJS 2) - _unreleased_
4
4
5
5
### Fixed
6
-
- TextureAtlas: source-rectangle UVs are cached separately from named frames, so cropped image and pattern draws no longer add regions to the animation dictionary. `getUVs(name)` now throws for an unknown name instead of parsing it as coordinates; use `getUVs(x, y, width, height)` for a source rectangle, or define a named region with `addRegion()` before looking it up ([#1281](https://github.com/melonjs/melonJS/issues/1281)). (thanks @snowyukitty)
6
+
- TextureAtlas: drawing part of an image, a bitmap font glyph or a repeating pattern no longer adds a region to the atlas for every new source rectangle. Those regions piled up for as long as the atlas lived, and turned up among the frames an animation is built from ([#1281](https://github.com/melonjs/melonJS/issues/1281), thanks @snowyukitty)
7
+
- TextureAtlas: on an atlas with pages of different sizes, a source rectangle drawn from one page no longer reuses the UVs worked out for the same rectangle on another (thanks @snowyukitty)
8
+
9
+
### Performance
10
+
- Rendering: drawing a sprite, a glyph or a pattern computes its UVs from the image size instead of looking them up, with no string built and nothing allocated or kept. On the platformer, text and Jungle Rabbit examples a lookup took 34 to 58 ns and now takes 6 to 10, in Chrome and WebKit: 1 to 2% of a frame's CPU time on the text example, and too little to measure on the platformer
0 commit comments