Lighting bugfixes
This commit is contained in:
@@ -22,6 +22,10 @@ public class EnvRenderers{
|
|||||||
((Texture)t).setFilter(TextureFilter.linear);
|
((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, () -> {
|
renderer.addEnvRenderer(Env.underwater, () -> {
|
||||||
Draw.draw(Layer.light + 1, () -> {
|
Draw.draw(Layer.light + 1, () -> {
|
||||||
Draw.color(waterColor, 0.4f);
|
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();
|
Draw.blend();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -191,7 +191,10 @@ public class LightRenderer{
|
|||||||
|
|
||||||
Draw.color();
|
Draw.color();
|
||||||
buffer.begin(Color.clear);
|
buffer.begin(Color.clear);
|
||||||
|
Draw.sort(false);
|
||||||
Gl.blendEquationSeparate(Gl.funcAdd, Gl.max);
|
Gl.blendEquationSeparate(Gl.funcAdd, Gl.max);
|
||||||
|
//apparently necessary
|
||||||
|
Blending.normal.apply();
|
||||||
|
|
||||||
for(Runnable run : lights){
|
for(Runnable run : lights){
|
||||||
run.run();
|
run.run();
|
||||||
@@ -202,6 +205,7 @@ public class LightRenderer{
|
|||||||
Draw.rect(circleRegion, cir.x, cir.y, cir.radius * 2, cir.radius * 2);
|
Draw.rect(circleRegion, cir.x, cir.y, cir.radius * 2, cir.radius * 2);
|
||||||
}
|
}
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
Draw.sort(true);
|
||||||
buffer.end();
|
buffer.end();
|
||||||
Gl.blendEquationSeparate(Gl.funcAdd, Gl.funcAdd);
|
Gl.blendEquationSeparate(Gl.funcAdd, Gl.funcAdd);
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import mindustry.content.*;
|
|||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
import mindustry.maps.generators.*;
|
import mindustry.maps.generators.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.type.Weather.*;
|
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
@@ -49,7 +48,7 @@ public class TantrosPlanetGenerator extends PlanetGenerator{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addWeather(Sector sector, Rules rules){
|
public void addWeather(Sector sector, Rules rules){
|
||||||
rules.weather.and(new WeatherEntry(Weathers.suspendParticles)).peek().always = true;
|
//no weather... yet
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -147,6 +147,8 @@ public class Weather extends UnlockableContent{
|
|||||||
Draw.rect(region, x, y, size, size, rotation);
|
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){
|
public static void drawRain(float sizeMin, float sizeMax, float xspeed, float yspeed, float density, float intensity, float stroke, Color color){
|
||||||
|
|||||||
Reference in New Issue
Block a user