phaser/src/renderer/webgl/shaders/PointLight-vert.js

32 lines
882 B
JavaScript
Raw Normal View History

2020-10-13 17:17:30 +00:00
module.exports = [
'#define SHADER_NAME PHASER_POINTLIGHT_VS',
'',
'precision mediump float;',
'',
'uniform mat4 uProjectionMatrix;',
'uniform mat4 uViewMatrix;',
'uniform mat4 uModelMatrix;',
'',
'attribute vec2 inPosition;',
'attribute vec2 inLightPosition;',
'attribute vec4 inLightColor;',
'attribute float inLightRadius;',
'attribute float inLightIntensity;',
2020-10-13 17:17:30 +00:00
'',
2020-10-13 21:34:26 +00:00
'varying vec4 lightPosition;',
2020-10-13 17:17:30 +00:00
'varying vec4 lightColor;',
'varying float lightRadius;',
'',
'void main ()',
'{',
2020-10-13 21:34:26 +00:00
' mat4 mvp = uProjectionMatrix * uViewMatrix * uModelMatrix;',
'',
2020-10-13 17:17:30 +00:00
' lightColor = inLightColor;',
2020-10-13 21:34:26 +00:00
' lightRadius = inLightRadius;',
' lightPosition = mvp * vec4(inLightPosition, 1.0, 1.0);',
2020-10-13 17:17:30 +00:00
'',
2020-10-13 21:34:26 +00:00
' gl_Position = mvp * vec4(inPosition, 1.0, 1.0);',
2020-10-13 17:17:30 +00:00
'}',
''
].join('\n');