Add getParent to TransformNode and add StdBVHFileStream

This commit is contained in:
ButterscotchVanilla committed 2021-12-01 20:17:36 -05:00
1 parent 76ab69e44e
commit e44ce3fb0b
4 files changed
+130 -7

No files matched your search

@@ -16,20 +16,32 @@ public class TransformNodeWrapper {
public final Transform localTransform;
public final Transform worldTransform;
public final boolean flippedOffset;
protected TransformNodeWrapper parent;
public final List<TransformNodeWrapper> children = new FastList<>();
public TransformNodeWrapper(String name, TransformNode nodeToWrap) {
public TransformNodeWrapper(TransformNode nodeToWrap, String name, boolean flippedOffset) {
this.wrappedNode = nodeToWrap;
this.name = name;
this.localTransform = nodeToWrap.localTransform;
this.worldTransform = nodeToWrap.worldTransform;
this.flippedOffset = flippedOffset;
}
public TransformNodeWrapper(TransformNode nodeToWrap, String name) {
this(nodeToWrap, name, false);
}
public TransformNodeWrapper(TransformNode nodeToWrap, boolean flippedOffset) {
this(nodeToWrap, nodeToWrap.getName(), flippedOffset);
}
public TransformNodeWrapper(TransformNode nodeToWrap) {
this(nodeToWrap.getName(), nodeToWrap);
this(nodeToWrap, nodeToWrap.getName());
}
public boolean hasLocalRotation () {
@@ -37,10 +49,18 @@ public class TransformNodeWrapper {
}
public void attachChild(TransformNodeWrapper node) {
if (node.parent != null) {
throw new IllegalArgumentException("The child node must not already have a parent");
}
this.children.add(node);
node.parent = this;
}
public TransformNodeWrapper getParent() {
return parent;
}
public String getName() {
return name;
}