[Bprocessor-commit] /gl/src/net/sourceforge/bprocessor/gl/view View.java, 1.171, 1.172
Status: Pre-Alpha
Brought to you by:
henryml
|
From: rimestad <rim...@us...> - 2007-01-20 21:24:57
|
Update of /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23448/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: made several smaller fixes to the scalefactor for cameras, including saving of it and visualization in attribute view... This alongside with better feedback when altering the current cam and copying cameras... Index: View.java =================================================================== RCS file: /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.171 retrieving revision 1.172 diff -C2 -d -r1.171 -r1.172 *** View.java 12 Jan 2007 17:52:27 -0000 1.171 --- View.java 20 Jan 2007 21:24:56 -0000 1.172 *************** *** 76,84 **** */ public class View implements GLEventListener { - /** - * - */ - private static final int CONVETIONAL_WINDOW_HEIGHT = 600; - /** The logger */ private static Logger log = Logger.getLogger(View.class); --- 76,79 ---- *************** *** 748,752 **** far = far < 20 ? 20 : far; double focalwidth = camera.getFocalwidth(); ! double d = View.height / CONVETIONAL_WINDOW_HEIGHT; if (camera.getType() == Camera.ORTHOGRAPHIC) { int dpi = Toolkit.getDefaultToolkit().getScreenResolution(); --- 743,747 ---- far = far < 20 ? 20 : far; double focalwidth = camera.getFocalwidth(); ! double d = View.height / Camera.CONVETIONAL_WINDOW_HEIGHT; if (camera.getType() == Camera.ORTHOGRAPHIC) { int dpi = Toolkit.getDefaultToolkit().getScreenResolution(); *************** *** 783,787 **** protected void grid(CoordinateSystem cs) { double size = View.gridSize(); ! gl.glLineWidth(0.5f); gl.glColor4fv(gridColor, 0); //gl.glDisable(GL.GL_DEPTH_TEST); --- 778,782 ---- protected void grid(CoordinateSystem cs) { double size = View.gridSize(); ! gl.glLineWidth(1.0f); gl.glColor4fv(gridColor, 0); //gl.glDisable(GL.GL_DEPTH_TEST); *************** *** 812,816 **** protected void coords() { double size = View.gridSize(); ! gl.glLineWidth(0.5f); gl.glBegin(GL.GL_LINES); gl.glDisable(GL.GL_DEPTH_TEST); --- 807,811 ---- protected void coords() { double size = View.gridSize(); ! gl.glLineWidth(1.0f); gl.glBegin(GL.GL_LINES); gl.glDisable(GL.GL_DEPTH_TEST); *************** *** 1548,1552 **** */ private void drawConstructorLine(Vertex from, Vertex direction, double dist) { ! gl.glLineWidth(0.5f); gl.glEnable(GL.GL_LINE_STIPPLE); drawConstructorLineGeometry(from, direction, dist); --- 1543,1547 ---- */ private void drawConstructorLine(Vertex from, Vertex direction, double dist) { ! gl.glLineWidth(1.0f); gl.glEnable(GL.GL_LINE_STIPPLE); drawConstructorLineGeometry(from, direction, dist); *************** *** 2279,2285 **** private void drawConstructor(Edge e) { gl.glEnable(GL.GL_LINE_STIPPLE); - gl.glLineWidth(0.5f); drawEdge(e); - gl.glLineWidth(1.0f); gl.glDisable(GL.GL_LINE_STIPPLE); } --- 2274,2278 ---- *************** *** 3359,3399 **** this.glObjects3D.add(glo); } - - /** - * Calculate the 1 : factor ralationship with reality - * @return The to reality factor for the camera - */ - public double calcFactor() { - Camera current = Project.getInstance().getCurrentCamera(); - double[] camera = current.getCamera(); - double[] center = current.getCenter(); - double length = Math.sqrt((camera[0] - center[0]) * (camera[0] - center[0]) + - (camera[1] - center[1]) * (camera[1] - center[1]) + - (camera[2] - center[2]) * (camera[2] - center[2])); - double tal = Math.tan(Math.toRadians(current.getFocalwidth())) * length; - int dpi = Toolkit.getDefaultToolkit().getScreenResolution(); - double dpm = (dpi / 2.54) * 100; - double windowheight = CONVETIONAL_WINDOW_HEIGHT / dpm; - log.info("factor " + (tal / windowheight)); - return tal / windowheight; - } - - /** - * Calc position for the camera based on the given to reality factor - */ - public void invertFactor() { - Camera current = Project.getInstance().getCurrentCamera(); - int dpi = Toolkit.getDefaultToolkit().getScreenResolution(); - double dpm = (dpi / 2.54) * 100; - double window = CONVETIONAL_WINDOW_HEIGHT / dpm; - double length = current.getFactor() * window; - length /= Math.tan(Math.toRadians(current.getFocalwidth())); - double[] camera = current.getCamera(); - double[] center = current.getCenter(); - Vertex back = new Vertex(camera).minus(new Vertex(center)); - back.scale(length / back.length()); - camera[0] = center[0] + back.getX(); - camera[1] = center[1] + back.getY(); - camera[2] = center[2] + back.getZ(); - } } --- 3352,3354 ---- |