SDF, Noise, Blocks Helper, Spline Helper, Translation Helper
This commit is contained in:
parent
6a5584deae
commit
017d663af6
37 changed files with 4315 additions and 0 deletions
21
src/main/java/ru/bclib/sdf/operator/SDFRotation.java
Normal file
21
src/main/java/ru/bclib/sdf/operator/SDFRotation.java
Normal file
|
@ -0,0 +1,21 @@
|
|||
package ru.bclib.sdf.operator;
|
||||
|
||||
import com.mojang.math.Quaternion;
|
||||
import com.mojang.math.Vector3f;
|
||||
|
||||
public class SDFRotation extends SDFUnary {
|
||||
private static final Vector3f POS = new Vector3f();
|
||||
private Quaternion rotation;
|
||||
|
||||
public SDFRotation setRotation(Vector3f axis, float rotationAngle) {
|
||||
rotation = new Quaternion(axis, rotationAngle, false);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDistance(float x, float y, float z) {
|
||||
POS.set(x, y, z);
|
||||
POS.transform(rotation);
|
||||
return source.getDistance(POS.x(), POS.y(), POS.z());
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue