Blender V5.3
overlay_gsplat.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2026 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_ = {"GSplat"};
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->gsplat_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 draw::gsplat_sub_pass_setup(ps_, ob_ref, res_handle, nullptr);
53 gpu::Batch *geom = DRW_cache_gsplat_vert_overlay_get(ob_ref.object);
54 ps_.draw(geom, res_handle, res.select_id(ob_ref).get());
55 }
56 }
57
58 void pre_draw(Manager &manager, View &view) final
59 {
60 if (!enabled_) {
61 return;
62 }
63
64 manager.generate_commands(ps_, view);
65 }
66
67 void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
68 {
69 if (!enabled_) {
70 return;
71 }
72
73 GPU_framebuffer_bind(framebuffer);
74 manager.submit_only(ps_, view);
75 }
76};
77} // namespace blender::draw::overlay
void begin_sync(Resources &res, const State &state) final
void pre_draw(Manager &manager, View &view) final
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
void edit_object_sync(Manager &manager, const ObjectRef &ob_ref, Resources &res, const State &) final
#define DRW_CLIPPING_UBO_SLOT
#define OVERLAY_GLOBALS_SLOT
const int state
gpu::Batch * DRW_cache_gsplat_vert_overlay_get(Object *ob)
detail::Pass< command::DrawMultiBuf > PassMain
gpu::Batch * gsplat_sub_pass_setup(PassMain::Sub &sub_ps, const ObjectRef &ob_ref, const ResourceHandleRange &res_handle, GPUMaterial *gpu_material=nullptr)
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