Blender V5.0
workbench_effect_outline.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
12
13#include "workbench_private.hh"
14
15namespace blender::workbench {
16
17void OutlinePass::init(const SceneState &scene_state)
18{
19 enabled_ = scene_state.draw_outline;
20 if (!enabled_) {
21 return;
22 }
23}
24
26{
27 if (!enabled_) {
28 return;
29 }
30
31 ps_.init();
33 ps_.shader_set(ShaderCache::get().outline.get());
34 ps_.bind_ubo("world_data", resources.world_buf);
35 ps_.bind_texture("object_id_buffer", &resources.object_id_tx);
36 ps_.draw_procedural(GPU_PRIM_TRIS, 1, 3);
37}
38
39void OutlinePass::draw(Manager &manager, SceneResources &resources)
40{
41 if (!enabled_) {
42 return;
43 }
44
46 fb_.bind();
47 manager.submit(ps_);
48}
49
50} // namespace blender::workbench
#define GPU_ATTACHMENT_TEXTURE(_texture)
#define GPU_ATTACHMENT_NONE
@ GPU_PRIM_TRIS
void submit(PassSimple &pass, View &view)
void draw(Manager &manager, SceneResources &resources)
void sync(SceneResources &resources)
void init(const SceneState &scene_state)
@ DRW_STATE_WRITE_COLOR
Definition draw_state.hh:30
@ DRW_STATE_BLEND_ALPHA_PREMUL
Definition draw_state.hh:57
UniformBuffer< WorldData > world_buf