mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 18:48:36 +02:00
Renderer now prints status to standard output when in headless mode
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@
|
|||||||
/RT
|
/RT
|
||||||
compile_flags.txt
|
compile_flags.txt
|
||||||
imgui.ini
|
imgui.ini
|
||||||
|
/output*
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
|
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/09/27 14:52:10 by TheRed #+# #+# */
|
/* Created: 2024/09/27 14:52:10 by TheRed #+# #+# */
|
||||||
/* Updated: 2025/02/04 01:10:20 by tomoron ### ########.fr */
|
/* Updated: 2025/02/04 23:39:14 by tomoron ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -34,6 +34,7 @@
|
|||||||
# include <algorithm>
|
# include <algorithm>
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
# include <iostream>
|
# include <iostream>
|
||||||
|
# include <iomanip>
|
||||||
# include <fstream>
|
# include <fstream>
|
||||||
# include <sstream>
|
# include <sstream>
|
||||||
# include <chrono>
|
# include <chrono>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/01/22 16:29:26 by tomoron #+# #+# */
|
/* Created: 2025/01/22 16:29:26 by tomoron #+# #+# */
|
||||||
/* Updated: 2025/02/04 21:56:58 by tomoron ### ########.fr */
|
/* Updated: 2025/02/04 23:19:37 by tomoron ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class Renderer
|
|||||||
void addImageToRender(Shader &shader);
|
void addImageToRender(Shader &shader);
|
||||||
void endRender(void);
|
void endRender(void);
|
||||||
void imguiPathCreation(void);
|
void imguiPathCreation(void);
|
||||||
void imguiRenderInfo(void);
|
void showRenderInfo(int isImgui);
|
||||||
void imguiRenderSettings(void);
|
void imguiRenderSettings(void);
|
||||||
std::string floatToTime(double timef);
|
std::string floatToTime(double timef);
|
||||||
glm::vec2 bezierSphereInterpolate(glm::vec4 control, glm::vec2 from, glm::vec2 to, float time);
|
glm::vec2 bezierSphereInterpolate(glm::vec4 control, glm::vec2 from, glm::vec2 to, float time);
|
||||||
|
@ -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/04 21:56:44 by tomoron ### ########.fr */
|
/* Updated: 2025/02/04 23:42:00 by tomoron ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -414,6 +414,9 @@ void Renderer::update(Shader &shader)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
_curSamples++;
|
_curSamples++;
|
||||||
|
if(_headless)
|
||||||
|
showRenderInfo(0);
|
||||||
|
|
||||||
if((_testMode && _curSamples < _testSamples) || (!_testMode && _curSamples < _samples))
|
if((_testMode && _curSamples < _testSamples) || (!_testMode && _curSamples < _samples))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -429,6 +432,7 @@ void Renderer::update(Shader &shader)
|
|||||||
}
|
}
|
||||||
makeMovement(curTime - _curSplitStart, curTime);
|
makeMovement(curTime - _curSplitStart, curTime);
|
||||||
_curSamples = 0;
|
_curSamples = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3 Renderer::hermiteInterpolate(glm::vec3 points[4], double alpha)
|
glm::vec3 Renderer::hermiteInterpolate(glm::vec3 points[4], double alpha)
|
||||||
@ -760,8 +764,9 @@ std::string Renderer::floatToTime(double timef)
|
|||||||
return(res);
|
return(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::imguiRenderInfo(void)
|
void Renderer::showRenderInfo(int isImgui)
|
||||||
{
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
long int totalFrames;
|
long int totalFrames;
|
||||||
float renderTime;
|
float renderTime;
|
||||||
float progress;
|
float progress;
|
||||||
@ -776,23 +781,54 @@ void Renderer::imguiRenderInfo(void)
|
|||||||
timeEst *= (totalFrames * _samples) - ((_frameCount * _samples) + _curSamples);
|
timeEst *= (totalFrames * _samples) - ((_frameCount * _samples) + _curSamples);
|
||||||
if(timeEst > 1e15)
|
if(timeEst > 1e15)
|
||||||
timeEst = 0;
|
timeEst = 0;
|
||||||
ImGui::Text("render in progress");
|
|
||||||
ImGui::Text("samples per frame : %d", _samples);
|
oss << std::fixed << std::setprecision(2);
|
||||||
ImGui::Text("render fps : %d", _fps);
|
|
||||||
ImGui::Text("total render time : %s", floatToTime((_path[_destPathIndex].time - _path[0].time) * 60).c_str());
|
oss << "render in progress" << std::endl;
|
||||||
ImGui::Separator();
|
oss << "samples per frame : " << _samples << std::endl;
|
||||||
ImGui::Text("Frames : %ld / %ld", _frameCount, totalFrames);
|
oss << "render fps : " << _fps << std::endl;
|
||||||
ImGui::Text("Frames (with accumulation) : %ld / %ld", (_frameCount * _samples) + _curSamples, totalFrames * _samples);
|
oss << "total render time : ";
|
||||||
ImGui::Text("Render time : %dm%f", (int)renderTime, (renderTime - (int)renderTime) * 60);
|
oss << floatToTime((_path[_destPathIndex].time - _path[0].time) * 60).c_str();
|
||||||
ImGui::Text("elapsed time : %s", floatToTime(timeElapsed).c_str());
|
|
||||||
ImGui::Text("estimated time remaining : %s", floatToTime(timeEst).c_str());
|
if(isImgui)
|
||||||
|
{
|
||||||
|
ImGui::Text("%s",oss.str().c_str());
|
||||||
|
ImGui::Separator();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "\033[2J\033[H";
|
||||||
|
std::cout << oss.str() << std::endl;
|
||||||
|
std::cout << "-----------------------" << std::endl;
|
||||||
|
}
|
||||||
|
oss.str("");
|
||||||
|
oss.clear();
|
||||||
|
|
||||||
|
oss << "Frames : " << _frameCount << " / " << totalFrames << std::endl;
|
||||||
|
oss << "Frames (with accumulation) : " << (_frameCount * _samples) + _curSamples;
|
||||||
|
oss << " / " << totalFrames * _samples << std::endl;
|
||||||
|
oss << "Render time : " << (int)renderTime << "m";
|
||||||
|
oss << (renderTime - (int)renderTime) * 60 << "s" << std::endl;
|
||||||
|
oss << "elapsed time : " << floatToTime(timeElapsed) << std::endl;
|
||||||
|
oss << "estimated time remaining :" << floatToTime(timeEst);
|
||||||
|
|
||||||
progress = ((float)_frameCount * _samples) + _curSamples;
|
progress = ((float)_frameCount * _samples) + _curSamples;
|
||||||
progress /= (float)totalFrames * _samples;
|
progress /= (float)totalFrames * _samples;
|
||||||
ImGui::ProgressBar(progress, ImVec2(0, 0));
|
|
||||||
if(ImGui::Button("stop"))
|
if(isImgui)
|
||||||
{
|
{
|
||||||
_destPathIndex = 0;
|
ImGui::Text("%s",oss.str().c_str());
|
||||||
endRender();
|
ImGui::ProgressBar(progress, ImVec2(0, 0));
|
||||||
|
if(ImGui::Button("stop"))
|
||||||
|
{
|
||||||
|
_destPathIndex = 0;
|
||||||
|
endRender();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
oss << std::endl << progress * 100 << "%";
|
||||||
|
std::cout << oss.str() << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -833,7 +869,7 @@ void Renderer::renderImgui(void)
|
|||||||
if (ImGui::CollapsingHeader("Renderer"))
|
if (ImGui::CollapsingHeader("Renderer"))
|
||||||
{
|
{
|
||||||
if(rendering())
|
if(rendering())
|
||||||
imguiRenderInfo();
|
showRenderInfo(1);
|
||||||
else if(_renderSettings)
|
else if(_renderSettings)
|
||||||
imguiRenderSettings();
|
imguiRenderSettings();
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user