mirror of
https://github.com/GTNewHorizons/CodeChickenCore.git
synced 2026-11-15 09:34:53 +00:00
Initial 1.7 commit
This commit is contained in:
1 parent
34154fc011
commit
ca675b5f31
72 files changed
+2967
-3335
No files matched your search
@@ -9,73 +9,63 @@ import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Translation extends Transformation
|
||||
{
|
||||
private Vector3 vec;
|
||||
|
||||
public Translation(Vector3 vec)
|
||||
{
|
||||
public class Translation extends Transformation {
|
||||
public Vector3 vec;
|
||||
|
||||
public Translation(Vector3 vec) {
|
||||
this.vec = vec;
|
||||
}
|
||||
|
||||
public Translation(double x, double y, double z)
|
||||
{
|
||||
public Translation(double x, double y, double z) {
|
||||
this(new Vector3(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Vector3 vec)
|
||||
{
|
||||
public void apply(Vector3 vec) {
|
||||
vec.add(this.vec);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyN(Vector3 normal)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Matrix4 mat)
|
||||
{
|
||||
public void applyN(Vector3 normal) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Matrix4 mat) {
|
||||
mat.translate(vec);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Transformation at(Vector3 point)
|
||||
{
|
||||
public Transformation at(Vector3 point) {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void glApply()
|
||||
{
|
||||
public void glApply() {
|
||||
GL11.glTranslated(vec.x, vec.y, vec.z);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Transformation inverse()
|
||||
{
|
||||
public Transformation inverse() {
|
||||
return new Translation(-vec.x, -vec.y, -vec.z);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Transformation merge(Transformation next) {
|
||||
if(next instanceof Translation)
|
||||
if (next instanceof Translation)
|
||||
return new Translation(vec.copy().add(((Translation) next).vec));
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isRedundant() {
|
||||
return vec.equalsT(Vector3.zero);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
public String toString() {
|
||||
MathContext cont = new MathContext(4, RoundingMode.HALF_UP);
|
||||
return "Translation("+new BigDecimal(vec.x, cont)+", "+new BigDecimal(vec.y, cont)+", "+new BigDecimal(vec.z, cont)+")";
|
||||
return "Translation(" + new BigDecimal(vec.x, cont) + ", " + new BigDecimal(vec.y, cont) + ", " + new BigDecimal(vec.z, cont) + ")";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user