mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-12-06 02:40:23 -08:00
Defer shadow buffer init
This commit is contained in:
parent
1dedefd56c
commit
34be5ffc6c
1 changed files with 11 additions and 11 deletions
|
|
@ -60,6 +60,7 @@ public class Schematics implements Loadable{
|
|||
private ObjectMap<CoreBlock, Seq<Schematic>> loadouts = new ObjectMap<>();
|
||||
private ObjectMap<CoreBlock, Schematic> defaultLoadouts = new ObjectMap<>();
|
||||
private @Nullable FrameBuffer shadowBuffer;
|
||||
private boolean triedCreatingShadowBuffer;
|
||||
private Texture errorTexture;
|
||||
private long lastClearTime;
|
||||
|
||||
|
|
@ -97,17 +98,6 @@ public class Schematics implements Loadable{
|
|||
});
|
||||
|
||||
all.sort();
|
||||
|
||||
if(shadowBuffer == null && !headless){
|
||||
Core.app.post(() -> {
|
||||
try{
|
||||
shadowBuffer = new FrameBuffer(maxSchematicSize + padding + 8, maxSchematicSize + padding + 8);
|
||||
}catch(Exception e){
|
||||
Log.err(Strings.format("Failed to create shadow buffer (@x@): @. This is likely because a mod is setting maxSchematicSize too high. Don't do that.",
|
||||
maxSchematicSize + padding + 8, maxSchematicSize + padding + 8, Strings.getSimpleMessage(e)));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void loadLoadouts(){
|
||||
|
|
@ -222,6 +212,16 @@ public class Schematics implements Loadable{
|
|||
Tmp.m2.set(Draw.trans());
|
||||
FrameBuffer buffer = new FrameBuffer((schematic.width + padding) * resolution, (schematic.height + padding) * resolution);
|
||||
|
||||
if(shadowBuffer == null && !triedCreatingShadowBuffer){
|
||||
triedCreatingShadowBuffer = true;
|
||||
try{
|
||||
shadowBuffer = new FrameBuffer(maxSchematicSize + padding + 8, maxSchematicSize + padding + 8);
|
||||
}catch(Exception e){
|
||||
Log.err(Strings.format("Failed to create shadow buffer (@x@): @. This is likely because a mod is setting maxSchematicSize too high. Don't do that.",
|
||||
maxSchematicSize + padding + 8, maxSchematicSize + padding + 8, Strings.getSimpleMessage(e)));
|
||||
}
|
||||
}
|
||||
|
||||
if(shadowBuffer != null){
|
||||
shadowBuffer.begin(Color.clear);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue