glTF importer: set camera near/far
This commit is contained in:
parent
02ca41d48e
commit
43148f1749
|
@ -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, 2, 59),
|
||||
"version": (1, 2, 60),
|
||||
'blender': (2, 82, 7),
|
||||
'location': 'File > Import-Export',
|
||||
'description': 'Import-Export as glTF 2.0',
|
||||
|
|
|
@ -35,17 +35,25 @@ class BlenderCamera():
|
|||
# Blender create a perspective camera by default
|
||||
if pycamera.type == "orthographic":
|
||||
cam.type = "ORTHO"
|
||||
|
||||
# TODO: xmag/ymag
|
||||
|
||||
cam.clip_start = pycamera.orthographic.znear
|
||||
cam.clip_end = pycamera.orthographic.zfar
|
||||
|
||||
else:
|
||||
if hasattr(pycamera.perspective, "yfov"):
|
||||
cam.angle_y = pycamera.perspective.yfov
|
||||
cam.lens_unit = "FOV"
|
||||
cam.sensor_fit = "VERTICAL"
|
||||
cam.angle_y = pycamera.perspective.yfov
|
||||
cam.lens_unit = "FOV"
|
||||
cam.sensor_fit = "VERTICAL"
|
||||
|
||||
# TODO: lot's of work for camera here...
|
||||
if hasattr(pycamera, "znear"):
|
||||
cam.clip_start = pycamera.znear
|
||||
# TODO: fov/aspect ratio
|
||||
|
||||
cam.clip_start = pycamera.perspective.znear
|
||||
if pycamera.perspective.zfar is not None:
|
||||
cam.clip_end = pycamera.perspective.zfar
|
||||
else:
|
||||
# Infinite projection
|
||||
cam.clip_end = 1e12 # some big number
|
||||
|
||||
if hasattr(pycamera, "zfar"):
|
||||
cam.clip_end = pycamera.zfar
|
||||
|
||||
return cam
|
||||
|
|
Loading…
Reference in New Issue