mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-10 07:07:03 +07:00
Shader tests
This commit is contained in:
parent
61f75d7331
commit
4eba89603e
Binary file not shown.
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.2 KiB |
@ -3,8 +3,7 @@ precision mediump float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
#define SPACE 0.75
|
||||
#define RADIUS 5.0
|
||||
#define SPACE 2.0
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
@ -21,15 +20,25 @@ void main() {
|
||||
vec4 c = texture2D(u_texture, v_texCoord.xy);
|
||||
float spacing = SPACE * u_scl;
|
||||
|
||||
if(c.a >= 0.001){
|
||||
gl_FragColor = c * v_color;
|
||||
}else{
|
||||
for(float cx = -RADIUS; cx <= RADIUS; cx ++){
|
||||
for(float cy = -RADIUS; cy <= RADIUS; cy ++){
|
||||
if(cx*cx + cy*cy <= RADIUS * RADIUS && texture2D(u_texture, v_texCoord.xy + vec2(cx, cy) * v * spacing).a >= 0.001){
|
||||
gl_FragColor = u_color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
gl_FragColor = mix(vec4(0.0, 0.0, 0.0, min(c.a, u_color.a)), u_color,
|
||||
(1.0-step(0.001, texture2D(u_texture, v_texCoord.xy).a)) *
|
||||
step(0.001,
|
||||
//cardinals
|
||||
texture2D(u_texture, v_texCoord.xy + vec2(0, spacing) * v).a +
|
||||
texture2D(u_texture, v_texCoord.xy + vec2(0, -spacing) * v).a +
|
||||
texture2D(u_texture, v_texCoord.xy + vec2(spacing, 0) * v).a +
|
||||
texture2D(u_texture, v_texCoord.xy + vec2(-spacing, 0) * v).a +
|
||||
|
||||
//cardinal edges
|
||||
texture2D(u_texture, v_texCoord.xy + vec2(spacing, spacing) * v).a +
|
||||
texture2D(u_texture, v_texCoord.xy + vec2(spacing, -spacing) * v).a +
|
||||
texture2D(u_texture, v_texCoord.xy + vec2(-spacing, spacing) * v).a +
|
||||
texture2D(u_texture, v_texCoord.xy + vec2(-spacing, -spacing) * v).a +
|
||||
|
||||
//cardinals * 2
|
||||
texture2D(u_texture, v_texCoord.xy + vec2(0, spacing) * v*2.0).a +
|
||||
texture2D(u_texture, v_texCoord.xy + vec2(0, -spacing) * v*2.0).a +
|
||||
texture2D(u_texture, v_texCoord.xy + vec2(spacing, 0) * v*2.0).a +
|
||||
texture2D(u_texture, v_texCoord.xy + vec2(-spacing, 0) * v*2.0).a
|
||||
));
|
||||
}
|
@ -3,8 +3,6 @@ precision mediump float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
#define step 3.0
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
uniform float u_time;
|
||||
@ -17,8 +15,8 @@ uniform vec2 u_texsize;
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
#define SPACE 0.75
|
||||
#define RADIUS 5.0
|
||||
#define SPACE 1.3
|
||||
#define RADIUS 2.0
|
||||
|
||||
bool cont(vec2 t, vec2 v){
|
||||
|
||||
|
@ -140,7 +140,7 @@ public class HudFragment extends Fragment{
|
||||
infolabel.marginLeft(10f);
|
||||
IntFormat fps = new IntFormat("fps");
|
||||
IntFormat ping = new IntFormat("ping");
|
||||
infolabel.label(() -> fps.get(Core.graphics.getFramesPerSecond())).padRight(10);
|
||||
infolabel.label(() -> fps.get(Core.graphics.getFramesPerSecond())).padLeft(10).growX();
|
||||
infolabel.row();
|
||||
if(Net.hasClient()){
|
||||
infolabel.label(() -> ping.get(Net.getPing())).visible(Net::client).colspan(2);
|
||||
|
Loading…
Reference in New Issue
Block a user