diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-03-17 18:27:08 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-03-18 13:23:05 +0300 |
commit | fd53b72871e045dfebfb9ddbe2b3c491491aa913 (patch) | |
tree | 892721f97e6bff16c9d87bc3ffee295d2f4a77bc /source/blender/draw/engines/workbench/workbench_shader.c | |
parent | b0a1cf2c9ae696b07f7a236bc855a5ab4a493dcb (diff) |
Objects: Eevee and workbench rendering of new Volume, Hair, PointCloud
Only the volume drawing part is really finished and exposed to the user. Hair
plugs into the existing hair rendering code and is fairly straightforward. The
pointcloud drawing is a hack using overlays rather than Eevee and workbench.
The most tricky part for volume rendering is the case where each volume grid
has a different transform, which requires an additional matrix in the shader
and non-trivial logic in Eevee volume drawing. In the common case were all the
transforms match we don't use the additional per-grid matrix in the shader.
Ref T73201, T68981
Differential Revision: https://developer.blender.org/D6955
Diffstat (limited to 'source/blender/draw/engines/workbench/workbench_shader.c')
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_shader.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_shader.c b/source/blender/draw/engines/workbench/workbench_shader.c index 14a980fe628..2e796056029 100644 --- a/source/blender/draw/engines/workbench/workbench_shader.c +++ b/source/blender/draw/engines/workbench/workbench_shader.c @@ -106,7 +106,7 @@ static struct { struct GPUShader *aa_accum_sh; struct GPUShader *smaa_sh[3]; - struct GPUShader *volume_sh[2][2][2]; + struct GPUShader *volume_sh[2][2][2][2]; struct DRWShaderLibrary *lib; } e_data = {{{{NULL}}}}; @@ -448,9 +448,9 @@ GPUShader *workbench_shader_antialiasing_get(int stage) return e_data.smaa_sh[stage]; } -GPUShader *workbench_shader_volume_get(bool slice, bool coba, bool cubic) +GPUShader *workbench_shader_volume_get(bool slice, bool coba, bool cubic, bool smoke) { - GPUShader **shader = &e_data.volume_sh[slice][coba][cubic]; + GPUShader **shader = &e_data.volume_sh[slice][coba][cubic][smoke]; if (*shader == NULL) { DynStr *ds = BLI_dynstr_new(); @@ -464,6 +464,9 @@ GPUShader *workbench_shader_volume_get(bool slice, bool coba, bool cubic) if (cubic) { BLI_dynstr_append(ds, "#define USE_TRICUBIC\n"); } + if (smoke) { + BLI_dynstr_append(ds, "#define VOLUME_SMOKE\n"); + } char *defines = BLI_dynstr_get_cstring(ds); BLI_dynstr_free(ds); @@ -513,7 +516,7 @@ void workbench_shader_free(void) DRW_SHADER_FREE_SAFE(sh_array[j]); } for (int j = 0; j < sizeof(e_data.volume_sh) / sizeof(void *); j++) { - struct GPUShader **sh_array = &e_data.volume_sh[0][0][0]; + struct GPUShader **sh_array = &e_data.volume_sh[0][0][0][0]; DRW_SHADER_FREE_SAFE(sh_array[j]); } |