mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
Don't indent shader code to minify better.
This commit is contained in:
parent
55c2bd9ed4
commit
d5cd7f67b1
@ -194,106 +194,106 @@ export class Shader implements Disposable, Restorable {
|
||||
|
||||
public static newColoredTextured (context: ManagedWebGLRenderingContext | WebGLRenderingContext): Shader {
|
||||
let vs = `
|
||||
attribute vec4 ${Shader.POSITION};
|
||||
attribute vec4 ${Shader.COLOR};
|
||||
attribute vec2 ${Shader.TEXCOORDS};
|
||||
uniform mat4 ${Shader.MVP_MATRIX};
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
attribute vec4 ${Shader.POSITION};
|
||||
attribute vec4 ${Shader.COLOR};
|
||||
attribute vec2 ${Shader.TEXCOORDS};
|
||||
uniform mat4 ${Shader.MVP_MATRIX};
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
|
||||
void main () {
|
||||
v_color = ${Shader.COLOR};
|
||||
v_texCoords = ${Shader.TEXCOORDS};
|
||||
gl_Position = ${Shader.MVP_MATRIX} * ${Shader.POSITION};
|
||||
}
|
||||
`;
|
||||
void main () {
|
||||
v_color = ${Shader.COLOR};
|
||||
v_texCoords = ${Shader.TEXCOORDS};
|
||||
gl_Position = ${Shader.MVP_MATRIX} * ${Shader.POSITION};
|
||||
}
|
||||
`;
|
||||
|
||||
let fs = `
|
||||
#ifdef GL_ES
|
||||
#define LOWP lowp
|
||||
precision mediump float;
|
||||
#else
|
||||
#define LOWP
|
||||
#endif
|
||||
varying LOWP vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
uniform sampler2D u_texture;
|
||||
#ifdef GL_ES
|
||||
#define LOWP lowp
|
||||
precision mediump float;
|
||||
#else
|
||||
#define LOWP
|
||||
#endif
|
||||
varying LOWP vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
void main () {
|
||||
gl_FragColor = v_color * texture2D(u_texture, v_texCoords);
|
||||
}
|
||||
`;
|
||||
void main () {
|
||||
gl_FragColor = v_color * texture2D(u_texture, v_texCoords);
|
||||
}
|
||||
`;
|
||||
|
||||
return new Shader(context, vs, fs);
|
||||
}
|
||||
|
||||
public static newTwoColoredTextured (context: ManagedWebGLRenderingContext | WebGLRenderingContext): Shader {
|
||||
let vs = `
|
||||
attribute vec4 ${Shader.POSITION};
|
||||
attribute vec4 ${Shader.COLOR};
|
||||
attribute vec4 ${Shader.COLOR2};
|
||||
attribute vec2 ${Shader.TEXCOORDS};
|
||||
uniform mat4 ${Shader.MVP_MATRIX};
|
||||
varying vec4 v_light;
|
||||
varying vec4 v_dark;
|
||||
varying vec2 v_texCoords;
|
||||
attribute vec4 ${Shader.POSITION};
|
||||
attribute vec4 ${Shader.COLOR};
|
||||
attribute vec4 ${Shader.COLOR2};
|
||||
attribute vec2 ${Shader.TEXCOORDS};
|
||||
uniform mat4 ${Shader.MVP_MATRIX};
|
||||
varying vec4 v_light;
|
||||
varying vec4 v_dark;
|
||||
varying vec2 v_texCoords;
|
||||
|
||||
void main () {
|
||||
v_light = ${Shader.COLOR};
|
||||
v_dark = ${Shader.COLOR2};
|
||||
v_texCoords = ${Shader.TEXCOORDS};
|
||||
gl_Position = ${Shader.MVP_MATRIX} * ${Shader.POSITION};
|
||||
}
|
||||
`;
|
||||
void main () {
|
||||
v_light = ${Shader.COLOR};
|
||||
v_dark = ${Shader.COLOR2};
|
||||
v_texCoords = ${Shader.TEXCOORDS};
|
||||
gl_Position = ${Shader.MVP_MATRIX} * ${Shader.POSITION};
|
||||
}
|
||||
`;
|
||||
|
||||
let fs = `
|
||||
#ifdef GL_ES
|
||||
#define LOWP lowp
|
||||
precision mediump float;
|
||||
#else
|
||||
#define LOWP
|
||||
#endif
|
||||
varying LOWP vec4 v_light;
|
||||
varying LOWP vec4 v_dark;
|
||||
varying vec2 v_texCoords;
|
||||
uniform sampler2D u_texture;
|
||||
#ifdef GL_ES
|
||||
#define LOWP lowp
|
||||
precision mediump float;
|
||||
#else
|
||||
#define LOWP
|
||||
#endif
|
||||
varying LOWP vec4 v_light;
|
||||
varying LOWP vec4 v_dark;
|
||||
varying vec2 v_texCoords;
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
void main () {
|
||||
vec4 texColor = texture2D(u_texture, v_texCoords);
|
||||
gl_FragColor.a = texColor.a * v_light.a;
|
||||
gl_FragColor.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb;
|
||||
}
|
||||
`;
|
||||
void main () {
|
||||
vec4 texColor = texture2D(u_texture, v_texCoords);
|
||||
gl_FragColor.a = texColor.a * v_light.a;
|
||||
gl_FragColor.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb;
|
||||
}
|
||||
`;
|
||||
|
||||
return new Shader(context, vs, fs);
|
||||
}
|
||||
|
||||
public static newColored (context: ManagedWebGLRenderingContext | WebGLRenderingContext): Shader {
|
||||
let vs = `
|
||||
attribute vec4 ${Shader.POSITION};
|
||||
attribute vec4 ${Shader.COLOR};
|
||||
uniform mat4 ${Shader.MVP_MATRIX};
|
||||
varying vec4 v_color;
|
||||
attribute vec4 ${Shader.POSITION};
|
||||
attribute vec4 ${Shader.COLOR};
|
||||
uniform mat4 ${Shader.MVP_MATRIX};
|
||||
varying vec4 v_color;
|
||||
|
||||
void main () {
|
||||
v_color = ${Shader.COLOR};
|
||||
gl_Position = ${Shader.MVP_MATRIX} * ${Shader.POSITION};
|
||||
}
|
||||
`;
|
||||
void main () {
|
||||
v_color = ${Shader.COLOR};
|
||||
gl_Position = ${Shader.MVP_MATRIX} * ${Shader.POSITION};
|
||||
}
|
||||
`;
|
||||
|
||||
let fs = `
|
||||
#ifdef GL_ES
|
||||
#define LOWP lowp
|
||||
precision mediump float;
|
||||
#else
|
||||
#define LOWP
|
||||
#endif
|
||||
varying LOWP vec4 v_color;
|
||||
#ifdef GL_ES
|
||||
#define LOWP lowp
|
||||
precision mediump float;
|
||||
#else
|
||||
#define LOWP
|
||||
#endif
|
||||
varying LOWP vec4 v_color;
|
||||
|
||||
void main () {
|
||||
gl_FragColor = v_color;
|
||||
}
|
||||
`;
|
||||
void main () {
|
||||
gl_FragColor = v_color;
|
||||
}
|
||||
`;
|
||||
|
||||
return new Shader(context, vs, fs);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user