mirror of
https://github.com/photonstorm/phaser
synced 2024-11-21 20:23:19 +00:00
Shaders renamed to match new pipeline names
This commit is contained in:
parent
96072e58a9
commit
6435772646
11 changed files with 131 additions and 6 deletions
|
@ -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/';
|
||||
|
|
38
src/renderer/webgl/shaders/Single-frag.js
Normal file
38
src/renderer/webgl/shaders/Single-frag.js
Normal 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');
|
28
src/renderer/webgl/shaders/Single-vert.js
Normal file
28
src/renderer/webgl/shaders/Single-vert.js
Normal 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');
|
35
src/renderer/webgl/shaders/src/Single.frag
Normal file
35
src/renderer/webgl/shaders/src/Single.frag
Normal 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;
|
||||
}
|
25
src/renderer/webgl/shaders/src/Single.vert
Normal file
25
src/renderer/webgl/shaders/src/Single.vert
Normal 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;
|
||||
}
|
Loading…
Reference in a new issue