add fps to Renderer info whwen in headless and fix limits for fps and samples in path file parsing

This commit is contained in:
2025-02-07 23:27:29 +01:00
parent 4531e586ca
commit e791b8b27d

View File

@ -6,7 +6,7 @@
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */ /* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/22 16:34:53 by tomoron #+# #+# */ /* Created: 2025/01/22 16:34:53 by tomoron #+# #+# */
/* Updated: 2025/02/05 17:21:00 by tomoron ### ########.fr */ /* Updated: 2025/02/07 23:24:53 by tomoron ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -137,7 +137,7 @@ void Renderer::loadPath(std::string filename)
throw std::runtime_error("codec not available"); throw std::runtime_error("codec not available");
rawRead(file, &_samples, sizeof(_samples)); rawRead(file, &_samples, sizeof(_samples));
rawRead(file, &_fps, sizeof(_fps)); rawRead(file, &_fps, sizeof(_fps));
if(_samples < 1 || _fps < 1 || _samples >= 1000 || _fps >= 120) if(_samples < 1 || _fps < 1 || _samples > 1000 || _fps > 120)
throw std::runtime_error("invalid value provided in fps or samples"); throw std::runtime_error("invalid value provided in fps or samples");
while(file.peek() != EOF) while(file.peek() != EOF)
{ {
@ -769,6 +769,8 @@ void Renderer::showRenderInfo(int isImgui)
oss << (renderTime - (int)renderTime) * 60 << "s" << std::endl; oss << (renderTime - (int)renderTime) * 60 << "s" << std::endl;
oss << "elapsed time : " << floatToTime(timeElapsed) << std::endl; oss << "elapsed time : " << floatToTime(timeElapsed) << std::endl;
oss << "estimated time remaining :" << floatToTime(timeEst); oss << "estimated time remaining :" << floatToTime(timeEst);
if(_headless)
oss << std::endl << "fps : " << _win->getFps();
progress = ((float)_frameCount * _samples) + _curSamples; progress = ((float)_frameCount * _samples) + _curSamples;
progress /= (float)totalFrames * _samples; progress /= (float)totalFrames * _samples;