Switched back to GLSL 1.20 because my laptop is a brick

This commit is contained in:
OLEGSHA 2020-08-09 11:40:41 +03:00
parent 1362dab2c1
commit 45b0ad2888
11 changed files with 31 additions and 20 deletions

View File

@ -44,7 +44,7 @@ public class CombinedShader extends Shader {
}
private static String combine(String[] resources) {
StringBuilder accumulator = new StringBuilder("#version 140\n");
StringBuilder accumulator = new StringBuilder("#version 120\n");
for (String resourceName : resources) {
Resource resource = getShaderResource(resourceName);

View File

@ -1,9 +1,20 @@
#version 140
#version 120
uniform int maskCount;
uniform vec2 masks[3 * 2 * 16];
mat2 inverse(mat2 matrix) {
mat2 result = mat2(
+matrix[1][1], -matrix[1][0],
-matrix[0][1], +matrix[0][0]
);
float det = matrix[0][0] * matrix[1][1] - matrix[1][0] * matrix[0][1];
return result / det;
}
bool isInMaskPrimitive(int primitive) {
vec2 origin = masks[3 * primitive + 0];
vec2 width = masks[3 * primitive + 1];

View File

@ -1,5 +1,5 @@
#version 140
#version 120
void flatTransferToFragment() {
shapeTransferToFragment();
}
}

View File

@ -1,8 +1,8 @@
#version 140
#version 120
void main(void) {
applyTexture();
applyColorMultiplier();
applyAlpha();
applyMask();
}
}

View File

@ -1,6 +1,6 @@
#version 140
#version 120
void main(void) {
gl_Position = applyFinalTransform(vec4(inputPositions, 1.0));
flatTransferToFragment();
}
}

View File

@ -1,4 +1,4 @@
#version 140
#version 120
varying vec3 varyingColorMultiplier;
varying vec2 varyingTextureCoords;
@ -45,4 +45,4 @@ void applyAlpha() {
if (gl_FragColor.w < 0.01) {
discard;
}
}
}

View File

@ -1,4 +1,4 @@
#version 140
#version 120
attribute vec3 inputPositions;
@ -17,4 +17,4 @@ vec4 applyFinalTransform(vec4 vector) {
void shapeTransferToFragment() {
varyingColorMultiplier = inputColorMultiplier;
varyingTextureCoords = inputTextureCoords;
}
}

View File

@ -1,4 +1,4 @@
#version 140
#version 120
varying vec3 varyingNormals;
@ -10,4 +10,4 @@ void applyShading() {
float lightness = (angleCos + 1.5) / 2;
linearMultiply(gl_FragColor, vec4(lightness, lightness, lightness, 1.0));
}
}

View File

@ -1,4 +1,4 @@
#version 140
#version 120
attribute vec3 inputNormals;
varying vec3 varyingNormals;
@ -10,4 +10,4 @@ void worldTransferToFragment() {
mat3 worldRotation = mat3(worldTransform);
varyingNormals = normalize(worldRotation * inputNormals);
}
}

View File

@ -1,8 +1,8 @@
#version 140
#version 120
void main(void) {
applyTexture();
applyColorMultiplier();
applyShading();
applyAlpha();
}
}

View File

@ -1,6 +1,6 @@
#version 140
#version 120
void main(void) {
gl_Position = applyFinalTransform(vec4(inputPositions, 1.0));
worldTransferToFragment();
}
}