Shaders renamed to match new pipeline names

This commit is contained in:
Richard Davey 2020-08-21 15:41:12 +01:00
parent 96072e58a9
commit 6435772646
11 changed files with 131 additions and 6 deletions

View file

@ -3,12 +3,11 @@ let fs = require('fs-extra');
/*
BitmapMask.frag
BitmapMask.vert
DeferredDiffuse.frag
DeferredDiffuse.vert
ForwardDiffuse.frag
GBuffer.frag
TextureTint.frag
TextureTint.vert
Light.frag
Single.frag
Single.vert
Multi.frag
Multi.vert
*/
let srcdir = './src/renderer/webgl/shaders/src/';

View file

@ -0,0 +1,38 @@
module.exports = [
'#define SHADER_NAME PHASER_SINGLE_TEXTURE_TINT_FS',
'',
'precision mediump float;',
'',
'uniform sampler2D uMainSampler;',
'',
'varying vec2 outTexCoord;',
'varying float outTintEffect;',
'varying vec4 outTint;',
'',
'void main()',
'{',
' vec4 texture = texture2D(uMainSampler, outTexCoord);',
' vec4 texel = vec4(outTint.rgb * outTint.a, outTint.a);',
' vec4 color = texture;',
'',
' if (outTintEffect == 0.0)',
' {',
' // Multiply texture tint',
' color = texture * texel;',
' }',
' else if (outTintEffect == 1.0)',
' {',
' // Solid color + texture alpha',
' color.rgb = mix(texture.rgb, outTint.rgb * outTint.a, texture.a);',
' color.a = texture.a * texel.a;',
' }',
' else if (outTintEffect == 2.0)',
' {',
' // Solid color, no texture',
' color = texel;',
' }',
'',
' gl_FragColor = color;',
'}',
''
].join('\n');

View file

@ -0,0 +1,28 @@
module.exports = [
'#define SHADER_NAME PHASER_SINGLE_TEXTURE_TINT_VS',
'',
'precision mediump float;',
'',
'uniform mat4 uProjectionMatrix;',
'uniform mat4 uViewMatrix;',
'uniform mat4 uModelMatrix;',
'',
'attribute vec2 inPosition;',
'attribute vec2 inTexCoord;',
'attribute float inTintEffect;',
'attribute vec4 inTint;',
'',
'varying vec2 outTexCoord;',
'varying float outTintEffect;',
'varying vec4 outTint;',
'',
'void main ()',
'{',
' gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(inPosition, 1.0, 1.0);',
'',
' outTexCoord = inTexCoord;',
' outTint = inTint;',
' outTintEffect = inTintEffect;',
'}',
''
].join('\n');

View file

@ -0,0 +1,35 @@
#define SHADER_NAME PHASER_SINGLE_TEXTURE_TINT_FS
precision mediump float;
uniform sampler2D uMainSampler;
varying vec2 outTexCoord;
varying float outTintEffect;
varying vec4 outTint;
void main()
{
vec4 texture = texture2D(uMainSampler, outTexCoord);
vec4 texel = vec4(outTint.rgb * outTint.a, outTint.a);
vec4 color = texture;
if (outTintEffect == 0.0)
{
// Multiply texture tint
color = texture * texel;
}
else if (outTintEffect == 1.0)
{
// Solid color + texture alpha
color.rgb = mix(texture.rgb, outTint.rgb * outTint.a, texture.a);
color.a = texture.a * texel.a;
}
else if (outTintEffect == 2.0)
{
// Solid color, no texture
color = texel;
}
gl_FragColor = color;
}

View file

@ -0,0 +1,25 @@
#define SHADER_NAME PHASER_SINGLE_TEXTURE_TINT_VS
precision mediump float;
uniform mat4 uProjectionMatrix;
uniform mat4 uViewMatrix;
uniform mat4 uModelMatrix;
attribute vec2 inPosition;
attribute vec2 inTexCoord;
attribute float inTintEffect;
attribute vec4 inTint;
varying vec2 outTexCoord;
varying float outTintEffect;
varying vec4 outTint;
void main ()
{
gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(inPosition, 1.0, 1.0);
outTexCoord = inTexCoord;
outTint = inTint;
outTintEffect = inTintEffect;
}