[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Camera.java,1.7,1.8 Project.java,1.24
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2006-01-25 14:46:33
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24326/src/net/sourceforge/bprocessor/model Modified Files: Camera.java Project.java Log Message: Added currentCamera to project and made small fixes in Camera Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Camera.java 19 Jan 2006 10:57:18 -0000 1.7 --- Camera.java 25 Jan 2006 14:46:01 -0000 1.8 *************** *** 57,60 **** --- 57,94 ---- /** + * Constructor with arguments + * @param center The center position + * @param camera The camera positon + * @param roll The roll of the camera (up vector) + * @param name The name of the cam setting + * @param type Which type ortho or perspective + */ + public Camera(String name, double[] center, double[] camera, double[] roll, int type) { + this.name = name; + this.center = center; + this.camera = camera; + this.roll = roll; + this.focalwidth = 65; + if (type == ORTHOGRAPHIC || type == PERSPECTIVE) { + this.type = type; + } else { + log.error("Wrong type " + type); + this.type = PERSPECTIVE; + } + } + + /** + * Constructor that take a camera to make a copy of + * @param c The Camera + * @param name The name for the cam + */ + public Camera(Camera c, String name) { + this(name, new double[]{c.center[0], c.center[1], c.center[2]}, + new double[]{c.camera[0], c.camera[1], c.camera[2]}, + new double[]{c.roll[0], c.roll[1], c.roll[2]}, c.getType()); + } + + /** + /** * Create a default camera of your choice * @param type the camera type *************** *** 66,86 **** 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; --- 100,116 ---- res = new Camera("3D", new double[]{0, 0, 0}, new double[]{22, 19, 22}, ! new double[] {0, 0, 1}, 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}, 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}, 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}, ORTHOGRAPHIC); } return res; *************** *** 106,124 **** return type; } - - /** - * Constructor with arguments - * @param center The center position - * @param camera The camera positon - * @param roll The roll of the camera (up vector) - * @param name The name of the cam setting - */ - public Camera(String name, double[] center, double[] camera, double[] roll) { - this.name = name; - this.center = center; - this.camera = camera; - this.roll = roll; - this.focalwidth = 65; - } /** --- 136,139 ---- Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Project.java 25 Jan 2006 11:19:40 -0000 1.24 --- Project.java 25 Jan 2006 14:46:01 -0000 1.25 *************** *** 63,66 **** --- 63,69 ---- private boolean dirty; + /** The current project camera */ + private Camera currentCamera; + /** * Get the instance *************** *** 131,147 **** Camera cam0 = Camera.create(Camera.VIEW_3D); // The starting cam cam0.setId(new Long(cameraId++)); - cameras.put(cam0.getId(), cam0); Camera cam1 = Camera.create(Camera.VIEW_3D); // Reset to 3D position cam1.setId(new Long(cameraId++)); cameras.put(cam1.getId(), cam1); Camera cam2 = Camera.create(Camera.VIEW_XY); // Reset to 2D position XY with ortho ! cam1.setId(new Long(cameraId++)); cameras.put(cam2.getId(), cam2); Camera cam3 = Camera.create(Camera.VIEW_XZ); // Reset to 2D position XZ with ortho ! cam1.setId(new Long(cameraId++)); cameras.put(cam3.getId(), cam3); Camera cam4 = Camera.create(Camera.VIEW_YZ); // Reset to 2D position YZ with ortho ! cam1.setId(new Long(cameraId++)); cameras.put(cam4.getId(), cam4); } --- 134,150 ---- Camera cam0 = Camera.create(Camera.VIEW_3D); // The starting cam cam0.setId(new Long(cameraId++)); Camera cam1 = Camera.create(Camera.VIEW_3D); // Reset to 3D position cam1.setId(new Long(cameraId++)); cameras.put(cam1.getId(), cam1); Camera cam2 = Camera.create(Camera.VIEW_XY); // Reset to 2D position XY with ortho ! cam2.setId(new Long(cameraId++)); cameras.put(cam2.getId(), cam2); Camera cam3 = Camera.create(Camera.VIEW_XZ); // Reset to 2D position XZ with ortho ! cam3.setId(new Long(cameraId++)); cameras.put(cam3.getId(), cam3); Camera cam4 = Camera.create(Camera.VIEW_YZ); // Reset to 2D position YZ with ortho ! cam4.setId(new Long(cameraId++)); cameras.put(cam4.getId(), cam4); + currentCamera = cam0; } *************** *** 416,419 **** --- 419,432 ---- makeDirty(); } + + /** + * Remove an camera + * @param c The camera + */ + public void remove(Camera c) { + cameras.remove(c.getId()); + c.setId(null); + changed(this); + } /** *************** *** 512,514 **** --- 525,542 ---- } + /** + * Sets the current camera + * @param camera the Camera + */ + public void setCurrentCamera(Camera camera) { + currentCamera = camera; + } + + /** + * getter for currentCamera + * @return the currentcamera + */ + public Camera getCurrentCamera() { + return currentCamera; + } } |