// 3D Engine // // Camera for viewing universe. // // Author Matthew Caryl // Created 9.5.97 // // Although under copywrite to the author (Matthew Caryl) this code can be copied and modified for non-commercial // purposes as long as any derivatives contain this condition. package ADT; import java.awt.Color; public class Camera extends Entity { // // Public interface // public Camera(float length) { viewfield_length = length; } public Camera(Vector[] vs, int[] ts, Color[] cs, Entity[] children, float length) { super(vs, ts, cs, children); viewfield_length = length; } public float getViewfield() { return viewfield_length; } public void setViewfield(float length) { viewfield_length = length; } public void parallel(Matrix M) { M.setParallel(); M.multiply(transform_matrix); } public void perspective(Matrix M) { M.setPerspective(viewfield_length); M.multiply(transform_matrix); } // // Protected interface // protected void transformCorrection() { transform_matrix.setTranslate(-x, -y, -z); transform_matrix.rotateBy(-ax, -ay, -az); } // // Private interface // private float viewfield_length; }