Cleanup: DRW/GPU: Remove eye vector uniform
This commit is contained in:
parent
901026c493
commit
3d759e2b09
|
@ -107,8 +107,7 @@ enum {
|
|||
DRW_CALL_NORMALVIEWINVERSE = (1 << 5),
|
||||
DRW_CALL_NORMALWORLD = (1 << 6),
|
||||
DRW_CALL_ORCOTEXFAC = (1 << 7),
|
||||
DRW_CALL_EYEVEC = (1 << 8),
|
||||
DRW_CALL_OBJECTINFO = (1 << 9),
|
||||
DRW_CALL_OBJECTINFO = (1 << 8),
|
||||
};
|
||||
|
||||
typedef struct DRWCallState {
|
||||
|
@ -132,7 +131,6 @@ typedef struct DRWCallState {
|
|||
float normalworld[3][3]; /* Not view dependent */
|
||||
float orcotexfac[2][3]; /* Not view dependent */
|
||||
float objectinfo[2];
|
||||
float eyevec[3];
|
||||
} DRWCallState;
|
||||
|
||||
typedef enum {
|
||||
|
@ -265,7 +263,6 @@ struct DRWShadingGroup {
|
|||
int normalviewinverse;
|
||||
int normalworld;
|
||||
int orcotexfac;
|
||||
int eye;
|
||||
int callid;
|
||||
int objectinfo;
|
||||
uint16_t matflag; /* Matrices needed, same as DRWCall.flag */
|
||||
|
|
|
@ -842,7 +842,6 @@ static void drw_shgroup_init(DRWShadingGroup *shgroup, GPUShader *shader)
|
|||
shgroup->normalworld = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_WORLDNORMAL);
|
||||
shgroup->orcotexfac = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_ORCO);
|
||||
shgroup->objectinfo = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_OBJECT_INFO);
|
||||
shgroup->eye = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_EYE);
|
||||
shgroup->callid = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_CALLID);
|
||||
|
||||
shgroup->matflag = 0;
|
||||
|
@ -873,9 +872,6 @@ static void drw_shgroup_init(DRWShadingGroup *shgroup, GPUShader *shader)
|
|||
if (shgroup->objectinfo > -1) {
|
||||
shgroup->matflag |= DRW_CALL_OBJECTINFO;
|
||||
}
|
||||
if (shgroup->eye > -1) {
|
||||
shgroup->matflag |= DRW_CALL_EYEVEC;
|
||||
}
|
||||
}
|
||||
|
||||
static void drw_shgroup_instance_init(DRWShadingGroup *shgroup,
|
||||
|
|
|
@ -792,8 +792,7 @@ static void draw_matrices_model_prepare(DRWCallState *st)
|
|||
return;
|
||||
}
|
||||
/* Order matters */
|
||||
if (st->matflag &
|
||||
(DRW_CALL_MODELVIEW | DRW_CALL_MODELVIEWINVERSE | DRW_CALL_NORMALVIEW | DRW_CALL_EYEVEC)) {
|
||||
if (st->matflag & (DRW_CALL_MODELVIEW | DRW_CALL_MODELVIEWINVERSE | DRW_CALL_NORMALVIEW)) {
|
||||
mul_m4_m4m4(st->modelview, DST.view_data.matstate.mat[DRW_MAT_VIEW], st->model);
|
||||
}
|
||||
if (st->matflag & DRW_CALL_MODELVIEWINVERSE) {
|
||||
|
@ -802,21 +801,14 @@ static void draw_matrices_model_prepare(DRWCallState *st)
|
|||
if (st->matflag & DRW_CALL_MODELVIEWPROJECTION) {
|
||||
mul_m4_m4m4(st->modelviewprojection, DST.view_data.matstate.mat[DRW_MAT_PERS], st->model);
|
||||
}
|
||||
if (st->matflag & (DRW_CALL_NORMALVIEW | DRW_CALL_NORMALVIEWINVERSE | DRW_CALL_EYEVEC)) {
|
||||
if (st->matflag & (DRW_CALL_NORMALVIEW | DRW_CALL_NORMALVIEWINVERSE)) {
|
||||
copy_m3_m4(st->normalview, st->modelview);
|
||||
invert_m3(st->normalview);
|
||||
transpose_m3(st->normalview);
|
||||
}
|
||||
if (st->matflag & (DRW_CALL_NORMALVIEWINVERSE | DRW_CALL_EYEVEC)) {
|
||||
if (st->matflag & (DRW_CALL_NORMALVIEWINVERSE)) {
|
||||
invert_m3_m3(st->normalviewinverse, st->normalview);
|
||||
}
|
||||
/* TODO remove eye vec (unused) */
|
||||
if (st->matflag & DRW_CALL_EYEVEC) {
|
||||
/* Used by orthographic wires */
|
||||
copy_v3_fl3(st->eyevec, 0.0f, 0.0f, 1.0f);
|
||||
/* set eye vector, transformed to object coords */
|
||||
mul_m3_v3(st->normalviewinverse, st->eyevec);
|
||||
}
|
||||
/* Non view dependent */
|
||||
if (st->matflag & DRW_CALL_NORMALWORLD) {
|
||||
copy_m3_m4(st->normalworld, st->model);
|
||||
|
@ -878,13 +870,9 @@ static void draw_geometry_prepare(DRWShadingGroup *shgroup, DRWCall *call)
|
|||
GPU_shader_uniform_vector(
|
||||
shgroup->shader, shgroup->orcotexfac, 3, 2, (float *)state->orcotexfac);
|
||||
}
|
||||
if (shgroup->eye != -1) {
|
||||
GPU_shader_uniform_vector(shgroup->shader, shgroup->eye, 3, 1, (float *)state->eyevec);
|
||||
}
|
||||
}
|
||||
else {
|
||||
BLI_assert((shgroup->normalview == -1) && (shgroup->normalworld == -1) &&
|
||||
(shgroup->eye == -1));
|
||||
BLI_assert((shgroup->normalview == -1) && (shgroup->normalworld == -1));
|
||||
/* For instancing and batching. */
|
||||
float unitmat[4][4];
|
||||
unit_m4(unitmat);
|
||||
|
|
|
@ -51,7 +51,6 @@ typedef enum {
|
|||
GPU_UNIFORM_ORCO, /* vec3 OrcoTexCoFactors[] */
|
||||
|
||||
GPU_UNIFORM_COLOR, /* vec4 color */
|
||||
GPU_UNIFORM_EYE, /* vec3 eye */
|
||||
GPU_UNIFORM_CALLID, /* int callId */
|
||||
GPU_UNIFORM_OBJECT_INFO, /* vec3 objectInfo */
|
||||
|
||||
|
|
|
@ -67,7 +67,6 @@ static const char *BuiltinUniform_name(GPUUniformBuiltin u)
|
|||
[GPU_UNIFORM_ORCO] = "OrcoTexCoFactors",
|
||||
|
||||
[GPU_UNIFORM_COLOR] = "color",
|
||||
[GPU_UNIFORM_EYE] = "eye",
|
||||
[GPU_UNIFORM_CALLID] = "callId",
|
||||
[GPU_UNIFORM_OBJECT_INFO] = "unfobjectinfo",
|
||||
|
||||
|
|
Loading…
Reference in New Issue