Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/modes/object_mode.c
| Show First 20 Lines • Show All 2,958 Lines • ▼ Show 20 Lines | // DRW_draw_pass(psl->bone_envelope); /* Never drawn in Object mode currently. */ | ||||
| batch_camera_path_free(&stl->g_data->sgl.camera_path); | batch_camera_path_free(&stl->g_data->sgl.camera_path); | ||||
| if (!DRW_pass_is_empty(stl->g_data->sgl_ghost.bone_solid) || | if (!DRW_pass_is_empty(stl->g_data->sgl_ghost.bone_solid) || | ||||
| !DRW_pass_is_empty(stl->g_data->sgl_ghost.bone_wire) || | !DRW_pass_is_empty(stl->g_data->sgl_ghost.bone_wire) || | ||||
| !DRW_pass_is_empty(stl->g_data->sgl_ghost.bone_outline) || | !DRW_pass_is_empty(stl->g_data->sgl_ghost.bone_outline) || | ||||
| !DRW_pass_is_empty(stl->g_data->sgl_ghost.non_meshes) || | !DRW_pass_is_empty(stl->g_data->sgl_ghost.non_meshes) || | ||||
| !DRW_pass_is_empty(stl->g_data->sgl_ghost.bone_axes)) | !DRW_pass_is_empty(stl->g_data->sgl_ghost.bone_axes)) | ||||
| { | { | ||||
| if (DRW_state_is_fbo()) { | GPUFrameBuffer *fbo_prev = NULL; | ||||
| if (DRW_state_is_fbo() || DRW_state_is_select()) { | |||||
| fbo_prev = GPU_framebuffer_active_get(); | |||||
| /* meh, late init to not request a depth buffer we won't use. */ | /* meh, late init to not request a depth buffer we won't use. */ | ||||
| const float *viewport_size = DRW_viewport_size_get(); | const float *viewport_size = DRW_viewport_size_get(); | ||||
| const int size[2] = {(int)viewport_size[0], (int)viewport_size[1]}; | const int size[2] = {(int)viewport_size[0], (int)viewport_size[1]}; | ||||
| GPUTexture *ghost_depth_tx = DRW_texture_pool_query_2D(size[0], size[1], GPU_DEPTH_COMPONENT24, &draw_engine_object_type); | GPUTexture *ghost_depth_tx = DRW_texture_pool_query_2D(size[0], size[1], GPU_DEPTH_COMPONENT24, &draw_engine_object_type); | ||||
| BLI_assert(DRW_state_is_select() == (dtxl->color == NULL)); | |||||
| 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); | ||||
| } | } | ||||
| 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); | ||||
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.bone_axes); | DRW_draw_pass(stl->g_data->sgl_ghost.bone_axes); | ||||
| if (fbo_prev) { | |||||
| /* restore */ | |||||
| GPU_framebuffer_bind(fbo_prev); | |||||
| } | |||||
| } | } | ||||
| 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.