package org.notimetoplay.voxeldesc;

public class Camera {
	public float x;
	public float y;
	public float z;
	public float f;
	
	public float px;
	public float py;
	public float scale;
	
	public Camera(float nx, float ny, float nz, float nf) {
		x = nx;
		y = ny;
		z = nz;
		f = nf;
	}
	
	public void project(float nx, float ny, float nz) {
		nx -= x;
		ny -= y;
		nz -= z;

		scale = f / nz;
		px = nx * scale;
		py = ny * scale;
	}
	
	// Convenience methods (for the scripting engine).
	
	public Camera moveTo(final float nx, final float ny, final float nz) {
		x = nx;
		y = ny;
		z = nz;
		return this;
	}
	
	public Camera moveBy(final float nx, final float ny, final float nz) {
		x += nx;
		y += ny;
		z += nz;
		return this;
	}
}

@@ -583,24 +583,27 @@
 ;%0A%09%09z = nz;%0A
+%09%09%0A
 %09%09return thi
@@ -605,16 +605,16 @@
 n this;%0A
-
 %09%7D%0A%09%0A%09pu
@@ -715,16 +715,19 @@
  += nz;%0A
+%09%09%0A
 %09%09return
@@ -736,10 +736,832 @@
 his;%0A%09%7D%0A
+%09%0A%09public Camera zoomIn(final float factor) %7B%0A%09%09x /= factor;%0A%09%09y /= factor;%0A%09%09z /= factor;%0A%09%09%0A%09%09return this;%0A%09%7D%0A%09%0A%09public Camera zoomOut(final float factor) %7B%0A%09%09x *= factor;%0A%09%09y *= factor;%0A%09%09z *= factor;%0A%09%09%0A%09%09return this;%0A%09%7D%0A%09%0A%09public Camera left(final float by) %7B%0A%09%09x -= by;%0A%09%09return this;%0A%09%7D%0A%09%0A%09public Camera right(final float by) %7B%0A%09%09x += by;%0A%09%09return this;%0A%09%7D%0A%09%0A%09public Camera up(final float by) %7B%0A%09%09y += by;%0A%09%09return this;%0A%09%7D%0A%09%0A%09public Camera down(final float by) %7B%0A%09%09y -= by;%0A%09%09return this;%0A%09%7D%0A%09%0A%09public Camera back(final float by) %7B%0A%09%09z -= by;%0A%09%09return this;%0A%09%7D%0A%09%0A%09public Camera fore(final float by) %7B%0A%09%09z += by;%0A%09%09return this;%0A%09%7D%0A%09%0A%09public Camera center() %7B%0A%09%09x = 0;%0A%09%09y = Math.abs(z) / 2;%0A%09%09return this;%0A%09%7D%0A%09%0A%09public String toString() %7B%0A%09%09return String.format(%0A%09%09%09%22Camera(%25.2f %25.2f %25.2f) f=%25.2f%22, x, y, z, f);%0A%09%7D%0A
 %7D%0A

Add toString() and chainable methods.