Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
guiYMOUR authored Oct 13, 2024
1 parent 60c6aa0 commit 211d2be
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
14 changes: 11 additions & 3 deletions src/ExtraUtilities/graphics/MainRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class MainRenderer{

private FrameBuffer buffer;

private static final float[][] initFloat = new float[510][];
private static final float[][] initFloat = new float[512][];
//private static final Pool<BlackHole> holePool = Pools.get(BlackHole.class, BlackHole::new);

protected MainRenderer(){
Expand All @@ -35,7 +35,7 @@ protected MainRenderer(){

public static void init(){
if(renderer == null) renderer = new MainRenderer();
for(int i = 0; i < 510; i++){
for(int i = 0; i < 512; i++){
initFloat[i] = new float[i * 4];
}
}
Expand All @@ -48,6 +48,10 @@ public static void addBlackHole(float x, float y, float inRadius, float outRadiu
}

private void advancedDraw(){
if(settings.getBool("pixelate") || holes.size >= 512) {
holes.clear();
return;
}
Draw.draw(Layer.background - 1, () -> {
buffer.resize(graphics.getWidth(), graphics.getHeight());
buffer.begin();
Expand All @@ -56,7 +60,11 @@ private void advancedDraw(){
Draw.draw(Layer.max - 1, () -> {
buffer.end();

if(holes.size >= 510) return;
// if(holes.size >= 512) {
// for(int i = 0; i <= holes.size - 512; i++){
// holes.remove(i);
// }
// }
if(holes.size >= MainShader.MaxCont) MainShader.createShader();

float[] blackholes = initFloat[holes.size];
Expand Down
4 changes: 2 additions & 2 deletions src/ExtraUtilities/graphics/MainShader.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ public class MainShader {
public static HoleShader holeShader;

public static void createShader(){
if(MaxCont >= 510) return;
if(MaxCont >= 512) return;

MaxCont = Math.min(MaxCont * 2, 510);
MaxCont = Math.min(MaxCont * 2, 512);
if(holeShader != null) holeShader.dispose();
Shader.prependFragmentCode = "#define MAX_COUNT " + MaxCont + "\n";
holeShader = new HoleShader();
Expand Down

0 comments on commit 211d2be

Please sign in to comment.