mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 05:33:35 +00:00
Add texture ID to shaders
This commit is contained in:
parent
43beca7bab
commit
76689942c0
4 changed files with 19 additions and 5 deletions
|
@ -3,15 +3,19 @@ module.exports = [
|
|||
'',
|
||||
'precision mediump float;',
|
||||
'',
|
||||
'uniform sampler2D uMainSampler;',
|
||||
'uniform sampler2D uMainSampler[%count%];',
|
||||
'',
|
||||
'varying vec2 outTexCoord;',
|
||||
'varying float outTexId;',
|
||||
'varying float outTintEffect;',
|
||||
'varying vec4 outTint;',
|
||||
'',
|
||||
'void main()',
|
||||
'{',
|
||||
' vec4 texture = texture2D(uMainSampler, outTexCoord);',
|
||||
' vec4 texture;',
|
||||
'',
|
||||
' %forloop%',
|
||||
'',
|
||||
' vec4 texel = vec4(outTint.rgb * outTint.a, outTint.a);',
|
||||
' vec4 color = texture;',
|
||||
'',
|
||||
|
|
|
@ -9,10 +9,12 @@ module.exports = [
|
|||
'',
|
||||
'attribute vec2 inPosition;',
|
||||
'attribute vec2 inTexCoord;',
|
||||
'attribute float inTexId;',
|
||||
'attribute float inTintEffect;',
|
||||
'attribute vec4 inTint;',
|
||||
'',
|
||||
'varying vec2 outTexCoord;',
|
||||
'varying float outTexId;',
|
||||
'varying float outTintEffect;',
|
||||
'varying vec4 outTint;',
|
||||
'',
|
||||
|
@ -21,6 +23,7 @@ module.exports = [
|
|||
' gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(inPosition, 1.0, 1.0);',
|
||||
'',
|
||||
' outTexCoord = inTexCoord;',
|
||||
' outTexId = inTexId;',
|
||||
' outTint = inTint;',
|
||||
' outTintEffect = inTintEffect;',
|
||||
'}',
|
||||
|
|
|
@ -2,15 +2,19 @@
|
|||
|
||||
precision mediump float;
|
||||
|
||||
uniform sampler2D uMainSampler;
|
||||
uniform sampler2D uMainSampler[%count%];
|
||||
|
||||
varying vec2 outTexCoord;
|
||||
varying float outTexId;
|
||||
varying float outTintEffect;
|
||||
varying vec4 outTint;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 texture = texture2D(uMainSampler, outTexCoord);
|
||||
vec4 texture;
|
||||
|
||||
%forloop%
|
||||
|
||||
vec4 texel = vec4(outTint.rgb * outTint.a, outTint.a);
|
||||
vec4 color = texture;
|
||||
|
||||
|
|
|
@ -8,18 +8,21 @@ uniform mat4 uModelMatrix;
|
|||
|
||||
attribute vec2 inPosition;
|
||||
attribute vec2 inTexCoord;
|
||||
attribute float inTexId;
|
||||
attribute float inTintEffect;
|
||||
attribute vec4 inTint;
|
||||
|
||||
varying vec2 outTexCoord;
|
||||
varying float outTexId;
|
||||
varying float outTintEffect;
|
||||
varying vec4 outTint;
|
||||
|
||||
void main ()
|
||||
void main ()
|
||||
{
|
||||
gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(inPosition, 1.0, 1.0);
|
||||
|
||||
outTexCoord = inTexCoord;
|
||||
outTexId = inTexId;
|
||||
outTint = inTint;
|
||||
outTintEffect = inTintEffect;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue