mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-12 03:37:27 +07:00
Bloom option
This commit is contained in:
parent
22656a40b2
commit
89a4e6506f
@ -341,6 +341,7 @@ error.alreadyconnected = Already connected.
|
||||
error.mapnotfound = Map file not found!
|
||||
error.io = Network I/O error.
|
||||
error.any = Unknown network error.
|
||||
error.bloom = Failed to initialize bloom.\nYour device may not support it.
|
||||
|
||||
zone.groundZero.name = Ground Zero
|
||||
zone.desertWastes.name = Desert Wastes
|
||||
@ -485,6 +486,7 @@ setting.mutesound.name = Mute Sound
|
||||
setting.crashreport.name = Send Anonymous Crash Reports
|
||||
setting.chatopacity.name = Chat Opacity
|
||||
setting.playerchat.name = Display In-Game Chat
|
||||
setting.bloom.name = Bloom
|
||||
keybind.title = Rebind Keys
|
||||
category.general.name = General
|
||||
category.view.name = View
|
||||
|
@ -44,7 +44,9 @@ public class Renderer implements ApplicationListener{
|
||||
|
||||
public Renderer(){
|
||||
camera = new Camera();
|
||||
bloom = new Bloom(true);
|
||||
if(settings.getBool("bloom")){
|
||||
setupBloom();
|
||||
}
|
||||
Lines.setCircleVertices(20);
|
||||
Shaders.init();
|
||||
|
||||
@ -132,14 +134,45 @@ public class Renderer implements ApplicationListener{
|
||||
minimap.dispose();
|
||||
shieldBuffer.dispose();
|
||||
blocks.dispose();
|
||||
bloom.dispose();
|
||||
if(bloom != null){
|
||||
bloom.dispose();
|
||||
bloom = null;
|
||||
}
|
||||
Events.fire(new DisposeEvent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resize(int width, int height){
|
||||
bloom.dispose();
|
||||
bloom = new Bloom(true);
|
||||
if(settings.getBool("bloom")){
|
||||
setupBloom();
|
||||
}
|
||||
}
|
||||
|
||||
void setupBloom(){
|
||||
try{
|
||||
if(bloom != null){
|
||||
bloom.dispose();
|
||||
}
|
||||
bloom = new Bloom(true);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
settings.put("bloom", false);
|
||||
settings.save();
|
||||
ui.showError("$error.bloom");
|
||||
}
|
||||
}
|
||||
|
||||
public void toggleBloom(boolean enabled){
|
||||
if(enabled){
|
||||
if(bloom == null){
|
||||
setupBloom();
|
||||
}
|
||||
}else{
|
||||
if(bloom != null){
|
||||
bloom.dispose();
|
||||
bloom = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void updateShake(float scale){
|
||||
@ -206,14 +239,18 @@ public class Renderer implements ApplicationListener{
|
||||
drawAllTeams(true);
|
||||
|
||||
Draw.flush();
|
||||
bloom.setClearColor(0f, 0f, 0f, 0f);
|
||||
bloom.capture();
|
||||
if(bloom != null && !pixelator.enabled()){
|
||||
bloom.setClearColor(0f, 0f, 0f, 0f);
|
||||
bloom.capture();
|
||||
}
|
||||
|
||||
draw(bulletGroup);
|
||||
draw(effectGroup);
|
||||
|
||||
Draw.flush();
|
||||
bloom.render();
|
||||
if(bloom != null && !pixelator.enabled()){
|
||||
bloom.render();
|
||||
}
|
||||
|
||||
overlays.drawBottom();
|
||||
draw(playerGroup, p -> true, Player::drawBuildRequests);
|
||||
|
@ -218,6 +218,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
graphics.checkPref("indicators", true);
|
||||
graphics.checkPref("animatedwater", false);
|
||||
graphics.checkPref("animatedshields", !mobile);
|
||||
graphics.checkPref("bloom", false, val -> renderer.toggleBloom(val));
|
||||
graphics.checkPref("lasers", true);
|
||||
graphics.checkPref("pixelate", false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user