Skip to content

Commit

Permalink
fix: update uvPadding default when antialiasing: false or ImageFilter…
Browse files Browse the repository at this point in the history
…ing.Pixel
  • Loading branch information
eonarheim committed Feb 6, 2024
1 parent 74c9ade commit 85a7e9c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/engine/Engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ export interface EngineOptions<TKnownScenes extends string = any> {
* Specify any UV padding you want use in pixels, this brings sampling into the texture if you're using
* a sprite sheet in one image to prevent sampling bleed.
*
* By default .01 pixels, and .25 pixels if `pixelArt: true`
* Defaults:
* * `antialiasing: false` or `filtering: ImageFiltering.Pixel` - 0.0;
* * `pixelArt: true` - 0.25
* * All else 0.01
*/
uvPadding?: number;

Expand Down Expand Up @@ -819,6 +822,11 @@ O|===|* >________________>\n\
if (options.pixelArt) {
uvPadding = .25;
}

if (!options.antialiasing || filtering === ImageFiltering.Pixel) {
uvPadding = 0;
}

// Override with any user option, if non default to .25 for pixel art, 0.01 for everything else
uvPadding = options.uvPadding ?? uvPadding ?? 0.01;

Expand Down
Binary file modified src/spec/images/GraphicsSystemSpec/graphics-system.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 85a7e9c

Please sign in to comment.