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
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);
76 pass.draw_procedural(GPU_PRIM_TRIS, 1, 3);
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
unsigned int U
Definition btGjkEpa3.h:78
void submit(PassSimple &pass, View &view)
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