Skip to content

Commit

Permalink
Minor cleanup and comments from last PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
Eirenliel committed Jun 28, 2022
1 parent 8df4726 commit ceb1cc7
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/main/java/dev/slimevr/protocol/DataFeedHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

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.*;
Expand Down Expand Up @@ -81,8 +80,7 @@ public int buildDatafeed(FlatBufferBuilder fbb, DataFeedConfigT config) {
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,
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/dev/slimevr/vr/processor/skeleton/BoneInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public void updateLength() {
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@
import dev.slimevr.vr.trackers.*;
import io.eiren.util.collections.FastList;

import java.util.ArrayList;
import java.util.List;
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);
Expand Down Expand Up @@ -355,6 +353,10 @@ protected void resetBones() {
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
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/dev/slimevr/vr/processor/skeleton/Skeleton.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
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;


public abstract class Skeleton {

public final List<BoneInfo> currentBoneInfo = new ArrayList<>();

@VRServerThread
public abstract void updatePose();

Expand Down

0 comments on commit ceb1cc7

Please sign in to comment.