Commit 9c847a4b authored by sumpfralle's avatar sumpfralle

added optional orthogonal view


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@651 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 11016c42
Version 0.3.1 - UNRELEASED Version 0.3.1 - UNRELEASED
* added automatic support grid positioning for contour models * added automatic support grid positioning for contour models
* allow to reverse the direction of a 2D contour model * allow to reverse the direction of a 2D contour model
* added optional "orthogonal" view (instead of perspective)
Version 0.3.0 - 2010-08-16 Version 0.3.0 - 2010-08-16
* added support for importing contour paths from SVG files (requires Inkscape and pstoedit) * added support for importing contour paths from SVG files (requires Inkscape and pstoedit)
......
...@@ -5792,6 +5792,20 @@ It is significantly faster, but the current release of ODE contains a nasty bug ...@@ -5792,6 +5792,20 @@ It is significantly faster, but the current release of ODE contains a nasty bug
<property name="position">2</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkCheckButton" id="OpenGLPerspective">
<property name="label" translatable="yes">Perspective view</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Toggle between orthogonal and perspective view.</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">3</property>
</packing>
</child>
<child> <child>
<object class="GtkHBox" id="hbox7"> <object class="GtkHBox" id="hbox7">
<property name="visible">True</property> <property name="visible">True</property>
...@@ -5822,7 +5836,7 @@ It is significantly faster, but the current release of ODE contains a nasty bug ...@@ -5822,7 +5836,7 @@ It is significantly faster, but the current release of ODE contains a nasty bug
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="position">3</property> <property name="position">4</property>
</packing> </packing>
</child> </child>
</object> </object>
...@@ -6126,7 +6140,7 @@ You should have received a copy of the GNU General Public License along with thi ...@@ -6126,7 +6140,7 @@ You should have received a copy of the GNU General Public License along with thi
<property name="always_show_image">True</property> <property name="always_show_image">True</property>
</object> </object>
<object class="GtkAdjustment" id="ScaleDimensionValue"> <object class="GtkAdjustment" id="ScaleDimensionValue">
<property name="upper">2000</property> <property name="upper">10000</property>
<property name="step_increment">1</property> <property name="step_increment">1</property>
</object> </object>
<object class="GtkImage" id="ShowToolPathSimulation"> <object class="GtkImage" id="ShowToolPathSimulation">
......
...@@ -200,8 +200,22 @@ class Camera: ...@@ -200,8 +200,22 @@ class Camera:
camera_position = (v["center"][0] + v["distance"][0], camera_position = (v["center"][0] + v["distance"][0],
v["center"][1] + v["distance"][1], v["center"][1] + v["distance"][1],
v["center"][2] + v["distance"][2]) v["center"][2] + v["distance"][2])
GLU.gluPerspective(v["fovy"], (0.0 + width) / height, v["znear"], if self.settings.get("view_perspective"):
v["zfar"]) # perspective view
GLU.gluPerspective(v["fovy"], (0.0 + width) / height, v["znear"],
v["zfar"])
else:
# parallel projection
# This distance calculation is completely based on trial-and-error.
distance = math.sqrt(sum([d ** 2 for d in v["distance"]]))
distance *= math.log(math.sqrt(width * height)) / math.log(10)
left = v["center"][0] - math.sin(v["fovy"] / 360.0 * math.pi) * distance
right = v["center"][0] + math.sin(v["fovy"] / 360.0 * math.pi) * distance
top = v["center"][1] + math.sin(v["fovy"] / 360.0 * math.pi) * distance
bottom = v["center"][1] - math.sin(v["fovy"] / 360.0 * math.pi) * distance
near = v["center"][2] - 2 * math.sin(v["fovy"] / 360.0 * math.pi) * distance
far = v["center"][2] + 2 * math.sin(v["fovy"] / 360.0 * math.pi) * distance
GL.glOrtho(left, right, bottom, top, near, far)
GLU.gluLookAt(camera_position[0], camera_position[1], GLU.gluLookAt(camera_position[0], camera_position[1],
camera_position[2], v["center"][0], v["center"][1], camera_position[2], v["center"][0], v["center"][1],
v["center"][2], v["up"][0], v["up"][1], v["up"][2]) v["center"][2], v["up"][0], v["up"][1], v["up"][2])
......
...@@ -92,6 +92,7 @@ PREFERENCES_DEFAULTS = { ...@@ -92,6 +92,7 @@ PREFERENCES_DEFAULTS = {
"view_light": True, "view_light": True,
"view_shadow": True, "view_shadow": True,
"view_polygon": True, "view_polygon": True,
"view_perspective": True,
"simulation_details_level": 3, "simulation_details_level": 3,
"drill_progress_max_fps": 2, "drill_progress_max_fps": 2,
"gcode_safety_height": 25.0, "gcode_safety_height": 25.0,
...@@ -459,7 +460,8 @@ class ProjectGui: ...@@ -459,7 +460,8 @@ class ProjectGui:
for name, objname in ( for name, objname in (
("view_light", "OpenGLLight"), ("view_light", "OpenGLLight"),
("view_shadow", "OpenGLShadow"), ("view_shadow", "OpenGLShadow"),
("view_polygon", "OpenGLPolygon")): ("view_polygon", "OpenGLPolygon"),
("view_perspective", "OpenGLPerspective")):
obj = self.gui.get_object(objname) obj = self.gui.get_object(objname)
self.settings.add_item(name, obj.get_active, obj.set_active) self.settings.add_item(name, obj.get_active, obj.set_active)
# send "True" to trigger a re-setup of GL settings # send "True" to trigger a re-setup of GL settings
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment