diff options
author | Jorge Bernal <jbernalmartinez@gmail.com> | 2015-03-22 20:13:53 +0300 |
---|---|---|
committer | Jorge Bernal <jbernalmartinez@gmail.com> | 2015-03-22 20:19:49 +0300 |
commit | e7d051043dc82c2991eb491e0630d9b1065934c3 (patch) | |
tree | 83e6c88e2ebdfca3ffb50814d66c525c5d5bb231 /source/blender/makesrna/intern | |
parent | 0b4a71b07245d5370a02fae4dbde9195c9c58881 (diff) |
BGE: New hysteresis offset to improve LOD level transitions
This change introduces a new hysteresis parameter that it will be added
or subtracted to/from the LOD distance to avoid popping when a LOD
object moves close to the LOD transition continuously.
Then, we have the following:
- a new LOD Hysteresis setting per scene (default 10%) which is located
in Scene context --> Level of Detail panel. This scene parameter also
will active/deactive the scene hysteresis.
- and a new LOD Hysteresis setting per object (default 10%) which is
located in Object context --> Levels of Detail panel. The LOD hysteresis
setting per object (if active) will overwrite the hysteresis setting per
scene value.
For the new blends: the hysteresis setting per scene would be active by
default and the per object would be inactive by default.
For the old blends: both hysteresis settings (per scene and per object)
would be inactive by default. A quick way to take advantage of this
feature for old blends would be to activate the hysteresis parameter in
the scene context -> Level of Detail panel
Reviewers: campbellbarton, kupoman, moguri
Reviewed By: kupoman, moguri
Subscribers: nonamejuju, lordodin
Differential Revision: https://developer.blender.org/D957
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 13 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 14 |
2 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index d8aa659b68e..a49388866a6 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -2089,6 +2089,14 @@ static void rna_def_object_lodlevel(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Distance", "Distance to begin using this level of detail"); RNA_def_property_update(prop, NC_OBJECT | ND_LOD, "rna_Object_lod_distance_update"); + prop = RNA_def_property(srna, "object_hysteresis_percentage", PROP_INT, PROP_PERCENTAGE); + RNA_def_property_int_sdna(prop, NULL, "obhysteresis"); + RNA_def_property_range(prop, 0, 100); + RNA_def_property_ui_range(prop, 0, 100, 10, 1); + RNA_def_property_ui_text(prop, "Hysteresis %", "Minimum distance change required to transition to the previous" + " level of detail"); + RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL); + prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "source"); RNA_def_property_struct_type(prop, "Object"); @@ -2107,6 +2115,11 @@ static void rna_def_object_lodlevel(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Use Material", "Use the material from this object at this level of detail"); RNA_def_property_ui_icon(prop, ICON_MATERIAL, 0); RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL); + + prop = RNA_def_property(srna, "use_object_hysteresis", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", OB_LOD_USE_HYST); + RNA_def_property_ui_text(prop, "Hysteresis Override", "Override LoD Hysteresis scene setting for this Lod Level"); + RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL); } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 2e941487e98..a0a0eedcfed 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -3886,6 +3886,20 @@ static void rna_def_scene_game_data(BlenderRNA *brna) /* Nestled Data */ rna_def_scene_game_recast_data(brna); + + /* LoD */ + prop = RNA_def_property(srna, "use_scene_hysteresis", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "lodflag", SCE_LOD_USE_HYST); + RNA_def_property_ui_text(prop, "Hysteresis", "Use LoD Hysteresis setting for the scene"); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop = RNA_def_property(srna, "scene_hysteresis_percentage", PROP_INT, PROP_PERCENTAGE); + RNA_def_property_int_sdna(prop, NULL, "scehysteresis"); + RNA_def_property_range(prop, 0, 100); + RNA_def_property_ui_range(prop, 0, 100, 10, 1); + RNA_def_property_ui_text(prop, "Hysteresis %", "Minimum distance change required to transition to the previous" + " level of detail"); + RNA_def_property_update(prop, NC_SCENE, NULL); } static void rna_def_gpu_dof_fx(BlenderRNA *brna) |