diff options
author | Maurice Raybaud <mauriceraybaud@hotmail.fr> | 2020-04-04 16:01:30 +0300 |
---|---|---|
committer | Maurice Raybaud <mauriceraybaud@hotmail.fr> | 2020-04-04 16:01:30 +0300 |
commit | a6a0a94c368adef9cdb7bf3d3a36da8f36b73bbb (patch) | |
tree | 8ef70fbd27d3a43ac2d8a06d9ba971e6ec23078d /render_povray | |
parent | ac8dd9a5fe32ac8a3cdfa725013c11e1aff87d03 (diff) |
POV: Add camera types
orthographic and cylindrical modes. best match for ortho.
Diffstat (limited to 'render_povray')
-rw-r--r-- | render_povray/render.py | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/render_povray/render.py b/render_povray/render.py index afae0981..6efe7291 100644 --- a/render_povray/render.py +++ b/render_povray/render.py @@ -660,15 +660,38 @@ def write_pov(filename, scene=None, info_callback=None): tabWrite("}\n") tabWrite("location <0,0,.01>") tabWrite("direction <0,0,-1>") - # Using standard camera otherwise + else: - tabWrite("location <0, 0, 0>\n") - tabWrite("look_at <0, 0, -1>\n") - tabWrite("right <%s, 0, 0>\n" % -Qsize) - tabWrite("up <0, 1, 0>\n") - tabWrite( - "angle %f\n" % (360.0 * atan(16.0 / camera.data.lens) / pi) - ) + if camera.data.type == 'ORTHO': + SensorHeightRatio = render.resolution_x * camera.data.ortho_scale / render.resolution_y + tabWrite("orthographic\n") + # Blender angle is radian so should be converted to degrees: + # % (camera.data.angle * (180.0 / pi) ) + # but actually argument is not compulsory after angle in pov ortho mode + tabWrite("angle\n") + tabWrite("right <%6f, 0, 0>\n" % -camera.data.ortho_scale) + tabWrite("location <0, 0, 0>\n") + tabWrite("look_at <0, 0, -1>\n") + tabWrite("up <0, %6f, 0>\n" % (camera.data.ortho_scale / Qsize)) + + elif camera.data.type == 'PANO': + tabWrite("panoramic\n") + tabWrite("location <0, 0, 0>\n") + tabWrite("look_at <0, 0, -1>\n") + tabWrite("right <%s, 0, 0>\n" % -Qsize) + tabWrite("up <0, 1, 0>\n") + tabWrite( + "angle %f\n" % (360.0 * atan(16.0 / camera.data.lens) / pi) + ) + elif camera.data.type == 'PERSP': + # Standard camera otherwise would be default in pov + tabWrite("location <0, 0, 0>\n") + tabWrite("look_at <0, 0, -1>\n") + tabWrite("right <%s, 0, 0>\n" % -Qsize) + tabWrite("up <0, 1, 0>\n") + tabWrite( + "angle %f\n" % (360.0 * atan(16.0 / camera.data.lens) / pi) + ) tabWrite( "rotate <%.6f, %.6f, %.6f>\n" |