Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/overlay/overlay_shader.c
| Show First 20 Lines • Show All 205 Lines • ▼ Show 20 Lines | typedef struct OVERLAY_Shaders { | ||||
| GPUShader *outline_prepass_gpencil; | GPUShader *outline_prepass_gpencil; | ||||
| GPUShader *outline_prepass_pointcloud; | GPUShader *outline_prepass_pointcloud; | ||||
| GPUShader *outline_prepass_wire; | GPUShader *outline_prepass_wire; | ||||
| GPUShader *outline_detect; | GPUShader *outline_detect; | ||||
| GPUShader *paint_face; | GPUShader *paint_face; | ||||
| GPUShader *paint_point; | GPUShader *paint_point; | ||||
| GPUShader *paint_texture; | GPUShader *paint_texture; | ||||
| GPUShader *paint_vertcol; | GPUShader *paint_vertcol; | ||||
| GPUShader *paint_weight; | GPUShader *paint_weight[2]; | ||||
| GPUShader *paint_wire; | GPUShader *paint_wire; | ||||
| GPUShader *particle_dot; | GPUShader *particle_dot; | ||||
| GPUShader *particle_shape; | GPUShader *particle_shape; | ||||
| GPUShader *pointcloud_dot; | GPUShader *pointcloud_dot; | ||||
| GPUShader *sculpt_mask; | GPUShader *sculpt_mask; | ||||
| GPUShader *uniform_color; | GPUShader *uniform_color; | ||||
| GPUShader *volume_velocity_needle_sh; | GPUShader *volume_velocity_needle_sh; | ||||
| GPUShader *volume_velocity_mac_sh; | GPUShader *volume_velocity_mac_sh; | ||||
| ▲ Show 20 Lines • Show All 1,106 Lines • ▼ Show 20 Lines | sh_data->paint_vertcol = GPU_shader_create_from_arrays({ | ||||
| datatoc_paint_vertcol_frag_glsl, | datatoc_paint_vertcol_frag_glsl, | ||||
| NULL}, | NULL}, | ||||
| .defs = (const char *[]){sh_cfg->def, NULL}, | .defs = (const char *[]){sh_cfg->def, NULL}, | ||||
| }); | }); | ||||
| } | } | ||||
| return sh_data->paint_vertcol; | return sh_data->paint_vertcol; | ||||
| } | } | ||||
| GPUShader *OVERLAY_shader_paint_weight(void) | GPUShader *OVERLAY_shader_paint_weight(const bool shading) | ||||
| { | { | ||||
| int index = shading ? 1 : 0; | |||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| const GPUShaderConfigData *sh_cfg = &GPU_shader_cfg_data[draw_ctx->sh_cfg]; | const GPUShaderConfigData *sh_cfg = &GPU_shader_cfg_data[draw_ctx->sh_cfg]; | ||||
| OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; | OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; | ||||
| if (!sh_data->paint_weight) { | if (!sh_data->paint_weight[index]) { | ||||
| sh_data->paint_weight = GPU_shader_create_from_arrays({ | sh_data->paint_weight[index] = GPU_shader_create_from_arrays({ | ||||
| .vert = (const char *[]){sh_cfg->lib, | .vert = (const char *[]){sh_cfg->lib, | ||||
| datatoc_common_globals_lib_glsl, | datatoc_common_globals_lib_glsl, | ||||
| datatoc_common_view_lib_glsl, | datatoc_common_view_lib_glsl, | ||||
| datatoc_paint_weight_vert_glsl, | datatoc_paint_weight_vert_glsl, | ||||
| NULL}, | NULL}, | ||||
| .frag = (const char *[]){datatoc_common_globals_lib_glsl, | .frag = (const char *[]){datatoc_common_globals_lib_glsl, | ||||
| datatoc_paint_weight_frag_glsl, | datatoc_paint_weight_frag_glsl, | ||||
| NULL}, | NULL}, | ||||
| .defs = (const char *[]){sh_cfg->def, NULL}, | .defs = (const char *[]){sh_cfg->def, shading ? "#define FAKE_SHADING\n" : "", NULL}, | ||||
| }); | }); | ||||
| } | } | ||||
| return sh_data->paint_weight; | return sh_data->paint_weight[index]; | ||||
| } | } | ||||
| GPUShader *OVERLAY_shader_paint_wire(void) | GPUShader *OVERLAY_shader_paint_wire(void) | ||||
| { | { | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| const GPUShaderConfigData *sh_cfg = &GPU_shader_cfg_data[draw_ctx->sh_cfg]; | const GPUShaderConfigData *sh_cfg = &GPU_shader_cfg_data[draw_ctx->sh_cfg]; | ||||
| OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; | OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; | ||||
| if (!sh_data->paint_wire) { | if (!sh_data->paint_wire) { | ||||
| ▲ Show 20 Lines • Show All 411 Lines • Show Last 20 Lines | |||||