reformat all

This commit is contained in:
lucas lelievre committed 2022-04-27 21:39:54 +02:00
1 parent 9d6dda8b17
commit 9e12958ca6
105 files changed
+10092 -9417

No files matched your search

+15 -15
View File
@@ -19,17 +19,17 @@ import io.eiren.util.ann.ThreadSafe;
import io.eiren.util.collections.FastList;
public class SkeletonList extends EJBagNoStretch {
private static final long UPDATE_DELAY = 50;
Quaternion q = new Quaternion();
Vector3f v = new Vector3f();
float[] angles = new float[3];
private final VRServerGUI gui;
private final List<NodeStatus> nodes = new FastList<>();
private long lastUpdate = 0;
public SkeletonList(VRServer server, VRServerGUI gui) {
super(false, true);
this.gui = gui;
@@ -37,13 +37,13 @@ public class SkeletonList extends EJBagNoStretch {
setAlignmentY(TOP_ALIGNMENT);
server.addSkeletonUpdatedCallback(this::skeletonUpdated);
}
@ThreadSafe
public void skeletonUpdated(HumanSkeleton newSkeleton) {
java.awt.EventQueue.invokeLater(() -> {
removeAll();
nodes.clear();
add(new JLabel("Joint"), c(0, 0, 2));
add(new JLabel("X"), c(1, 0, 2));
add(new JLabel("Y"), c(2, 0, 2));
@@ -51,28 +51,28 @@ public class SkeletonList extends EJBagNoStretch {
add(new JLabel("Pitch"), c(4, 0, 2));
add(new JLabel("Yaw"), c(5, 0, 2));
add(new JLabel("Roll"), c(6, 0, 2));
TransformNode[] allNodes = newSkeleton.getAllNodes();
for(int i = 0; i < allNodes.length; i++){
for (int i = 0; i < allNodes.length; i++) {
nodes.add(new NodeStatus(allNodes[i], i + 1));
}
gui.refresh();
});
}
@VRServerThread
public void updateBones() {
if(lastUpdate + UPDATE_DELAY > System.currentTimeMillis())
if (lastUpdate + UPDATE_DELAY > System.currentTimeMillis())
return;
lastUpdate = System.currentTimeMillis();
java.awt.EventQueue.invokeLater(() -> {
for(int i = 0; i < nodes.size(); ++i)
for (int i = 0; i < nodes.size(); ++i)
nodes.get(i).update();
});
}
private class NodeStatus {
TransformNode n;
@@ -82,7 +82,7 @@ public class SkeletonList extends EJBagNoStretch {
JLabel a1;
JLabel a2;
JLabel a3;
public NodeStatus(TransformNode node, int n) {
this.n = node;
add(new JLabel(node.getName()), c(0, n, 2, GridBagConstraints.FIRST_LINE_START));
@@ -93,12 +93,12 @@ public class SkeletonList extends EJBagNoStretch {
add(a2 = new JLabel("0"), c(5, n, 2, GridBagConstraints.FIRST_LINE_START));
add(a3 = new JLabel("0"), c(6, n, 2, GridBagConstraints.FIRST_LINE_START));
}
public void update() {
n.worldTransform.getTranslation(v);
n.worldTransform.getRotation(q);
q.toAngles(angles);
x.setText(StringUtils.prettyNumber(v.x, 2));
y.setText(StringUtils.prettyNumber(v.y, 2));
z.setText(StringUtils.prettyNumber(v.z, 2));