View3D: use defines for default zoom-levels

This commit is contained in:
Campbell Barton
2015-03-21 15:11:19 +11:00
parent 997c0c837b
commit e88cfc28b2
2 changed files with 7 additions and 3 deletions

View File

@@ -104,6 +104,10 @@ typedef struct CameraParams {
float winmat[4][4];
} CameraParams;
/* values for CameraParams.zoom, need to be taken into account for some operations */
#define CAMERA_PARAM_ZOOM_INIT_CAMOB 1.0f
#define CAMERA_PARAM_ZOOM_INIT_PERSP 2.0f
void BKE_camera_params_init(CameraParams *params);
void BKE_camera_params_from_object(CameraParams *params, struct Object *camera);
void BKE_camera_params_from_view3d(CameraParams *params, struct View3D *v3d, struct RegionView3D *rv3d);

View File

@@ -274,7 +274,7 @@ void BKE_camera_params_from_view3d(CameraParams *params, View3D *v3d, RegionView
params->shiftx *= params->zoom;
params->shifty *= params->zoom;
params->zoom = 1.0f / params->zoom;
params->zoom = CAMERA_PARAM_ZOOM_INIT_CAMOB / params->zoom;
}
else if (rv3d->persp == RV3D_ORTHO) {
/* orthographic view */
@@ -285,11 +285,11 @@ void BKE_camera_params_from_view3d(CameraParams *params, View3D *v3d, RegionView
params->is_ortho = true;
/* make sure any changes to this match ED_view3d_radius_to_ortho_dist() */
params->ortho_scale = rv3d->dist * sensor_size / v3d->lens;
params->zoom = 2.0f;
params->zoom = CAMERA_PARAM_ZOOM_INIT_PERSP;
}
else {
/* perspective view */
params->zoom = 2.0f;
params->zoom = CAMERA_PARAM_ZOOM_INIT_PERSP;
}
}