summaryrefslogtreecommitdiff
path: root/gfx/gl/shaders/networkCommon.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/gl/shaders/networkCommon.glsl')
-rw-r--r--gfx/gl/shaders/networkCommon.glsl17
1 files changed, 6 insertions, 11 deletions
diff --git a/gfx/gl/shaders/networkCommon.glsl b/gfx/gl/shaders/networkCommon.glsl
index e1811bc..7b55cad 100644
--- a/gfx/gl/shaders/networkCommon.glsl
+++ b/gfx/gl/shaders/networkCommon.glsl
@@ -1,11 +1,6 @@
-const float RAIL_HEIGHT = 250;
-const vec3[] profile = vec3[]( //
- vec3(-1900.F, 0.F, 0.F), //
- vec3(-608.F, 0.F, RAIL_HEIGHT), //
- vec3(0, 0.F, RAIL_HEIGHT * .7F), //
- vec3(608.F, 0.F, RAIL_HEIGHT), //
- vec3(1900.F, 0.F, 0.F));
-const float[profile.length()] texturePos = float[](0, 0.34, 0.5, 0.65, 1);
+uniform vec3[10] profile;
+uniform float[10] texturePos;
+uniform uint profileLength;
uniform mat4 viewProjection;
uniform ivec3 viewPoint;
@@ -25,7 +20,7 @@ segDist(const ivec3 a, const ivec3 b)
ifelse(
TYPE, .gs,
// Begin: Geometry shader only function
- void doVertex(const ivec3 end, const int v, const float texY, const mat2 rot) {
+ void doVertex(const ivec3 end, const uint v, const float texY, const mat2 rot) {
rposition = vec3(rot * profile[v].xy, profile[v].z);
ivec3 vpos = end + ivec3(rposition);
gl_Position = viewProjection * vec4(vpos - viewPoint, 1);
@@ -36,8 +31,8 @@ ifelse(
void doSeg(const float dist, const ivec3 apos, const ivec3 bpos, const float atexY, const float btexY,
const mat2 arot, const mat2 brot) {
if (dist < clipDistance) {
- int vstep = (dist < flatDistance) ? 1 : profile.length() - 1;
- for (int v = 0; v < profile.length(); v += vstep) {
+ uint vstep = (dist < flatDistance) ? 1u : profileLength - 1u;
+ for (uint v = 0u; v < profileLength; v += vstep) {
doVertex(bpos, v, btexY, brot);
doVertex(apos, v, atexY, arot);
}