Cave crystals
This commit is contained in:
parent
5228d778c8
commit
d0a16bf66b
4 changed files with 52 additions and 3 deletions
|
@ -7,7 +7,8 @@ public class SDFRotation extends SDFUnary {
|
|||
private static final Vector3f POS = new Vector3f();
|
||||
private Quaternion rotation;
|
||||
|
||||
public SDFRotation setRotation() {
|
||||
public SDFRotation setRotation(Vector3f axis, float rotationAngle) {
|
||||
rotation = new Quaternion(axis, rotationAngle, false);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package ru.betterend.util.sdf.primitive;
|
||||
|
||||
import ru.betterend.util.MHelper;
|
||||
|
||||
public class SDFHexPrism extends SDFPrimitive {
|
||||
private float radius;
|
||||
private float height;
|
||||
|
||||
public SDFHexPrism setRadius(float radius) {
|
||||
this.radius = radius;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SDFHexPrism setHeight(float height) {
|
||||
this.height = height;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDistance(float x, float y, float z) {
|
||||
float px = Math.abs(x);
|
||||
float py = Math.abs(y);
|
||||
float pz = Math.abs(z);
|
||||
return MHelper.max(py - height, MHelper.max((px * 0.866025F + pz * 0.5F), pz) - radius);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue