Skip to content

Commit dcca364

Browse files
Merge pull request #77 from ArtifactForms/working2
update
2 parents dc55420 + 9fe7a26 commit dcca364

26 files changed

Lines changed: 620 additions & 350 deletions

pom.xml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<artifactId>maven-compiler-plugin</artifactId>
1414
<version>3.8.1</version>
1515
<configuration>
16-
<release>15</release>
16+
<release>17</release>
1717
</configuration>
1818
</plugin>
1919
<plugin>
@@ -23,6 +23,25 @@
2323
<configuration>
2424
</configuration>
2525
</plugin>
26+
<plugin>
27+
<groupId>com.googlecode.mavennatives</groupId>
28+
<artifactId>maven-nativedependencies-plugin</artifactId>
29+
<version>0.0.7</version>
30+
<executions>
31+
<execution>
32+
<id>unpack-natives</id>
33+
<phase>process-resources</phase>
34+
<goals>
35+
<goal>copy</goal>
36+
</goals>
37+
<configuration>
38+
<outputDirectory>
39+
${project.build.directory}/natives
40+
</outputDirectory>
41+
</configuration>
42+
</execution>
43+
</executions>
44+
</plugin>
2645
</plugins>
2746
</build>
2847
<repositories>
@@ -98,7 +117,13 @@
98117
<dependency>
99118
<groupId>net.java.jinput</groupId>
100119
<artifactId>jinput</artifactId>
101-
<version>2.0.9</version>
120+
<version>2.0.10</version>
121+
</dependency>
122+
<dependency>
123+
<groupId>net.java.jinput</groupId>
124+
<artifactId>jinput</artifactId>
125+
<version>2.0.10</version>
126+
<classifier>natives-all</classifier>
102127
</dependency>
103128
</dependencies>
104129
</project>

src/main/java/engine/components/SmoothFlyByCameraControl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class SmoothFlyByCameraControl extends AbstractComponent {
4545
private float moveSpeed = DEFAULT_MOVE_SPEED;
4646
private float acceleration = 10f;
4747
private float deceleration = 8f;
48-
private float speedBoostMultiplier = 3;
48+
private float speedBoostMultiplier = 3f;
4949

5050
private Input input;
5151
private Camera camera;

src/main/java/engine/debug/FpsGraph.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,15 @@ private void renderFpsGraph(Graphics g, int width, int height) {
5353
}
5454

5555
// Draw axis labels
56+
g.setColor(Color.BLACK);
57+
renderAxisLabels(g, x + 1, y + 1, height);
5658
g.setColor(Color.WHITE);
59+
renderAxisLabels(g, x, y, height);
60+
}
61+
62+
private void renderAxisLabels(Graphics g, int x, int y, int height) {
63+
float maxFps = fpsHistory.getMaxFps();
64+
5765
g.text("0 FPS", x, y + height + 15); // Min FPS label
5866
g.text((int) maxFps + " FPS", x, y - 5); // Max FPS label
5967
}

src/main/java/engine/demos/landmass/ProceduralLandmassDemo.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import engine.scene.SceneNode;
1212
import engine.scene.camera.PerspectiveCamera;
1313
import engine.scene.light.DirectionalLight;
14-
import engine.ui.LoadingScreen;
1514
import math.Color;
1615
import math.Vector3f;
1716
import mesh.Mesh3D;
@@ -51,7 +50,7 @@ public enum DrawMode {
5150
private Scene scene;
5251
// private EndlessTerrain endlessTerrain;
5352

54-
private LoadingScreen loadingScreen;
53+
// private LoadingScreen loadingScreen;
5554
private RoundReticle roundReticle;
5655

5756
public static void main(String[] args) {
@@ -101,8 +100,8 @@ private void setupUI() {
101100
rootUI.addChild(reticleNode);
102101

103102
SceneNode loadingScreenNode = new SceneNode();
104-
loadingScreen = new LoadingScreen();
105-
loadingScreenNode.addComponent(loadingScreen);
103+
// loadingScreen = new LoadingScreen();
104+
// loadingScreenNode.addComponent(loadingScreen);
106105
rootUI.addChild(loadingScreenNode);
107106
}
108107

@@ -143,7 +142,7 @@ private void createTerrain() {
143142
scene.addNode(chunkDisplayNode);
144143

145144
roundReticle.setActive(true);
146-
loadingScreen.hide();
145+
// loadingScreen.hide();
147146
}
148147

149148
/** Sets up the camera with smooth fly-by controls. */

src/main/java/engine/demos/voxels/ChunkMesher.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ public class ChunkMesher {
2929

3030
private static ArrayList<Vector2f> uvs;
3131
public static Material sharedMaterial;
32-
private static TextureAtlas textureAtlas;
32+
private static TextureAtlas2 textureAtlas;
3333

3434
static {
3535
sharedMaterial = new Material();
36-
textureAtlas = new TextureAtlas();
36+
textureAtlas = new TextureAtlas2();
3737
Texture texture = textureAtlas.getTexture();
3838
texture.setFilterMode(FilterMode.POINT);
3939
sharedMaterial.setDiffuseTexture(texture);

src/main/java/engine/demos/voxels/GameSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ public class GameSettings {
44

55
public static boolean textureNoise = false;
66

7-
public static boolean textureDebugText = true;
7+
public static boolean textureDebugText = false;
88

99
public static boolean textureBackground = false;
1010

src/main/java/engine/demos/voxels/Hotbar.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class Hotbar extends AbstractComponent implements RenderableComponent {
2222

2323
// Hotbar configuration
2424
private static final int SCALE = 4;
25-
private static final int SIZE = 19;
25+
private static final int SIZE = 16;
2626
private static final int BORDER = 1;
2727
private static final int MARGIN = 20;
2828
private static final int SLOTS = 9;
@@ -97,10 +97,15 @@ private void drawHotbarSlots(Graphics2D g2d) {
9797
g2d.setColor(java.awt.Color.LIGHT_GRAY);
9898
g2d.drawRoundRect(x, 0, SIZE - 1, SIZE - 1, 2, 2);
9999

100-
// Slot decorations
100+
// Slot highlights
101101
g2d.setColor(java.awt.Color.GRAY);
102-
g2d.drawLine(x + 2, 1, x + SIZE - 2, 1); // Horizontal
103-
g2d.drawLine(x + 1, 1, x + 1, SIZE - 2); // Vertical
102+
g2d.drawLine(x + 2, 1, x + SIZE - 2, 1); // Horizontal top
103+
g2d.drawLine(x + 1, 1, x + 1, SIZE - 2); // Vertical top
104+
105+
// // Slot shadows
106+
g2d.setColor(java.awt.Color.DARK_GRAY);
107+
g2d.drawLine(x + 2, SIZE - 2, x + SIZE - 2, SIZE - 2); // Horizontal bottom
108+
g2d.drawLine(x + SIZE - 2, 2, x + SIZE - 2, SIZE - 2); // Vertical bottom
104109
}
105110
}
106111

@@ -136,5 +141,4 @@ public void onDetach() {
136141
public void onUpdate(float tpf) {
137142
// Optional: Add update logic (e.g., animations or interactions)
138143
}
139-
140144
}

src/main/java/engine/demos/voxels/Player.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@
55
public class Player {
66

77
private Vector3f position;
8+
private Vector3f velocity;
9+
private float width = 0.6f;
10+
private float height = 1.8f;
11+
private boolean grounded;
812

913
public Player() {
1014
position = new Vector3f();
15+
velocity = new Vector3f();
16+
grounded = false;
1117
}
1218

1319
public Vector3f getPosition() {
@@ -17,4 +23,28 @@ public Vector3f getPosition() {
1723
public void setPosition(Vector3f position) {
1824
this.position = position;
1925
}
26+
27+
public Vector3f getVelocity() {
28+
return velocity;
29+
}
30+
31+
public void setVelocity(Vector3f velocity) {
32+
this.velocity = velocity;
33+
}
34+
35+
public float getWidth() {
36+
return width;
37+
}
38+
39+
public float getHeight() {
40+
return height;
41+
}
42+
43+
public boolean isGrounded() {
44+
return grounded;
45+
}
46+
47+
public void setGrounded(boolean grounded) {
48+
this.grounded = grounded;
49+
}
2050
}

src/main/java/engine/demos/voxels/PlayerVisual.java

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,35 @@
1212
public class PlayerVisual extends AbstractComponent implements RenderableComponent {
1313

1414
private Mesh3D mesh;
15-
15+
1616
public PlayerVisual() {
17-
mesh = new BoxCreator(0.9f, 1.8f, 0.9f).create();
18-
mesh.apply(new SnapToGroundModifier());
19-
mesh.apply(new TranslateModifier(0, -0.5f, 0));
17+
mesh = new BoxCreator(0.9f, 1.8f, 0.9f).create();
18+
mesh.apply(new SnapToGroundModifier());
19+
mesh.apply(new TranslateModifier(0, -0.5f, 0));
2020
}
21-
21+
2222
@Override
23-
public void onAttach() {
24-
// TODO Auto-generated method stub
25-
23+
public void render(Graphics g) {
24+
g.setColor(Color.YELLOW);
25+
g.drawFaces(mesh);
26+
g.drawLine(0, 0, 0, 0, -200, 0);
2627
}
2728

2829
@Override
29-
public void onDetach() {
30+
public void onUpdate(float tpf) {
3031
// TODO Auto-generated method stub
31-
32+
3233
}
3334

3435
@Override
35-
public void render(Graphics g) {
36-
g.setColor(Color.YELLOW);
37-
g.drawFaces(mesh);
38-
g.drawLine(0, 0, 0, 0, -200, 0);
36+
public void onAttach() {
37+
// TODO Auto-generated method stub
38+
3939
}
4040

4141
@Override
42-
public void onUpdate(float tpf) {
42+
public void onDetach() {
4343
// TODO Auto-generated method stub
44-
44+
4545
}
46-
4746
}

src/main/java/engine/demos/voxels/TextureAtlas.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class TextureAtlas {
1717
private boolean useNoise = GameSettings.textureNoise;
1818
private boolean drawDebugText = GameSettings.textureDebugText;
1919
private boolean fillTextureBackground = GameSettings.textureBackground;
20-
private float epsilon = 0.001f; // Small margin to prevent texture bleeding
20+
private float epsilon = 0.002f; // Small margin to prevent texture bleeding
2121
private int tileSize = 128;
2222
private int columns = 6; // 6 faces per block
2323
private int rows = BlockType.values().length;

0 commit comments

Comments
 (0)