mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-22 05:02:25 +00:00
24 lines
497 B
Java
24 lines
497 B
Java
package crazypants.render;
|
|
|
|
import crazypants.vecmath.Quat4d;
|
|
import crazypants.vecmath.Vector3d;
|
|
|
|
public class VertexRotation implements VertexTransform {
|
|
|
|
private final Vector3d center;
|
|
private final Quat4d quat;
|
|
|
|
public VertexRotation(double angle, Vector3d axis, Vector3d center) {
|
|
this.center = center;
|
|
quat = Quat4d.makeRotate(angle, axis);
|
|
}
|
|
|
|
@Override
|
|
public void apply(Vector3d vec) {
|
|
vec.sub(center);
|
|
quat.rotate(vec);
|
|
vec.add(center);
|
|
}
|
|
|
|
}
|