From 7a693626d63a52acd12e80209b634711154a2f9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Mon, 16 Jul 2018 15:01:44 +0200 Subject: Smoke: Port display to Workbench + object mode This does not fix the smokesim. It only port the drawing method. The Object mode engine is in charge of rendering the velocity debugging. Things left to do: - Flame rendering. - Color Ramp coloring of volume data. - View facing slicing (for now it's only doing sampling starting from the volume bounds which gives a squarish look) - Add option to enable dithering (currently on by default. --- source/blender/draw/intern/draw_common.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'source/blender/draw/intern/draw_common.c') diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c index a1c60be4742..df80300417e 100644 --- a/source/blender/draw/intern/draw_common.c +++ b/source/blender/draw/intern/draw_common.c @@ -162,6 +162,8 @@ extern char datatoc_animviz_mpath_lines_vert_glsl[]; extern char datatoc_animviz_mpath_lines_geom_glsl[]; extern char datatoc_animviz_mpath_points_vert_glsl[]; +extern char datatoc_volume_velocity_vert_glsl[]; + extern char datatoc_armature_axes_vert_glsl[]; extern char datatoc_armature_sphere_solid_vert_glsl[]; extern char datatoc_armature_sphere_solid_frag_glsl[]; @@ -199,6 +201,9 @@ static struct { struct GPUShader *mpath_line_sh; struct GPUShader *mpath_points_sh; + struct GPUShader *volume_velocity_needle_sh; + struct GPUShader *volume_velocity_sh; + struct GPUShader *mball_handles; } g_shaders = {NULL}; @@ -736,6 +741,26 @@ struct GPUShader *mpath_points_shader_get(void) return g_shaders.mpath_points_sh; } +struct GPUShader *volume_velocity_shader_get(bool use_needle) +{ + if (use_needle) { + if (g_shaders.volume_velocity_needle_sh == NULL) { + g_shaders.volume_velocity_needle_sh = DRW_shader_create( + datatoc_volume_velocity_vert_glsl, NULL, + datatoc_gpu_shader_flat_color_frag_glsl, "#define USE_NEEDLE"); + } + return g_shaders.volume_velocity_needle_sh; + } + else { + if (g_shaders.volume_velocity_sh == NULL) { + g_shaders.volume_velocity_sh = DRW_shader_create( + datatoc_volume_velocity_vert_glsl, NULL, + datatoc_gpu_shader_flat_color_frag_glsl, NULL); + } + return g_shaders.volume_velocity_sh; + } +} + /* ******************************************** COLOR UTILS *********************************************** */ /* TODO FINISH */ -- cgit v1.2.3