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:
authorJorge Bernal <jbernalmartinez@gmail.com>2015-03-22 20:13:53 +0300
committerJorge Bernal <jbernalmartinez@gmail.com>2015-03-22 20:19:49 +0300
commite7d051043dc82c2991eb491e0630d9b1065934c3 (patch)
tree83e6c88e2ebdfca3ffb50814d66c525c5d5bb231 /source/blender/blenloader
parent0b4a71b07245d5370a02fae4dbde9195c9c58881 (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/blenloader')
-rw-r--r--source/blender/blenloader/intern/versioning_270.c18
-rw-r--r--source/blender/blenloader/intern/versioning_defaults.c3
2 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index adf5f93ae16..0853c93750c 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -654,5 +654,23 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
}
}
}
+
+ /* hysteresis setted to 10% but not actived */
+ if (!DNA_struct_elem_find(fd->filesdna, "LodLevel", "int", "obhysteresis")) {
+ Object* ob;
+ for (ob = main->object.first; ob; ob = ob->id.next) {
+ LodLevel *level;
+ for (level = ob->lodlevels.first; level; level = level->next) {
+ level->obhysteresis = 10;
+ }
+ }
+ }
+
+ if (!DNA_struct_elem_find(fd->filesdna, "GameData", "int", "scehysteresis")) {
+ Scene *scene;
+ for (scene = main->scene.first; scene; scene = scene->id.next) {
+ scene->gm.scehysteresis = 10;
+ }
+ }
}
}
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index 4c7b011097b..d320b305c06 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -92,6 +92,9 @@ void BLO_update_defaults_startup_blend(Main *bmain)
sculpt->detail_size = 12;
}
}
+
+ scene->gm.lodflag |= SCE_LOD_USE_HYST;
+ scene->gm.scehysteresis = 10;
}
for (linestyle = bmain->linestyle.first; linestyle; linestyle = linestyle->id.next) {