Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/view3d_view.c
| Show First 20 Lines • Show All 1,164 Lines • ▼ Show 20 Lines | |||||
| /** | /** | ||||
| * \warning be sure to account for a negative return value | * \warning be sure to account for a negative return value | ||||
| * This is an error, "Too many objects in select buffer" | * This is an error, "Too many objects in select buffer" | ||||
| * and no action should be taken (can crash blender) if this happens | * and no action should be taken (can crash blender) if this happens | ||||
| * | * | ||||
| * \note (vc->obedit == NULL) can be set to explicitly skip edit-object selection. | * \note (vc->obedit == NULL) can be set to explicitly skip edit-object selection. | ||||
| */ | */ | ||||
| short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int bufsize, const rcti *input, bool do_nearest) | short view3d_opengl_select( | ||||
| ViewContext *vc, unsigned int *buffer, unsigned int bufsize, const rcti *input, | |||||
| bool do_nearest) | |||||
| { | { | ||||
| Scene *scene = vc->scene; | Scene *scene = vc->scene; | ||||
| View3D *v3d = vc->v3d; | View3D *v3d = vc->v3d; | ||||
| ARegion *ar = vc->ar; | ARegion *ar = vc->ar; | ||||
| rctf rect; | rctf rect; | ||||
| short hits; | short hits; | ||||
| const bool use_obedit_skip = (scene->obedit != NULL) && (vc->obedit == NULL); | const bool use_obedit_skip = (scene->obedit != NULL) && (vc->obedit == NULL); | ||||
| const bool do_passes = do_nearest && GPU_select_query_check_active(); | const bool do_passes = do_nearest && GPU_select_query_check_active(); | ||||
| Show All 17 Lines | short view3d_opengl_select( | ||||
| if (v3d->drawtype > OB_WIRE) { | if (v3d->drawtype > OB_WIRE) { | ||||
| v3d->zbuf = true; | v3d->zbuf = true; | ||||
| glEnable(GL_DEPTH_TEST); | glEnable(GL_DEPTH_TEST); | ||||
| } | } | ||||
| if (vc->rv3d->rflag & RV3D_CLIPPING) | if (vc->rv3d->rflag & RV3D_CLIPPING) | ||||
| ED_view3d_clipping_set(vc->rv3d); | ED_view3d_clipping_set(vc->rv3d); | ||||
| if (do_passes) | if (do_nearest) { | ||||
| GPU_select_begin(buffer, bufsize, &rect, GPU_SELECT_NEAREST_DEPTH_SORT, 0); | |||||
| } | |||||
| else if (do_passes) { | |||||
| /* XXX, this wont run currently with GPU_SELECT_NEAREST_DEPTH_SORT above */ | |||||
| GPU_select_begin(buffer, bufsize, &rect, GPU_SELECT_NEAREST_FIRST_PASS, 0); | GPU_select_begin(buffer, bufsize, &rect, GPU_SELECT_NEAREST_FIRST_PASS, 0); | ||||
| else | } | ||||
| else { | |||||
| GPU_select_begin(buffer, bufsize, &rect, GPU_SELECT_ALL, 0); | GPU_select_begin(buffer, bufsize, &rect, GPU_SELECT_ALL, 0); | ||||
| } | |||||
| view3d_select_loop(vc, scene, v3d, ar, use_obedit_skip); | view3d_select_loop(vc, scene, v3d, ar, use_obedit_skip); | ||||
| hits = GPU_select_end(); | hits = GPU_select_end(); | ||||
| /* second pass, to get the closest object to camera */ | /* second pass, to get the closest object to camera */ | ||||
| if (do_passes) { | if (do_passes) { | ||||
| GPU_select_begin(buffer, bufsize, &rect, GPU_SELECT_NEAREST_SECOND_PASS, hits); | GPU_select_begin(buffer, bufsize, &rect, GPU_SELECT_NEAREST_SECOND_PASS, hits); | ||||
| ▲ Show 20 Lines • Show All 750 Lines • Show Last 20 Lines | |||||