mirror of
https://github.com/GTNewHorizons/CodeChickenCore.git
synced 2026-11-15 01:24:58 +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,72 +9,62 @@ import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Scale extends Transformation
|
||||
{
|
||||
private Vector3 factor;
|
||||
|
||||
public Scale(Vector3 factor)
|
||||
{
|
||||
public class Scale extends Transformation {
|
||||
public Vector3 factor;
|
||||
|
||||
public Scale(Vector3 factor) {
|
||||
this.factor = factor;
|
||||
}
|
||||
|
||||
public Scale(double factor)
|
||||
{
|
||||
public Scale(double factor) {
|
||||
this(new Vector3(factor, factor, factor));
|
||||
}
|
||||
|
||||
public Scale(double x, double y, double z)
|
||||
{
|
||||
|
||||
public Scale(double x, double y, double z) {
|
||||
this(new Vector3(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Vector3 vec)
|
||||
{
|
||||
public void apply(Vector3 vec) {
|
||||
vec.multiply(factor);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void applyN(Vector3 normal)
|
||||
{
|
||||
public void applyN(Vector3 normal) {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void apply(Matrix4 mat)
|
||||
{
|
||||
public void apply(Matrix4 mat) {
|
||||
mat.scale(factor);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void glApply()
|
||||
{
|
||||
public void glApply() {
|
||||
GL11.glScaled(factor.x, factor.y, factor.z);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Transformation inverse()
|
||||
{
|
||||
return new Scale(1/factor.x, 1/factor.y, 1/factor.z);
|
||||
public Transformation inverse() {
|
||||
return new Scale(1 / factor.x, 1 / factor.y, 1 / factor.z);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Transformation merge(Transformation next) {
|
||||
if(next instanceof Scale)
|
||||
if (next instanceof Scale)
|
||||
return new Scale(factor.copy().multiply(((Scale) next).factor));
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isRedundant() {
|
||||
return factor.equalsT(Vector3.one);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
public String toString() {
|
||||
MathContext cont = new MathContext(4, RoundingMode.HALF_UP);
|
||||
return "Scale("+new BigDecimal(factor.x, cont)+", "+new BigDecimal(factor.y, cont)+", "+new BigDecimal(factor.z, cont)+")";
|
||||
return "Scale(" + new BigDecimal(factor.x, cont) + ", " + new BigDecimal(factor.y, cont) + ", " + new BigDecimal(factor.z, cont) + ")";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user