Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <eiseljulian@gmail.com>2015-09-11 02:38:08 +0300
committerJulian Eisel <eiseljulian@gmail.com>2015-09-11 02:38:08 +0300
commit0f06bef71307a3f5d6b25c5241fcbad7d15b3f5b (patch)
tree85534371d16cc64fe90798e86c5e7080d90df8d1 /source/blender/blenkernel/intern/camera.c
parente6c5611dbced32ddbb54c2558f08a9dcc262f9d2 (diff)
parent935544671636fd679a607d380c11c4176b22bb6f (diff)
Merge branch 'master' into wiggly-widgets
Conflicts: source/blender/editors/transform/transform_manipulator.c
Diffstat (limited to 'source/blender/blenkernel/intern/camera.c')
-rw-r--r--source/blender/blenkernel/intern/camera.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index 807ae9094fd..07ce96461e5 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -169,15 +169,15 @@ float BKE_camera_object_dof_distance(Object *ob)
if (ob->type != OB_CAMERA)
return 0.0f;
if (cam->dof_ob) {
- /* too simple, better to return the distance on the view axis only
- * return len_v3v3(ob->obmat[3], cam->dof_ob->obmat[3]); */
- float mat[4][4], imat[4][4], obmat[4][4];
-
- copy_m4_m4(obmat, ob->obmat);
- normalize_m4(obmat);
- invert_m4_m4(imat, obmat);
- mul_m4_m4m4(mat, imat, cam->dof_ob->obmat);
- return fabsf(mat[3][2]);
+#if 0
+ /* too simple, better to return the distance on the view axis only */
+ return len_v3v3(ob->obmat[3], cam->dof_ob->obmat[3]);
+#else
+ float view_dir[3], dof_dir[3];
+ normalize_v3_v3(view_dir, ob->obmat[2]);
+ sub_v3_v3v3(dof_dir, ob->obmat[3], cam->dof_ob->obmat[3]);
+ return fabsf(dot_v3v3(view_dir, dof_dir));
+#endif
}
return cam->YF_dofdist;
}
@@ -959,11 +959,6 @@ void BKE_camera_to_gpu_dof(struct Object *camera, struct GPUFXSettings *r_fx_set
r_fx_settings->dof = &cam->gpu_dof;
r_fx_settings->dof->focal_length = cam->lens;
r_fx_settings->dof->sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
- if (cam->dof_ob) {
- r_fx_settings->dof->focus_distance = len_v3v3(cam->dof_ob->obmat[3], camera->obmat[3]);
- }
- else {
- r_fx_settings->dof->focus_distance = cam->YF_dofdist;
- }
+ r_fx_settings->dof->focus_distance = BKE_camera_object_dof_distance(camera);
}
}