Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/modes/object_mode.c
| Show First 20 Lines • Show All 2,972 Lines • ▼ Show 20 Lines | if (DRW_state_is_fbo()) { | ||||
| GPU_framebuffer_ensure_config(&fbl->ghost_fb, { | GPU_framebuffer_ensure_config(&fbl->ghost_fb, { | ||||
| GPU_ATTACHMENT_TEXTURE(ghost_depth_tx), | GPU_ATTACHMENT_TEXTURE(ghost_depth_tx), | ||||
| GPU_ATTACHMENT_TEXTURE(dtxl->color), | GPU_ATTACHMENT_TEXTURE(dtxl->color), | ||||
| }); | }); | ||||
| GPU_framebuffer_bind(fbl->ghost_fb); | GPU_framebuffer_bind(fbl->ghost_fb); | ||||
| GPU_framebuffer_clear_depth(fbl->ghost_fb, 1.0f); | GPU_framebuffer_clear_depth(fbl->ghost_fb, 1.0f); | ||||
| } | } | ||||
| else if (DRW_state_is_select()) { | |||||
| /* `glDepthRange` is not a perfect solution since very distant | |||||
| * geometries can still be occluded. | |||||
| * Also the depth test precision of these geometries is impaired. | |||||
| * However solves the selection for the vast majority of cases. */ | |||||
| glDepthRange(0.0, 0.01); | |||||
fclem: The rule of thumb is to avoid gl* calls directly in the engines. Instead use a wrapper inside… | |||||
| } | |||||
| DRW_draw_pass(stl->g_data->sgl_ghost.spot_shapes); | DRW_draw_pass(stl->g_data->sgl_ghost.spot_shapes); | ||||
| DRW_draw_pass(stl->g_data->sgl_ghost.bone_solid); | DRW_draw_pass(stl->g_data->sgl_ghost.bone_solid); | ||||
| DRW_draw_pass(stl->g_data->sgl_ghost.bone_wire); | DRW_draw_pass(stl->g_data->sgl_ghost.bone_wire); | ||||
| DRW_draw_pass(stl->g_data->sgl_ghost.bone_outline); | DRW_draw_pass(stl->g_data->sgl_ghost.bone_outline); | ||||
| DRW_draw_pass(stl->g_data->sgl_ghost.non_meshes); | DRW_draw_pass(stl->g_data->sgl_ghost.non_meshes); | ||||
| DRW_draw_pass(stl->g_data->sgl_ghost.bone_axes); | DRW_draw_pass(stl->g_data->sgl_ghost.bone_axes); | ||||
| if (DRW_state_is_select()) { | |||||
| glDepthRange(0.0, 1.0); | |||||
| } | |||||
| } | } | ||||
| batch_camera_path_free(&stl->g_data->sgl_ghost.camera_path); | batch_camera_path_free(&stl->g_data->sgl_ghost.camera_path); | ||||
| /* This has to be freed only after drawing empties! */ | /* This has to be freed only after drawing empties! */ | ||||
| if (stl->g_data->sgl_ghost.image_plane_map) { | if (stl->g_data->sgl_ghost.image_plane_map) { | ||||
| BLI_ghash_free(stl->g_data->sgl_ghost.image_plane_map, NULL, MEM_freeN); | BLI_ghash_free(stl->g_data->sgl_ghost.image_plane_map, NULL, MEM_freeN); | ||||
| stl->g_data->sgl_ghost.image_plane_map = NULL; | stl->g_data->sgl_ghost.image_plane_map = NULL; | ||||
| } | } | ||||
| Show All 20 Lines | |||||
The rule of thumb is to avoid gl* calls directly in the engines. Instead use a wrapper inside the GPU module. This will make things easier if we one day decide to implement other backends.