Blender V5.0
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 }
39
41 const ObjectRef &ob_ref,
42 Resources &res,
43 const State & /*state*/) final
44 {
45 if (!enabled_) {
46 return;
47 }
48
49 ResourceHandleRange res_handle = manager.unique_handle(ob_ref);
50 {
51 gpu::Batch *geom = DRW_cache_pointcloud_vert_overlay_get(ob_ref.object);
52 ps_.draw(geom, res_handle, res.select_id(ob_ref).get());
53 }
54 }
55
56 void pre_draw(Manager &manager, View &view) final
57 {
58 if (!enabled_) {
59 return;
60 }
61
62 manager.generate_commands(ps_, view);
63 }
64
65 void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
66 {
67 if (!enabled_) {
68 return;
69 }
70
71 GPU_framebuffer_bind(framebuffer);
72 manager.submit_only(ps_, view);
73 }
74};
75} // namespace blender::draw::overlay
static AppView * view
void GPU_framebuffer_bind(blender::gpu::FrameBuffer *fb)
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 OVERLAY_GLOBALS_SLOT
@ DRW_STATE_WRITE_DEPTH
Definition draw_state.hh:29
@ DRW_STATE_WRITE_COLOR
Definition draw_state.hh:30
@ DRW_STATE_DEPTH_LESS_EQUAL
Definition draw_state.hh:38
static ulong state[N]
detail::Pass< command::DrawMultiBuf > PassMain
gpu::Batch * DRW_cache_pointcloud_vert_overlay_get(Object *ob)