Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/draw/engines/select/select_draw_utils.c')
-rw-r--r--source/blender/draw/engines/select/select_draw_utils.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/source/blender/draw/engines/select/select_draw_utils.c b/source/blender/draw/engines/select/select_draw_utils.c
index c3615cb5a81..c3ee7f962a1 100644
--- a/source/blender/draw/engines/select/select_draw_utils.c
+++ b/source/blender/draw/engines/select/select_draw_utils.c
@@ -40,6 +40,37 @@
/** \name Draw Utilities
* \{ */
+void draw_select_framebuffer_select_id_setup(struct SELECTID_Context *select_ctx)
+{
+ DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
+ int size[2];
+ size[0] = GPU_texture_width(dtxl->depth);
+ size[1] = GPU_texture_height(dtxl->depth);
+
+ if (select_ctx->framebuffer_select_id == NULL) {
+ select_ctx->framebuffer_select_id = GPU_framebuffer_create();
+ }
+
+ if ((select_ctx->texture_u32 != NULL) &&
+ ((GPU_texture_width(select_ctx->texture_u32) != size[0]) ||
+ (GPU_texture_height(select_ctx->texture_u32) != size[1]))) {
+ GPU_texture_free(select_ctx->texture_u32);
+ select_ctx->texture_u32 = NULL;
+ }
+
+ /* Make sure the depth texture is attached.
+ * It may disappear when loading another Blender session. */
+ GPU_framebuffer_texture_attach(select_ctx->framebuffer_select_id, dtxl->depth, 0, 0);
+
+ if (select_ctx->texture_u32 == NULL) {
+ select_ctx->texture_u32 = GPU_texture_create_2d(size[0], size[1], GPU_R32UI, NULL, NULL);
+ GPU_framebuffer_texture_attach(
+ select_ctx->framebuffer_select_id, select_ctx->texture_u32, 0, 0);
+
+ GPU_framebuffer_check_valid(select_ctx->framebuffer_select_id, NULL);
+ }
+}
+
short select_id_get_object_select_mode(Scene *scene, Object *ob)
{
short r_select_mode = 0;
@@ -179,6 +210,9 @@ static void draw_select_id_mesh(SELECTID_StorageList *stl,
DRW_shgroup_call(vert_shgrp, geom_verts, ob);
*r_vert_offset = *r_edge_offset + me->totvert;
}
+ else {
+ *r_vert_offset = *r_edge_offset;
+ }
}
void select_id_draw_object(void *vedata,