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:
Christopher Willis-Ford 2016-05-20 15:36:02 -07:00
parent 920271d076
commit dcedd0c3cf
3 changed files with 13 additions and 8 deletions

View file

@ -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';