10 Commits

Author SHA1 Message Date
6b66a66b15 Update plugin org.gradle.toolchains.foojay-resolver-convention to v1 2025-11-14 15:03:27 +00:00
caa59cd72f implement camera/position quantization 2025-11-14 15:18:42 +01:00
a31c018b92 Merge pull request 'Update plugin org.gradle.toolchains.foojay-resolver-convention to v0.10.0' (#4) from renovate/org.gradle.toolchains.foojay-resolver-convention-0.x into main
Reviewed-on: #4
2025-11-14 15:08:11 +01:00
008bbff99c Merge pull request 'Update dependency org.graalvm.buildtools.native:org.graalvm.buildtools.native.gradle.plugin to v0.11.3' (#3) from renovate/org.graalvm.buildtools.native-org.graalvm.buildtools.native.gradle.plugin-0.x into main
Reviewed-on: #3
2025-11-14 15:08:02 +01:00
ccb7cd90d0 Merge pull request 'Update dependency io.github.fourlastor:construo to v2.1.0' (#2) from renovate/io.github.fourlastor-construo-2.x into main
Reviewed-on: #2
2025-11-14 15:07:53 +01:00
2d68cabedf Merge pull request 'Update gdxControllersVersion to v2.2.4' (#1) from renovate/gdxcontrollersversion into main
Reviewed-on: #1
2025-11-14 15:07:41 +01:00
6f28e01e5c Update plugin org.gradle.toolchains.foojay-resolver-convention to v0.10.0 2025-11-14 14:01:06 +00:00
c7313a0487 Update dependency org.graalvm.buildtools.native:org.graalvm.buildtools.native.gradle.plugin to v0.11.3 2025-11-14 14:01:01 +00:00
15b3a17f62 Update dependency io.github.fourlastor:construo to v2.1.0 2025-11-14 13:55:21 +00:00
95ef82d757 Update gdxControllersVersion to v2.2.4 2025-11-14 13:55:17 +00:00
4 changed files with 36 additions and 9 deletions

View File

@@ -17,12 +17,22 @@ public class FpsCameraController {
private float yaw = 0f; private float yaw = 0f;
private float pitch = 0f; private float pitch = 0f;
private float eyeHeight = 1.8f; private final float eyeHeight = 1.8f;
private final float jumpSpeed = 12f;
private final float gravity = -50f;
private float velocityY = 0f; private float velocityY = 0f;
private float gravity = -50f;
private float jumpSpeed = 12f;
private boolean grounded = false; private boolean grounded = false;
// --- approximation toggles
private final boolean retroQuantization = true;
// how coarse the rotation is (0.25f = round to 0.25°)
private final float yawStepDegrees = 0.2f;
private final float pitchStepDegrees = 0.2f;
// how coarse the position is (16f = steps of 1/16 units)
private final float positionQuantize = 64f;
private final Vector3 tmpForward = new Vector3(); private final Vector3 tmpForward = new Vector3();
private final Vector3 tmpRight = new Vector3(); private final Vector3 tmpRight = new Vector3();
@@ -205,12 +215,29 @@ public class FpsCameraController {
velocityY = jumpSpeed; velocityY = jumpSpeed;
grounded = false; grounded = false;
} }
// snap position to quantization steps
if (retroQuantization) {
float q = positionQuantize;
camera.position.x = Math.round(camera.position.x * q) / q;
camera.position.y = Math.round(camera.position.y * q) / q;
camera.position.z = Math.round(camera.position.z * q) / q;
}
} }
private void updateCameraDirection() { private void updateCameraDirection() {
// build direction vector from yaw/pitch // build direction vector from yaw/pitch
float yawRad = (float) Math.toRadians(yaw); float useYaw = yaw;
float pitchRad = (float) Math.toRadians(pitch); float usePitch = pitch;
if (retroQuantization) {
// snap yaw/pitch to fixed angular steps
useYaw = Math.round(useYaw / yawStepDegrees) * yawStepDegrees;
usePitch = Math.round(usePitch / pitchStepDegrees) * pitchStepDegrees;
}
float yawRad = (float) Math.toRadians(useYaw);
float pitchRad = (float) Math.toRadians(usePitch);
float x = (float) (Math.cos(pitchRad) * Math.sin(yawRad)); float x = (float) (Math.cos(pitchRad) * Math.sin(yawRad));
float y = (float) Math.sin(pitchRad); float y = (float) Math.sin(pitchRad);

View File

@@ -13,7 +13,7 @@ org.gradle.configureondemand=false
# the link to the scan won't get shown at all. # the link to the scan won't get shown at all.
# Documented at: https://docs.gradle.org/current/userguide/command_line_interface.html#sec:command_line_logging # Documented at: https://docs.gradle.org/current/userguide/command_line_interface.html#sec:command_line_logging
org.gradle.logging.level=quiet org.gradle.logging.level=quiet
gdxControllersVersion=2.2.3 gdxControllersVersion=2.2.4
enableGraalNative=false enableGraalNative=false
graalHelperVersion=2.0.1 graalHelperVersion=2.0.1
gdxVersion=1.14.0 gdxVersion=1.14.0

View File

@@ -4,9 +4,9 @@ buildscript {
gradlePluginPortal() gradlePluginPortal()
} }
dependencies { dependencies {
classpath "io.github.fourlastor:construo:2.0.2" classpath "io.github.fourlastor:construo:2.1.0"
if(enableGraalNative == 'true') { if(enableGraalNative == 'true') {
classpath "org.graalvm.buildtools.native:org.graalvm.buildtools.native.gradle.plugin:0.9.28" classpath "org.graalvm.buildtools.native:org.graalvm.buildtools.native.gradle.plugin:0.11.3"
} }
} }
} }

View File

@@ -1,6 +1,6 @@
plugins { plugins {
// Applies the foojay-resolver plugin to allow automatic download of JDKs. // Applies the foojay-resolver plugin to allow automatic download of JDKs.
id("org.gradle.toolchains.foojay-resolver-convention") version "0.9.0" id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
} }
// A list of which subprojects to load as part of the same larger project. // A list of which subprojects to load as part of the same larger project.
// You can remove Strings from the list and reload the Gradle project // You can remove Strings from the list and reload the Gradle project