Unary operators

This commit is contained in:
paulevsGitch 2020-09-28 20:36:32 +03:00
parent 17663dac02
commit 9ccd0d987b
3 changed files with 29 additions and 9 deletions

View file

@ -0,0 +1,16 @@
package ru.betterend.util.sdf.operator;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.util.math.Quaternion;
public class SDFRotation extends SDFUnary {
private static final Vector3f POS = new Vector3f();
private Quaternion rotation;
@Override
public float getDistance(float x, float y, float z) {
POS.set(x, y, z);
POS.rotate(rotation);
return source.getDistance(POS.getX(), POS.getY(), POS.getZ());
}
}

View file

@ -1,16 +1,8 @@
package ru.betterend.util.sdf.operator; package ru.betterend.util.sdf.operator;
import ru.betterend.util.sdf.ISDF; public class SDFScale extends SDFUnary {
public class SDFScale implements ISDF {
private ISDF source;
private float scale; private float scale;
public SDFScale setSorce(ISDF source) {
this.source = source;
return this;
}
public SDFScale setScale(float scale) { public SDFScale setScale(float scale) {
this.scale = scale; this.scale = scale;
return this; return this;

View file

@ -0,0 +1,12 @@
package ru.betterend.util.sdf.operator;
import ru.betterend.util.sdf.ISDF;
public abstract class SDFUnary implements ISDF {
protected ISDF source;
public SDFUnary setSource(ISDF source) {
this.source = source;
return this;
}
}