package common.model;

import common.util.Vector3f;

public class Transform {
	public static final Transform IDENTITY = new Transform(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);

	public final Vector3f rotation;
	public final Vector3f translation;
	public final Vector3f scale;

	public Transform(float rx, float ry, float rz, float tx, float ty, float tz, float sx, float sy, float sz) {
		this.rotation = new Vector3f(rx, ry, rz);
		this.translation = (Vector3f)new Vector3f(tx, ty, tz).scale(0.0625F);
		this.scale = new Vector3f(sx, sy, sz);
	}

	public boolean equals(Object obj) {
		if(this == obj) {
			return true;
		}
		else if(this.getClass() != obj.getClass()) {
			return false;
		}
		else {
			Transform other = (Transform)obj;
			return this.rotation.equals(other.rotation) && this.scale.equals(other.scale) && this.translation.equals(other.translation);
		}
	}

	public int hashCode() {
		int i = this.rotation.hashCode();
		i = 31 * i + this.translation.hashCode();
		i = 31 * i + this.scale.hashCode();
		return i;
	}
}
