Blender V5.3
gpu_select_next.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2017 Blender Authors. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10#include <cfloat>
11
12#include "BLI_rect.hh"
13#include "BLI_span.hh"
14
15#include "gpu_select_private.hh"
16
17namespace blender {
18
31
33
35 const rcti *input,
36 const int radius,
37 GPUSelectMode mode)
38
39{
40 g_state.buffer = buffer;
41 g_state.rect = *input;
42 g_state.mode = mode;
43 g_state.radius = radius;
44}
45
50
55
57{
58 return g_state.radius;
59}
60
62{
63 const int old_size = g_state.buffer->storage.size();
64 g_state.buffer->storage.resize(old_size + hit_len);
66 old_size, hit_len);
67 const Span<GPUSelectResult> hits(hit_buf, hit_len);
68
69 /* TODO(fclem): There might be some conversion to do to align to the other APIs output. */
70 switch (g_state.mode) {
72 hit_results.copy_from(hits);
73 break;
75 hit_results.copy_from(hits);
76 break;
78 hit_results.copy_from(hits);
79 break;
84 break;
85 }
86
87 g_state.hits = hit_len;
88}
89
91{
92 return g_state.hits;
93}
94
95} // namespace blender
#define BLI_assert_unreachable()
constexpr void copy_from(Span< T > values) const
Definition BLI_span.hh:745
int64_t size() const
void resize(const int64_t new_size)
MutableSpan< T > as_mutable_span()
BMesh Iterators.
unsigned int uint
Definition BKE_text.h:55
@ GPU_SELECT_INVALID
Definition GPU_select.hh:21
@ GPU_SELECT_PICK_ALL
Definition GPU_select.hh:27
@ GPU_SELECT_PICK_NEAREST
Definition GPU_select.hh:28
@ GPU_SELECT_NEAREST_SECOND_PASS
Definition GPU_select.hh:25
@ GPU_SELECT_ALL
Definition GPU_select.hh:22
@ GPU_SELECT_NEAREST_FIRST_PASS
Definition GPU_select.hh:24
static GPUSelectNextState g_state
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition BLI_rect.hh:207
VecBase< int32_t, 2 > int2
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition BLI_rect.hh:203
int gpu_select_next_get_radius()
void gpu_select_next_set_result(GPUSelectResult *hit_buf, uint hit_len)
int2 gpu_select_next_get_pick_area_center()
uint gpu_select_next_end()
GPUSelectMode gpu_select_next_get_mode()
void gpu_select_next_begin(GPUSelectBuffer *buffer, const rcti *input, const int radius, GPUSelectMode mode)
GPUSelectStorage storage
Definition GPU_select.hh:49