Unary operators
This commit is contained in:
parent
17663dac02
commit
9ccd0d987b
3 changed files with 29 additions and 9 deletions
|
@ -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());
|
||||
}
|
||||
}
|
|
@ -1,16 +1,8 @@
|
|||
package ru.betterend.util.sdf.operator;
|
||||
|
||||
import ru.betterend.util.sdf.ISDF;
|
||||
|
||||
public class SDFScale implements ISDF {
|
||||
private ISDF source;
|
||||
public class SDFScale extends SDFUnary {
|
||||
private float scale;
|
||||
|
||||
public SDFScale setSorce(ISDF source) {
|
||||
this.source = source;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SDFScale setScale(float scale) {
|
||||
this.scale = scale;
|
||||
return this;
|
||||
|
|
12
src/main/java/ru/betterend/util/sdf/operator/SDFUnary.java
Normal file
12
src/main/java/ru/betterend/util/sdf/operator/SDFUnary.java
Normal 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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue