mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 04:33:31 +00:00
Updated shaders to use 'round' glsl instead of 'floor'
This commit is contained in:
parent
91b145915c
commit
e36d43533c
6 changed files with 6 additions and 10 deletions
|
@ -17,7 +17,7 @@ module.exports = [
|
|||
' gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);',
|
||||
' if (uRoundPixels == 1)',
|
||||
' {',
|
||||
' gl_Position.xy = floor((gl_Position.xy + 1.0) * 0.5 * uResolution) / uResolution * 2.0 - 1.0;',
|
||||
' gl_Position.xy = floor(((gl_Position.xy + 1.0) * 0.5 * uResolution) + 0.5) / uResolution * 2.0 - 1.0;',
|
||||
' }',
|
||||
' outTexCoord = inTexCoord;',
|
||||
' outTint = inTint;',
|
||||
|
|
|
@ -13,16 +13,12 @@ module.exports = [
|
|||
'varying float outTexId;',
|
||||
'varying float outTintEffect;',
|
||||
'varying vec4 outTint;',
|
||||
'vec2 roundPixels (vec2 position, vec2 targetSize)',
|
||||
'{',
|
||||
' return (floor((position * 0.5 + 0.5) * targetSize) / targetSize) * 2.0 - 1.0;',
|
||||
'}',
|
||||
'void main ()',
|
||||
'{',
|
||||
' gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);',
|
||||
' if (uRoundPixels == 1)',
|
||||
' {',
|
||||
' gl_Position.xy = roundPixels(gl_Position.xy, uResolution);',
|
||||
' gl_Position.xy = floor(((gl_Position.xy + 1.0) * 0.5 * uResolution) + 0.5) / uResolution * 2.0 - 1.0;',
|
||||
' }',
|
||||
' outTexCoord = inTexCoord;',
|
||||
' outTexId = inTexId;',
|
||||
|
|
|
@ -17,7 +17,7 @@ module.exports = [
|
|||
' gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);',
|
||||
' if (uRoundPixels == 1)',
|
||||
' {',
|
||||
' gl_Position.xy = floor((gl_Position.xy + 1.0) * 0.5 * uResolution) / uResolution * 2.0 - 1.0;',
|
||||
' gl_Position.xy = floor(((gl_Position.xy + 1.0) * 0.5 * uResolution) + 0.5) / uResolution * 2.0 - 1.0;',
|
||||
' }',
|
||||
' outTexCoord = inTexCoord;',
|
||||
' outTint = inTint;',
|
||||
|
|
|
@ -22,7 +22,7 @@ void main ()
|
|||
|
||||
if (uRoundPixels == 1)
|
||||
{
|
||||
gl_Position.xy = floor((gl_Position.xy + 1.0) * 0.5 * uResolution) / uResolution * 2.0 - 1.0;
|
||||
gl_Position.xy = floor(((gl_Position.xy + 1.0) * 0.5 * uResolution) + 0.5) / uResolution * 2.0 - 1.0;
|
||||
}
|
||||
|
||||
outTexCoord = inTexCoord;
|
||||
|
|
|
@ -23,7 +23,7 @@ void main ()
|
|||
|
||||
if (uRoundPixels == 1)
|
||||
{
|
||||
gl_Position.xy = floor((gl_Position.xy + 1.0) * 0.5 * uResolution) / uResolution * 2.0 - 1.0;
|
||||
gl_Position.xy = floor(((gl_Position.xy + 1.0) * 0.5 * uResolution) + 0.5) / uResolution * 2.0 - 1.0;
|
||||
}
|
||||
|
||||
outTexCoord = inTexCoord;
|
||||
|
|
|
@ -22,7 +22,7 @@ void main ()
|
|||
|
||||
if (uRoundPixels == 1)
|
||||
{
|
||||
gl_Position.xy = floor((gl_Position.xy + 1.0) * 0.5 * uResolution) / uResolution * 2.0 - 1.0;
|
||||
gl_Position.xy = floor(((gl_Position.xy + 1.0) * 0.5 * uResolution) + 0.5) / uResolution * 2.0 - 1.0;
|
||||
}
|
||||
|
||||
outTexCoord = inTexCoord;
|
||||
|
|
Loading…
Reference in a new issue