-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Pixel Art Sampler & Antialiasing Improvements (#2739)
This PR adds a new pixel art setting and special sampler for sub-pixel pixel art rendering. Additionally this PR adds MSAA to the framebuffer implementation, giving a nicer look to some graphics when drawing to the quad boundary. Also fixes an issue with `snapToPixel` where camera did not correctly snap to pixel Example using the old `antialiasing: false` on pixel art https://github.com/excaliburjs/Excalibur/assets/612071/c55a09b0-cf7e-409c-a82c-447e0bec198a New `pixelArt: true` https://github.com/excaliburjs/Excalibur/assets/612071/eff9f9f3-a731-482a-8e15-e778e60c225e
- Loading branch information
Showing
31 changed files
with
794 additions
and
104 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Graphics Context</title> | ||
</head> | ||
<body> | ||
<script src="../../lib/excalibur.js"></script> | ||
<script src="./index.js"></script> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
var canvasElement = document.createElement('canvas'); | ||
document.body.appendChild(canvasElement); | ||
canvasElement.width = 100; | ||
canvasElement.height = 100; | ||
var sut = new ex.ExcaliburGraphicsContextWebGL({ | ||
canvasElement: canvasElement, | ||
enableTransparency: false, | ||
antialiasing: false, | ||
multiSampleAntialiasing: true, | ||
backgroundColor: ex.Color.White | ||
}); | ||
sut.updateViewport({ | ||
width: 100, | ||
height: 100 | ||
}); | ||
|
||
var rect = new ex.Rectangle({ | ||
width: 50, | ||
height: 50, | ||
color: ex.Color.Blue | ||
}); | ||
sut.beginDrawLifecycle(); | ||
sut.clear(); | ||
|
||
sut.save() | ||
sut.drawImage(rect._bitmap, 20, 20); | ||
sut.restore(); | ||
|
||
sut.flush(); | ||
sut.endDrawLifecycle(); |
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
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
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
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
Oops, something went wrong.