|
@@ -184,10 +184,12 @@ void MovieWriter::set_extensions_hint() {
|
|
|
|
|
|
void MovieWriter::add_frame() {
|
|
|
const int movie_time_seconds = Engine::get_singleton()->get_frames_drawn() / fps;
|
|
|
- const String movie_time = vformat("%s:%s:%s",
|
|
|
- String::num(movie_time_seconds / 3600).pad_zeros(2),
|
|
|
- String::num((movie_time_seconds % 3600) / 60).pad_zeros(2),
|
|
|
- String::num(movie_time_seconds % 60).pad_zeros(2));
|
|
|
+ const int frame_remainder = Engine::get_singleton()->get_frames_drawn() % fps;
|
|
|
+ const String movie_time = vformat("%s:%s:%s:%s",
|
|
|
+ String::num(movie_time_seconds / 3600, 0).pad_zeros(2),
|
|
|
+ String::num((movie_time_seconds % 3600) / 60, 0).pad_zeros(2),
|
|
|
+ String::num(movie_time_seconds % 60, 0).pad_zeros(2),
|
|
|
+ String::num(frame_remainder, 0).pad_zeros(2));
|
|
|
|
|
|
#ifdef DEBUG_ENABLED
|
|
|
DisplayServer::get_singleton()->window_set_title(vformat("MovieWriter: Frame %d (time: %s) - %s (DEBUG)", Engine::get_singleton()->get_frames_drawn(), movie_time, project_name));
|
|
@@ -216,7 +218,7 @@ void MovieWriter::end() {
|
|
|
write_end();
|
|
|
|
|
|
// Print a report with various statistics.
|
|
|
- print_line("----------------");
|
|
|
+ print_line("--------------------------------------------------------------------------------");
|
|
|
String movie_path = Engine::get_singleton()->get_write_movie_path();
|
|
|
if (movie_path.is_relative_path()) {
|
|
|
// Print absolute path to make finding the file easier,
|
|
@@ -226,19 +228,21 @@ void MovieWriter::end() {
|
|
|
print_line(vformat("Done recording movie at path: %s", movie_path));
|
|
|
|
|
|
const int movie_time_seconds = Engine::get_singleton()->get_frames_drawn() / fps;
|
|
|
- const String movie_time = vformat("%s:%s:%s",
|
|
|
- String::num(movie_time_seconds / 3600).pad_zeros(2),
|
|
|
- String::num((movie_time_seconds % 3600) / 60).pad_zeros(2),
|
|
|
- String::num(movie_time_seconds % 60).pad_zeros(2));
|
|
|
+ const int frame_remainder = Engine::get_singleton()->get_frames_drawn() % fps;
|
|
|
+ const String movie_time = vformat("%s:%s:%s:%s",
|
|
|
+ String::num(movie_time_seconds / 3600, 0).pad_zeros(2),
|
|
|
+ String::num((movie_time_seconds % 3600) / 60, 0).pad_zeros(2),
|
|
|
+ String::num(movie_time_seconds % 60, 0).pad_zeros(2),
|
|
|
+ String::num(frame_remainder, 0).pad_zeros(2));
|
|
|
|
|
|
const int real_time_seconds = Time::get_singleton()->get_ticks_msec() / 1000;
|
|
|
const String real_time = vformat("%s:%s:%s",
|
|
|
- String::num(real_time_seconds / 3600).pad_zeros(2),
|
|
|
- String::num((real_time_seconds % 3600) / 60).pad_zeros(2),
|
|
|
- String::num(real_time_seconds % 60).pad_zeros(2));
|
|
|
+ String::num(real_time_seconds / 3600, 0).pad_zeros(2),
|
|
|
+ String::num((real_time_seconds % 3600) / 60, 0).pad_zeros(2),
|
|
|
+ String::num(real_time_seconds % 60, 0).pad_zeros(2));
|
|
|
|
|
|
- print_line(vformat("%d frames at %d FPS (movie length: %s), recorded in %s (%d%% of real-time speed).", Engine::get_singleton()->get_frames_drawn(), fps, movie_time, real_time, (float(movie_time_seconds) / real_time_seconds) * 100));
|
|
|
+ print_line(vformat("%d frames at %d FPS (movie length: %s), recorded in %s (%d%% of real-time speed).", Engine::get_singleton()->get_frames_drawn(), fps, movie_time, real_time, (float(MAX(1, movie_time_seconds)) / MAX(1, real_time_seconds)) * 100));
|
|
|
print_line(vformat("CPU time: %.2f seconds (average: %.2f ms/frame)", cpu_time / 1000, cpu_time / Engine::get_singleton()->get_frames_drawn()));
|
|
|
print_line(vformat("GPU time: %.2f seconds (average: %.2f ms/frame)", gpu_time / 1000, gpu_time / Engine::get_singleton()->get_frames_drawn()));
|
|
|
- print_line("----------------");
|
|
|
+ print_line("--------------------------------------------------------------------------------");
|
|
|
}
|