Blender V4.3
overlay_next_antialiasing.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2019 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
42
43#pragma once
44
46
48
50 private:
51 PassSimple anti_aliasing_ps_ = {"AntiAliasing"};
52
53 GPUFrameBuffer *framebuffer_ref_ = nullptr;
54
55 public:
57 {
58 if (res.selection_type != SelectionType::DISABLED) {
59 anti_aliasing_ps_.init();
60 return;
61 }
62
63 const bool do_smooth_lines = (U.gpu_flag & USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE) != 0;
64
65 {
66 PassSimple &pass = anti_aliasing_ps_;
67 pass.init();
68 pass.framebuffer_set(&framebuffer_ref_);
70 pass.shader_set(res.shaders.anti_aliasing.get());
71 pass.bind_ubo("globalsBlock", &res.globals_buf);
72 pass.bind_texture("depthTex", &res.depth_tx);
73 pass.bind_texture("colorTex", &res.overlay_tx);
74 pass.bind_texture("lineTex", &res.line_tx);
75 pass.push_constant("doSmoothLines", do_smooth_lines);
77 }
78 }
79
80 void draw(Framebuffer &framebuffer, Manager &manager, View & /*view*/)
81 {
82 framebuffer_ref_ = framebuffer;
83 manager.submit(anti_aliasing_ps_);
84 }
85};
86
87} // namespace blender::draw::overlay
@ USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE
@ GPU_PRIM_TRIS
#define U
void submit(PassSimple &pass, View &view)
void bind_texture(const char *name, GPUTexture *texture, GPUSamplerState state=sampler_auto)
void draw_procedural(GPUPrimType primitive, uint instance_len, uint vertex_len, uint vertex_first=-1, ResourceHandle handle={0}, uint custom_id=0)
Definition draw_pass.hh:833
void state_set(DRWState state, int clip_plane_count=0)
Definition draw_pass.hh:954
void bind_ubo(const char *name, GPUUniformBuf *buffer)
void framebuffer_set(GPUFrameBuffer **framebuffer)
Definition draw_pass.hh:977
void push_constant(const char *name, const float &data)
void shader_set(GPUShader *shader)
Definition draw_pass.hh:971
void draw(Framebuffer &framebuffer, Manager &manager, View &)
@ DRW_STATE_WRITE_COLOR
Definition draw_state.hh:30
@ DRW_STATE_BLEND_ALPHA_PREMUL
Definition draw_state.hh:57
detail::Pass< command::DrawCommandBuf > PassSimple