Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweaks and improvement to declutter defense-ranges (2nd attempt) #4050

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
15c9e7e
Tweaks and improvement to declutter defense-ranges
icexuick Sep 16, 2024
cfb729c
Tweaks to colors and range settings
icexuick Sep 16, 2024
3ca5341
Some Tweaks to colors
icexuick Sep 18, 2024
1636045
Add weapondef customParam `noattackrangearc` which when set, will for…
Beherith Sep 18, 2024
cc51870
Note that this is not the same as the distance from the unit to the c…
Beherith Sep 18, 2024
6964b0a
Dont draw stenciled circles for LRPCs in defense range
Beherith Sep 18, 2024
7d2386f
add a separate LRPC class that ONLY draws rings and no stencil disks
Beherith Sep 18, 2024
881ca7c
draw attack ranges onto minimap
Beherith Sep 18, 2024
2be318c
Tweaks to colors + thickness
icexuick Sep 18, 2024
3cce2bb
Fixes for no-arc units
icexuick Sep 18, 2024
4d3ad62
More no-arc weapons/units Incl. Legion
icexuick Sep 18, 2024
ee1ac7d
More fixes
icexuick Sep 18, 2024
522d29f
Bogus weapon fix
icexuick Sep 18, 2024
eb9aed8
Fixes for Mines + T2 AA cleanup + some tweaks to colors and fade-params
icexuick Sep 18, 2024
53e3fd3
Some tweaks to ranges again
icexuick Sep 18, 2024
828597b
strip out weapon range rings unified into its own shader
Beherith Nov 9, 2024
cb738b3
Move attack range drawing to DrawWorld so that its drawn after water,…
Beherith Nov 10, 2024
60b979a
Clamp range rings just above water level, also send vertices forward …
Beherith Nov 10, 2024
49915e8
less debug echos
Beherith Nov 10, 2024
80d49ee
docs
Beherith Nov 10, 2024
d42fea1
refactor fade control
Beherith Nov 10, 2024
5895eb4
Share vertex and fragment shaders between defense and attack ranges
Beherith Nov 10, 2024
8a3d794
Update defense range gl4 to use unified weapon ranges shader
Beherith Nov 10, 2024
c91c468
Also draw defense range rings after water
Beherith Nov 10, 2024
131b829
docs and debug views
Beherith Nov 10, 2024
4e18042
Merge branch 'master' into New-Defense-Ranges-GL4-/-Removal-of-old-&-…
Beherith Dec 13, 2024
0214a6b
Merge branch 'master' into New-Defense-Ranges-GL4-/-Removal-of-old-&-…
Beherith Dec 22, 2024
25aad02
fix reference to texture() without textureLod in vertex shader
Beherith Dec 22, 2024
e7a3ff6
Merge branch 'master' into New-Defense-Ranges-GL4-/-Removal-of-old-&-…
Beherith Dec 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions luaui/Widgets/Shaders/attack_range_gl4.vert.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ uniform float lineAlphaUniform = 1.0;
uniform float cannonmode = 0.0;
uniform float fadeDistOffset = 0.0;
uniform float drawMode = 0.0;
uniform float inMiniMap = 0.0;


uniform sampler2D heightmapTex;
uniform sampler2D losTex; // hmm maybe?
Expand Down Expand Up @@ -143,7 +145,7 @@ void main() {
// rotate the circle into unit space, wierd that it has to be rotated on other direction
float maxAngleDif = 1;
float mainDirDegrees = 0;
if (MAXANGLEDIF != 0) {
if (MAXANGLEDIF > 0.0) {
maxAngleDif = fract(MAXANGLEDIF);// goes from 0.0 to 1.0, where 0.25 would mean a 90 deg cone
mainDirDegrees = MAXANGLEDIF - maxAngleDif;// Is the offset in degrees.
}
Expand Down Expand Up @@ -249,14 +251,22 @@ void main() {

//--- DISTANCE FADE ---
vec4 camPos = cameraViewInv[3];

// Note that this is not the same as the distance from the unit to the camera, but the distance from the circle to the camera
float distToCam = length(modelWorldPos.xyz - camPos.xyz); //dist from cam
// FadeStart, FadeEnd, StartAlpha, EndAlpha
float fadeDist = visibility.y - visibility.x;

if (ISDGUN > 0.5) {
FADEALPHA = clamp((visibility.y + fadeDistOffset + 1000 - distToCam)/(fadeDist),visibility.w,visibility.z);
} else {
FADEALPHA = clamp((visibility.y + fadeDistOffset - distToCam)/(fadeDist),visibility.w,visibility.z);
}

if (inMiniMap> 0.5){
FADEALPHA = 1.0;
}

//FADEALPHA = clamp((visibility.y + fadeDistOffset - distToCam)/(fadeDist),visibility.w,visibility.z);

//--- Optimize by anything faded out getting transformed back to origin with 0 range?
Expand Down Expand Up @@ -297,7 +307,12 @@ void main() {
//worldPos = circleWorldPos;
//worldPos.a = RANGE;
alphaControl.x = circlepointposition.z; // save circle progress here
gl_Position = cameraViewProj * vec4(circleWorldPos.xyz, 1.0);

if (inMiniMap < 0.5) {
gl_Position = cameraViewProj * vec4(circleWorldPos.xyz, 1.0);
} else {
gl_Position = mmDrawViewProj * vec4(circleWorldPos.xyz, 1.0);
}

//lets blend the alpha here, and save work in FS:
float outalpha = OUTOFBOUNDSALPHA * (MOUSEALPHA + FADEALPHA * lineAlphaUniform);
Expand Down
39 changes: 39 additions & 0 deletions luaui/Widgets/Shaders/weapon_range_rings_unified_gl4.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#version 330

#extension GL_ARB_uniform_buffer_object : require
#extension GL_ARB_shading_language_420pack: require
// This shader is (c) Beherith ([email protected]), released under the MIT license

//__DEFINES__

#line 20000

uniform float selUnitCount = 1.0;
uniform float selBuilderCount = 1.0;
uniform float drawAlpha = 1.0;
uniform float drawMode = 0.0;

//_ENGINEUNIFORMBUFFERDEFS__

in DataVS {
flat vec4 v_blendedcolor;
};

out vec4 fragColor;

void main() {

fragColor = v_blendedcolor;
// For testing:
#if (DEBUG == 1)
if (fract(gl_FragCoord.x * 0.125) < 0.4) {
#if (STATICUNITS == 0)
fragColor.rgba *= 0.0;
#endif
}else{
#if(STATICUNITS == 1)
fragColor.rgba *= 0.0;
#endif
}
#endif
}
Loading