Blender V5.3
overlay_pointcloud.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2025 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "draw_cache.hh"
12#include "draw_cache_impl.hh"
13#include "draw_common_c.hh"
14#include "overlay_base.hh"
15
16namespace blender::draw::overlay {
17
22 private:
23 PassMain ps_ = {"PointCloud"};
24
25 public:
26 void begin_sync(Resources &res, const State &state) final
27 {
28 enabled_ = state.is_space_v3d();
29 if (!enabled_) {
30 return;
31 }
32
33 ps_.init();
35 state.clipping_plane_count);
36 ps_.shader_set(res.shaders->pointcloud_points.get());
37 ps_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
38 ps_.bind_ubo(DRW_CLIPPING_UBO_SLOT, &res.clip_planes_buf);
39 }
40
42 const ObjectRef &ob_ref,
43 Resources &res,
44 const State & /*state*/) final
45 {
46 if (!enabled_) {
47 return;
48 }
49
50 ResourceHandleRange res_handle = manager.unique_handle(ob_ref);
51 {
52 gpu::Batch *geom = DRW_cache_pointcloud_vert_overlay_get(ob_ref.object);
53 ps_.draw(geom, res_handle, res.select_id(ob_ref).get());
54 }
55 }
56
57 void pre_draw(Manager &manager, View &view) final
58 {
59 if (!enabled_) {
60 return;
61 }
62
63 manager.generate_commands(ps_, view);
64 }
65
66 void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
67 {
68 if (!enabled_) {
69 return;
70 }
71
72 GPU_framebuffer_bind(framebuffer);
73 manager.submit_only(ps_, view);
74 }
75};
76} // namespace blender::draw::overlay
void begin_sync(Resources &res, const State &state) final
void pre_draw(Manager &manager, View &view) final
void edit_object_sync(Manager &manager, const ObjectRef &ob_ref, Resources &res, const State &) final
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
#define DRW_CLIPPING_UBO_SLOT
#define OVERLAY_GLOBALS_SLOT
const int state
detail::Pass< command::DrawMultiBuf > PassMain
gpu::Batch * DRW_cache_pointcloud_vert_overlay_get(Object *ob)
void GPU_framebuffer_bind(gpu::FrameBuffer *fb)
@ DRW_STATE_WRITE_COLOR
Definition draw_state.hh:32
@ DRW_STATE_WRITE_DEPTH
Definition draw_state.hh:31
@ DRW_STATE_DEPTH_LESS_EQUAL
Definition draw_state.hh:40