generated from GlennFolker/MindustryModTemplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
05f1cfa
commit a128b41
Showing
11 changed files
with
296 additions
and
63 deletions.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package confictura.proc.list; | ||
|
||
import arc.func.*; | ||
import confictura.graphics.g2d.*; | ||
import confictura.proc.*; | ||
import confictura.proc.GenAtlas.*; | ||
|
||
import static confictura.proc.ConficturaProc.*; | ||
|
||
public class EffectProc implements Proc{ | ||
@Override | ||
public void init(Cons<Runnable> async){ | ||
async.get(() -> { | ||
var brand = atlas.find("confictura-monolith-brand"); | ||
new GenRegion( | ||
"confictura-monolith-brand-glow", | ||
brand.file.sibling("monolith-brand-glow.png"), | ||
CPixmaps.gaussianBlur(brand.pixmap(), 16, 16, 4f) | ||
).save(true); | ||
}); | ||
} | ||
|
||
@Override | ||
public void finish(){} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package confictura.graphics; | ||
|
||
import arc.func.*; | ||
import arc.graphics.*; | ||
import arc.util.*; | ||
import mindustry.entities.*; | ||
import mindustry.gen.*; | ||
|
||
public class ExtEffect extends Effect{ | ||
public Prov<? extends EffectState> constructor; | ||
public @Nullable Prov<Object> data; | ||
|
||
public ExtEffect(float lifetime, Cons<EffectContainer> e){ | ||
this(EffectState::create, lifetime, e); | ||
} | ||
|
||
public ExtEffect(float lifetime, float clip, Cons<EffectContainer> e){ | ||
this(EffectState::create, lifetime, clip, e); | ||
} | ||
|
||
public ExtEffect(Prov<? extends EffectState> constructor, float lifetime, Cons<EffectContainer> e){ | ||
this(constructor, null, lifetime, e); | ||
} | ||
|
||
public ExtEffect(Prov<? extends EffectState> constructor, float lifetime, float clip, Cons<EffectContainer> e){ | ||
this(constructor, null, lifetime, clip, e); | ||
} | ||
|
||
public ExtEffect(Prov<? extends EffectState> constructor, @Nullable Prov<Object> data, float lifetime, Cons<EffectContainer> e){ | ||
this(constructor, data, lifetime, 50f, e); | ||
} | ||
|
||
public ExtEffect(Prov<? extends EffectState> constructor, @Nullable Prov<Object> data, float lifetime, float clip, Cons<EffectContainer> e){ | ||
super(lifetime, clip, e); | ||
this.constructor = constructor; | ||
this.data = data; | ||
} | ||
|
||
@Override | ||
protected void add(float x, float y, float rotation, Color color, Object data){ | ||
inst(x, y, rotation, color, data).add(); | ||
} | ||
|
||
protected EffectState inst(float x, float y, float rotation, Color color, Object data){ | ||
var e = constructor.get(); | ||
e.effect = this; | ||
e.rotation = baseRotation + rotation; | ||
e.data = this.data != null ? this.data.get() : data; | ||
e.lifetime = lifetime; | ||
e.set(x, y); | ||
e.color.set(color); | ||
if(followParent && data instanceof Posc p){ | ||
e.parent = p; | ||
e.rotWithParent = rotWithParent; | ||
} | ||
|
||
return e; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package confictura.graphics.g2d; | ||
|
||
import arc.graphics.*; | ||
import arc.math.*; | ||
|
||
import static arc.graphics.Pixmaps.*; | ||
|
||
public final class CPixmaps{ | ||
private CPixmaps(){ | ||
throw new AssertionError(); | ||
} | ||
|
||
public static Pixmap gaussianBlur(Pixmap in, int blurWidth, int blurHeight, float deviation){ | ||
var blur = new float[(2 * blurWidth + 1) * (2 * blurHeight + 1)]; | ||
float s = 2f * deviation * deviation, nor = 0f; | ||
|
||
for(int tx = -blurWidth; tx <= blurWidth; tx++){ | ||
for(int ty = -blurHeight; ty <= blurHeight; ty++){ | ||
float r = Mathf.sqrt(tx * tx + ty * ty); | ||
float res = Mathf.pow(Mathf.E, -(r * r) / s) / (Mathf.pi * s); | ||
|
||
blur[tx + blurWidth + (ty + blurHeight) * (2 * blurWidth + 1)] = res; | ||
nor += res; | ||
} | ||
} | ||
|
||
for(int i = 0; i < blur.length; i++) blur[i] /= nor; | ||
|
||
var ref = new Pixmap(in.width + blurWidth * 2, in.height + blurHeight * 2); | ||
ref.draw(in, blurWidth, blurHeight); | ||
bleed(ref, Integer.MAX_VALUE); | ||
|
||
Color sum = new Color(), col = new Color(); | ||
|
||
var out = new Pixmap(ref.width, ref.height); | ||
ref.each((x, y) -> { | ||
sum.set(0f, 0f, 0f, 0f); | ||
for(int tx = -blurWidth; tx <= blurWidth; tx++){ | ||
for(int ty = -blurHeight; ty <= blurHeight; ty++){ | ||
float factor = blur[tx + blurWidth + (ty + blurHeight) * (2 * blurWidth + 1)]; | ||
col.set(ref.get(x + tx, y + ty)); | ||
|
||
sum.r += col.r * factor; | ||
sum.g += col.g * factor; | ||
sum.b += col.b * factor; | ||
sum.a += col.a * factor; | ||
} | ||
} | ||
|
||
out.setRaw(x, y, sum.rgba()); | ||
}); | ||
|
||
ref.dispose(); | ||
return out; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.