17#include "../intern/gpu_select_private.hh"
38 ID(uint32_t value) : value(value) {};
118 if (sub_object_id ==
uint(-1)) {
131 printf(
"%s : %u | %u = %u -> %u\n",
135 object_id | sub_object_id,
149 return {uint32_t(-1)};
281 hit_result.
depth = 0xFFFF;
282 hit_results.
append(hit_result);
297 float offset_depth = *
reinterpret_cast<float *
>(&hit_result.
depth) / 100.0f;
298 hit_result.
depth = *
reinterpret_cast<uint32_t *
>(&offset_depth);
300 hit_results.
append(hit_result);
315 const uint32_t depth_mask = 0x00FFFFFFu << 8u;
316 uint32_t offset_depth = ((hit_result.
depth & depth_mask) >> 8u) / 100;
317 hit_result.
depth &= ~depth_mask;
318 hit_result.
depth |= offset_depth << 8u;
320 if (hit_results.
is_empty() || hit_result.
depth < hit_results[0].depth) {
321 hit_results = {hit_result};
328 for (
auto &hit : hit_results) {
331 printf(
" hit: %u: depth %u\n", hit.id, hit.depth);
#define BLI_assert_unreachable()
MINLINE uint ceil_to_multiple_u(uint a, uint b)
MINLINE uint max_uu(uint a, uint b)
@ GPU_SELECT_NEAREST_SECOND_PASS
@ GPU_SELECT_NEAREST_FIRST_PASS
@ GPU_SELECT_PICK_NEAREST
@ GPU_BARRIER_BUFFER_UPDATE
void GPU_memory_barrier(GPUBarrier barrier)
void GPU_storagebuf_clear(blender::gpu::StorageBuf *ssbo, uint32_t clear_value)
void append(const T &value)
void state_set(DRWState state, int clip_plane_count=0)
void bind_ubo(const char *name, gpu::UniformBuf *buffer)
void bind_ssbo(const char *name, gpu::StorageBuf *buffer)
detail::PassBase< command::DrawCommandBuf > Sub
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()
detail::Pass< command::DrawCommandBuf > PassSimple
detail::Pass< command::DrawMultiBuf > PassMain
VecBase< int32_t, 2 > int2
ObjectRuntimeHandle * runtime
void select_append(ID select_id)
StorageVectorBuffer< uint32_t > select_buf
void select_bind(PassSimple::Sub &pass)
SelectBuf(const SelectionType selection_type)
const SelectionType selection_type
void select_bind(PassMain &pass, PassMain::Sub &sub)
Vector< std::string > map_names
UniformBuffer< SelectInfoData > info_buf
void select_bind(PassSimple &pass)
void begin_sync(int clipping_plane_count)
static const ID select_invalid_id()
StorageArrayBuffer< uint > select_output_buf
StorageArrayBuffer< uint, 4, true > dummy_select_buf
void select_bind(PassMain &pass)
const ID select_id(const ObjectRef &ob_ref, uint sub_object_id=0)
SelectMap(const SelectionType selection_type)
Vector< uint > select_id_map
const SelectionType selection_type
Vector< bool > in_front_map