23 #define SELECT_ENGINE "SELECT_ENGINE"
102 float viewmat[4][4], winmat[4][4], winmat_subregion[4][4];
107 e_data.context.last_rect.xmin,
108 e_data.context.last_rect.xmax,
109 e_data.context.last_rect.ymin,
110 e_data.context.last_rect.ymax,
131 if (
e_data.context.select_mode == -1) {
170 if (!
e_data.context.is_dirty) {
173 for (
uint i =
e_data.context.objects_drawn_len; i--; ob++) {
177 e_data.context.is_dirty =
true;
182 if (
e_data.context.is_dirty) {
185 e_data.context.objects_drawn_len = 0;
186 e_data.context.index_drawn_len = 1;
189 GPU_framebuffer_clear_color_depth(
e_data.framebuffer_select_id, (
const float[4]){0.0f}, 1.0f);
191 e_data.runtime_new_objects = 0;
211 #ifdef USE_CAGE_OCCLUSION
235 if (sel_data ==
NULL) {
244 &
e_data.context.index_offsets[
e_data.context.objects_drawn_len];
250 e_data.context.select_mode,
257 e_data.context.index_drawn_len = ob_offsets->
vert;
258 e_data.context.objects_drawn[
e_data.context.objects_drawn_len] = ob;
259 e_data.context.objects_drawn_len++;
260 e_data.runtime_new_objects++;
272 if (!
e_data.runtime_new_objects) {
304 for (
int sh_data_index = 0; sh_data_index <
ARRAY_SIZE(
e_data.sh_data); sh_data_index++) {
311 GPU_FRAMEBUFFER_FREE_SAFE(
e_data.framebuffer_select_id);
377 return e_data.framebuffer_select_id;
382 return e_data.texture_u32;
typedef float(TangentPoint)[2]
void projmat_from_subregion(const float projmat[4][4], const int win_size[2], int x_min, int x_max, int y_min, int y_max, float r_projmat[4][4])
void copy_m4_m4(float m1[4][4], const float m2[4][4])
bool compare_m4m4(const float mat1[4][4], const float mat2[4][4], float limit)
#define SCE_SELECT_VERTEX
#define RV3D_CLIPPING_ENABLED(v3d, rv3d)
@ DRW_STATE_FIRST_VERTEX_CONVENTION
#define DRW_SHADER_FREE_SAFE(shader)
#define DRW_PASS_CREATE(pass, state)
#define DRW_shgroup_call_obmat(shgroup, geom, obmat)
#define DRW_STATE_DEFAULT
#define DRW_VIEWPORT_DATA_SIZE(ty)
#define DRW_TEXTURE_FREE_SAFE(tex)
struct GPUFrameBuffer GPUFrameBuffer
bool GPU_framebuffer_check_valid(GPUFrameBuffer *fb, char err_out[256])
void GPU_framebuffer_bind(GPUFrameBuffer *fb)
GPUFrameBuffer * GPU_framebuffer_create(const char *name)
GPUShader * GPU_shader_create_from_info_name(const char *info_name)
#define GPU_SHADER_CFG_LEN
int GPU_texture_height(const GPUTexture *tex)
struct GPUTexture GPUTexture
int GPU_texture_width(const GPUTexture *tex)
void GPU_texture_free(GPUTexture *tex)
GPUTexture * GPU_texture_create_2d(const char *name, int w, int h, int mip_len, eGPUTextureFormat format, const float *data)
#define RE_USE_STEREO_VIEWPORT
#define RE_USE_GPU_CONTEXT
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
struct GPUBatch * DRW_mesh_batch_cache_get_triangles_with_select_id(struct Mesh *me)
struct GPUBatch * DRW_mesh_batch_cache_get_edges_with_select_id(struct Mesh *me)
struct GPUBatch * DRW_mesh_batch_cache_get_verts_with_select_id(struct Mesh *me)
struct GPUBatch * DRW_mesh_batch_cache_get_surface(struct Mesh *me)
DRWView * DRW_view_create_with_zoffset(const DRWView *parent_view, const RegionView3D *rv3d, float offset)
DrawData * DRW_drawdata_ensure(ID *id, DrawEngineType *engine_type, size_t size, DrawDataInitCb init_cb, DrawDataFreeCb free_cb)
DefaultFramebufferList * DRW_viewport_framebuffer_list_get(void)
const DRWContextState * DRW_context_state_get(void)
DrawData * DRW_drawdata_get(ID *id, DrawEngineType *engine_type)
DefaultTextureList * DRW_viewport_texture_list_get(void)
void DRW_shgroup_uniform_float_copy(DRWShadingGroup *shgroup, const char *name, const float value)
const DRWView * DRW_view_default_get(void)
void DRW_view_winmat_get(const DRWView *view, float mat[4][4], bool inverse)
void DRW_shgroup_uniform_int_copy(DRWShadingGroup *shgroup, const char *name, const int value)
bool DRW_pass_is_empty(DRWPass *pass)
DRWView * DRW_view_create(const float viewmat[4][4], const float winmat[4][4], const float(*culling_viewmat)[4], const float(*culling_winmat)[4], DRWCallVisibilityFn *visibility_fn)
DRWShadingGroup * DRW_shgroup_create(struct GPUShader *shader, DRWPass *pass)
void DRW_view_viewmat_get(const DRWView *view, float mat[4][4], bool inverse)
void DRW_draw_pass(DRWPass *pass)
void DRW_view_set_active(const DRWView *view)
bool DRW_culling_min_max_test(const DRWView *view, float obmat[4][4], float min[3], float max[3])
void GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, int slot, int mip)
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
ccl_gpu_kernel_postfix ccl_global float int int int int sh
void *(* MEM_mallocN)(size_t len, const char *str)
short select_id_get_object_select_mode(Scene *scene, Object *ob)
void select_id_object_min_max(Object *obj, float r_min[3], float r_max[3])
void select_id_draw_object(void *vedata, View3D *v3d, Object *ob, short select_mode, uint initial_offset, uint *r_vert_offset, uint *r_edge_offset, uint *r_face_offset)
DrawEngineType draw_engine_select_type
struct GPUTexture * texture_u32
SELECTID_Shaders sh_data[GPU_SHADER_CFG_LEN]
struct SELECTID_Context * DRW_select_engine_context_get(void)
struct GPUFrameBuffer * framebuffer_select_id
static void select_cache_populate(void *vedata, Object *ob)
static void select_cache_init(void *vedata)
RenderEngineType DRW_engine_viewport_select_type
GPUFrameBuffer * DRW_engine_select_framebuffer_get(void)
static void select_engine_framebuffer_setup(void)
static const DrawEngineDataSize select_data_size
static void select_engine_free(void)
static struct @268 e_data
GPUTexture * DRW_engine_select_texture_get(void)
static void select_draw_scene(void *vedata)
static void select_engine_init(void *vedata)
struct SELECTID_Context context
struct RegionView3D * rv3d
struct GPUFrameBuffer * depth_only_fb
struct GPUTexture * depth
struct DRWPass * depth_only_pass
struct DRWPass * select_id_vert_pass
struct DRWPass * select_id_face_pass
struct DRWPass * select_id_edge_pass
DRWShadingGroup * shgrp_face_unif
DRWShadingGroup * shgrp_edge
DRWShadingGroup * shgrp_depth_only
DRWShadingGroup * shgrp_face_flat
DRWShadingGroup * shgrp_vert
struct GPUShader * select_id_uniform
struct GPUShader * select_id_flat
struct SELECTID_PrivateData * g_data