Unit assembler shader fix
This commit is contained in:
@@ -400,7 +400,6 @@ public class Control implements ApplicationListener, Loadable{
|
||||
control.saves.resetSave();
|
||||
}
|
||||
|
||||
//for planet launches, mostly
|
||||
if(sector.preset != null){
|
||||
sector.preset.quietUnlock();
|
||||
}
|
||||
|
||||
@@ -232,6 +232,8 @@ public class Shaders{
|
||||
|
||||
public static class BlockBuildShader extends LoadShader{
|
||||
public float progress;
|
||||
//Alpha changes the opacity of *everything*, while the provided batch color only changes the outline
|
||||
public float alpha = 1f;
|
||||
public TextureRegion region = new TextureRegion();
|
||||
public float time;
|
||||
|
||||
@@ -243,6 +245,7 @@ public class Shaders{
|
||||
public void apply(){
|
||||
setUniformf("u_progress", progress);
|
||||
setUniformf("u_time", time);
|
||||
setUniformf("u_alpha", alpha);
|
||||
|
||||
if(region.texture == null){
|
||||
setUniformf("u_uv", 0f, 0f);
|
||||
|
||||
@@ -200,7 +200,7 @@ public class UnitAssembler extends PayloadBlock{
|
||||
}).left();
|
||||
|
||||
t.table(req -> {
|
||||
req.table().grow(); //it refuses to go to the right unless I do this. please help.
|
||||
req.add().grow(); //it refuses to go to the right unless I do this. please help.
|
||||
|
||||
req.table(solid -> {
|
||||
int length = 0;
|
||||
@@ -222,13 +222,13 @@ public class UnitAssembler extends PayloadBlock{
|
||||
length++;
|
||||
}
|
||||
}).right();
|
||||
|
||||
|
||||
LiquidStack[] stacks = plan.liquidReq;
|
||||
if(stacks != null){
|
||||
for(int i = 0; i < plan.liquidReq.length; i++){
|
||||
req.row();
|
||||
|
||||
req.table().grow(); //another one.
|
||||
req.add().grow(); //another one.
|
||||
|
||||
req.add(StatValues.displayLiquid(stacks[i].liquid, stacks[i].amount * 60f, true)).right();
|
||||
}
|
||||
@@ -561,18 +561,19 @@ public class UnitAssembler extends PayloadBlock{
|
||||
var plan = plan();
|
||||
|
||||
//draw the unit construction as outline
|
||||
//TODO flashes when no gallium
|
||||
Draw.draw(Layer.blockBuilding, () -> {
|
||||
Draw.color(Pal.accent, warmup);
|
||||
|
||||
Shaders.blockbuild.region = plan.unit.fullIcon;
|
||||
Shaders.blockbuild.time = Time.time;
|
||||
Shaders.blockbuild.alpha = warmup;
|
||||
//margin due to units not taking up whole region
|
||||
Shaders.blockbuild.progress = Mathf.clamp(progress + 0.05f);
|
||||
|
||||
Draw.rect(plan.unit.fullIcon, sx, sy, rotdeg() - 90f);
|
||||
Draw.flush();
|
||||
Draw.color();
|
||||
Shaders.blockbuild.alpha = 1f;
|
||||
});
|
||||
|
||||
Draw.reset();
|
||||
|
||||
Reference in New Issue
Block a user