From f137022f9919f4dd315ec6b325a08e1bf5aec6fb Mon Sep 17 00:00:00 2001 From: Sriharsha Kotcharlakot Date: Tue, 15 Sep 2020 21:21:14 +0530 Subject: Liquid Simulation Display Options (GSoC 2020) All the changes made in the branch `soc-2020-fluid-tools` are included in this patch. **Major changes:** === Viewport Display === - //Raw voxel display// or //closest (nearest-neighbor)// interpolation for displaying the underlying voxel data of the simulation grids more clearly. - An option to display //gridlines// when the slicing method is //single//. ==== Grid Display ==== - Visualization for flags, pressure and level-set representation grids with a fixed color coding based on Manta GUI. ==== Vector Display ==== - //**M**arker **A**nd **C**ell// grid visualization options for vector grids like velocity or external forces. - Made vector display options available for external forces. ==== Coloring options for //gridlines// ==== - Range highlighting and cell filtering options for displaying the simulation grid data more precisely. - Color gridlines with flags. - Also, made slicing and interpolation options available for Volume Object. Reviewed By: JacquesLucke, sebbas Differential Revision: https://developer.blender.org/D8705 --- .../draw/engines/workbench/workbench_shader.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'source/blender/draw/engines/workbench/workbench_shader.c') diff --git a/source/blender/draw/engines/workbench/workbench_shader.c b/source/blender/draw/engines/workbench/workbench_shader.c index af3b5d31b2b..b3b9e11ae58 100644 --- a/source/blender/draw/engines/workbench/workbench_shader.c +++ b/source/blender/draw/engines/workbench/workbench_shader.c @@ -111,7 +111,7 @@ static struct { struct GPUShader *aa_accum_sh; struct GPUShader *smaa_sh[3]; - struct GPUShader *volume_sh[2][2][2][2]; + struct GPUShader *volume_sh[2][2][3][2]; struct DRWShaderLibrary *lib; } e_data = {{{{NULL}}}}; @@ -463,9 +463,12 @@ GPUShader *workbench_shader_antialiasing_get(int stage) return e_data.smaa_sh[stage]; } -GPUShader *workbench_shader_volume_get(bool slice, bool coba, bool cubic, bool smoke) +GPUShader *workbench_shader_volume_get(bool slice, + bool coba, + eWORKBENCH_VolumeInterpType interp_type, + bool smoke) { - GPUShader **shader = &e_data.volume_sh[slice][coba][cubic][smoke]; + GPUShader **shader = &e_data.volume_sh[slice][coba][interp_type][smoke]; if (*shader == NULL) { DynStr *ds = BLI_dynstr_new(); @@ -476,8 +479,16 @@ GPUShader *workbench_shader_volume_get(bool slice, bool coba, bool cubic, bool s if (coba) { BLI_dynstr_append(ds, "#define USE_COBA\n"); } - if (cubic) { - BLI_dynstr_append(ds, "#define USE_TRICUBIC\n"); + switch (interp_type) { + case WORKBENCH_VOLUME_INTERP_LINEAR: + BLI_dynstr_append(ds, "#define USE_TRILINEAR\n"); + break; + case WORKBENCH_VOLUME_INTERP_CUBIC: + BLI_dynstr_append(ds, "#define USE_TRICUBIC\n"); + break; + case WORKBENCH_VOLUME_INTERP_CLOSEST: + BLI_dynstr_append(ds, "#define USE_CLOSEST\n"); + break; } if (smoke) { BLI_dynstr_append(ds, "#define VOLUME_SMOKE\n"); -- cgit v1.2.3