mirror of
https://github.com/scratchfoundation/scratch-render.git
synced 2025-08-11 13:59:18 -04:00
Fix brightness and ghost effects
The renderer now uses premultiplied alpha in the frame buffer, though textures are still stored without premultiplied alpha. This makes it easier to get the desired results from the browser's canvas compositing step, and might be nicer for mobile hardware depending on which parts of the Internet you believe.
This commit is contained in:
parent
920271d076
commit
dcedd0c3cf
3 changed files with 13 additions and 8 deletions
src
|
@ -95,10 +95,10 @@ Drawable._effectConverter = {
|
|||
return Math.max(1, Math.min(x, 512));
|
||||
},
|
||||
brightness: function(x) {
|
||||
return Math.max(-100, Math.min(x, 100));
|
||||
return Math.max(-100, Math.min(x, 100)) / 100;
|
||||
},
|
||||
ghost: function(x) {
|
||||
return Math.max(0, Math.min(x, 100));
|
||||
return 1 - Math.max(0, Math.min(x, 100)) / 100;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -312,6 +312,8 @@ Drawable.prototype._setSkinCore = function (source, costumeResolution) {
|
|||
|
||||
var options = {
|
||||
auto: true,
|
||||
mag: this._gl.NEAREST,
|
||||
min: this._gl.LINEAR, // TODO: mipmaps
|
||||
src: source
|
||||
};
|
||||
var willCallCallback = typeof source == 'string';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue