26 PassSimple paint_region_ps_ = {
"paint_region_ps_"};
33 PassSimple paint_mask_ps_ = {
"paint_mask_ps_"};
35 bool show_weight_ =
false;
36 bool show_wires_ =
false;
37 bool show_paint_mask_ =
false;
39 bool enabled_ =
false;
49 paint_region_ps_.
init();
51 paint_mask_ps_.
init();
61 auto &pass = paint_region_ps_;
63 auto &sub = pass.
sub(
"Face");
66 state.clipping_plane_count);
69 sub.push_constant(
"ucolor",
float4(1.0, 1.0, 1.0, 0.2));
70 paint_region_face_ps_ = ⊂
73 auto &sub = pass.
sub(
"Edge");
76 state.clipping_plane_count);
79 paint_region_edge_ps_ = ⊂
82 auto &sub = pass.
sub(
"Vert");
84 state.clipping_plane_count);
87 paint_region_vert_ps_ = ⊂
95 const bool masked_transparency_support = (shading_type <=
OB_SOLID) ||
97 const bool shadeless = shading_type ==
OB_WIRE;
100 auto &pass = weight_ps_;
102 (masked_transparency_support ?
105 state.clipping_plane_count);
110 pass.push_constant(
"drawContours", draw_contours);
111 pass.push_constant(
"opacity",
state.overlay.weight_paint_mode_opacity);
120 show_paint_mask_ = paint_settings.
stencil &&
123 if (show_paint_mask_) {
128 auto &pass = paint_mask_ps_;
130 state.clipping_plane_count);
133 pass.bind_texture(
"maskImage", mask_texture);
134 pass.push_constant(
"maskPremult", mask_premult);
135 pass.push_constant(
"maskInvertStencil", mask_inverted);
137 pass.push_constant(
"opacity",
state.overlay.texture_paint_mode_opacity);
153 switch (
state.ctx_mode) {
177 switch (
state.ctx_mode) {
188 if (show_paint_mask_) {
209 if ((use_face_selection || show_wires_) && !in_texture_paint_mode) {
211 paint_region_edge_ps_->
push_constant(
"useSelect", use_face_selection);
214 if (use_face_selection) {
218 if (use_vert_selection && !in_texture_paint_mode) {
231 manager.
submit(weight_ps_, view);
232 manager.
submit(paint_mask_ps_, view);
235 manager.
submit(paint_region_ps_, view);
GPUTexture * BKE_image_get_gpu_texture(Image *image, ImageUser *iuser)
bool BKE_scene_uses_blender_workbench(const Scene *scene)
#define BLI_assert_unreachable()
Object * DEG_get_original_object(Object *object)
@ IMAGEPAINT_PROJECT_LAYER_STENCIL_INV
@ IMAGEPAINT_PROJECT_LAYER_STENCIL
@ V3D_OVERLAY_WPAINT_CONTOURS
void GPU_framebuffer_bind(GPUFrameBuffer *framebuffer)
ResourceHandle unique_handle(const ObjectRef &ref)
void submit(PassSimple &pass, View &view)
void draw(gpu::Batch *batch, uint instance_len=-1, uint vertex_len=-1, uint vertex_first=-1, ResourceHandle handle={0}, uint custom_id=0)
PassBase< DrawCommandBufType > & sub(const char *name)
void state_set(DRWState state, int clip_plane_count=0)
void push_constant(const char *name, const float &data)
void begin_sync(Resources &res, const State &state)
void draw(GPUFrameBuffer *framebuffer, Manager &manager, View &view)
void object_sync(Manager &manager, const ObjectRef &ob_ref, const State &state)
ShaderPtr paint_region_edge
ShaderPtr paint_region_face
ShaderPtr paint_weight_fake_shading
ShaderPtr paint_region_vert
blender::gpu::Batch * DRW_cache_mesh_surface_weights_get(Object *ob)
blender::gpu::Batch * DRW_cache_mesh_surface_edges_get(Object *ob)
blender::gpu::Batch * DRW_cache_mesh_surface_get(Object *ob)
blender::gpu::Batch * DRW_cache_mesh_all_verts_get(Object *ob)
blender::gpu::Batch * DRW_cache_mesh_surface_texpaint_single_get(Object *ob)
@ DRW_STATE_DEPTH_LESS_EQUAL
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
VecBase< float, 4 > float4
VecBase< float, 3 > float3
TextureRef weight_ramp_tx
GPUUniformBuf * globals_buf
const SelectionType selection_type