The default BaseShader vertex shader will now set the fragCoord varying to be the viewport height minus the y inPosition. This will give the correct y axis in the fragment shader, causing 'inverted' shaders to display normally when using the default vertex code.

This commit is contained in:
Richard Davey 2019-05-16 17:30:30 +01:00
parent 48bf3d2b5e
commit f792fce9cb
2 changed files with 2 additions and 1 deletions

View file

@ -5,6 +5,7 @@
### Updates
* `Zones` will now use the new `customHitArea` property introduced in 3.17 to avoid their hit areas from being resized if you specified your own custom hit area (thanks @rexrainbow)
* The default `BaseShader` vertex shader will now set the `fragCoord` varying to be the viewport height minus the y inPosition. This will give the correct y axis in the fragment shader, causing 'inverted' shaders to display normally when using the default vertex code.
### Bug Fixes

View file

@ -68,7 +68,7 @@ var BaseShader = new Class({
'void main () {',
'gl_Position = uProjectionMatrix * uViewMatrix * vec4(inPosition, 1.0, 1.0);',
'fragCoord = inPosition;',
'fragCoord = vec2(inPosition.x, uViewMatrix[2][0] - inPosition.y);',
'}'
].join('\n');
}