Minor cleanup and comments from last PRs

This commit is contained in:
Eiren Rain committed 2022-06-28 20:11:08 +02:00
1 parent 8df4726d22
commit ceb1cc77d8
5 files changed
+16 -6

No files matched your search

@@ -2,7 +2,6 @@ package dev.slimevr.protocol;
import com.google.flatbuffers.FlatBufferBuilder;
import dev.slimevr.vr.processor.skeleton.HumanSkeleton;
import io.eiren.util.logging.LogManager;
import solarxr_protocol.MessageBundle;
import solarxr_protocol.data_feed.*;
@@ -81,8 +80,7 @@ public class DataFeedHandler extends ProtocolHandler<DataFeedMessageHeader> {
this.api.server.getAllTrackers()
);
// TODO: Remove the unecessary `Skeleton` abstraction
var s = (HumanSkeleton) this.api.server.humanPoseProcessor.getSkeleton();
var s = this.api.server.humanPoseProcessor.getSkeleton();
int bonesOffset = DataFeedBuilder
.createBonesData(
fbb,
@@ -37,6 +37,11 @@ public class BoneInfo {
this.length = this.tailNode.localTransform.getTranslation().length();
}
// TODO : There shouldn't be edge cases like multiplying
// feet by rotation. This is the best solution right now,
// or we'd need to store this info on the client, which is
// worse. Need to rework the skeleton using new @SkeletonData
// system
public Quaternion getLocalRotation() {
var rot = this.tailNode.getParent().localTransform.getRotation();
if (this.boneType == BoneType.LEFT_FOOT || this.boneType == BoneType.RIGHT_FOOT) {
@@ -11,7 +11,6 @@ import dev.slimevr.vr.processor.TransformNode;
import dev.slimevr.vr.trackers.*;
import io.eiren.util.collections.FastList;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -19,7 +18,6 @@ import java.util.Map;
public class HumanSkeleton extends Skeleton implements SkeletonConfigCallback {
public final SkeletonConfig skeletonConfig;
public final List<BoneInfo> currentBoneInfo = new ArrayList<>();
// #region Upper body nodes (torso)
protected final TransformNode hmdNode = new TransformNode("HMD", false);
protected final TransformNode headNode = new TransformNode("Head", false);
@@ -355,6 +353,10 @@ public class HumanSkeleton extends Skeleton implements SkeletonConfigCallback {
if (rightControllerTracker != null && rightLowerArmTracker != null) {
currentBoneInfo.add(new BoneInfo(BoneType.RIGHT_LOWER_ARM, rightElbowNodeContrl));
}
// TODO : Many bones were removed for preview, add them back
// from https://github.com/SlimeVR/SlimeVR-Server/pull/196
// (Except tracker bones. We all agreed, they're not needed)
}
// #region Set trackers inputs
@@ -1,5 +1,8 @@
package dev.slimevr.vr.processor.skeleton;
import java.util.ArrayList;
import java.util.List;
import dev.slimevr.util.ann.VRServerThread;
import dev.slimevr.vr.processor.TransformNode;
import io.eiren.util.ann.ThreadSafe;
@@ -7,6 +10,8 @@ import io.eiren.util.ann.ThreadSafe;
public abstract class Skeleton {
public final List<BoneInfo> currentBoneInfo = new ArrayList<>();
@VRServerThread
public abstract void updatePose();