server now sends jobs to client and client can send result image to server

This commit is contained in:
2025-02-25 01:53:08 +01:00
parent fcc6f8266b
commit 29f00cf9b2
13 changed files with 182 additions and 91 deletions

View File

@ -6,7 +6,7 @@
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/22 16:34:53 by tomoron #+# #+# */
/* Updated: 2025/02/24 00:49:53 by tomoron ### ########.fr */
/* Updated: 2025/02/25 00:52:27 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -37,7 +37,7 @@ Renderer::Renderer(Scene *scene, Window *win, Arguments &args)
try{
if(_headless)
initRender();
initRender(0);
}
catch(std::exception &e)
{
@ -136,7 +136,7 @@ void Renderer::addTeleport(glm::vec3 from_pos, glm::vec2 from_dir, glm::vec3 to
void Renderer::createClusterJobs(Clusterizer &clust)
{
float delta;
double delta;
size_t frames;
glm::vec3 pos;
glm::vec2 dir;
@ -147,15 +147,15 @@ void Renderer::createClusterJobs(Clusterizer &clust)
while(_destPathIndex)
{
interpolateMovement(delta * frames, &pos, &dir);
clust.addJob(pos, dir, _samples);
frames++;
clust.addJob(pos, dir, _samples, frames, _scene->getDenoise());
if(_curPathIndex == _destPathIndex)
_destPathIndex = 0;
(void)clust;
frames++;
}
}
void Renderer::initRender(void)
void Renderer::initRender(Clusterizer *clust)
{
if(_path.size() < 2)
throw std::runtime_error("render path doesn't have enough path points");
@ -167,10 +167,9 @@ void Renderer::initRender(void)
_curPathIndex = 0;
_destPathIndex = _path.size() - 1;
_renderStartTime = glfwGetTime();
// if(clust && clust->isServer())
// createClusterJobs(*clust);
// else
if(1)
if(clust && clust->isServer())
createClusterJobs(*clust);
else
{
_frameCount = 0;
_curSamples = 0;

View File

@ -6,7 +6,7 @@
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/20 15:54:35 by tomoron #+# #+# */
/* Updated: 2025/02/24 00:34:48 by tomoron ### ########.fr */
/* Updated: 2025/02/24 17:42:35 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -171,7 +171,7 @@ void Renderer::imguiRenderSettings(Clusterizer &clust)
try
{
if(ImGui::Button("start render"))
initRender();
initRender(&clust);
ImGui::SameLine();
if(ImGui::Button("save path"))
savePath();