mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-04-05 18:01:56 +02:00
Update all gradle dependencies we have (#1173)
This commit is contained in:
@@ -13,8 +13,8 @@ android.useAndroidX=true
|
||||
android.nonTransitiveRClass=true
|
||||
org.gradle.unsafe.configuration-cache=false
|
||||
|
||||
kotlinVersion=1.9.23
|
||||
kotlinVersion=2.0.20
|
||||
spotlessVersion=6.25.0
|
||||
shadowJarVersion=8.1.1
|
||||
buildconfigVersion=5.3.5
|
||||
shadowJarVersion=8.3.2
|
||||
buildconfigVersion=5.5.0
|
||||
grgitVersion=5.2.2
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* For more details take a look at the Java Libraries chapter in the Gradle
|
||||
* User Manual available at https://docs.gradle.org/6.3/userguide/java_library_plugin.html
|
||||
*/
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
plugins {
|
||||
@@ -12,7 +13,7 @@ plugins {
|
||||
kotlin("plugin.serialization")
|
||||
id("com.github.gmazzo.buildconfig")
|
||||
|
||||
id("com.android.application") version "8.0.2"
|
||||
id("com.android.application") version "8.6.1"
|
||||
id("org.ajoberstar.grgit")
|
||||
}
|
||||
|
||||
@@ -39,8 +40,10 @@ tasks.preBuild {
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions.jvmTarget = "17"
|
||||
kotlinOptions.freeCompilerArgs += "-Xvalue-classes"
|
||||
compilerOptions {
|
||||
jvmTarget.set(JvmTarget.JVM_17)
|
||||
freeCompilerArgs.set(listOf("-Xvalue-classes"))
|
||||
}
|
||||
}
|
||||
|
||||
// Set compiler to use UTF-8
|
||||
@@ -65,21 +68,21 @@ allprojects {
|
||||
dependencies {
|
||||
implementation(project(":server:core"))
|
||||
|
||||
implementation("commons-cli:commons-cli:1.5.0")
|
||||
implementation("org.apache.commons:commons-lang3:3.12.0")
|
||||
implementation("commons-cli:commons-cli:1.8.0")
|
||||
implementation("org.apache.commons:commons-lang3:3.15.0")
|
||||
|
||||
// Android stuff
|
||||
implementation("androidx.appcompat:appcompat:1.6.1")
|
||||
implementation("androidx.core:core-ktx:1.10.1")
|
||||
implementation("com.google.android.material:material:1.9.0")
|
||||
implementation("androidx.appcompat:appcompat:1.7.0")
|
||||
implementation("androidx.core:core-ktx:1.13.1")
|
||||
implementation("com.google.android.material:material:1.12.0")
|
||||
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
||||
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
|
||||
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
|
||||
androidTestImplementation("androidx.test.ext:junit:1.2.1")
|
||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
|
||||
// For hosting web GUI
|
||||
implementation("io.ktor:ktor-server-core:2.3.0")
|
||||
implementation("io.ktor:ktor-server-netty:2.3.0")
|
||||
implementation("io.ktor:ktor-server-caching-headers:2.3.0")
|
||||
implementation("io.ktor:ktor-server-core:2.3.12")
|
||||
implementation("io.ktor:ktor-server-netty:2.3.10")
|
||||
implementation("io.ktor:ktor-server-caching-headers:2.3.12")
|
||||
|
||||
// Serial
|
||||
implementation("com.github.mik3y:usb-serial-for-android:3.7.0")
|
||||
@@ -99,7 +102,7 @@ android {
|
||||
compile your app. This means your app can use the API features included in
|
||||
this API level and lower. */
|
||||
|
||||
compileSdk = 33
|
||||
compileSdk = 35
|
||||
|
||||
/* The defaultConfig block encapsulates default settings and entries for all
|
||||
build variants and can override some attributes in main/AndroidManifest.xml
|
||||
@@ -119,7 +122,7 @@ android {
|
||||
minSdk = 26
|
||||
|
||||
// Specifies the API level used to test the app.
|
||||
targetSdk = 33
|
||||
targetSdk = 35
|
||||
|
||||
// Defines the version number of your app.
|
||||
versionCode = extra["gitVersionCode"] as? Int
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
@@ -16,7 +17,7 @@
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.SlimeVR"
|
||||
tools:targetApi="33"
|
||||
tools:targetApi="35"
|
||||
android:usesCleartextTraffic="true">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
@@ -31,6 +32,7 @@
|
||||
<service
|
||||
android:name=".ForegroundService"
|
||||
android:enabled="true"
|
||||
android:foregroundServiceType="connectedDevice"
|
||||
android:exported="false" />
|
||||
</application>
|
||||
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package dev.slimevr.android
|
||||
|
||||
import android.app.Notification
|
||||
import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.app.Service
|
||||
import android.app.*
|
||||
import android.content.Intent
|
||||
import android.content.pm.ServiceInfo
|
||||
import android.os.Build
|
||||
import android.os.IBinder
|
||||
import androidx.core.app.NotificationChannelCompat
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import androidx.core.app.ServiceCompat
|
||||
import io.eiren.util.logging.LogManager
|
||||
|
||||
/**
|
||||
* ForegroundService helps to keep the SlimeVR Server on Android from being killed.
|
||||
@@ -35,9 +38,26 @@ class ForegroundService : Service() {
|
||||
}
|
||||
|
||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||
val notification = createNotification()
|
||||
startForeground(NOTIFICATION_ID, notification)
|
||||
|
||||
try {
|
||||
val notification = createNotification()
|
||||
ServiceCompat.startForeground(
|
||||
this,
|
||||
NOTIFICATION_ID, // Cannot be 0
|
||||
notification,
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE
|
||||
} else {
|
||||
0
|
||||
},
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
|
||||
e is ForegroundServiceStartNotAllowedException
|
||||
) {
|
||||
LogManager.severe("Tried to start foreground service when not allowed:", e)
|
||||
}
|
||||
// ...
|
||||
}
|
||||
/*
|
||||
* Currently being a foreground process should be enough to keep the server running.
|
||||
* If it turns out to not be enough then the next option would be to return sticky here
|
||||
@@ -51,13 +71,12 @@ class ForegroundService : Service() {
|
||||
override fun onBind(intent: Intent?): IBinder? = null
|
||||
|
||||
private fun createNotificationChannel() {
|
||||
val serviceChannel = NotificationChannel(
|
||||
CHANNEL_ID,
|
||||
"SlimeVR Foreground Service Channel",
|
||||
NotificationManager.IMPORTANCE_LOW,
|
||||
)
|
||||
val manager = getSystemService(NotificationManager::class.java)
|
||||
manager.createNotificationChannel(serviceChannel)
|
||||
val serviceChannel = NotificationChannelCompat.Builder(CHANNEL_ID, NotificationManager.IMPORTANCE_LOW)
|
||||
.setName("SlimeVR Foreground Service Channel")
|
||||
.build()
|
||||
NotificationManagerCompat
|
||||
.from(this)
|
||||
.createNotificationChannel(serviceChannel)
|
||||
}
|
||||
|
||||
private fun createNotification(): Notification = NotificationCompat.Builder(this, CHANNEL_ID)
|
||||
|
||||
@@ -37,7 +37,7 @@ configure<com.diffplug.gradle.spotless.SpotlessExtension> {
|
||||
"java.util.*,kotlin.math.*,dev.slimevr.autobone.errors.*" +
|
||||
",io.github.axisangles.ktmath.*,kotlinx.atomicfu.*" +
|
||||
",dev.slimevr.tracking.trackers.*,dev.slimevr.desktop.platform.ProtobufMessages.*" +
|
||||
",com.illposed.osc.*",
|
||||
",com.illposed.osc.*,android.app.*",
|
||||
"ij_kotlin_allow_trailing_comma" to true,
|
||||
)
|
||||
val ktlintVersion = "1.2.1"
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* For more details take a look at the Java Libraries chapter in the Gradle
|
||||
* User Manual available at https://docs.gradle.org/6.3/userguide/java_library_plugin.html
|
||||
*/
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
plugins {
|
||||
@@ -25,8 +26,10 @@ java {
|
||||
}
|
||||
}
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions.jvmTarget = "17"
|
||||
kotlinOptions.freeCompilerArgs += "-Xvalue-classes"
|
||||
compilerOptions {
|
||||
jvmTarget.set(JvmTarget.JVM_17)
|
||||
freeCompilerArgs.set(listOf("-Xvalue-classes"))
|
||||
}
|
||||
}
|
||||
|
||||
// Set compiler to use UTF-8
|
||||
@@ -60,26 +63,26 @@ dependencies {
|
||||
// This dependency is used internally,
|
||||
// and not exposed to consumers on their own compile classpath.
|
||||
implementation("com.google.flatbuffers:flatbuffers-java:22.10.26")
|
||||
implementation("commons-cli:commons-cli:1.5.0")
|
||||
implementation("commons-cli:commons-cli:1.8.0")
|
||||
implementation("com.fasterxml.jackson.core:jackson-databind:2.15.1")
|
||||
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.1")
|
||||
|
||||
implementation("com.github.jonpeterson:jackson-module-model-versioning:1.2.2")
|
||||
implementation("org.apache.commons:commons-math3:3.6.1")
|
||||
implementation("org.apache.commons:commons-lang3:3.12.0")
|
||||
implementation("org.apache.commons:commons-lang3:3.15.0")
|
||||
implementation("org.apache.commons:commons-collections4:4.4")
|
||||
|
||||
implementation("com.illposed.osc:javaosc-core:0.8")
|
||||
implementation("org.java-websocket:Java-WebSocket:1.+")
|
||||
implementation("com.melloware:jintellitype:1.+")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")
|
||||
|
||||
// Jitpack
|
||||
implementation("com.github.SlimeVR:oscquery-kt:566a0cba58")
|
||||
|
||||
testImplementation(kotlin("test"))
|
||||
// Use JUnit test framework
|
||||
testImplementation(platform("org.junit:junit-bom:5.9.0"))
|
||||
testImplementation(platform("org.junit:junit-bom:5.10.3"))
|
||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||
testImplementation("org.junit.platform:junit-platform-launcher")
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class QuaternionMovingAverage(
|
||||
// GUI should clamp it from 0.01 (1%) or 0.1 (10%)
|
||||
// to 1 (100%).
|
||||
amount = amount.coerceAtLeast(0f)
|
||||
if (type === TrackerFilters.SMOOTHING) {
|
||||
if (type == TrackerFilters.SMOOTHING) {
|
||||
// lower smoothFactor = more smoothing
|
||||
smoothFactor = SMOOTH_MULTIPLIER * (1 - amount.coerceAtMost(1f)) + SMOOTH_MIN
|
||||
// Totally a hack
|
||||
@@ -43,7 +43,7 @@ class QuaternionMovingAverage(
|
||||
smoothFactor /= amount
|
||||
}
|
||||
}
|
||||
if (type === TrackerFilters.PREDICTION) {
|
||||
if (type == TrackerFilters.PREDICTION) {
|
||||
// higher predictFactor = more prediction
|
||||
predictFactor = PREDICT_MULTIPLIER * amount + PREDICT_MIN
|
||||
rotBuffer = CircularArrayList(PREDICT_BUFFER)
|
||||
@@ -95,7 +95,7 @@ class QuaternionMovingAverage(
|
||||
|
||||
@Synchronized
|
||||
fun addQuaternion(q: Quaternion) {
|
||||
if (type === TrackerFilters.PREDICTION) {
|
||||
if (type == TrackerFilters.PREDICTION) {
|
||||
if (rotBuffer.size == rotBuffer.capacity()) {
|
||||
rotBuffer.removeLast()
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ class UnityArmature(localRot: Boolean) {
|
||||
fun setLocalRotationForBone(unityBone: UnityBone, localRot: Quaternion) {
|
||||
val node = getHeadNodeOfBone(unityBone)
|
||||
if (node != null) {
|
||||
if (unityBone === UnityBone.HIPS) {
|
||||
if (unityBone == UnityBone.HIPS) {
|
||||
node.worldTransform.rotation = localRot
|
||||
} else {
|
||||
node.localTransform.rotation = when (unityBone) {
|
||||
@@ -117,7 +117,7 @@ class UnityArmature(localRot: Boolean) {
|
||||
fun getGlobalTranslationForBone(unityBone: UnityBone): Vector3 {
|
||||
val node = getHeadNodeOfBone(unityBone)
|
||||
return if (node != null) {
|
||||
if (unityBone === UnityBone.HIPS) {
|
||||
if (unityBone == UnityBone.HIPS) {
|
||||
val hipsAverage = (
|
||||
leftHipNode.worldTransform.translation +
|
||||
rightHipNode.worldTransform.translation
|
||||
@@ -134,7 +134,7 @@ class UnityArmature(localRot: Boolean) {
|
||||
fun getLocalTranslationForBone(unityBone: UnityBone): Vector3 {
|
||||
val node = getHeadNodeOfBone(unityBone)
|
||||
return if (node != null) {
|
||||
if (unityBone === UnityBone.HIPS) {
|
||||
if (unityBone == UnityBone.HIPS) {
|
||||
val hipsAverage = (
|
||||
leftHipNode.worldTransform.translation +
|
||||
rightHipNode.worldTransform.translation
|
||||
@@ -160,7 +160,7 @@ class UnityArmature(localRot: Boolean) {
|
||||
fun getLocalRotationForBone(unityBone: UnityBone): Quaternion {
|
||||
val node = getHeadNodeOfBone(unityBone)
|
||||
return if (node != null) {
|
||||
if (unityBone === UnityBone.HIPS) {
|
||||
if (unityBone == UnityBone.HIPS) {
|
||||
node.worldTransform.rotation * rootRotation
|
||||
} else {
|
||||
node.parent!!.worldTransform.rotation.inv() * node.worldTransform.rotation
|
||||
|
||||
@@ -169,7 +169,7 @@ class VMCHandler(
|
||||
try {
|
||||
val addr = InetAddress.getByName(ip)
|
||||
oscSender = OSCPortOut(InetSocketAddress(addr, portOut))
|
||||
if ((lastPortOut != portOut && lastAddress !== addr) || !wasConnected) {
|
||||
if ((lastPortOut != portOut && lastAddress != addr) || !wasConnected) {
|
||||
LogManager
|
||||
.info(
|
||||
"[VMCHandler] Sending to port $portOut at address $ip",
|
||||
|
||||
@@ -80,7 +80,7 @@ class VRCOSCHandler(
|
||||
override fun refreshSettings(refreshRouterSettings: Boolean) {
|
||||
// Sets which trackers are enabled and force head and hands to false
|
||||
for (i in computedTrackers.indices) {
|
||||
if (computedTrackers[i].trackerPosition !== TrackerPosition.HEAD || computedTrackers[i].trackerPosition !== TrackerPosition.LEFT_HAND || computedTrackers[i].trackerPosition !== TrackerPosition.RIGHT_HAND) {
|
||||
if (computedTrackers[i].trackerPosition != TrackerPosition.HEAD || computedTrackers[i].trackerPosition != TrackerPosition.LEFT_HAND || computedTrackers[i].trackerPosition != TrackerPosition.RIGHT_HAND) {
|
||||
trackersEnabled[i] = config
|
||||
.getOSCTrackerRole(
|
||||
computedTrackers[i].trackerPosition!!.trackerRole!!,
|
||||
@@ -199,7 +199,7 @@ class VRCOSCHandler(
|
||||
try {
|
||||
val addr = InetAddress.getByName(ip)
|
||||
oscSender = OSCPortOut(InetSocketAddress(addr, portOut))
|
||||
if (oscPortOut != portOut && oscIp !== addr || !wasConnected) {
|
||||
if (oscPortOut != portOut && oscIp != addr || !wasConnected) {
|
||||
LogManager.info("[VRCOSCHandler] Sending to port $portOut at address $ip")
|
||||
}
|
||||
oscPortOut = portOut
|
||||
@@ -463,7 +463,7 @@ class VRCOSCHandler(
|
||||
),
|
||||
)
|
||||
}
|
||||
if (computedTrackers[i].trackerPosition === TrackerPosition.HEAD) {
|
||||
if (computedTrackers[i].trackerPosition == TrackerPosition.HEAD) {
|
||||
// Send HMD position
|
||||
val (x, y, z) = computedTrackers[i].position
|
||||
oscArgs.clear()
|
||||
|
||||
@@ -111,7 +111,7 @@ class SkeletonConfigManager(
|
||||
|
||||
fun setToggle(config: SkeletonConfigToggles, newValue: Boolean?) {
|
||||
if (newValue != null) {
|
||||
if (configToggles[config] != null && (newValue !== configToggles[config])) {
|
||||
if (configToggles[config] != null && (newValue != configToggles[config])) {
|
||||
changedToggles[config.id - 1] = true
|
||||
}
|
||||
configToggles[config] = newValue
|
||||
|
||||
@@ -210,7 +210,7 @@ class Localizer(humanSkeleton: HumanSkeleton) {
|
||||
// update the target position of the foot
|
||||
private fun updateTargetPos(loc: Vector3, foot: MovementStates) {
|
||||
if (foot == plantedFoot) {
|
||||
if (worldReference === MovementStates.FOLLOW_COM) {
|
||||
if (worldReference == MovementStates.FOLLOW_COM) {
|
||||
targetFoot = loc
|
||||
}
|
||||
} else {
|
||||
@@ -255,16 +255,16 @@ class Localizer(humanSkeleton: HumanSkeleton) {
|
||||
|
||||
// update how long the COM has been the reference and how long the foot
|
||||
// has been
|
||||
comFrames = if (worldReference === MovementStates.FOLLOW_COM) comFrames + 1 else 0
|
||||
footFrames = if (worldReference === MovementStates.FOLLOW_FOOT) footFrames + 1 else 0
|
||||
sittingFrames = if (worldReference === MovementStates.FOLLOW_SITTING) sittingFrames + 1 else 0
|
||||
comFrames = if (worldReference == MovementStates.FOLLOW_COM) comFrames + 1 else 0
|
||||
footFrames = if (worldReference == MovementStates.FOLLOW_FOOT) footFrames + 1 else 0
|
||||
sittingFrames = if (worldReference == MovementStates.FOLLOW_SITTING) sittingFrames + 1 else 0
|
||||
}
|
||||
|
||||
// gets the position the COM should be at based on the velocity of the com and
|
||||
// the location of the floor
|
||||
private fun updateTargetCOM() {
|
||||
// if not in COM tracking mode, just use the current COM
|
||||
if (worldReference === MovementStates.FOLLOW_FOOT || worldReference === MovementStates.FOLLOW_SITTING) {
|
||||
if (worldReference == MovementStates.FOLLOW_FOOT || worldReference == MovementStates.FOLLOW_SITTING) {
|
||||
targetCOM = bufCur.centerOfMass
|
||||
} else {
|
||||
currentCOM = targetCOM
|
||||
@@ -293,7 +293,7 @@ class Localizer(humanSkeleton: HumanSkeleton) {
|
||||
val comPosStart: Vector3 = buf.centerOfMass
|
||||
|
||||
// get the buffer that occurred VELOCITY_SAMPLE_RATE ago in time
|
||||
while (buf.timeOfFrame > timeEnd && buf.parent !== null) {
|
||||
while (buf.timeOfFrame > timeEnd && buf.parent != null) {
|
||||
buf = buf.parent!!
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ class TapDetection {
|
||||
accelList.add(listval)
|
||||
|
||||
// remove old values from the list (if they are too old)
|
||||
while (time - accelList.first[1] > CLUMP_TIME_NS) {
|
||||
while (time - accelList.first()[1] > CLUMP_TIME_NS) {
|
||||
accelList.removeFirst()
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ class TapDetection {
|
||||
|
||||
// remove old taps from the list (if they are too old)
|
||||
if (!tapTimes.isEmpty()) {
|
||||
while (time - tapTimes.first > timeWindowNS) {
|
||||
while (time - tapTimes.first() > timeWindowNS) {
|
||||
tapTimes.removeFirst()
|
||||
if (tapTimes.isEmpty()) return
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ object TrackerUtils {
|
||||
position: TrackerPosition,
|
||||
): Tracker? {
|
||||
val resetTrackers = allTrackers.filter {
|
||||
it.trackerPosition === position &&
|
||||
it.trackerPosition == position &&
|
||||
!it.isInternal &&
|
||||
!it.status.reset
|
||||
}
|
||||
@@ -51,7 +51,7 @@ object TrackerUtils {
|
||||
position: TrackerPosition,
|
||||
): Tracker? {
|
||||
val resetTrackers = allTrackers.filter {
|
||||
it.trackerPosition === position &&
|
||||
it.trackerPosition == position &&
|
||||
!it.isComputed &&
|
||||
!it.isInternal &&
|
||||
!it.status.reset
|
||||
@@ -72,7 +72,7 @@ object TrackerUtils {
|
||||
position: TrackerPosition,
|
||||
): Tracker? {
|
||||
val resetTrackers = allTrackers.filter {
|
||||
it.trackerPosition === position &&
|
||||
it.trackerPosition == position &&
|
||||
!it.isImu() &&
|
||||
!it.isInternal &&
|
||||
!it.status.reset
|
||||
|
||||
@@ -221,15 +221,15 @@ value class Matrix3
|
||||
* finds the rotation matrix closest to all given rotation matrices.
|
||||
* multiply input matrices by a weight for weighted averaging.
|
||||
* WARNING: NOT ANGULAR
|
||||
* @param others a variable number of additional matrices to average
|
||||
* @param others a variable number of additional boxed matrices to average
|
||||
* @return the average rotation matrix
|
||||
*/
|
||||
fun average(vararg others: Matrix3): Matrix3 {
|
||||
fun average(vararg others: ObjectMatrix3): Matrix3 {
|
||||
var count = 1f
|
||||
var sum = this
|
||||
others.forEach {
|
||||
count += 1f
|
||||
sum += it
|
||||
sum += it.toValue()
|
||||
}
|
||||
return (sum / count).orthonormalize()
|
||||
}
|
||||
@@ -460,6 +460,16 @@ value class Matrix3
|
||||
*/
|
||||
fun toEulerAngles(order: EulerOrder): EulerAngles =
|
||||
orthonormalize().toEulerAnglesAssumingOrthonormal(order)
|
||||
|
||||
fun toObject() = ObjectMatrix3(xx, yx, zx, xy, yy, zy, xz, yz, zz)
|
||||
}
|
||||
|
||||
data class ObjectMatrix3(
|
||||
val xx: Float, val yx: Float, val zx: Float,
|
||||
val xy: Float, val yy: Float, val zy: Float,
|
||||
val xz: Float, val yz: Float, val zz: Float
|
||||
) {
|
||||
fun toValue() = Matrix3(xx, yx, zx, xy, yy, zy, xz, yz, zz)
|
||||
}
|
||||
|
||||
operator fun Float.times(that: Matrix3): Matrix3 = that * this
|
||||
|
||||
@@ -5,12 +5,13 @@
|
||||
* For more details take a look at the Java Libraries chapter in the Gradle
|
||||
* User Manual available at https://docs.gradle.org/6.3/userguide/java_library_plugin.html
|
||||
*/
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
application
|
||||
id("com.github.johnrengelman.shadow")
|
||||
id("com.gradleup.shadow")
|
||||
id("com.github.gmazzo.buildconfig")
|
||||
id("org.ajoberstar.grgit")
|
||||
}
|
||||
@@ -26,8 +27,10 @@ java {
|
||||
}
|
||||
}
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions.jvmTarget = "17"
|
||||
kotlinOptions.freeCompilerArgs += "-Xvalue-classes"
|
||||
compilerOptions {
|
||||
jvmTarget.set(JvmTarget.JVM_17)
|
||||
freeCompilerArgs.set(listOf("-Xvalue-classes"))
|
||||
}
|
||||
}
|
||||
|
||||
// Set compiler to use UTF-8
|
||||
@@ -54,8 +57,8 @@ dependencies {
|
||||
implementation(project(":server:core"))
|
||||
implementation(project(":solarxr-protocol"))
|
||||
|
||||
implementation("commons-cli:commons-cli:1.5.0")
|
||||
implementation("org.apache.commons:commons-lang3:3.12.0")
|
||||
implementation("commons-cli:commons-cli:1.8.0")
|
||||
implementation("org.apache.commons:commons-lang3:3.15.0")
|
||||
implementation("com.google.protobuf:protobuf-java:3.21.12")
|
||||
implementation("net.java.dev.jna:jna:5.+")
|
||||
implementation("net.java.dev.jna:jna-platform:5.+")
|
||||
|
||||
@@ -26,7 +26,7 @@ pluginManagement {
|
||||
kotlin("jvm") version kotlinVersion
|
||||
kotlin("android") version kotlinVersion
|
||||
id("com.diffplug.spotless") version spotlessVersion
|
||||
id("com.github.johnrengelman.shadow") version shadowJarVersion
|
||||
id("com.gradleup.shadow") version shadowJarVersion
|
||||
id("com.github.gmazzo.buildconfig") version buildconfigVersion
|
||||
id("org.ajoberstar.grgit") version grgitVersion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user