Merge branch 'master' into blender2.8
This commit is contained in:
@@ -133,11 +133,18 @@ void ED_view3d_update_viewmat(
|
||||
view3d_winmatrix_set(depsgraph, ar, v3d, rect);
|
||||
|
||||
/* setup view matrix */
|
||||
if (viewmat)
|
||||
if (viewmat) {
|
||||
copy_m4_m4(rv3d->viewmat, viewmat);
|
||||
else
|
||||
view3d_viewmatrix_set(eval_ctx, scene, v3d, rv3d); /* note: calls BKE_object_where_is_calc for camera... */
|
||||
|
||||
}
|
||||
else {
|
||||
float rect_scale[2];
|
||||
if (rect) {
|
||||
rect_scale[0] = (float)BLI_rcti_size_x(rect) / (float)ar->winx;
|
||||
rect_scale[1] = (float)BLI_rcti_size_y(rect) / (float)ar->winy;
|
||||
}
|
||||
/* note: calls BKE_object_where_is_calc for camera... */
|
||||
view3d_viewmatrix_set(eval_ctx, scene, v3d, rv3d, rect ? rect_scale : NULL);
|
||||
}
|
||||
/* update utility matrices */
|
||||
mul_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat);
|
||||
invert_m4_m4(rv3d->persinv, rv3d->persmat);
|
||||
|
||||
@@ -276,8 +276,12 @@ void ED_view3d_smooth_view_force_finish(
|
||||
struct bContext *C,
|
||||
struct View3D *v3d, struct ARegion *ar);
|
||||
|
||||
void view3d_winmatrix_set(const struct Depsgraph *depsgraph, ARegion *ar, const View3D *v3d, const rcti *rect);
|
||||
void view3d_viewmatrix_set(const struct EvaluationContext *eval_ctx, Scene *scene, const View3D *v3d, RegionView3D *rv3d);
|
||||
void view3d_winmatrix_set(
|
||||
const struct Depsgraph *depsgraph,
|
||||
ARegion *ar, const View3D *v3d, const rcti *rect);
|
||||
void view3d_viewmatrix_set(
|
||||
const struct EvaluationContext *eval_ctx, Scene *scene,
|
||||
const View3D *v3d, RegionView3D *rv3d, const float rect_scale[2]);
|
||||
|
||||
void fly_modal_keymap(struct wmKeyConfig *keyconf);
|
||||
void walk_modal_keymap(struct wmKeyConfig *keyconf);
|
||||
|
||||
@@ -1113,8 +1113,21 @@ bool ED_view3d_lock(RegionView3D *rv3d)
|
||||
return ED_view3d_quat_from_axis_view(rv3d->view, rv3d->viewquat);
|
||||
}
|
||||
|
||||
/* don't set windows active in here, is used by renderwin too */
|
||||
void view3d_viewmatrix_set(const EvaluationContext *eval_ctx, Scene *scene, const View3D *v3d, RegionView3D *rv3d)
|
||||
/**
|
||||
* Sets #RegionView3D.viewmat
|
||||
*
|
||||
* \param eval_ctx: Context.
|
||||
* \param scene: Scene for camera and cursor location.
|
||||
* \param v3d: View 3D space data.
|
||||
* \param rv3d: 3D region which stores the final matrices.
|
||||
* \param rect_scale: Optional 2D scale argument,
|
||||
* Use when displaying a sub-region, eg: when #view3d_winmatrix_set takes a 'rect' argument.
|
||||
*
|
||||
* \note don't set windows active in here, is used by renderwin too.
|
||||
*/
|
||||
void view3d_viewmatrix_set(
|
||||
const EvaluationContext *eval_ctx, Scene *scene,
|
||||
const View3D *v3d, RegionView3D *rv3d, const float rect_scale[2])
|
||||
{
|
||||
if (rv3d->persp == RV3D_CAMOB) { /* obs/camera */
|
||||
if (v3d->camera) {
|
||||
@@ -1175,6 +1188,12 @@ void view3d_viewmatrix_set(const EvaluationContext *eval_ctx, Scene *scene, cons
|
||||
|
||||
mul_v2_v2fl(vec, rv3d->ofs_lock, rv3d->is_persp ? rv3d->dist : 1.0f);
|
||||
vec[2] = 0.0f;
|
||||
|
||||
if (rect_scale) {
|
||||
vec[0] /= rect_scale[0];
|
||||
vec[1] /= rect_scale[1];
|
||||
}
|
||||
|
||||
mul_mat3_m4_v3(persinv, vec);
|
||||
translate_m4(rv3d->viewmat, vec[0], vec[1], vec[2]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user