diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-03-31 14:41:15 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-03-31 14:48:17 +0300 |
commit | 2f7171622d784384053eb5094edaa81eb8133f0a (patch) | |
tree | b73d5080845916f9b5ba60b7f2aa109c58300860 /source/blender/draw/engines/overlay | |
parent | ca37654b63277985a4f050772ddc412d8158a529 (diff) |
DRW: Rename DRW_shgroup_uniform_vec4_array_copy to mat4_copy
This function was not used for anything other than mat4. This
was because of a limitation of the DRW module/
This makes it cleaner for the GLSL and also less tempting to use
it for other unconventional purpose.
Diffstat (limited to 'source/blender/draw/engines/overlay')
4 files changed, 6 insertions, 9 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_extra.c b/source/blender/draw/engines/overlay/overlay_extra.c index aae12e5513e..9953480e7fa 100644 --- a/source/blender/draw/engines/overlay/overlay_extra.c +++ b/source/blender/draw/engines/overlay/overlay_extra.c @@ -756,7 +756,7 @@ void OVERLAY_lightprobe_cache_populate(OVERLAY_Data *vedata, Object *ob) uint cell_count = prb->grid_resolution_x * prb->grid_resolution_y * prb->grid_resolution_z; DRWShadingGroup *grp = DRW_shgroup_create_sub(vedata->stl->pd->extra_grid_grp); - DRW_shgroup_uniform_vec4_array_copy(grp, "gridModelMatrix", instdata.mat, 4); + DRW_shgroup_uniform_mat4_copy(grp, "gridModelMatrix", instdata.mat); DRW_shgroup_call_procedural_points(grp, NULL, cell_count); } break; diff --git a/source/blender/draw/engines/overlay/overlay_wireframe.c b/source/blender/draw/engines/overlay/overlay_wireframe.c index b3c0c5da9b5..a5628559cfd 100644 --- a/source/blender/draw/engines/overlay/overlay_wireframe.c +++ b/source/blender/draw/engines/overlay/overlay_wireframe.c @@ -148,7 +148,7 @@ static void wireframe_hair_cache_populate(OVERLAY_Data *vedata, Object *ob, Part const bool use_coloring = true; DRWShadingGroup *shgrp = DRW_shgroup_create_sub(pd->wires_hair_grp[is_xray][use_coloring]); - DRW_shgroup_uniform_vec4_array_copy(shgrp, "hairDupliMatrix", dupli_mat, 4); + DRW_shgroup_uniform_mat4_copy(shgrp, "hairDupliMatrix", dupli_mat); DRW_shgroup_call_no_cull(shgrp, hairs, ob); } diff --git a/source/blender/draw/engines/overlay/shaders/extra_lightprobe_grid_vert.glsl b/source/blender/draw/engines/overlay/shaders/extra_lightprobe_grid_vert.glsl index 19a3cd42bde..8006c51a946 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_lightprobe_grid_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_lightprobe_grid_vert.glsl @@ -1,6 +1,6 @@ uniform depth2D depthBuffer; -uniform vec4 gridModelMatrix[4]; +uniform mat4 gridModelMatrix; uniform bool isTransform; out vec4 finalColor; @@ -27,8 +27,7 @@ vec4 color_from_id(float color_id) void main() { - mat4 model_mat = mat4( - gridModelMatrix[0], gridModelMatrix[1], gridModelMatrix[2], gridModelMatrix[3]); + mat4 model_mat = gridModelMatrix; model_mat[0][3] = model_mat[1][3] = model_mat[2][3] = 0.0; model_mat[3][3] = 1.0; float color_id = gridModelMatrix[3].w; diff --git a/source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl b/source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl index 060b7a957c1..8d26aa89f13 100644 --- a/source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl @@ -6,7 +6,7 @@ uniform bool isTransform; uniform bool isObjectColor; uniform bool isRandomColor; uniform bool isHair; -uniform vec4 hairDupliMatrix[4]; +uniform mat4 hairDupliMatrix; in vec3 pos; in vec3 nor; @@ -94,9 +94,7 @@ void main() vec3 wpos = point_object_to_world(pos); if (isHair) { - mat4 obmat = mat4( - hairDupliMatrix[0], hairDupliMatrix[1], hairDupliMatrix[2], hairDupliMatrix[3]); - + mat4 obmat = hairDupliMatrix; wpos = (obmat * vec4(pos, 1.0)).xyz; wnor = -normalize(mat3(obmat) * nor); } |