Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ android.nonTransitiveRClass=true
org.gradle.unsafe.configuration-cache=false

kotlinVersion=2.0.20
spotlessVersion=7.0.2
spotlessVersion=7.2.1
shadowJarVersion=8.3.2
buildconfigVersion=5.5.0
grgitVersion=5.2.2
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
distributionSha256Sum=bd71102213493060956ec229d946beee57158dbd89d0e62b91bca0fa2c5f3531
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
34 changes: 21 additions & 13 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -83,10 +85,9 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,26 +134,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -197,11 +201,15 @@ if "$cygwin" || "$msys" ; then
done
fi

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
22 changes: 12 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down Expand Up @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
6 changes: 3 additions & 3 deletions server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ configure<com.diffplug.gradle.spotless.SpotlessExtension> {
",solarxr_protocol.rpc.*,kotlinx.coroutines.*,com.illposed.osc.*,android.app.*",
"ij_kotlin_allow_trailing_comma" to true,
)
val ktlintVersion = "1.2.1"
val ktlintVersion = "1.7.1"
kotlinGradle {
target("**/*.gradle.kts") // default target for kotlinGradle
ktlint(ktlintVersion)
Expand All @@ -61,8 +61,8 @@ configure<com.diffplug.gradle.spotless.SpotlessExtension> {

removeUnusedImports()
// Use eclipse JDT formatter
eclipse()
eclipse("4.36")
.configFile("spotless.xml")
.withP2Mirrors(mapOf("https://download.eclipse.org/" to "https://mirror.umd.edu/eclipse/"))
// .withP2Mirrors(mapOf("https://download.eclipse.org/" to "https://mirror.umd.edu/eclipse/"))
}
}
14 changes: 9 additions & 5 deletions server/core/src/main/java/com/jme3/math/FastMath.kt
Original file line number Diff line number Diff line change
Expand Up @@ -455,13 +455,17 @@ object FastMath {
val det13 = m21 * m33 - m23 * m31
val det23 = m22 * m33 - m23 * m32
return (
m00 * (m11 * det23 - m12 * det13 + m13 * det12) -
m00 *
(m11 * det23 - m12 * det13 + m13 * det12) -
m01
* (m10 * det23 - m12 * det03 + m13 * det02) +
*
(m10 * det23 - m12 * det03 + m13 * det02) +
m02
* (m10 * det13 - m11 * det03 + m13 * det01) -
*
(m10 * det13 - m11 * det03 + m13 * det01) -
m03
* (m10 * det12 - m11 * det02 + m12 * det01)
*
(m10 * det12 - m11 * det02 + m12 * det01)
).toFloat()
}

Expand Down Expand Up @@ -606,7 +610,7 @@ object FastMath {
*
* Source:
* [
* http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf](http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf)<br></br>
* http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf](http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf)<br></br>
* **broken link**
*
* @param half The half floating point value as a short.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class BodyProportionError : IAutoBoneError {

// "Expected" are values from Drillis and Contini (1966)
// Default are values from experimentation by the SlimeVR community

/**
* Proportions are based off the headset height (or eye height), not the total height of the user.
* To use the total height of the user, multiply it by [eyeHeightToHeightRatio] and use that in the limiters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class SlideError : IAutoBoneError {
return (
getSlideError(skeleton1, skeleton2, BoneType.LEFT_LOWER_LEG) +
getSlideError(skeleton1, skeleton2, BoneType.RIGHT_LOWER_LEG)
) / 2f
) /
2f
}

fun getSlideError(
Expand Down
42 changes: 14 additions & 28 deletions server/core/src/main/java/dev/slimevr/math/Angle.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,52 +11,38 @@ import kotlin.math.*
@JvmInline
value class Angle(private val rad: Float) {

fun toRad() =
rad
fun toRad() = rad

fun toDeg() =
rad * FastMath.RAD_TO_DEG
fun toDeg() = rad * FastMath.RAD_TO_DEG

operator fun unaryPlus() =
this
operator fun unaryPlus() = this

operator fun unaryMinus() =
Angle(normalize(-rad))
operator fun unaryMinus() = Angle(normalize(-rad))

operator fun plus(other: Angle) =
Angle(normalize(rad + other.rad))
operator fun plus(other: Angle) = Angle(normalize(rad + other.rad))

operator fun minus(other: Angle) =
Angle(normalize(rad - other.rad))
operator fun minus(other: Angle) = Angle(normalize(rad - other.rad))

operator fun times(scale: Float) =
Angle(normalize(rad * scale))
operator fun times(scale: Float) = Angle(normalize(rad * scale))

operator fun div(scale: Float) =
Angle(normalize(rad / scale))
operator fun div(scale: Float) = Angle(normalize(rad / scale))

operator fun compareTo(other: Angle) =
rad.compareTo(other.rad)
operator fun compareTo(other: Angle) = rad.compareTo(other.rad)

override fun toString() =
"${toDeg()} deg"
override fun toString() = "${toDeg()} deg"

companion object {
val ZERO = Angle(0.0f)

fun ofRad(rad: Float) =
Angle(normalize(rad))
fun ofRad(rad: Float) = Angle(normalize(rad))

fun ofDeg(deg: Float) =
Angle(normalize(deg * FastMath.DEG_TO_RAD))
fun ofDeg(deg: Float) = Angle(normalize(deg * FastMath.DEG_TO_RAD))

// Angle between two vectors
fun absBetween(a: Vector3, b: Vector3) =
Angle(normalize(a.angleTo(b)))
fun absBetween(a: Vector3, b: Vector3) = Angle(normalize(a.angleTo(b)))

// Angle between two rotations in rotation space
fun absBetween(a: Quaternion, b: Quaternion) =
Angle(normalize(a.angleToR(b)))
fun absBetween(a: Quaternion, b: Quaternion) = Angle(normalize(a.angleToR(b)))

/**
* Normalizes an angle to [-PI, PI)
Expand Down
14 changes: 6 additions & 8 deletions server/core/src/main/java/dev/slimevr/math/AngleAverage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,14 @@ class AngleAverage {
/**
* Gets the average angle.
*/
fun toAngle(): Angle =
if (isEmpty()) {
Angle.ZERO
} else {
Angle.ofRad(atan2(sumY, sumX))
}
fun toAngle(): Angle = if (isEmpty()) {
Angle.ZERO
} else {
Angle.ofRad(atan2(sumY, sumX))
}

/**
* Whether there are any angles to average.
*/
fun isEmpty() =
sumX == 0.0f && sumY == 0.0f
fun isEmpty() = sumX == 0.0f && sumY == 0.0f
}
3 changes: 1 addition & 2 deletions server/core/src/main/java/dev/slimevr/math/AngleErrors.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ class AngleErrors {
sumSqrErrors += error.toRad() * error.toRad()
}

fun toL2Norm() =
Angle.ofRad(sqrt(sumSqrErrors))
fun toL2Norm() = Angle.ofRad(sqrt(sumSqrErrors))
}
6 changes: 4 additions & 2 deletions server/core/src/main/java/dev/slimevr/osc/UnityArmature.kt
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ class UnityArmature(localRot: Boolean) {
val hipsAverage = (
leftHipNode.worldTransform.translation +
rightHipNode.worldTransform.translation
) * 0.5f
) *
0.5f
node.worldTransform.translation * 2f - hipsAverage + rootPosition
} else {
node.worldTransform.translation + rootPosition
Expand All @@ -233,7 +234,8 @@ class UnityArmature(localRot: Boolean) {
val hipsAverage = (
leftHipNode.worldTransform.translation +
rightHipNode.worldTransform.translation
) * 0.5f
) *
0.5f
node.worldTransform.translation * 2f - hipsAverage + rootPosition
} else {
node.localTransform.translation
Expand Down
Loading
Loading