diff --git a/.gitignore b/.gitignore
index 5cf9556..a356b9a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,5 @@
.mvn
target
.idea/
-*.iml
\ No newline at end of file
+*.iml
+dependency-reduced-pom.xml
\ No newline at end of file
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..6f692ab
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,15 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "type": "java",
+ "name": "App",
+ "request": "launch",
+ "mainClass": "fr.mrdev023.vulkan_java.App",
+ "projectName": "vulkan_java"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..c956c5f
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,5 @@
+{
+ "java.configuration.updateBuildConfiguration": "automatic",
+ "java.maven.downloadSources": true,
+ "java.maven.downloadJavadocs": true
+}
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..19df913
--- /dev/null
+++ b/README.md
@@ -0,0 +1,21 @@
+# Project
+
+## Usefull command
+
+1. Compile
+
+```console
+mvn compile
+```
+
+2. Run
+
+```console
+mvn exec:java
+```
+
+3. Package
+
+```console
+mvn package
+```
\ No newline at end of file
diff --git a/flake.nix b/flake.nix
index fc74497..da8ae80 100644
--- a/flake.nix
+++ b/flake.nix
@@ -10,10 +10,15 @@
flake-utils.lib.eachSystem flake-utils.lib.allSystems (system:
let
pkgs = import nixpkgs { inherit system; };
+
+ buildInputs = with pkgs; [ vulkan-headers vulkan-loader vulkan-validation-layers renderdoc ];
in
{
devShells = {
default = pkgs.mkShell {
+ LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
+ VK_LAYER_PATH = "${pkgs.vulkan-validation-layers}/share/vulkan/explicit_layer.d:${pkgs.renderdoc}/share/vulkan/implicit_layer.d";
+
packages = with pkgs; [
jdk22
maven
diff --git a/pom.xml b/pom.xml
index 5ed906e..735d74d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,27 +12,184 @@
UTF-8
+ fr.mrdev023.vulkan_java.App
21
- 3.3.4
+ 3.13.0
+ 3.6.0
+ 3.3.6
1.10.8
2.7.0
+
+
+ lwjgl-natives-linux-amd64
+
+
+ unix
+ linux
+ amd64
+
+
+
+ natives-linux
+
+
+
+ lwjgl-natives-linux-aarch64
+
+
+ unix
+ linux
+ aarch64
+
+
+
+ natives-linux-arm64
+
+
+
+ lwjgl-natives-macos-aarch64
+
+
+ mac
+ aarch64
+
+
+
+ natives-macos-arm64
+
+
+
+ org.lwjgl
+ lwjgl-vulkan
+ natives-macos-arm64
+
+
+
+
+ lwjgl-natives-windows-amd64
+
+
+ windows
+ amd64
+
+
+
+ natives-windows
+
+
+
+ lwjgl-natives-windows-aarch64
+
+
+ windows
+ aarch64
+
+
+
+ natives-windows-arm64
+
+
+
+
+
+
+
+ org.lwjgl
+ lwjgl-bom
+ ${lwjgl.version}
+ import
+ pom
+
+
+
+
org.lwjgl
lwjgl
- ${lwjgl.version}
+
+
+ org.lwjgl
+ lwjgl-assimp
org.lwjgl
lwjgl-glfw
- ${lwjgl.version}
+
+
+ org.lwjgl
+ lwjgl-llvm
+
+
+ org.lwjgl
+ lwjgl-openal
+
+
+ org.lwjgl
+ lwjgl-shaderc
+
+
+ org.lwjgl
+ lwjgl-spvc
+
+
+ org.lwjgl
+ lwjgl-stb
+
+
+ org.lwjgl
+ lwjgl-vma
org.lwjgl
lwjgl-vulkan
- ${lwjgl.version}
+
+
+ org.lwjgl
+ lwjgl
+ ${lwjgl.natives}
+
+
+ org.lwjgl
+ lwjgl-assimp
+ ${lwjgl.natives}
+
+
+ org.lwjgl
+ lwjgl-glfw
+ ${lwjgl.natives}
+
+
+ org.lwjgl
+ lwjgl-llvm
+ ${lwjgl.natives}
+
+
+ org.lwjgl
+ lwjgl-openal
+ ${lwjgl.natives}
+
+
+ org.lwjgl
+ lwjgl-shaderc
+ ${lwjgl.natives}
+
+
+ org.lwjgl
+ lwjgl-spvc
+ ${lwjgl.natives}
+
+
+ org.lwjgl
+ lwjgl-stb
+ ${lwjgl.natives}
+
+
+ org.lwjgl
+ lwjgl-vma
+ ${lwjgl.natives}
org.joml
@@ -44,105 +201,59 @@
tinylog-impl
${tinylog.version}
-
-
-
- org.lwjgl
- lwjgl
- ${lwjgl.version}
- ${native.target}
- runtime
-
-
- org.lwjgl
- lwjgl-glfw
- ${lwjgl.version}
- ${native.target}
- runtime
-
-
-
-
-
-
-
-
-
-
-
-
- maven-clean-plugin
- 3.4.0
-
-
-
- maven-resources-plugin
- 3.3.1
-
-
- maven-compiler-plugin
- 3.13.0
-
-
- maven-surefire-plugin
- 3.3.0
-
-
- maven-jar-plugin
- 3.4.2
-
-
- maven-install-plugin
- 3.1.2
-
-
- maven-deploy-plugin
- 3.1.2
-
-
- maven-project-info-reports-plugin
- 3.6.1
-
-
-
+ src
+
+
+ res
+
+
+
+
+ maven-compiler-plugin
+ ${maven-compiler-plugin.version}
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 3.1.0
+
+ ${main.class}
+
+
+
+ maven-shade-plugin
+ ${maven-shade-plugin.version}
+
+
+ package
+
+ shade
+
+
+
+
+
+ *:*
+
+ META-INF/*.SF
+ META-INF/*.RSA
+ META-INF/*.DSA
+
+
+
+
+
+ ${main.class}
+
+
+
+
+
+
+
-
-
-
- windows-profile
-
-
- Windows
-
-
-
- natives-windows
-
-
-
- linux-profile
-
-
- Linux
-
-
-
- natives-linux
-
-
-
- OSX-profile
-
-
- mac
-
-
-
- natives-macos
-
-
-
diff --git a/src/main/java/fr/mrdev023/vulkan_java/window/Display.java b/src/main/java/fr/mrdev023/vulkan_java/window/Display.java
index d4faec1..81434c8 100644
--- a/src/main/java/fr/mrdev023/vulkan_java/window/Display.java
+++ b/src/main/java/fr/mrdev023/vulkan_java/window/Display.java
@@ -22,8 +22,20 @@ public class Display {
TITLE = title;
displayMode = new DisplayMode(width, height);
+
+ // Configure GLFW for Vulkan
+ glfwDefaultWindowHints();
+ glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); // Tell GLFW not to create an OpenGL context
+ glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
+ glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE);
+
+ // Create the window
window = glfwCreateWindow(displayMode.getWidth(), displayMode.getHeight(), TITLE, NULL, NULL);
- glfwMakeContextCurrent(window);
+ if (window == NULL)
+ throw new RuntimeException("Failed to create the GLFW window");
+
+ // Make the window visible
+ glfwShowWindow(window);
}
public static void setMouseGrabbed(boolean a) {
diff --git a/src/main/java/fr/mrdev023/vulkan_java/window/Input.java b/src/main/java/fr/mrdev023/vulkan_java/window/Input.java
index 99a19cf..8355a32 100644
--- a/src/main/java/fr/mrdev023/vulkan_java/window/Input.java
+++ b/src/main/java/fr/mrdev023/vulkan_java/window/Input.java
@@ -1,6 +1,7 @@
package fr.mrdev023.vulkan_java.window;
import static org.lwjgl.glfw.GLFW.*;
+import static org.lwjgl.system.MemoryUtil.NULL;
import java.util.*;
import java.util.Map.*;
@@ -26,16 +27,30 @@ public class Input {
private static double ywheel = 0;
public static void init() {
- glfwSetScrollCallback(Display.getWindow(), scroll = new GLFWScrollCallback() {
+ long window = Display.getWindow();
+ if (window == NULL) {
+ throw new IllegalStateException("Window not initialized");
+ }
+
+ // Initialize scroll callback
+ scroll = new GLFWScrollCallback() {
+ @Override
public void invoke(long window, double xoffset, double yoffset) {
scroll(window, xoffset, yoffset);
}
- });
- glfwSetCursorPosCallback(Display.getWindow(), mousePos = new GLFWCursorPosCallback() {
+ };
+ glfwSetScrollCallback(window, scroll);
+
+ // Initialize cursor position callback
+ mousePos = new GLFWCursorPosCallback() {
+ @Override
public void invoke(long window, double xpos, double ypos) {
mousepos(window, xpos, ypos);
}
- });
+ };
+ glfwSetCursorPosCallback(window, mousePos);
+
+ // Initialize input state
for (int i = 0; i < NBRE_KEY; i++) {
state.put(i, NONE);
}