Fallback shield shader

This commit is contained in:
Anuken
2019-08-23 14:16:51 -04:00
parent 6d72c08d63
commit 0d4716f3b4
3 changed files with 13 additions and 4 deletions

View File

@@ -256,7 +256,7 @@ public class Renderer implements ApplicationListener{
draw(playerGroup, p -> true, Player::drawBuildRequests); draw(playerGroup, p -> true, Player::drawBuildRequests);
if(Entities.countInBounds(shieldGroup) > 0){ if(Entities.countInBounds(shieldGroup) > 0){
if(settings.getBool("animatedshields")){ if(settings.getBool("animatedshields") && Shaders.shield != null){
Draw.flush(); Draw.flush();
shieldBuffer.begin(); shieldBuffer.begin();
graphics.clear(Color.CLEAR); graphics.clear(Color.CLEAR);

View File

@@ -1,5 +1,6 @@
package io.anuke.mindustry.graphics; package io.anuke.mindustry.graphics;
import io.anuke.annotations.Annotations.*;
import io.anuke.arc.Core; import io.anuke.arc.Core;
import io.anuke.arc.graphics.Color; import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.TextureRegion; import io.anuke.arc.graphics.g2d.TextureRegion;
@@ -10,7 +11,7 @@ import io.anuke.arc.util.Time;
public class Shaders{ public class Shaders{
public static Shadow shadow; public static Shadow shadow;
public static BlockBuild blockbuild; public static BlockBuild blockbuild;
public static Shield shield; public static @Nullable Shield shield;
public static UnitBuild build; public static UnitBuild build;
public static FogShader fog; public static FogShader fog;
public static MenuShader menu; public static MenuShader menu;
@@ -19,7 +20,13 @@ public class Shaders{
public static void init(){ public static void init(){
shadow = new Shadow(); shadow = new Shadow();
blockbuild = new BlockBuild(); blockbuild = new BlockBuild();
shield = new Shield(); try{
shield = new Shield();
}catch(Throwable t){
//don't load shield shader
shield = null;
t.printStackTrace();
}
build = new UnitBuild(); build = new UnitBuild();
fog = new FogShader(); fog = new FogShader();
menu = new MenuShader(); menu = new MenuShader();

View File

@@ -241,7 +241,9 @@ public class SettingsMenuDialog extends SettingsDialog{
graphics.checkPref("fps", false); graphics.checkPref("fps", false);
graphics.checkPref("indicators", true); graphics.checkPref("indicators", true);
graphics.checkPref("animatedwater", false); graphics.checkPref("animatedwater", false);
graphics.checkPref("animatedshields", !mobile); if(Shaders.shield != null){
graphics.checkPref("animatedshields", !mobile);
}
graphics.checkPref("bloom", false, val -> renderer.toggleBloom(val)); graphics.checkPref("bloom", false, val -> renderer.toggleBloom(val));
graphics.checkPref("lasers", true); graphics.checkPref("lasers", true);
graphics.checkPref("pixelate", false); graphics.checkPref("pixelate", false);