diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-03-03 03:48:16 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-03-06 18:44:04 +0300 |
commit | a6e6d7e0221eb46effbb65e98c471447b67a4c8c (patch) | |
tree | d8d780ddf184db53e517be30fdc813011aa9f7e8 | |
parent | 2af6520007a9ff61b404163090d497ddd487f5a6 (diff) |
Eevee: More use of DRW_viewport_matrix_override_set_all
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_lightprobes.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c index 11eebb517e2..9e5aa56b220 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobes.c +++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c @@ -1140,8 +1140,15 @@ static void render_scene_to_probe( EEVEE_StorageList *stl = vedata->stl; EEVEE_LightProbesInfo *pinfo = sldata->probes; - float winmat[4][4], wininv[4][4], posmat[4][4]; - + DRWMatrixState matstate; + float (*viewmat)[4] = matstate.mat[DRW_MAT_VIEW]; + float (*viewinv)[4] = matstate.mat[DRW_MAT_VIEWINV]; + float (*persmat)[4] = matstate.mat[DRW_MAT_PERS]; + float (*persinv)[4] = matstate.mat[DRW_MAT_PERSINV]; + float (*winmat)[4] = matstate.mat[DRW_MAT_WIN]; + float (*wininv)[4] = matstate.mat[DRW_MAT_WININV]; + + float posmat[4][4]; unit_m4(posmat); /* Move to capture position */ @@ -1170,9 +1177,6 @@ static void render_scene_to_probe( DRW_framebuffer_texture_detach(sldata->probe_rt); DRW_framebuffer_texture_detach(sldata->probe_depth_rt); for (int i = 0; i < 6; ++i) { - float viewmat[4][4], persmat[4][4]; - float viewinv[4][4], persinv[4][4]; - /* Setup custom matrices */ mul_m4_m4m4(viewmat, cubefacemat[i], posmat); mul_m4_m4m4(persmat, winmat, viewmat); @@ -1180,12 +1184,7 @@ static void render_scene_to_probe( invert_m4_m4(viewinv, viewmat); invert_m4_m4(wininv, winmat); - DRW_viewport_matrix_override_set(persmat, DRW_MAT_PERS); - DRW_viewport_matrix_override_set(persinv, DRW_MAT_PERSINV); - DRW_viewport_matrix_override_set(viewmat, DRW_MAT_VIEW); - DRW_viewport_matrix_override_set(viewinv, DRW_MAT_VIEWINV); - DRW_viewport_matrix_override_set(winmat, DRW_MAT_WIN); - DRW_viewport_matrix_override_set(wininv, DRW_MAT_WININV); + DRW_viewport_matrix_override_set_all(&matstate); /* Be sure that cascaded shadow maps are updated. */ EEVEE_draw_shadows(sldata, psl); |