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/networkCurve.vs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 gfx/gl/shaders/networkCurve.vs (limited to 'gfx/gl/shaders/networkCurve.vs') diff --git a/gfx/gl/shaders/networkCurve.vs b/gfx/gl/shaders/networkCurve.vs new file mode 100644 index 0000000..b4324d6 --- /dev/null +++ b/gfx/gl/shaders/networkCurve.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 ivec3 v_centre; +layout(location = 3) 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 d1d1a4e349f18cd36406f75170dad87fbad2722a Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 20 Jan 2024 13:00:49 +0000 Subject: Common code between straight/curve network geometry shaders --- gfx/gl/shaders/networkCurve.vs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gfx/gl/shaders/networkCurve.vs') diff --git a/gfx/gl/shaders/networkCurve.vs b/gfx/gl/shaders/networkCurve.vs index b4324d6..d083765 100644 --- a/gfx/gl/shaders/networkCurve.vs +++ b/gfx/gl/shaders/networkCurve.vs @@ -5,16 +5,16 @@ layout(location = 1) in ivec3 v_bpos; layout(location = 2) in ivec3 v_centre; layout(location = 3) in float v_reps; -uniform mat4 viewProjection; - flat out ivec3 apos; flat out ivec3 bpos; -flat out mat2 rot; +flat out ivec3 cpos; flat out float reps; -flat out float dist; void main() { - dist = viewProjection[0][0]; + apos = v_apos; + bpos = v_bpos; + cpos = v_centre; + reps = v_reps; } -- 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/networkCurve.vs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gfx/gl/shaders/networkCurve.vs') diff --git a/gfx/gl/shaders/networkCurve.vs b/gfx/gl/shaders/networkCurve.vs index d083765..6c56e93 100644 --- a/gfx/gl/shaders/networkCurve.vs +++ b/gfx/gl/shaders/networkCurve.vs @@ -4,11 +4,15 @@ layout(location = 0) in ivec3 v_apos; layout(location = 1) in ivec3 v_bpos; layout(location = 2) in ivec3 v_centre; layout(location = 3) in float v_reps; +layout(location = 4) in float v_aangle; +layout(location = 5) in float v_bangle; flat out ivec3 apos; flat out ivec3 bpos; flat out ivec3 cpos; flat out float reps; +flat out float aangle; +flat out float bangle; void main() @@ -17,4 +21,6 @@ main() bpos = v_bpos; cpos = v_centre; reps = v_reps; + aangle = v_aangle; + bangle = v_bangle; } -- cgit v1.2.3 From 35a9f035963458156c719dc16f4073b8244d66eb Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 20 Jan 2024 23:27:01 +0000 Subject: Pass curve link radius, no recalculate, its constant --- gfx/gl/shaders/networkCurve.vs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gfx/gl/shaders/networkCurve.vs') diff --git a/gfx/gl/shaders/networkCurve.vs b/gfx/gl/shaders/networkCurve.vs index 6c56e93..f51bb87 100644 --- a/gfx/gl/shaders/networkCurve.vs +++ b/gfx/gl/shaders/networkCurve.vs @@ -6,6 +6,7 @@ layout(location = 2) in ivec3 v_centre; layout(location = 3) in float v_reps; layout(location = 4) in float v_aangle; layout(location = 5) in float v_bangle; +layout(location = 6) in float v_radius; flat out ivec3 apos; flat out ivec3 bpos; @@ -13,6 +14,7 @@ flat out ivec3 cpos; flat out float reps; flat out float aangle; flat out float bangle; +flat out float radius; void main() @@ -23,4 +25,5 @@ main() reps = v_reps; aangle = v_aangle; bangle = v_bangle; + radius = v_radius; } -- cgit v1.2.3