Blender
V3.3
|
#include <stdlib.h>
#include <string.h>
#include "GPU_select.h"
#include "BLI_rect.h"
#include "BLI_utildefines.h"
#include "gpu_select_private.h"
Go to the source code of this file.
Classes | |
struct | GPUSelectState |
Functions | |
Public API | |
void | GPU_select_begin (GPUSelectResult *buffer, const uint buffer_len, const rcti *input, eGPUSelectMode mode, int oldhits) |
bool | GPU_select_load_id (uint id) |
uint | GPU_select_end (void) |
Caching | |
Support multiple begin/end's as long as they are within the initial region. Currently only used by ALGO_GL_PICK. | |
void | GPU_select_cache_begin (void) |
void | GPU_select_cache_load_id (void) |
void | GPU_select_cache_end (void) |
bool | GPU_select_is_cached (void) |
Utilities | |
const GPUSelectResult * | GPU_select_buffer_near (const GPUSelectResult *buffer, int hits) |
uint | GPU_select_buffer_remove_by_id (GPUSelectResult *buffer, int hits, uint select_id) |
void | GPU_select_buffer_stride_realign (const rcti *src, const rcti *dst, uint *r_buf) |
Internal Types | |
enum | eGPUSelectAlgo { ALGO_GL_QUERY = 1 , ALGO_GL_PICK = 2 } |
typedef enum eGPUSelectAlgo | eGPUSelectAlgo |
typedef struct GPUSelectState | GPUSelectState |
static GPUSelectState | g_select_state = {0} |
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.c.
typedef enum eGPUSelectAlgo eGPUSelectAlgo |
typedef struct GPUSelectState GPUSelectState |
enum eGPUSelectAlgo |
Enumerator | |
---|---|
ALGO_GL_QUERY | glBegin/EndQuery(GL_SAMPLES_PASSED... ), |
ALGO_GL_PICK | Read depth buffer for every drawing pass and extract depths, |
Definition at line 26 of file gpu_select.c.
void GPU_select_begin | ( | GPUSelectResult * | buffer, |
const uint | buffer_len, | ||
const rcti * | input, | ||
eGPUSelectMode | mode, | ||
int | oldhits | ||
) |
Definition at line 63 of file gpu_select.c.
References ALGO_GL_PICK, ALGO_GL_QUERY, GPUSelectState::algorithm, BLI_assert, buffer, ELEM, g_select_state, GPU_SELECT_NEAREST_SECOND_PASS, GPU_SELECT_PICK_ALL, gpu_select_pick_begin(), gpu_select_pick_cache_begin(), GPU_SELECT_PICK_NEAREST, gpu_select_query_begin(), input, GPUSelectState::mode, GPUSelectState::select_is_active, GPUSelectState::use_cache, and GPUSelectState::use_cache_needs_init.
const GPUSelectResult* GPU_select_buffer_near | ( | const GPUSelectResult * | buffer, |
int | hits | ||
) |
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 206 of file gpu_select.c.
References BLI_assert, buffer, and NULL.
Referenced by gizmo_find_intersected_3d_intern().
uint GPU_select_buffer_remove_by_id | ( | GPUSelectResult * | buffer, |
int | hits, | ||
uint | select_id | ||
) |
Definition at line 221 of file gpu_select.c.
References buffer, and GPUSelectResult::id.
Referenced by view3d_opengl_select_with_id_filter().
Definition at line 239 of file gpu_select.c.
References BLI_assert, BLI_rcti_size_x(), BLI_rcti_size_y(), src, x, rcti::xmax, rcti::xmin, y, rcti::ymax, and rcti::ymin.
Definition at line 165 of file gpu_select.c.
References BLI_assert, g_select_state, GPUSelectState::select_is_active, and GPUSelectState::use_cache_needs_init.
Referenced by view3d_opengl_select_cache_begin().
Definition at line 184 of file gpu_select.c.
References ALGO_GL_PICK, GPUSelectState::algorithm, BLI_assert, g_select_state, gpu_select_pick_cache_end(), GPUSelectState::use_cache, and GPUSelectState::use_cache_needs_init.
Referenced by view3d_opengl_select_cache_end(), and view3d_opengl_select_ex().
Definition at line 176 of file gpu_select.c.
References ALGO_GL_PICK, GPUSelectState::algorithm, BLI_assert, g_select_state, gpu_select_pick_cache_load_id(), and GPUSelectState::use_cache.
Referenced by view3d_opengl_select_ex().
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 135 of file gpu_select.c.
References ALGO_GL_QUERY, GPUSelectState::algorithm, g_select_state, gpu_select_pick_end(), gpu_select_query_end(), and GPUSelectState::select_is_active.
Referenced by drw_select_loop_pass(), gizmo_find_intersected_3d_intern(), and view3d_opengl_select_ex().
Definition at line 195 of file gpu_select.c.
References g_select_state, gpu_select_pick_is_cached(), and GPUSelectState::use_cache.
Referenced by view3d_opengl_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 117 of file gpu_select.c.
References ALGO_GL_QUERY, GPUSelectState::algorithm, g_select_state, gpu_select_pick_load_id(), gpu_select_query_load_id(), and GPUSelectState::select_is_active.
Referenced by draw_call_single_do(), draw_select_buffer(), ED_gizmo_draw_preset_facemap(), 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(), and gizmo_primitive_draw_select().
|
static |
Definition at line 55 of file gpu_select.c.
Referenced by GPU_select_begin(), 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().