2018-08-12 14:03:07 +00:00
|
|
|
package com.boydti.fawe.object.brush.heightmap;
|
|
|
|
|
2018-12-23 16:19:33 +00:00
|
|
|
import com.sk89q.worldedit.math.BlockVector3;
|
2019-03-31 16:09:20 +00:00
|
|
|
import com.sk89q.worldedit.math.MutableVector3;
|
2018-08-12 14:03:07 +00:00
|
|
|
import com.sk89q.worldedit.math.transform.AffineTransform;
|
|
|
|
|
|
|
|
public class RotatableHeightMap extends AbstractDelegateHeightMap {
|
|
|
|
private AffineTransform transform;
|
2019-03-31 16:09:20 +00:00
|
|
|
private MutableVector3 mutable;
|
2018-08-12 14:03:07 +00:00
|
|
|
|
|
|
|
public RotatableHeightMap(HeightMap parent) {
|
|
|
|
super(parent);
|
2019-03-31 16:09:20 +00:00
|
|
|
mutable = new MutableVector3();
|
2018-08-12 14:03:07 +00:00
|
|
|
this.transform = new AffineTransform();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void rotate(double angle) {
|
|
|
|
this.transform = transform.rotateY(angle);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public double getHeight(int x, int z) {
|
|
|
|
mutable.mutX(x);
|
|
|
|
mutable.mutZ(z);
|
2019-03-31 16:09:20 +00:00
|
|
|
BlockVector3 pos = transform.apply(mutable.setComponents(x, 0, z)).toBlockPoint();
|
2018-08-12 14:03:07 +00:00
|
|
|
return super.getHeight(pos.getBlockX(), pos.getBlockZ());
|
|
|
|
}
|
|
|
|
}
|