From c7af64b7061c59c987958d0830838f1c05caeb29 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 19 Jan 2024 00:23:56 +0000 Subject: Render rail network using new shaders Non-functional, totally unimplemented at this stage --- gfx/gl/shaders/networkStraight.vs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 gfx/gl/shaders/networkStraight.vs (limited to 'gfx/gl/shaders/networkStraight.vs') diff --git a/gfx/gl/shaders/networkStraight.vs b/gfx/gl/shaders/networkStraight.vs new file mode 100644 index 0000000..025ae8f --- /dev/null +++ b/gfx/gl/shaders/networkStraight.vs @@ -0,0 +1,20 @@ +#version 330 core + +layout(location = 0) in ivec3 v_apos; +layout(location = 1) in ivec3 v_bpos; +layout(location = 2) in mat2 v_rot; +layout(location = 4) in float v_reps; + +uniform mat4 viewProjection; + +flat out ivec3 apos; +flat out ivec3 bpos; +flat out mat2 rot; +flat out float reps; +flat out float dist; + +void +main() +{ + dist = viewProjection[0][0]; +} -- cgit v1.2.3 From 7f852de673bb687c5721c6a74367278f8ba62f56 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 20 Jan 2024 12:05:53 +0000 Subject: Implement complete network straight part shader --- gfx/gl/shaders/networkStraight.vs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'gfx/gl/shaders/networkStraight.vs') diff --git a/gfx/gl/shaders/networkStraight.vs b/gfx/gl/shaders/networkStraight.vs index 025ae8f..a0fa437 100644 --- a/gfx/gl/shaders/networkStraight.vs +++ b/gfx/gl/shaders/networkStraight.vs @@ -5,7 +5,7 @@ layout(location = 1) in ivec3 v_bpos; layout(location = 2) in mat2 v_rot; layout(location = 4) in float v_reps; -uniform mat4 viewProjection; +uniform ivec3 viewPoint; flat out ivec3 apos; flat out ivec3 bpos; @@ -16,5 +16,9 @@ flat out float dist; void main() { - dist = viewProjection[0][0]; + apos = v_apos; + bpos = v_bpos; + rot = v_rot; + reps = v_reps; + dist = min(distance(viewPoint, v_apos), distance(viewPoint, v_bpos)); } -- cgit v1.2.3 From a19011b730ac6d770e3b42cde3a10961495a417d Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 20 Jan 2024 20:10:12 +0000 Subject: Implement basic network curve part shader --- gfx/gl/shaders/networkStraight.vs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gfx/gl/shaders/networkStraight.vs') diff --git a/gfx/gl/shaders/networkStraight.vs b/gfx/gl/shaders/networkStraight.vs index a0fa437..55f9c4f 100644 --- a/gfx/gl/shaders/networkStraight.vs +++ b/gfx/gl/shaders/networkStraight.vs @@ -5,14 +5,14 @@ layout(location = 1) in ivec3 v_bpos; layout(location = 2) in mat2 v_rot; layout(location = 4) in float v_reps; -uniform ivec3 viewPoint; - flat out ivec3 apos; flat out ivec3 bpos; flat out mat2 rot; flat out float reps; flat out float dist; +include(`networkCommon.glsl') + void main() { @@ -20,5 +20,5 @@ main() bpos = v_bpos; rot = v_rot; reps = v_reps; - dist = min(distance(viewPoint, v_apos), distance(viewPoint, v_bpos)); + dist = segDist(v_apos, v_bpos); } -- cgit v1.2.3