Blender V5.0
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_private.hh"
16
27
29
31
32{
33 g_state.buffer = buffer;
34 g_state.rect = *input;
35 g_state.mode = mode;
36}
37
43
48
50{
51 const int old_size = g_state.buffer->storage.size();
52 g_state.buffer->storage.resize(old_size + hit_len);
54 g_state.buffer->storage.as_mutable_span().slice(old_size, hit_len);
55 const blender::Span<GPUSelectResult> hits(hit_buf, hit_len);
56
57 /* TODO(fclem): There might be some conversion to do to align to the other APIs output. */
58 switch (g_state.mode) {
60 hit_results.copy_from(hits);
61 break;
63 hit_results.copy_from(hits);
64 break;
66 hit_results.copy_from(hits);
67 break;
72 break;
73 }
74
75 g_state.hits = hit_len;
76}
77
79{
80 return g_state.hits;
81}
#define BLI_assert_unreachable()
Definition BLI_assert.h:93
#define BLI_assert(a)
Definition BLI_assert.h:46
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition BLI_rect.h:198
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition BLI_rect.h:194
unsigned int uint
GPUSelectMode
Definition GPU_select.hh:18
@ GPU_SELECT_NEAREST_SECOND_PASS
Definition GPU_select.hh:23
@ GPU_SELECT_INVALID
Definition GPU_select.hh:19
@ GPU_SELECT_NEAREST_FIRST_PASS
Definition GPU_select.hh:22
@ GPU_SELECT_PICK_ALL
Definition GPU_select.hh:25
@ GPU_SELECT_ALL
Definition GPU_select.hh:20
@ GPU_SELECT_PICK_NEAREST
Definition GPU_select.hh:26
constexpr void copy_from(Span< T > values) const
Definition BLI_span.hh:739
void gpu_select_next_begin(GPUSelectBuffer *buffer, const rcti *input, GPUSelectMode mode)
void gpu_select_next_set_result(GPUSelectResult *hit_buf, uint hit_len)
int gpu_select_next_get_pick_area_center()
GPUSelectMode gpu_select_next_get_mode()
static GPUSelectNextState g_state
uint gpu_select_next_end()
#define input
GPUSelectBuffer * buffer