Improve terrain fog quality and refactor cloud rendering #52
+11
-7
@@ -50,13 +50,6 @@ public final class CloudVertices {
|
|||||||
translationUnit.injectVariable("uniform vec3 iris_CloudCellSize;");
|
translationUnit.injectVariable("uniform vec3 iris_CloudCellSize;");
|
||||||
translationUnit.injectVariable("uniform ivec2 iris_CloudCenterCell;");
|
translationUnit.injectVariable("uniform ivec2 iris_CloudCenterCell;");
|
||||||
translationUnit.injectVariable("uniform sampler2D " + CLOUD_COLORS_SAMPLER + ";");
|
translationUnit.injectVariable("uniform sampler2D " + CLOUD_COLORS_SAMPLER + ";");
|
||||||
translationUnit.injectFunction("""
|
|
||||||
vec4 iris_cloudCellColor(int cellX, int cellZ) {
|
|
||||||
ivec2 size = textureSize(iris_CloudColors, 0);
|
|
||||||
ivec2 cell = iris_CloudCenterCell + ivec2(cellX, cellZ);
|
|
||||||
cell -= size * ivec2(floor(vec2(cell) / vec2(size)));
|
|
||||||
return texelFetch(iris_CloudColors, cell, 0);
|
|
||||||
}""");
|
|
||||||
//?}
|
//?}
|
||||||
translationUnit.injectVariable("uniform isamplerBuffer " + CLOUD_FACES_SAMPLER + ";");
|
translationUnit.injectVariable("uniform isamplerBuffer " + CLOUD_FACES_SAMPLER + ";");
|
||||||
translationUnit.injectVariable("vec3 iris_cloudPosition;");
|
translationUnit.injectVariable("vec3 iris_cloudPosition;");
|
||||||
@@ -98,6 +91,17 @@ public final class CloudVertices {
|
|||||||
iris_cloudColor = (useTopColor ? faceColors[1] : faceColors[direction]) * iris_CloudColor""" + CELL_COLOR + """
|
iris_cloudColor = (useTopColor ? faceColors[1] : faceColors[direction]) * iris_CloudColor""" + CELL_COLOR + """
|
||||||
;
|
;
|
||||||
}""");
|
}""");
|
||||||
|
//? if <26.1 {
|
||||||
|
// injectFunction inserts each function before the previously injected one, so this ends up ahead of
|
||||||
|
// iris_generateCloudVertex, which calls it.
|
||||||
|
translationUnit.injectFunction("""
|
||||||
|
vec4 iris_cloudCellColor(int cellX, int cellZ) {
|
||||||
|
ivec2 size = textureSize(iris_CloudColors, 0);
|
||||||
|
ivec2 cell = iris_CloudCenterCell + ivec2(cellX, cellZ);
|
||||||
|
cell -= size * ivec2(floor(vec2(cell) / vec2(size)));
|
||||||
|
return texelFetch(iris_CloudColors, cell, 0);
|
||||||
|
}""");
|
||||||
|
//?}
|
||||||
translationUnit.prependMain("iris_generateCloudVertex();");
|
translationUnit.prependMain("iris_generateCloudVertex();");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user