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:
authorAntony Riakiotakis <kalast@gmail.com>2014-07-23 17:24:07 +0400
committerAntony Riakiotakis <kalast@gmail.com>2014-07-23 17:26:08 +0400
commit17021171f1b544aaa89d4776736255d8753e239c (patch)
treec5e61cf797b54ba77e65d05263503365a9acfc47 /source/blender/makesrna
parentcf9d5db75b4c8599b6669a49c40e40938ac6a34b (diff)
Occlusion Query based selection.
This patch creates an interface for selection mechanisms in opengl. This makes it possible to switch between occlusion query based or select rendermode based selection transparently. This is really useful on graphics drivers that do not accelerate the select rendermode path (some ATI cards are notorious for this, and the new path is used by default there), since occlusion queries are always hardware accelerated due to their use in games. The option can be found under system - selection. Auto just enables occlusion queries for ATI users while the rest of the options enforce one of the two methods always. There is just one known change, previous code enforced nearest bone to always get selected, even when mouse selecting near the same position, I couldn't replicate the behaviour though. patch by me with edits and review by Campbell. Thanks!
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index d43bd8c1ad4..cc1fb6f0410 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -91,6 +91,7 @@ EnumPropertyItem navigation_mode_items[] = {
#include "BKE_idprop.h"
#include "GPU_draw.h"
+#include "GPU_select.h"
#include "BLF_api.h"
@@ -332,6 +333,11 @@ static void rna_UserDef_viewport_lights_update(Main *bmain, Scene *scene, Pointe
rna_userdef_update(bmain, scene, ptr);
}
+static int rna_Scene_GPU_selection_supported(UserDef *UNUSED(U))
+{
+ return GPU_select_query_check_support();
+}
+
static void rna_userdef_autosave_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
wmWindowManager *wm = bmain->wm.first;
@@ -3588,7 +3594,9 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
static void rna_def_userdef_system(BlenderRNA *brna)
{
+ FunctionRNA *func;
PropertyRNA *prop;
+ PropertyRNA *parm;
StructRNA *srna;
static EnumPropertyItem gl_texture_clamp_items[] = {
@@ -3708,6 +3716,13 @@ static void rna_def_userdef_system(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};
+ static EnumPropertyItem gpu_select_method_items[] = {
+ {USER_SELECT_AUTO, "AUTO", 0, "Automatic", ""},
+ {USER_SELECT_USE_SELECT_RENDERMODE, "GL_SELECT", 0, "OpenGL Select", ""},
+ {USER_SELECT_USE_OCCLUSION_QUERY, "GL_QUERY", 0, "OpenGL Occlusion Queries", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
srna = RNA_def_struct(brna, "UserPreferencesSystem", NULL);
RNA_def_struct_sdna(srna, "UserDef");
RNA_def_struct_nested(brna, srna, "UserPreferences");
@@ -3950,7 +3965,16 @@ static void rna_def_userdef_system(BlenderRNA *brna)
RNA_def_property_boolean_negative_sdna(prop, NULL, "text_render", USER_TEXT_DISABLE_AA);
RNA_def_property_ui_text(prop, "Text Anti-aliasing", "Draw user interface text anti-aliased");
RNA_def_property_update(prop, 0, "rna_userdef_text_update");
-
+
+ func = RNA_def_function(srna, "is_occlusion_query_supported", "rna_Scene_GPU_selection_supported");
+ parm = RNA_def_boolean(func, "is_supported", 0, "Occlusion Query Support", "Check if GPU supports Occlusion Queries");
+ RNA_def_function_return(func, parm);
+
+ prop = RNA_def_property(srna, "select_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "gpu_select_method");
+ RNA_def_property_enum_items(prop, gpu_select_method_items);
+ RNA_def_property_ui_text(prop, "Selection Method", "Use OpenGL occlusion queries o selection rendermode to accelerate selection");
+
/* Full scene anti-aliasing */
prop = RNA_def_property(srna, "multi_sample", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "ogl_multisamples");