Lighting bugfixes

This commit is contained in:
Anuken
2021-06-12 17:22:12 -04:00
parent 816ac51beb
commit 4eb0852f9f
4 changed files with 23 additions and 2 deletions

View File

@@ -22,6 +22,10 @@ public class EnvRenderers{
((Texture)t).setFilter(TextureFilter.linear);
};
Color particleColor = Color.valueOf("a7c1fa");
float windSpeed = 0.03f, windAngle = 45f;
float windx = Mathf.cosDeg(windAngle) * windSpeed, windy = Mathf.sinDeg(windAngle) * windSpeed;
renderer.addEnvRenderer(Env.underwater, () -> {
Draw.draw(Layer.light + 1, () -> {
Draw.color(waterColor, 0.4f);
@@ -67,6 +71,18 @@ public class EnvRenderers{
}
}
//suspended particles
Draw.draw(Layer.weather, () -> {
Weather.drawParticles(Core.atlas.find("particle"), particleColor,
1.4f, 4f, //minmax size
10000f, 1f, 1f, //density
windx, windy, //wind vectors
0.5f, 1f, //minmax alpha
30f, 80f, //sinscl
1f, 7f, //sinmag
false);
});
Draw.blend();
});

View File

@@ -191,7 +191,10 @@ public class LightRenderer{
Draw.color();
buffer.begin(Color.clear);
Draw.sort(false);
Gl.blendEquationSeparate(Gl.funcAdd, Gl.max);
//apparently necessary
Blending.normal.apply();
for(Runnable run : lights){
run.run();
@@ -202,6 +205,7 @@ public class LightRenderer{
Draw.rect(circleRegion, cir.x, cir.y, cir.radius * 2, cir.radius * 2);
}
Draw.reset();
Draw.sort(true);
buffer.end();
Gl.blendEquationSeparate(Gl.funcAdd, Gl.funcAdd);

View File

@@ -9,7 +9,6 @@ import mindustry.content.*;
import mindustry.game.*;
import mindustry.maps.generators.*;
import mindustry.type.*;
import mindustry.type.Weather.*;
import mindustry.world.*;
import mindustry.world.meta.*;
@@ -49,7 +48,7 @@ public class TantrosPlanetGenerator extends PlanetGenerator{
@Override
public void addWeather(Sector sector, Rules rules){
rules.weather.and(new WeatherEntry(Weathers.suspendParticles)).peek().always = true;
//no weather... yet
}
@Override

View File

@@ -147,6 +147,8 @@ public class Weather extends UnlockableContent{
Draw.rect(region, x, y, size, size, rotation);
}
}
Draw.reset();
}
public static void drawRain(float sizeMin, float sizeMax, float xspeed, float yspeed, float density, float intensity, float stroke, Color color){