|
Blender V5.0
|
#include <cstdlib>#include <cstring>#include "GPU_select.hh"#include "BLI_rect.h"#include "BLI_utildefines.h"#include "gpu_select_private.hh"Go to the source code of this file.
Classes | |
| struct | GPUSelectState |
Functions | |
Public API | |
| static void | gpu_select_begin_ex (GPUSelectBuffer *buffer, const rcti *input, GPUSelectMode mode, int oldhits, bool use_select_next) |
| void | GPU_select_begin_next (GPUSelectBuffer *buffer, const rcti *input, GPUSelectMode mode, int oldhits) |
| void | GPU_select_begin (GPUSelectBuffer *buffer, const rcti *input, GPUSelectMode mode, int oldhits) |
| bool | GPU_select_load_id (uint id) |
| uint | GPU_select_end () |
Caching | |
Support multiple begin/end's as long as they are within the initial region. Currently only used by ALGO_DEPTH_PICK. | |
| void | GPU_select_cache_begin () |
| void | GPU_select_cache_load_id () |
| void | GPU_select_cache_end () |
| bool | GPU_select_is_cached () |
Utilities | |
| const GPUSelectResult * | GPU_select_buffer_near (const blender::Span< GPUSelectResult > hit_results) |
| uint | GPU_select_buffer_remove_by_id (blender::MutableSpan< GPUSelectResult > hit_results, uint select_id) |
| void | GPU_select_buffer_stride_realign (const rcti *src, const rcti *dst, uint *r_buf) |
Internal Types | |
| enum | GPUSelectAlgo { ALGO_SAMPLE_QUERY = 1 , ALGO_DEPTH_PICK = 2 , ALGO_SELECT_NEXT = 3 } |
| static GPUSelectState | g_select_state = {false} |
Interface for accessing GPU-related methods for selection. The semantics are similar to glRenderMode(GL_SELECT) from older OpenGL versions.
Definition in file gpu_select.cc.
| enum GPUSelectAlgo |
| Enumerator | |
|---|---|
| ALGO_SAMPLE_QUERY | glBegin/EndQuery(GL_SAMPLES_PASSED... ), gpu_select_query.c Only sets 4th component (ID) correctly. |
| ALGO_DEPTH_PICK | Read depth buffer for every drawing pass and extract depths, gpu_select_pick.cc Only sets 4th component (ID) correctly. |
| ALGO_SELECT_NEXT | Use Select-Next draw engine. |
Definition at line 27 of file gpu_select.cc.
| void GPU_select_begin | ( | GPUSelectBuffer * | buffer, |
| const rcti * | input, | ||
| GPUSelectMode | mode, | ||
| int | oldhits ) |
Initialize and provide buffer for results.
Definition at line 140 of file gpu_select.cc.
References gpu_select_begin_ex(), and input.
Referenced by gizmo_find_intersected_3d_intern().
|
static |
Definition at line 70 of file gpu_select.cc.
References ALGO_DEPTH_PICK, ALGO_SAMPLE_QUERY, ALGO_SELECT_NEXT, BLI_assert, ELEM, g_select_state, GPU_SELECT_NEAREST_SECOND_PASS, gpu_select_next_begin(), GPU_SELECT_PICK_ALL, gpu_select_pick_begin(), gpu_select_pick_cache_begin(), GPU_SELECT_PICK_NEAREST, gpu_select_query_begin(), and input.
Referenced by GPU_select_begin(), and GPU_select_begin_next().
| void GPU_select_begin_next | ( | GPUSelectBuffer * | buffer, |
| const rcti * | input, | ||
| GPUSelectMode | mode, | ||
| int | oldhits ) |
Initialize and provide buffer for results. Uses the new Select-Next engine if enabled.
Definition at line 132 of file gpu_select.cc.
References gpu_select_begin_ex(), and input.
Referenced by drw_select_loop_pass(), and view3d_gpu_select_ex().
| const GPUSelectResult * GPU_select_buffer_near | ( | const blender::Span< GPUSelectResult > | hit_results | ) |
Helper function, nothing special but avoids doing inline since hits aren't sorted by depth and purpose of 4x buffer indices isn't so clear.
Note that comparing depth as uint is fine.
Definition at line 243 of file gpu_select.cc.
References BLI_assert.
Referenced by gizmo_find_intersected_3d_intern().
| uint GPU_select_buffer_remove_by_id | ( | blender::MutableSpan< GPUSelectResult > | hit_results, |
| uint | select_id ) |
Definition at line 257 of file gpu_select.cc.
Referenced by view3d_gpu_select_with_id_filter().
Part of the solution copied from rect_subregion_stride_calc.
Definition at line 276 of file gpu_select.cc.
References BLI_assert, BLI_rcti_size_x(), BLI_rcti_size_y(), i, x, rcti::xmax, rcti::xmin, y, rcti::ymax, and rcti::ymin.
Referenced by DRW_select_buffer_read().
| void GPU_select_cache_begin | ( | ) |
Definition at line 202 of file gpu_select.cc.
References BLI_assert, and g_select_state.
Referenced by view3d_gpu_select_cache_begin().
| void GPU_select_cache_end | ( | ) |
Definition at line 221 of file gpu_select.cc.
References ALGO_DEPTH_PICK, BLI_assert, g_select_state, and gpu_select_pick_cache_end().
Referenced by view3d_gpu_select_cache_end(), and view3d_gpu_select_ex().
| void GPU_select_cache_load_id | ( | ) |
Definition at line 213 of file gpu_select.cc.
References ALGO_DEPTH_PICK, BLI_assert, g_select_state, and gpu_select_pick_cache_load_id().
Referenced by view3d_gpu_select_ex().
| uint GPU_select_end | ( | ) |
Cleanup and flush selection results to buffer. Return number of hits and hits in buffer. if dopass is true, we will do a second pass with occlusion queries to get the closest hit.
Definition at line 168 of file gpu_select.cc.
References ALGO_SAMPLE_QUERY, ALGO_SELECT_NEXT, g_select_state, gpu_select_next_end(), gpu_select_pick_end(), and gpu_select_query_end().
Referenced by drw_select_loop_pass(), gizmo_find_intersected_3d_intern(), and view3d_gpu_select_ex().
| bool GPU_select_is_cached | ( | ) |
Definition at line 232 of file gpu_select.cc.
References g_select_state, and gpu_select_pick_is_cached().
Referenced by view3d_gpu_select_ex().
| bool GPU_select_load_id | ( | unsigned int | id | ) |
Loads a new selection id and ends previous query, if any. In second pass of selection it also returns if id has been hit on the first pass already. Thus we can skip drawing un-hit objects.
Definition at line 145 of file gpu_select.cc.
References ALGO_SAMPLE_QUERY, ALGO_SELECT_NEXT, BLI_assert_unreachable, g_select_state, gpu_select_pick_load_id(), and gpu_select_query_load_id().
Referenced by ed_gizmo_draw_preset_geometry(), gizmo_arrow_draw_select(), gizmo_button2d_draw_select(), gizmo_cage2d_draw_intern(), gizmo_cage3d_draw_intern(), gizmo_dial_draw_select(), gizmo_move_draw_select(), gizmo_primitive_draw_select(), and pygpu_select_load_id().
|
static |
Definition at line 62 of file gpu_select.cc.
Referenced by gpu_select_begin_ex(), GPU_select_cache_begin(), GPU_select_cache_end(), GPU_select_cache_load_id(), GPU_select_end(), GPU_select_is_cached(), and GPU_select_load_id().