Browse Source

Merge branch 'patch-1' of https://github.com/thuron/three.js into dev

Mr.doob 11 years ago
parent
commit
321706dc43

+ 15 - 5
utils/exporters/blender/2.65/scripts/addons/io_mesh_threejs/export_threejs.py

@@ -2159,10 +2159,6 @@ def generate_cameras(data):
             for cameraobj in cams:
             for cameraobj in cams:
                 camera = bpy.data.cameras[cameraobj.data.name]
                 camera = bpy.data.cameras[cameraobj.data.name]
 
 
-                # TODO:
-                #   Support more than perspective camera
-                #   Calculate a target/lookat
-                #   Get correct aspect ratio
                 if camera.id_data.type == "PERSP":
                 if camera.id_data.type == "PERSP":
 
 
                     camera_string = TEMPLATE_CAMERA_PERSPECTIVE % {
                     camera_string = TEMPLATE_CAMERA_PERSPECTIVE % {
@@ -2174,7 +2170,21 @@ def generate_cameras(data):
                     "position"  : generate_vec3([cameraobj.location[0], -cameraobj.location[1], cameraobj.location[2]], data["flipyz"]),
                     "position"  : generate_vec3([cameraobj.location[0], -cameraobj.location[1], cameraobj.location[2]], data["flipyz"]),
                     "target"    : generate_vec3([0, 0, 0])
                     "target"    : generate_vec3([0, 0, 0])
                     }
                     }
-
+		
+		elif camera.id_data.type == "ORTHO":
+
+                    camera_string = TEMPLATE_CAMERA_ORTHO % {
+                    "camera_id" : generate_string(camera.name),
+                    "left"      : -(camera.angle_x * camera.ortho_scale),
+                    "right"     : (camera.angle_x * camera.ortho_scale),
+                    "top"       : (camera.angle_y * camera.ortho_scale),
+                    "bottom"    : -(camera.angle_y * camera.ortho_scale),
+                    "near"      : camera.clip_start,
+                    "far"       : camera.clip_end,
+                    "position"  : generate_vec3([cameraobj.location[0], -cameraobj.location[1], cameraobj.location[2]], data["flipyz"]),
+                    "target"    : generate_vec3([0, 0, 0])
+                    }
+                    
                 chunks.append(camera_string)
                 chunks.append(camera_string)
 
 
     return ",\n\n".join(chunks), len(chunks)
     return ",\n\n".join(chunks), len(chunks)