mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 05:33:35 +00:00
Merge branch 'master' of https://github.com/photonstorm/phaser
This commit is contained in:
commit
cff6c11ca0
3 changed files with 9 additions and 9 deletions
|
@ -80,9 +80,9 @@ var WebGLRenderer = new Class({
|
||||||
preserveDrawingBuffer: false,
|
preserveDrawingBuffer: false,
|
||||||
|
|
||||||
WebGLContextOptions: {
|
WebGLContextOptions: {
|
||||||
alpha: false,
|
alpha: true,
|
||||||
antialias: true,
|
antialias: true,
|
||||||
premultipliedAlpha: false,
|
premultipliedAlpha: true,
|
||||||
stencil: true,
|
stencil: true,
|
||||||
preserveDrawingBuffer: false
|
preserveDrawingBuffer: false
|
||||||
}
|
}
|
||||||
|
@ -143,9 +143,8 @@ var WebGLRenderer = new Class({
|
||||||
gl.enable(gl.BLEND);
|
gl.enable(gl.BLEND);
|
||||||
gl.clearColor(color.redGL, color.greenGL, color.blueGL, color.alphaGL);
|
gl.clearColor(color.redGL, color.greenGL, color.blueGL, color.alphaGL);
|
||||||
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
|
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
|
||||||
|
|
||||||
// Map Blend Modes
|
// Map Blend Modes
|
||||||
|
|
||||||
this.blendModes = [];
|
this.blendModes = [];
|
||||||
|
|
||||||
for (var i = 0; i <= 16; i++)
|
for (var i = 0; i <= 16; i++)
|
||||||
|
@ -154,13 +153,13 @@ var WebGLRenderer = new Class({
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add
|
// Add
|
||||||
this.blendModes[1].func = [ gl.SRC_ALPHA, gl.DST_ALPHA ];
|
this.blendModes[1].func = [ gl.ONE, gl.DST_ALPHA ];
|
||||||
|
|
||||||
// Multiply
|
// Multiply
|
||||||
this.blendModes[2].func = [ gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA ];
|
this.blendModes[2].func = [ gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA ];
|
||||||
|
|
||||||
// Screen
|
// Screen
|
||||||
this.blendModes[3].func = [ gl.SRC_ALPHA, gl.ONE ];
|
this.blendModes[3].func = [ gl.ONE, gl.ONE_MINUS_SRC_COLOR ];
|
||||||
|
|
||||||
this.blendMode = -1;
|
this.blendMode = -1;
|
||||||
this.extensions = gl.getSupportedExtensions();
|
this.extensions = gl.getSupportedExtensions();
|
||||||
|
@ -550,12 +549,13 @@ var WebGLRenderer = new Class({
|
||||||
|
|
||||||
setBlendMode: function (newBlendMode)
|
setBlendMode: function (newBlendMode)
|
||||||
{
|
{
|
||||||
|
var gl = this.gl;
|
||||||
|
|
||||||
if (newBlendMode === BlendModes.SKIP_CHECK)
|
if (newBlendMode === BlendModes.SKIP_CHECK)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var gl = this.gl;
|
|
||||||
var renderer = this.currentRenderer;
|
var renderer = this.currentRenderer;
|
||||||
|
|
||||||
if (this.blendMode !== newBlendMode)
|
if (this.blendMode !== newBlendMode)
|
||||||
|
|
|
@ -19,7 +19,7 @@ module.exports = {
|
||||||
'varying float v_alpha;',
|
'varying float v_alpha;',
|
||||||
'void main() {',
|
'void main() {',
|
||||||
' vec4 output_color = texture2D(u_sampler2D, v_tex_coord);',
|
' vec4 output_color = texture2D(u_sampler2D, v_tex_coord);',
|
||||||
' gl_FragColor = vec4(output_color.rgb * output_color.a, v_alpha * output_color.a);',
|
' gl_FragColor = vec4(output_color.rgb * v_alpha * output_color.a, v_alpha * output_color.a);',
|
||||||
'}'
|
'}'
|
||||||
].join('\n')
|
].join('\n')
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,7 +23,7 @@ module.exports = {
|
||||||
'varying float v_alpha;',
|
'varying float v_alpha;',
|
||||||
'void main() {',
|
'void main() {',
|
||||||
' vec4 sample_color = texture2D(u_sampler2D, v_tex_coord);',
|
' vec4 sample_color = texture2D(u_sampler2D, v_tex_coord);',
|
||||||
' gl_FragColor = vec4((sample_color.rgb * v_color.rgb) * sample_color.a, sample_color.a * v_alpha);',
|
' gl_FragColor = vec4(sample_color.rgb * v_alpha * sample_color.a, v_alpha * sample_color.a);',
|
||||||
'}'
|
'}'
|
||||||
].join('\n')
|
].join('\n')
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue