glTF exporter: Fix exporting `aspectRatio` for Perspective Cameras
Thanks pop!
This commit is contained in:
parent
63dd8498ac
commit
2b4bf943d0
|
@ -15,7 +15,7 @@
|
|||
bl_info = {
|
||||
'name': 'glTF 2.0 format',
|
||||
'author': 'Julien Duroure, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
|
||||
"version": (1, 3, 32),
|
||||
"version": (1, 3, 33),
|
||||
'blender': (2, 90, 0),
|
||||
'location': 'File > Import-Export',
|
||||
'description': 'Import-Export as glTF 2.0',
|
||||
|
|
|
@ -92,18 +92,18 @@ def __gather_perspective(blender_camera, export_settings):
|
|||
|
||||
width = bpy.context.scene.render.pixel_aspect_x * bpy.context.scene.render.resolution_x
|
||||
height = bpy.context.scene.render.pixel_aspect_y * bpy.context.scene.render.resolution_y
|
||||
perspective.aspectRatio = width / height
|
||||
perspective.aspect_ratio = width / height
|
||||
|
||||
if width >= height:
|
||||
if blender_camera.sensor_fit != 'VERTICAL':
|
||||
perspective.yfov = 2.0 * math.atan(math.tan(blender_camera.angle * 0.5) / perspective.aspectRatio)
|
||||
perspective.yfov = 2.0 * math.atan(math.tan(blender_camera.angle * 0.5) / perspective.aspect_ratio)
|
||||
else:
|
||||
perspective.yfov = blender_camera.angle
|
||||
else:
|
||||
if blender_camera.sensor_fit != 'HORIZONTAL':
|
||||
perspective.yfov = blender_camera.angle
|
||||
else:
|
||||
perspective.yfov = 2.0 * math.atan(math.tan(blender_camera.angle * 0.5) / perspective.aspectRatio)
|
||||
perspective.yfov = 2.0 * math.atan(math.tan(blender_camera.angle * 0.5) / perspective.aspect_ratio)
|
||||
|
||||
perspective.znear = blender_camera.clip_start
|
||||
perspective.zfar = blender_camera.clip_end
|
||||
|
|
Loading…
Reference in New Issue