Blender V4.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.h"
13#include "BLI_span.hh"
14
15#include "GPU_select.hh"
16
17#include "gpu_select_private.hh"
18
29
31
33
34{
35 g_state.buffer = buffer;
36 g_state.rect = *input;
37 g_state.mode = mode;
38}
39
45
50
52{
53 const int old_size = g_state.buffer->storage.size();
54 g_state.buffer->storage.resize(old_size + hit_len);
56 g_state.buffer->storage.as_mutable_span().slice(old_size, hit_len);
57 const blender::Span<GPUSelectResult> hits(hit_buf, hit_len);
58
59 /* TODO(fclem): There might be some conversion to do to align to the other APIs output. */
60 switch (g_state.mode) {
62 hit_results.copy_from(hits);
63 break;
65 hit_results.copy_from(hits);
66 break;
68 hit_results.copy_from(hits);
69 break;
71 hit_results.copy_from(hits);
72 break;
74 hit_results.copy_from(hits);
75 break;
76 }
77
78 g_state.hits = hit_len;
79}
80
82{
83 return g_state.hits;
84}
#define BLI_assert(a)
Definition BLI_assert.h:50
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition BLI_rect.h:193
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition BLI_rect.h:189
unsigned int uint
eGPUSelectMode
Definition GPU_select.hh:18
@ GPU_SELECT_NEAREST_SECOND_PASS
Definition GPU_select.hh:22
@ GPU_SELECT_NEAREST_FIRST_PASS
Definition GPU_select.hh:21
@ GPU_SELECT_PICK_ALL
Definition GPU_select.hh:24
@ GPU_SELECT_ALL
Definition GPU_select.hh:19
@ GPU_SELECT_PICK_NEAREST
Definition GPU_select.hh:25
constexpr void copy_from(Span< T > values) const
Definition BLI_span.hh:726
int64_t size() const
void resize(const int64_t new_size)
MutableSpan< T > as_mutable_span()
void gpu_select_next_set_result(GPUSelectResult *hit_buf, uint hit_len)
eGPUSelectMode gpu_select_next_get_mode()
int gpu_select_next_get_pick_area_center()
static GPUSelectNextState g_state
uint gpu_select_next_end()
void gpu_select_next_begin(GPUSelectBuffer *buffer, const rcti *input, eGPUSelectMode mode)
GPUSelectStorage storage
Definition GPU_select.hh:46
eGPUSelectMode mode
GPUSelectBuffer * buffer