diff options
Diffstat (limited to 'source/blender/blenkernel/intern/screen.c')
-rw-r--r-- | source/blender/blenkernel/intern/screen.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index 63e35408381..50b3e32278a 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -31,6 +31,7 @@ * \ingroup bke */ +#include "BLI_winstuff.h" #include <string.h> #include <stdio.h> @@ -416,3 +417,20 @@ void BKE_screen_view3d_main_sync(ListBase *screen_lb, Scene *scene) } } +/* magic zoom calculation, no idea what + * it signifies, if you find out, tell me! -zr + */ + +/* simple, its magic dude! + * well, to be honest, this gives a natural feeling zooming + * with multiple keypad presses (ton) + */ +float BKE_screen_view3d_zoom_to_fac(float camzoom) +{ + return powf(((float)M_SQRT2 + camzoom/50.0f), 2.0f) / 4.0f; +} + +float BKE_screen_view3d_zoom_from_fac(float zoomfac) +{ + return ((sqrtf(4.0f * zoomfac) - (float)M_SQRT2) * 50.0f); +} |