Adopted new Math and Widget changes

This commit is contained in:
Frank 2022-10-28 18:03:25 +02:00
parent e608bf21fe
commit ff77134ead
15 changed files with 62 additions and 51 deletions

View file

@ -1,6 +1,7 @@
package org.betterx.bclib.sdf.operator;
import com.mojang.math.Vector3f;
import org.joml.Vector3f;
import java.util.function.Consumer;

View file

@ -1,6 +1,7 @@
package org.betterx.bclib.sdf.operator;
import com.mojang.math.Vector3f;
import org.joml.Vector3f;
import java.util.function.Function;

View file

@ -1,21 +1,22 @@
package org.betterx.bclib.sdf.operator;
import com.mojang.math.Quaternion;
import com.mojang.math.Vector3f;
import org.joml.Quaternionf;
import org.joml.Vector3f;
public class SDFRotation extends SDFUnary {
private final Vector3f pos = new Vector3f();
private Quaternion rotation;
private Quaternionf rotation;
public SDFRotation setRotation(Vector3f axis, float rotationAngle) {
rotation = new Quaternion(axis, rotationAngle, false);
rotation = new Quaternionf().setAngleAxis(rotationAngle, axis.x, axis.y, axis.z);
return this;
}
@Override
public float getDistance(float x, float y, float z) {
pos.set(x, y, z);
pos.transform(rotation);
pos.rotate(rotation);
return source.getDistance(pos.x(), pos.y(), pos.z());
}
}