Skip to content

Commit 8da3003

Browse files
committed
refactor
removed singular fields solved max line length issues (ChunkMesher)
1 parent 0775365 commit 8da3003

7 files changed

Lines changed: 333 additions & 282 deletions

File tree

core/src/main/java/engine/backend/processing/ProcessingApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public void settings() {
3434
public void setup() {
3535
Graphics g = new GraphicsPImpl(this);
3636
ResourceManager.getInstance().setImageLoader(new ProcessingImageLoader(this));
37-
TextureManager.getInstance().setTextureLoader(new ProcessingTextureLoader(this));
37+
TextureManager.getInstance().setTextureLoader(new ProcessingTextureLoader());
3838
VBOFactory.getInstance()
3939
.setVBOCreationStrategy(new ProcessingVBOCreationStrategy(getGraphics()));
4040
Processing.parent = this;

core/src/main/java/engine/backend/processing/ProcessingTextureLoader.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99

1010
public class ProcessingTextureLoader implements TextureLoader {
1111

12-
private final PApplet parent;
13-
14-
public ProcessingTextureLoader(PApplet parent) {
15-
this.parent = parent;
16-
}
17-
1812
@Override
1913
public Texture loadTexture(String filePath) {
2014
String fullPath = "/images/" + filePath;
@@ -26,8 +20,7 @@ public Texture loadTexture(String filePath) {
2620
}
2721

2822
if (is == null) {
29-
System.err.println(
30-
"Datei weder in /images/ noch in /resources/images/ gefunden: " + filePath);
23+
System.err.println("File not found in either /images/ or /resources/images/: " + filePath);
3124
return null;
3225
}
3326

core/src/main/java/engine/runtime/input/action/InputActions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public InputActions(Input input) {
2727

2828
/** Called by the Input implementation once per frame */
2929
public void update() {
30-
// TODO implement
30+
// TODO implement
3131
}
3232

3333
public void bindButton(Action action, Key key) {

demos/src/main/java/demos/voxels/VoxelGameDemo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private void setupCamera() {
153153
}
154154

155155
private void setupChunkManager() {
156-
chunkManager = new ChunkManager(player, camera);
156+
chunkManager = new ChunkManager(player);
157157
SceneNode managerNode = new SceneNode();
158158
managerNode.addComponent(chunkManager);
159159
scene.addNode(managerNode);

demos/src/main/java/demos/voxels/chunk/ChunkManager.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
import engine.components.AbstractComponent;
1313
import engine.components.RenderableComponent;
1414
import engine.rendering.Graphics;
15-
import engine.scene.camera.Camera;
16-
import engine.scene.camera.Frustum;
1715
import math.Color;
1816
import math.Vector3f;
1917
import mesh.Mesh3D;
@@ -66,15 +64,9 @@ public class ChunkManager extends AbstractComponent implements RenderableCompone
6664

6765
private int playerChunkZ;
6866

69-
private Camera camera;
70-
71-
private Frustum frustum = new Frustum();
72-
73-
public ChunkManager(Player player, Camera camera) {
67+
public ChunkManager(Player player) {
7468
this.player = player;
75-
this.playerPosition = new Vector3f(0, 0, 0);
76-
77-
this.camera = camera;
69+
this.playerPosition = new Vector3f(0, 0, 0);
7870

7971
this.debugBox = new BoxCreator(16, 16, 16).create();
8072
new SnapToGroundModifier().modify(debugBox);
@@ -127,9 +119,6 @@ public void onUpdate(float tpf) {
127119
updateChunksAroundPlayer();
128120
enqueueChunks();
129121
processQueues();
130-
131-
// Frustum update
132-
// frustum.update(camera.getViewProjectionMatrix());
133122
}
134123

135124
// ============================

voxels-client/src/main/java/client/usecases/openinventory/InventoryViewComponent.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ public class InventoryViewComponent extends AbstractComponent
5050

5151
private final int slotSize;
5252

53-
private Texture texture;
54-
5553
private Geometry geometry;
5654

5755
private boolean inventoryOpen = false;
@@ -84,15 +82,19 @@ public InventoryViewComponent(Input input, Inventory inventory, ClientNetwork ne
8482

8583
this.slotSize = SIZE * SCALE;
8684

87-
texture = createAndConfigureTexture();
85+
this.geometry = createGeometry();
86+
}
87+
88+
private Geometry createGeometry() {
89+
Texture texture = createAndConfigureTexture();
8890
Mesh3D plane = createPlaneMesh();
8991

9092
Material material = new Material();
9193
material.setDiffuseTexture(texture);
9294
material.setUseLighting(false);
9395
material.setColor(new Color(0, 0, 0, 0));
9496

95-
geometry = new Geometry(plane, material);
97+
return new Geometry(plane, material);
9698
}
9799

98100
@Override

0 commit comments

Comments
 (0)