[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Camera.java,1.6,1.7
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2006-01-19 10:57:30
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27932/src/net/sourceforge/bprocessor/model Modified Files: Camera.java Log Message: Added capabillity for orthographic view and converted all the 2D views to orthographic. It is a type modifier in Camera Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Camera.java 20 Dec 2005 12:23:14 -0000 1.6 --- Camera.java 19 Jan 2006 10:57:18 -0000 1.7 *************** *** 26,29 **** --- 26,35 ---- public static final int VIEW_YZ = 4; + /** The orthographic view type */ + public static final int ORTHOGRAPHIC = 5; + + /** The perspective view type */ + public static final int PERSPECTIVE = 6; + /** The logger */ private static Logger log = Logger.getLogger(Camera.class); *************** *** 41,44 **** --- 47,53 ---- private String name; + /** The type of the camera */ + private int type; + /** * The constructor for the persistence layer *************** *** 55,73 **** Camera res = null; if (type == VIEW_3D) { ! res = new Camera("3d", new double[]{0, 0, 0}, new double[]{22, 19, 22}, new double[] {0, 0, 1}); } else if (type == VIEW_XZ) { ! res = new Camera("xz", new double[]{0, 0, 0}, ! new double[]{0, 20, 0}, new double[] {0, 0, 1}); } else if (type == VIEW_XY) { ! res = new Camera("xy", new double[]{0, 0, 0}, new double[]{0, 0, 20}, new double[] {0, 1, 0}); } else if (type == VIEW_YZ) { ! res = new Camera("yz", new double[]{0, 0, 0}, new double[]{20, 0, 0}, new double[] {0, 0, 1}); } return res; --- 64,86 ---- Camera res = null; if (type == VIEW_3D) { ! res = new Camera("3D", new double[]{0, 0, 0}, new double[]{22, 19, 22}, new double[] {0, 0, 1}); + res.setType(PERSPECTIVE); } else if (type == VIEW_XZ) { ! res = new Camera("xz (ortho)", new double[]{0, 0, 0}, ! new double[]{0, -20, 0}, new double[] {0, 0, 1}); + res.setType(ORTHOGRAPHIC); } else if (type == VIEW_XY) { ! res = new Camera("xy (ortho)", new double[]{0, 0, 0}, new double[]{0, 0, 20}, new double[] {0, 1, 0}); + res.setType(ORTHOGRAPHIC); } else if (type == VIEW_YZ) { ! res = new Camera("yz (ortho)", new double[]{0, 0, 0}, new double[]{20, 0, 0}, new double[] {0, 0, 1}); + res.setType(ORTHOGRAPHIC); } return res; *************** *** 75,78 **** --- 88,111 ---- /** + * Set the type of the camera + * @param type The type + */ + public void setType(int type) { + if (type == PERSPECTIVE || type == ORTHOGRAPHIC) { + this.type = type; + } else { + log.error("Wrong camera type should be either Camera.PERSPECTIVE or Camera.ORTHOGRAPIC"); + } + } + + /** + * Getter for camera.type + * @return The camera type + */ + public int getType() { + return type; + } + + /** * Constructor with arguments * @param center The center position *************** *** 340,349 **** */ public String toString() { ! String s = getName() ! + "[(" ! + camera[0] + ", " + camera[1] + ", " + camera[2] + ",) -> (" ! + center[0] + ", " + center[1] + ", " + center[2] + ",) ^ (" ! + roll[0] + ", " + roll[1] + ", " + roll[2] + "]"; ! return s; } } --- 373,377 ---- */ public String toString() { ! return getName(); } } |