Blender V4.3
select_instance.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
9#include "DRW_render.hh"
10
11#include "GPU_capabilities.hh"
12
13#include "select_engine.hh"
14
16#include "select_instance.hh"
17
18using namespace blender::draw;
19
20/* -------------------------------------------------------------------- */
25
35
36static void SELECT_next_engine_init(void *vedata)
37{
38 OVERLAY_Data *ved = reinterpret_cast<OVERLAY_Data *>(vedata);
39
40 if (ved->instance == nullptr) {
41 const DRWContextState *draw_ctx = DRW_context_state_get();
42 const RegionView3D *rv3d = draw_ctx->rv3d;
43 const View3D *v3d = draw_ctx->v3d;
44 const bool clipping_enabled = RV3D_CLIPPING_ENABLED(v3d, rv3d);
45
46 ved->instance = new Instance(select::SelectionType::ENABLED, clipping_enabled);
47 }
48
49 reinterpret_cast<Instance *>(ved->instance)->init();
50}
51
52static void SELECT_next_cache_init(void *vedata)
53{
54 reinterpret_cast<Instance *>(reinterpret_cast<OVERLAY_Data *>(vedata)->instance)->begin_sync();
55}
56
57static void SELECT_next_cache_populate(void *vedata, Object *object)
58{
59 ObjectRef ref;
60 ref.object = object;
63
64 reinterpret_cast<Instance *>(reinterpret_cast<OVERLAY_Data *>(vedata)->instance)
66}
67
68static void SELECT_next_cache_finish(void *vedata)
69{
70 reinterpret_cast<Instance *>(reinterpret_cast<OVERLAY_Data *>(vedata)->instance)->end_sync();
71}
72
73static void SELECT_next_draw_scene(void *vedata)
74{
75 reinterpret_cast<Instance *>(reinterpret_cast<OVERLAY_Data *>(vedata)->instance)
76 ->draw(*DRW_manager_get());
77}
78
79static void SELECT_next_instance_free(void *instance_)
80{
81 Instance *instance = (Instance *)instance_;
82 if (instance != nullptr) {
83 delete instance;
84 }
85}
86
88
90 /*next*/ nullptr,
91 /*prev*/ nullptr,
92 /*idname*/ N_("Select-Next"),
93 /*vedata_size*/ &SELECT_next_data_size,
94 /*engine_init*/ &SELECT_next_engine_init,
95 /*engine_free*/ nullptr,
96 /*instance_free*/ &SELECT_next_instance_free,
97 /*cache_init*/ &SELECT_next_cache_init,
98 /*cache_populate*/ &SELECT_next_cache_populate,
99 /*cache_finish*/ &SELECT_next_cache_finish,
100 /*draw_scene*/ &SELECT_next_draw_scene,
101 /*view_update*/ nullptr,
102 /*id_update*/ nullptr,
103 /*render_to_image*/ nullptr,
104 /*store_metadata*/ nullptr,
105};
106
#define RV3D_CLIPPING_ENABLED(v3d, rv3d)
char DRWViewportEmptyList
Definition DRW_render.hh:97
#define DRW_VIEWPORT_DATA_SIZE(ty)
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object instance
void init()
A running instance of the engine.
void object_sync(Object *ob)
blender::draw::Manager * DRW_manager_get()
Object * DRW_object_get_dupli_parent(const Object *)
const DRWContextState * DRW_context_state_get()
DupliObject * DRW_object_get_dupli(const Object *)
static void SELECT_next_cache_finish(void *vedata)
static void SELECT_next_cache_init(void *vedata)
DrawEngineType draw_engine_select_next_type
static void SELECT_next_instance_free(void *instance_)
static void SELECT_next_cache_populate(void *vedata, Object *object)
static void SELECT_next_draw_scene(void *vedata)
static void SELECT_next_engine_init(void *vedata)
overlay::Instance Instance
static const DrawEngineDataSize SELECT_next_data_size
RegionView3D * rv3d
DRWViewportEmptyList * txl
DRWViewportEmptyList * stl
DRWViewportEmptyList * fbl
DRWViewportEmptyList * psl
DupliObject * dupli_object
#define N_(msgid)