diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-05-11 15:04:18 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-05-14 11:57:03 +0300 |
commit | 642c8010b210e1671f4faa0ca1c097c77f19042a (patch) | |
tree | 1f86ec239b79179e8b78341136e1f3ea3bf942bb /source/blender/draw | |
parent | b13e0568d3ab1487b4787806b2d9f4116192983c (diff) |
DRW: Remove ModelViewMatrix and ModelViewMatrixInverse
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/intern/draw_manager.h | 6 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager_data.c | 12 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager_exec.c | 30 |
3 files changed, 5 insertions, 43 deletions
diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h index a1f9bb6713c..20dfe8bc057 100644 --- a/source/blender/draw/intern/draw_manager.h +++ b/source/blender/draw/intern/draw_manager.h @@ -100,8 +100,6 @@ enum { /* Used by DRWCallState.matflag */ enum { DRW_CALL_MODELINVERSE = (1 << 0), - DRW_CALL_MODELVIEW = (1 << 1), - DRW_CALL_MODELVIEWINVERSE = (1 << 2), DRW_CALL_MODELVIEWPROJECTION = (1 << 3), DRW_CALL_ORCOTEXFAC = (1 << 7), DRW_CALL_OBJECTINFO = (1 << 8), @@ -120,8 +118,6 @@ typedef struct DRWCallState { /* Matrices */ float model[4][4]; float modelinverse[4][4]; - float modelview[4][4]; - float modelviewinverse[4][4]; float modelviewprojection[4][4]; float orcotexfac[2][3]; /* Not view dependent */ float objectinfo[2]; @@ -250,8 +246,6 @@ struct DRWShadingGroup { /* Builtin matrices locations */ int model; int modelinverse; - int modelview; - int modelviewinverse; int modelviewprojection; int orcotexfac; int callid; diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c index 0375db12255..5d5e81ebbe2 100644 --- a/source/blender/draw/intern/draw_manager_data.c +++ b/source/blender/draw/intern/draw_manager_data.c @@ -832,10 +832,12 @@ static void drw_shgroup_init(DRWShadingGroup *shgroup, GPUShader *shader) shgroup, GPU_UNIFORM_CAMERATEXCO, DST.view_data.viewcamtexcofac, 3, 2); } + /* Not supported. */ + BLI_assert(GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_MODELVIEW_INV) == -1); + BLI_assert(GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_MODELVIEW) == -1); + shgroup->model = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_MODEL); shgroup->modelinverse = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_MODEL_INV); - shgroup->modelview = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_MODELVIEW); - shgroup->modelviewinverse = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_MODELVIEW_INV); shgroup->modelviewprojection = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_MVP); shgroup->orcotexfac = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_ORCO); shgroup->objectinfo = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_OBJECT_INFO); @@ -848,12 +850,6 @@ static void drw_shgroup_init(DRWShadingGroup *shgroup, GPUShader *shader) if (shgroup->modelinverse > -1) { shgroup->matflag |= DRW_CALL_MODELINVERSE; } - if (shgroup->modelview > -1) { - shgroup->matflag |= DRW_CALL_MODELVIEW; - } - if (shgroup->modelviewinverse > -1) { - shgroup->matflag |= DRW_CALL_MODELVIEWINVERSE; - } if (shgroup->modelviewprojection > -1) { shgroup->matflag |= DRW_CALL_MODELVIEWPROJECTION; } diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c index d0faed8e261..efea155d35d 100644 --- a/source/blender/draw/intern/draw_manager_exec.c +++ b/source/blender/draw/intern/draw_manager_exec.c @@ -791,13 +791,7 @@ static void draw_matrices_model_prepare(DRWCallState *st) if ((st->flag & DRW_CALL_CULLED) != 0 && (st->flag & DRW_CALL_BYPASS_CULLING) == 0) { return; } - /* Order matters */ - if (st->matflag & (DRW_CALL_MODELVIEW | DRW_CALL_MODELVIEWINVERSE)) { - mul_m4_m4m4(st->modelview, DST.view_data.matstate.mat[DRW_MAT_VIEW], st->model); - } - if (st->matflag & DRW_CALL_MODELVIEWINVERSE) { - invert_m4_m4(st->modelviewinverse, st->modelview); - } + if (st->matflag & DRW_CALL_MODELVIEWPROJECTION) { mul_m4_m4m4(st->modelviewprojection, DST.view_data.matstate.mat[DRW_MAT_PERS], st->model); } @@ -816,14 +810,6 @@ static void draw_geometry_prepare(DRWShadingGroup *shgroup, DRWCall *call) GPU_shader_uniform_vector( shgroup->shader, shgroup->modelinverse, 16, 1, (float *)state->modelinverse); } - if (shgroup->modelview != -1) { - GPU_shader_uniform_vector( - shgroup->shader, shgroup->modelview, 16, 1, (float *)state->modelview); - } - if (shgroup->modelviewinverse != -1) { - GPU_shader_uniform_vector( - shgroup->shader, shgroup->modelviewinverse, 16, 1, (float *)state->modelviewinverse); - } if (shgroup->modelviewprojection != -1) { GPU_shader_uniform_vector(shgroup->shader, shgroup->modelviewprojection, @@ -855,20 +841,6 @@ static void draw_geometry_prepare(DRWShadingGroup *shgroup, DRWCall *call) if (shgroup->modelinverse != -1) { GPU_shader_uniform_vector(shgroup->shader, shgroup->modelinverse, 16, 1, (float *)unitmat); } - if (shgroup->modelview != -1) { - GPU_shader_uniform_vector(shgroup->shader, - shgroup->modelview, - 16, - 1, - (float *)DST.view_data.matstate.mat[DRW_MAT_VIEW]); - } - if (shgroup->modelviewinverse != -1) { - GPU_shader_uniform_vector(shgroup->shader, - shgroup->modelviewinverse, - 16, - 1, - (float *)DST.view_data.matstate.mat[DRW_MAT_VIEWINV]); - } if (shgroup->modelviewprojection != -1) { GPU_shader_uniform_vector(shgroup->shader, shgroup->modelviewprojection, |