浏览代码

Merge pull request #38338 from RandomShaper/time_rollback_3.2

Improve shader time roll over (3.2)
Rémi Verschelde 5 年之前
父节点
当前提交
da68cece7f
共有 3 个文件被更改,包括 6 次插入7 次删除
  1. 2 3
      drivers/gles2/rasterizer_gles2.cpp
  2. 1 4
      drivers/gles3/rasterizer_gles3.cpp
  3. 3 0
      servers/visual_server.cpp

+ 2 - 3
drivers/gles2/rasterizer_gles2.cpp

@@ -277,9 +277,8 @@ void RasterizerGLES2::begin_frame(double frame_step) {
 		frame_step = 0.001;
 	}
 
-	// double time_roll_over = GLOBAL_GET("rendering/limits/time/time_rollover_secs");
-	// if (time_total > time_roll_over)
-	//	time_total = 0; //roll over every day (should be customz
+	double time_roll_over = GLOBAL_GET("rendering/limits/time/time_rollover_secs");
+	time_total = Math::fmod(time_total, time_roll_over);
 
 	storage->frame.time[0] = time_total;
 	storage->frame.time[1] = Math::fmod(time_total, 3600);

+ 1 - 4
drivers/gles3/rasterizer_gles3.cpp

@@ -202,8 +202,7 @@ void RasterizerGLES3::begin_frame(double frame_step) {
 	}
 
 	double time_roll_over = GLOBAL_GET("rendering/limits/time/time_rollover_secs");
-	if (time_total > time_roll_over)
-		time_total = 0; //roll over every day (should be customz
+	time_total = Math::fmod(time_total, time_roll_over);
 
 	storage->frame.time[0] = time_total;
 	storage->frame.time[1] = Math::fmod(time_total, 3600);
@@ -418,8 +417,6 @@ void RasterizerGLES3::register_config() {
 
 	GLOBAL_DEF("rendering/quality/filters/anisotropic_filter_level", 4);
 	ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/filters/anisotropic_filter_level", PropertyInfo(Variant::INT, "rendering/quality/filters/anisotropic_filter_level", PROPERTY_HINT_RANGE, "1,16,1"));
-	GLOBAL_DEF("rendering/limits/time/time_rollover_secs", 3600);
-	ProjectSettings::get_singleton()->set_custom_property_info("rendering/limits/time/time_rollover_secs", PropertyInfo(Variant::REAL, "rendering/limits/time/time_rollover_secs", PROPERTY_HINT_RANGE, "0,10000,1,or_greater"));
 }
 
 RasterizerGLES3::RasterizerGLES3() {

+ 3 - 0
servers/visual_server.cpp

@@ -2378,6 +2378,9 @@ VisualServer::VisualServer() {
 	GLOBAL_DEF_RST("rendering/vram_compression/import_etc2", true);
 	GLOBAL_DEF_RST("rendering/vram_compression/import_pvrtc", false);
 
+	GLOBAL_DEF("rendering/limits/time/time_rollover_secs", 3600);
+	ProjectSettings::get_singleton()->set_custom_property_info("rendering/limits/time/time_rollover_secs", PropertyInfo(Variant::REAL, "rendering/limits/time/time_rollover_secs", PROPERTY_HINT_RANGE, "0,10000,1,or_greater"));
+
 	GLOBAL_DEF("rendering/quality/directional_shadow/size", 4096);
 	GLOBAL_DEF("rendering/quality/directional_shadow/size.mobile", 2048);
 	ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/directional_shadow/size", PropertyInfo(Variant::INT, "rendering/quality/directional_shadow/size", PROPERTY_HINT_RANGE, "256,16384"));