mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-28 02:58:35 +02:00
server now receives images and create final video. server now handles clients disconnect
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/02/20 18:25:18 by tomoron #+# #+# */
|
/* Created: 2025/02/20 18:25:18 by tomoron #+# #+# */
|
||||||
/* Updated: 2025/02/25 01:49:07 by tomoron ### ########.fr */
|
/* Updated: 2025/02/25 22:26:49 by tomoron ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -38,6 +38,8 @@ typedef struct s_client
|
|||||||
t_job *curJob;
|
t_job *curJob;
|
||||||
uint8_t progress;
|
uint8_t progress;
|
||||||
bool ready;
|
bool ready;
|
||||||
|
bool readyRespond;
|
||||||
|
bool gotGo;
|
||||||
} t_client;
|
} t_client;
|
||||||
|
|
||||||
typedef enum e_msg
|
typedef enum e_msg
|
||||||
@ -46,7 +48,8 @@ typedef enum e_msg
|
|||||||
JOB,
|
JOB,
|
||||||
PROGRESS_UPDATE,
|
PROGRESS_UPDATE,
|
||||||
IMG_SEND_RQ,
|
IMG_SEND_RQ,
|
||||||
IMG
|
IMG,
|
||||||
|
ABORT
|
||||||
} t_msg;
|
} t_msg;
|
||||||
|
|
||||||
class Clusterizer
|
class Clusterizer
|
||||||
@ -62,6 +65,7 @@ class Clusterizer
|
|||||||
bool hasJobs(void);
|
bool hasJobs(void);
|
||||||
|
|
||||||
void addJob(glm::vec3 pos, glm::vec2 dir, size_t samples, size_t frames, GPUDenoise &denoise);
|
void addJob(glm::vec3 pos, glm::vec2 dir, size_t samples, size_t frames, GPUDenoise &denoise);
|
||||||
|
void abortJobs(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _isActive;
|
bool _isActive;
|
||||||
@ -74,6 +78,7 @@ class Clusterizer
|
|||||||
|
|
||||||
void imguiJobStat(void);
|
void imguiJobStat(void);
|
||||||
void imguiClients(void);
|
void imguiClients(void);
|
||||||
|
std::string clientStatus(t_client client);
|
||||||
|
|
||||||
private: //client
|
private: //client
|
||||||
void initClient(std::string &dest);
|
void initClient(std::string &dest);
|
||||||
@ -85,6 +90,7 @@ class Clusterizer
|
|||||||
void handleCurrentJob(Scene &scene, Window &win, std::vector<GLuint> &textures, ShaderProgram &denoisingProgram);
|
void handleCurrentJob(Scene &scene, Window &win, std::vector<GLuint> &textures, ShaderProgram &denoisingProgram);
|
||||||
void sendProgress(uint8_t progress);
|
void sendProgress(uint8_t progress);
|
||||||
void sendImageToServer(std::vector<GLuint> &textures, ShaderProgram &denoisingProgram);
|
void sendImageToServer(std::vector<GLuint> &textures, ShaderProgram &denoisingProgram);
|
||||||
|
std::vector<uint8_t> rgb32fToRgb24i(std::vector<float> &imageFloat);
|
||||||
|
|
||||||
int _serverFd;
|
int _serverFd;
|
||||||
std::string _serverIp;
|
std::string _serverIp;
|
||||||
@ -102,13 +108,16 @@ class Clusterizer
|
|||||||
int acceptClients(void);
|
int acceptClients(void);
|
||||||
void updatePollfds(void);
|
void updatePollfds(void);
|
||||||
int updateBuffer(int fd);
|
int updateBuffer(int fd);
|
||||||
void handleBuffer(int fd, std::vector<uint8_t> &buf);
|
bool handleBuffer(int fd, std::vector<uint8_t> &buf);
|
||||||
void deleteClient(int fd);
|
void deleteClient(int fd);
|
||||||
|
int handleSendRequests(void);
|
||||||
|
void getImageFromClient(int fd, std::vector<uint8_t> &buf);
|
||||||
|
void redistributeJob(t_job *job);
|
||||||
|
|
||||||
int dispatchJobs(void);
|
int dispatchJobs(void);
|
||||||
|
|
||||||
int _serverSocket;
|
int _serverSocket;
|
||||||
struct pollfd *_pollfds;
|
struct pollfd *_pollfds;
|
||||||
std::map<int, t_client> _clients;
|
std::map<int, t_client> _clients;
|
||||||
size_t _curId;
|
size_t _curFrame;
|
||||||
};
|
};
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/02/23 23:41:18 by tomoron #+# #+# */
|
/* Created: 2025/02/23 23:41:18 by tomoron #+# #+# */
|
||||||
/* Updated: 2025/02/24 00:41:00 by tomoron ### ########.fr */
|
/* Updated: 2025/02/25 14:47:37 by tomoron ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -22,6 +22,7 @@ class Ffmpeg
|
|||||||
~Ffmpeg();
|
~Ffmpeg();
|
||||||
|
|
||||||
void addImageToVideo(Scene &scene, std::vector<GLuint> &textures, ShaderProgram &denoisingProgram);
|
void addImageToVideo(Scene &scene, std::vector<GLuint> &textures, ShaderProgram &denoisingProgram);
|
||||||
|
void addImageToVideo(std::vector<uint8_t> &buf);
|
||||||
|
|
||||||
static void updateAvailableCodecs(std::vector<const AVCodec *> &codecList, std::vector<const char *> &codecListStr, std::string filename, int mode, AVCodecID id);
|
static void updateAvailableCodecs(std::vector<const AVCodec *> &codecList, std::vector<const char *> &codecListStr, std::string filename, int mode, AVCodecID id);
|
||||||
|
|
||||||
|
@ -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/24 17:21:08 by tomoron ### ########.fr */
|
/* Updated: 2025/02/25 19:16:25 by tomoron ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -48,11 +48,13 @@ class Renderer
|
|||||||
|
|
||||||
int rendering(void) const;
|
int rendering(void) const;
|
||||||
bool shouldClose(void) const;
|
bool shouldClose(void) const;
|
||||||
|
void addImageToRender(std::vector<uint8_t> &buffer);
|
||||||
|
void endRender(Clusterizer *clust);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init(Scene *scene, Window *win);
|
void init(Scene *scene, Window *win);
|
||||||
|
|
||||||
void showRenderInfo(int isImgui);
|
void showRenderInfo(int isImgui, Clusterizer *clust);
|
||||||
std::string floatToTime(double timef);
|
std::string floatToTime(double timef);
|
||||||
float calcTime(glm::vec3 pos);
|
float calcTime(glm::vec3 pos);
|
||||||
|
|
||||||
@ -76,7 +78,6 @@ class Renderer
|
|||||||
void createClusterJobs(Clusterizer &clust);
|
void createClusterJobs(Clusterizer &clust);
|
||||||
void fillGoodCodecList(std::vector<AVCodecID> &lst);
|
void fillGoodCodecList(std::vector<AVCodecID> &lst);
|
||||||
void addImageToRender(std::vector<GLuint> &textures, ShaderProgram &denoisingProgram);
|
void addImageToRender(std::vector<GLuint> &textures, ShaderProgram &denoisingProgram);
|
||||||
void endRender(void);
|
|
||||||
|
|
||||||
|
|
||||||
Scene *_scene;
|
Scene *_scene;
|
||||||
|
@ -6,21 +6,12 @@
|
|||||||
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/02/20 18:24:39 by tomoron #+# #+# */
|
/* Created: 2025/02/20 18:24:39 by tomoron #+# #+# */
|
||||||
/* Updated: 2025/02/25 01:49:23 by tomoron ### ########.fr */
|
/* Updated: 2025/02/25 22:33:01 by tomoron ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "RT.hpp"
|
#include "RT.hpp"
|
||||||
|
|
||||||
//TODO before push :
|
|
||||||
// - client work on image when gets job
|
|
||||||
// - handle client disconnect
|
|
||||||
// - show image number in imgui
|
|
||||||
// - client send progress update when percent change
|
|
||||||
// - server action to send map name
|
|
||||||
// - when image is done, send a image send request and wait for server response
|
|
||||||
// - when server accepts send request, send full image
|
|
||||||
|
|
||||||
Clusterizer::Clusterizer(Arguments &args, Renderer *renderer)
|
Clusterizer::Clusterizer(Arguments &args, Renderer *renderer)
|
||||||
{
|
{
|
||||||
_isActive = 1;
|
_isActive = 1;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/02/20 21:08:38 by tomoron #+# #+# */
|
/* Created: 2025/02/20 21:08:38 by tomoron #+# #+# */
|
||||||
/* Updated: 2025/02/25 01:48:47 by tomoron ### ########.fr */
|
/* Updated: 2025/02/25 20:41:09 by tomoron ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -17,6 +17,7 @@ void shaderDenoise(ShaderProgram &denoising_program, GPUDenoise &denoise, st
|
|||||||
void Clusterizer::initClient(std::string &dest)
|
void Clusterizer::initClient(std::string &dest)
|
||||||
{
|
{
|
||||||
_serverFd = 0;
|
_serverFd = 0;
|
||||||
|
_currentJob = 0;
|
||||||
if(dest.find(":") == std::string::npos)
|
if(dest.find(":") == std::string::npos)
|
||||||
std::cerr << "Client Initialisation error : invalid ip provided format must be <ip>:<port>" << std::endl;
|
std::cerr << "Client Initialisation error : invalid ip provided format must be <ip>:<port>" << std::endl;
|
||||||
_serverIp = dest.substr(0, dest.find(":"));
|
_serverIp = dest.substr(0, dest.find(":"));
|
||||||
@ -90,9 +91,23 @@ void Clusterizer::clientHandleBuffer(void)
|
|||||||
if(_receiveBuffer[0] == JOB)
|
if(_receiveBuffer[0] == JOB)
|
||||||
clientGetJob();
|
clientGetJob();
|
||||||
else if(_receiveBuffer[0] == RDY)
|
else if(_receiveBuffer[0] == RDY)
|
||||||
|
{
|
||||||
|
std::cout << "server is ready to receive" << std::endl;
|
||||||
_srvReady = 1;
|
_srvReady = 1;
|
||||||
else
|
|
||||||
_receiveBuffer.erase(_receiveBuffer.begin());
|
_receiveBuffer.erase(_receiveBuffer.begin());
|
||||||
|
}
|
||||||
|
else if(_receiveBuffer[0] == ABORT)
|
||||||
|
{
|
||||||
|
std::cout << "got a abort request, aborting current job";
|
||||||
|
delete _currentJob;
|
||||||
|
_currentJob = 0;
|
||||||
|
_receiveBuffer.erase(_receiveBuffer.begin());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "unknown request sent, ignoring" << std::endl;
|
||||||
|
_receiveBuffer.erase(_receiveBuffer.begin());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(sendBuf.size())
|
if(sendBuf.size())
|
||||||
@ -105,8 +120,8 @@ void Clusterizer::clientReceive(void)
|
|||||||
size_t ret;
|
size_t ret;
|
||||||
|
|
||||||
ret = recv(_serverFd, buffer, 512, MSG_DONTWAIT);
|
ret = recv(_serverFd, buffer, 512, MSG_DONTWAIT);
|
||||||
if(ret == (size_t)-1)
|
if(ret != (size_t)-1)
|
||||||
return;
|
{
|
||||||
if(!ret)
|
if(!ret)
|
||||||
{
|
{
|
||||||
close(_serverFd);
|
close(_serverFd);
|
||||||
@ -114,6 +129,7 @@ void Clusterizer::clientReceive(void)
|
|||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
_receiveBuffer.insert(_receiveBuffer.end(), buffer, buffer + ret);
|
_receiveBuffer.insert(_receiveBuffer.end(), buffer, buffer + ret);
|
||||||
|
}
|
||||||
clientHandleBuffer();
|
clientHandleBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,26 +143,62 @@ void Clusterizer::sendProgress(uint8_t progress)
|
|||||||
(void)write(_serverFd, buf, 2);
|
(void)write(_serverFd, buf, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<uint8_t> Clusterizer::rgb32fToRgb24i(std::vector<float> &imageFloat)
|
||||||
|
{
|
||||||
|
std::vector<uint8_t> buffer(WIDTH * HEIGHT * 3);
|
||||||
|
size_t rgbaIndex;
|
||||||
|
size_t rgbIndex;
|
||||||
|
|
||||||
|
for(size_t y = 0; y < HEIGHT; y++)
|
||||||
|
{
|
||||||
|
for(size_t x = 0; x < WIDTH; x++)
|
||||||
|
{
|
||||||
|
rgbaIndex = (((HEIGHT - 1 - y) * WIDTH) + x) * 4;
|
||||||
|
rgbIndex = ((y * WIDTH) + x) * 3;
|
||||||
|
buffer[rgbIndex] = fmin(imageFloat[rgbaIndex], 1) * 254;
|
||||||
|
buffer[rgbIndex + 1] = fmin(imageFloat[rgbaIndex + 1], 1) * 254;
|
||||||
|
buffer[rgbIndex + 2] = fmin(imageFloat[rgbaIndex + 2], 1) * 254;
|
||||||
|
rgbIndex += 3;
|
||||||
|
rgbaIndex += 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
void Clusterizer::sendImageToServer(std::vector<GLuint> &textures, ShaderProgram &denoisingProgram)
|
void Clusterizer::sendImageToServer(std::vector<GLuint> &textures, ShaderProgram &denoisingProgram)
|
||||||
{
|
{
|
||||||
_srvReady = 0;
|
_srvReady = 0;
|
||||||
std::vector<uint8_t> buffer(WIDTH * HEIGHT * 4);
|
std::vector<float> imageFloat(WIDTH * HEIGHT * 4);
|
||||||
|
std::vector<uint8_t> buffer;
|
||||||
|
|
||||||
(void)write(_serverFd, (uint8_t []){IMG_SEND_RQ}, 1);
|
(void)write(_serverFd, (uint8_t []){IMG_SEND_RQ}, 1);
|
||||||
while(!_srvReady)
|
while(!_srvReady)
|
||||||
{
|
{
|
||||||
clientReceive();
|
clientReceive();
|
||||||
|
if(!_serverFd)
|
||||||
|
{
|
||||||
|
delete _currentJob;
|
||||||
|
_currentJob = 0;
|
||||||
|
}
|
||||||
|
if(!_currentJob)
|
||||||
|
return ;
|
||||||
usleep(10000);
|
usleep(10000);
|
||||||
}
|
}
|
||||||
|
std::cout << "server ready" << std::endl;
|
||||||
|
|
||||||
if(_currentJob->denoise.enabled)
|
if(_currentJob->denoise.enabled)
|
||||||
shaderDenoise(denoisingProgram, _currentJob->denoise, textures);
|
shaderDenoise(denoisingProgram, _currentJob->denoise, textures);
|
||||||
glBindTexture(GL_TEXTURE_2D, textures[0]);
|
glBindTexture(GL_TEXTURE_2D, textures[0]);
|
||||||
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, buffer.data());
|
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, imageFloat.data());
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
|
||||||
|
buffer = rgb32fToRgb24i(imageFloat);
|
||||||
|
std::cout << "buffer size : " << buffer.size() << std::endl;
|
||||||
(void)write(_serverFd, (uint8_t []){IMG}, 1);
|
(void)write(_serverFd, (uint8_t []){IMG}, 1);
|
||||||
(void)write(_serverFd, buffer.data(), buffer.size());
|
(void)write(_serverFd, buffer.data(), buffer.size());
|
||||||
|
delete _currentJob;
|
||||||
|
_currentJob = 0;
|
||||||
|
std::cout << "image sent" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clusterizer::handleCurrentJob(Scene &scene, Window &win, std::vector<GLuint> &textures, ShaderProgram &denoisingProgram)
|
void Clusterizer::handleCurrentJob(Scene &scene, Window &win, std::vector<GLuint> &textures, ShaderProgram &denoisingProgram)
|
||||||
@ -157,23 +209,34 @@ void Clusterizer::handleCurrentJob(Scene &scene, Window &win, std::vector<GLuint
|
|||||||
|
|
||||||
if(scene.getCamera()->getPosition() != _currentJob->pos || scene.getCamera()->getDirection() != _currentJob->dir)
|
if(scene.getCamera()->getPosition() != _currentJob->pos || scene.getCamera()->getDirection() != _currentJob->dir)
|
||||||
{
|
{
|
||||||
|
std::cout << "not at right place, moving" << std::endl;
|
||||||
scene.getCamera()->setPosition(_currentJob->pos);
|
scene.getCamera()->setPosition(_currentJob->pos);
|
||||||
scene.getCamera()->setDirection(_currentJob->dir.x, _currentJob->dir.y);
|
scene.getCamera()->setDirection(_currentJob->dir.x, _currentJob->dir.y);
|
||||||
win.setFrameCount(0);
|
win.setFrameCount(0);
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((size_t)win.getFrameCount() < _currentJob->samples)
|
|
||||||
|
if((size_t)win.getFrameCount() <= _currentJob->samples)
|
||||||
{
|
{
|
||||||
progress = ((double)win.getFrameCount() / _currentJob->samples) * 100;
|
progress = ((double)win.getFrameCount() / _currentJob->samples) * 100;
|
||||||
if(progress != _progress)
|
if(progress != _progress)
|
||||||
|
{
|
||||||
|
std::cout << "new progress" << std::endl;
|
||||||
sendProgress(progress);
|
sendProgress(progress);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "sample " << win.getFrameCount() << "/" << _currentJob->samples << std::endl;
|
||||||
|
if((size_t)win.getFrameCount() > _currentJob->samples)
|
||||||
|
win.setFrameCount(0);
|
||||||
|
|
||||||
if((size_t)win.getFrameCount() == _currentJob->samples)
|
if((size_t)win.getFrameCount() == _currentJob->samples)
|
||||||
{
|
{
|
||||||
|
std::cout << "send request" << std::endl;
|
||||||
sendImageToServer(textures, denoisingProgram);
|
sendImageToServer(textures, denoisingProgram);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clusterizer::updateClient(Scene &scene, Window &win, std::vector<GLuint> &textures, ShaderProgram &denoisingProgram)
|
void Clusterizer::updateClient(Scene &scene, Window &win, std::vector<GLuint> &textures, ShaderProgram &denoisingProgram)
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/02/22 19:52:51 by tomoron #+# #+# */
|
/* Created: 2025/02/22 19:52:51 by tomoron #+# #+# */
|
||||||
/* Updated: 2025/02/24 20:52:33 by tomoron ### ########.fr */
|
/* Updated: 2025/02/25 22:26:44 by tomoron ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -20,6 +20,21 @@ void Clusterizer::imguiJobStat(void)
|
|||||||
ImGui::Text(" done : %lu", _jobs[DONE].size());
|
ImGui::Text(" done : %lu", _jobs[DONE].size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Clusterizer::clientStatus(t_client client)
|
||||||
|
{
|
||||||
|
if(!client.ready)
|
||||||
|
return("not ready");
|
||||||
|
if(client.curJob)
|
||||||
|
{
|
||||||
|
if(client.gotGo)
|
||||||
|
return("sending image to server");
|
||||||
|
if(client.readyRespond)
|
||||||
|
return("waiting for server to send image");
|
||||||
|
return("working on frame " + std::to_string(client.curJob->frameNb));
|
||||||
|
}
|
||||||
|
return("idle");
|
||||||
|
}
|
||||||
|
|
||||||
void Clusterizer::imguiClients(void)
|
void Clusterizer::imguiClients(void)
|
||||||
{
|
{
|
||||||
std::string status;
|
std::string status;
|
||||||
@ -28,13 +43,7 @@ void Clusterizer::imguiClients(void)
|
|||||||
ImGui::BeginChild("clientList", ImVec2(0, 0), true, 0);
|
ImGui::BeginChild("clientList", ImVec2(0, 0), true, 0);
|
||||||
for(auto it = _clients.begin();it != _clients.end(); it++)
|
for(auto it = _clients.begin();it != _clients.end(); it++)
|
||||||
{
|
{
|
||||||
if(it->second.ready)
|
status = clientStatus(it->second);
|
||||||
status = "idle";
|
|
||||||
else if(!it->second.ready && it->second.curJob)
|
|
||||||
status = "working";
|
|
||||||
else if(it->second.ready)
|
|
||||||
status = "not ready";
|
|
||||||
|
|
||||||
ImGui::Text("status : %s", status.c_str());
|
ImGui::Text("status : %s", status.c_str());
|
||||||
if(it->second.curJob)
|
if(it->second.curJob)
|
||||||
ImGui::ProgressBar((float)it->second.progress / 100);
|
ImGui::ProgressBar((float)it->second.progress / 100);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/02/20 21:08:38 by tomoron #+# #+# */
|
/* Created: 2025/02/20 21:08:38 by tomoron #+# #+# */
|
||||||
/* Updated: 2025/02/25 00:53:02 by tomoron ### ########.fr */
|
/* Updated: 2025/02/25 22:06:58 by tomoron ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -15,7 +15,7 @@
|
|||||||
void Clusterizer::initServer(std::string port)
|
void Clusterizer::initServer(std::string port)
|
||||||
{
|
{
|
||||||
_pollfds = 0;
|
_pollfds = 0;
|
||||||
_curId = 0;
|
_curFrame = 0;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -77,6 +77,47 @@ int Clusterizer::acceptClients(void)
|
|||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Clusterizer::redistributeJob(t_job *job)
|
||||||
|
{
|
||||||
|
size_t highestInProgress = 0;
|
||||||
|
auto clientHighest = _clients.begin();
|
||||||
|
t_job *replaced;
|
||||||
|
std::vector<t_job *>::iterator found;
|
||||||
|
|
||||||
|
if(!_clients.size())
|
||||||
|
{
|
||||||
|
found = std::find(_jobs[IN_PROGRESS].begin(), _jobs[IN_PROGRESS].end(), job);
|
||||||
|
_jobs[IN_PROGRESS].erase(found);
|
||||||
|
_jobs[WAITING].insert(_jobs[WAITING].begin(), job);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(auto it = _clients.begin(); it != _clients.end(); it++)
|
||||||
|
{
|
||||||
|
if(!it->second.curJob)
|
||||||
|
{
|
||||||
|
highestInProgress = (size_t) -1;
|
||||||
|
clientHighest = it;
|
||||||
|
}
|
||||||
|
else if(it->second.curJob->frameNb > highestInProgress)
|
||||||
|
{
|
||||||
|
highestInProgress = it->second.curJob->frameNb;
|
||||||
|
clientHighest = it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(clientHighest->second.curJob)
|
||||||
|
{
|
||||||
|
(void)write(clientHighest->first, (uint8_t []){ABORT}, 1);
|
||||||
|
replaced = clientHighest->second.curJob;
|
||||||
|
found = std::find(_jobs[IN_PROGRESS].begin(), _jobs[IN_PROGRESS].end(), replaced);
|
||||||
|
_jobs[IN_PROGRESS].erase(found);
|
||||||
|
_jobs[WAITING].insert(_jobs[WAITING].begin(), clientHighest->second.curJob);
|
||||||
|
}
|
||||||
|
clientHighest->second.curJob = job;
|
||||||
|
(void)write(clientHighest->first, (uint8_t []){JOB}, 1);
|
||||||
|
(void)write(clientHighest->first, job, sizeof(t_job));
|
||||||
|
}
|
||||||
|
|
||||||
void Clusterizer::deleteClient(int fd)
|
void Clusterizer::deleteClient(int fd)
|
||||||
{
|
{
|
||||||
std::map<int, t_client>::iterator it;
|
std::map<int, t_client>::iterator it;
|
||||||
@ -85,23 +126,88 @@ void Clusterizer::deleteClient(int fd)
|
|||||||
it = _clients.find(fd);
|
it = _clients.find(fd);
|
||||||
if(it == _clients.end())
|
if(it == _clients.end())
|
||||||
return;
|
return;
|
||||||
|
if(_clients[fd].curJob)
|
||||||
|
redistributeJob(_clients[fd].curJob);
|
||||||
_clients.erase(it);
|
_clients.erase(it);
|
||||||
updatePollfds();
|
updatePollfds();
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clusterizer::handleBuffer(int fd, std::vector<uint8_t> &buf)
|
void Clusterizer::getImageFromClient(int fd, std::vector<uint8_t> &buf)
|
||||||
|
{
|
||||||
|
std::cout << "client sent an image" << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
buf.erase(buf.begin());
|
||||||
|
|
||||||
|
if(_clients[fd].gotGo && _clients[fd].curJob)
|
||||||
|
_renderer->addImageToRender(buf);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "client sent an image before receiving a ready signal, dropping image" << std::endl;
|
||||||
|
buf.erase(buf.begin(), buf.begin() + (WIDTH * HEIGHT * 3));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
buf.erase(buf.begin(), buf.begin() + (WIDTH * HEIGHT * 3));
|
||||||
|
|
||||||
|
_clients[fd].gotGo = 0;
|
||||||
|
_clients[fd].curJob = 0;
|
||||||
|
_clients[fd].readyRespond = 0;
|
||||||
|
|
||||||
|
_jobs[IN_PROGRESS].erase(std::find(_jobs[IN_PROGRESS].begin(), _jobs[IN_PROGRESS].end(), _clients[fd].curJob));
|
||||||
|
_jobs[DONE].push_back(_clients[fd].curJob);
|
||||||
|
_clients[fd].curJob = 0;
|
||||||
|
|
||||||
|
_curFrame++;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Clusterizer::handleBuffer(int fd, std::vector<uint8_t> &buf)
|
||||||
{
|
{
|
||||||
std::vector<uint8_t> sendBuffer;
|
std::vector<uint8_t> sendBuffer;
|
||||||
|
uint8_t tmp;
|
||||||
|
|
||||||
if(buf[0] == RDY)
|
if(buf[0] == RDY)
|
||||||
{
|
{
|
||||||
_clients[fd].ready = 1;
|
_clients[fd].ready = 1;
|
||||||
|
buf.erase(buf.begin());
|
||||||
std::cout << "client " << fd << " is ready !" << std::endl;
|
std::cout << "client " << fd << " is ready !" << std::endl;
|
||||||
}
|
}
|
||||||
|
else if(buf[0] == IMG_SEND_RQ)
|
||||||
|
{
|
||||||
|
std::cout << "client " << fd << " is ready to send its image" << std::endl;
|
||||||
|
_clients[fd].readyRespond = 1;
|
||||||
|
buf.erase(buf.begin());
|
||||||
|
}
|
||||||
|
else if(buf[0] == PROGRESS_UPDATE)
|
||||||
|
{
|
||||||
|
if(buf.size() < 2)
|
||||||
|
return (0);
|
||||||
|
tmp = buf[1];
|
||||||
|
std::cout << "client " << fd << " sent a progress update, new progress : " << (int)tmp << std::endl;
|
||||||
|
buf.erase(buf.begin(), buf.begin() + 2);
|
||||||
|
if (tmp <= 100)
|
||||||
|
_clients[fd].progress = tmp;
|
||||||
|
}
|
||||||
|
else if(buf[0] == IMG)
|
||||||
|
{
|
||||||
|
if(buf.size() < ((WIDTH * HEIGHT * 3) + 1))
|
||||||
|
{
|
||||||
|
std::cout << "incomplete IMG request, " << buf.size() << "/"<< (WIDTH * HEIGHT * 3) << std::endl;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
getImageFromClient(fd, buf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "client sent an unknown request, ignoring" << std::endl;
|
||||||
|
buf.erase(buf.begin());
|
||||||
|
}
|
||||||
|
|
||||||
if(sendBuffer.size())
|
if(sendBuffer.size())
|
||||||
(void)write(fd, sendBuffer.data(), sendBuffer.size());
|
(void)write(fd, sendBuffer.data(), sendBuffer.size());
|
||||||
|
return(buf.size() != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Clusterizer::updateBuffer(int fd)
|
int Clusterizer::updateBuffer(int fd)
|
||||||
@ -113,14 +219,14 @@ int Clusterizer::updateBuffer(int fd)
|
|||||||
if(!ret || ret == (size_t)-1)
|
if(!ret || ret == (size_t)-1)
|
||||||
return(1);
|
return(1);
|
||||||
_clients[fd].buffer.insert(_clients[fd].buffer.end(), buffer, buffer + ret);
|
_clients[fd].buffer.insert(_clients[fd].buffer.end(), buffer, buffer + ret);
|
||||||
handleBuffer(fd, _clients[fd].buffer);
|
while(handleBuffer(fd, _clients[fd].buffer))
|
||||||
|
;;
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Clusterizer::dispatchJobs(void)
|
int Clusterizer::dispatchJobs(void)
|
||||||
{
|
{
|
||||||
t_job *tmp;
|
t_job *tmp;
|
||||||
uint8_t sendBuf;
|
|
||||||
int dispatched;
|
int dispatched;
|
||||||
|
|
||||||
dispatched = 0;
|
dispatched = 0;
|
||||||
@ -129,17 +235,17 @@ int Clusterizer::dispatchJobs(void)
|
|||||||
|
|
||||||
for(auto it = _clients.begin(); it != _clients.end(); it++)
|
for(auto it = _clients.begin(); it != _clients.end(); it++)
|
||||||
{
|
{
|
||||||
if(it->second.ready)
|
if(it->second.ready && !it->second.curJob)
|
||||||
{
|
{
|
||||||
tmp = _jobs[WAITING].front();
|
tmp = _jobs[WAITING].front();
|
||||||
_jobs[WAITING].erase(_jobs[WAITING].begin());
|
_jobs[WAITING].erase(_jobs[WAITING].begin());
|
||||||
_jobs[IN_PROGRESS].push_back(tmp);
|
_jobs[IN_PROGRESS].push_back(tmp);
|
||||||
sendBuf = JOB;
|
(void)write(it->first, (uint8_t []){JOB}, 1);
|
||||||
(void)write(it->first, &sendBuf, 1);
|
(void)write(it->first, tmp, sizeof(t_job));
|
||||||
(void)write(it->first, &tmp, sizeof(t_job));
|
|
||||||
it->second.ready = 0;
|
|
||||||
it->second.progress = 0;
|
it->second.progress = 0;
|
||||||
it->second.curJob = tmp;
|
it->second.curJob = tmp;
|
||||||
|
it->second.readyRespond = 0;
|
||||||
|
it->second.gotGo = 0;
|
||||||
dispatched = 1;
|
dispatched = 1;
|
||||||
}
|
}
|
||||||
if(!_jobs[WAITING].size())
|
if(!_jobs[WAITING].size())
|
||||||
@ -148,6 +254,23 @@ int Clusterizer::dispatchJobs(void)
|
|||||||
return (dispatched);
|
return (dispatched);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Clusterizer::handleSendRequests(void)
|
||||||
|
{
|
||||||
|
int action;
|
||||||
|
|
||||||
|
action = 0;
|
||||||
|
for(auto it = _clients.begin(); it != _clients.end(); it++)
|
||||||
|
{
|
||||||
|
if(it->second.curJob && it->second.curJob->frameNb == _curFrame + 1 && it->second.readyRespond && !it->second.gotGo)
|
||||||
|
{
|
||||||
|
action = 1;
|
||||||
|
(void)write(it->first, (uint8_t []){RDY}, 1);
|
||||||
|
it->second.gotGo = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(action);
|
||||||
|
}
|
||||||
|
|
||||||
void Clusterizer::addJob(glm::vec3 pos, glm::vec2 dir, size_t samples, size_t frame, GPUDenoise &denoise)
|
void Clusterizer::addJob(glm::vec3 pos, glm::vec2 dir, size_t samples, size_t frame, GPUDenoise &denoise)
|
||||||
{
|
{
|
||||||
t_job *tmp;
|
t_job *tmp;
|
||||||
@ -159,6 +282,7 @@ void Clusterizer::addJob(glm::vec3 pos, glm::vec2 dir, size_t samples, size_t fr
|
|||||||
tmp->frameNb = frame;
|
tmp->frameNb = frame;
|
||||||
tmp->denoise = denoise;
|
tmp->denoise = denoise;
|
||||||
_jobs[WAITING].push_back(tmp);
|
_jobs[WAITING].push_back(tmp);
|
||||||
|
_curFrame = 0;
|
||||||
|
|
||||||
std::cout << "new job added : " << std::endl;
|
std::cout << "new job added : " << std::endl;
|
||||||
std::cout << " - pos : " << glm::to_string(pos) << std::endl;
|
std::cout << " - pos : " << glm::to_string(pos) << std::endl;
|
||||||
@ -166,15 +290,45 @@ void Clusterizer::addJob(glm::vec3 pos, glm::vec2 dir, size_t samples, size_t fr
|
|||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Clusterizer::abortJobs(void)
|
||||||
|
{
|
||||||
|
for(auto it = _jobs[WAITING].begin(); it != _jobs[WAITING].end(); it++)
|
||||||
|
delete *it;
|
||||||
|
_jobs[WAITING].clear();
|
||||||
|
|
||||||
|
for(auto it = _clients.begin(); it != _clients.end(); it++)
|
||||||
|
{
|
||||||
|
if(it->second.curJob)
|
||||||
|
{
|
||||||
|
(void)write(it->first, (uint8_t []){ABORT}, 1);
|
||||||
|
delete it->second.curJob;
|
||||||
|
it->second.curJob = 0;
|
||||||
|
it->second.progress = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_jobs[IN_PROGRESS].clear();
|
||||||
|
|
||||||
|
for(auto it = _jobs[DONE].begin(); it != _jobs[DONE].end(); it++)
|
||||||
|
delete *it;
|
||||||
|
_jobs[DONE].clear();
|
||||||
|
}
|
||||||
|
|
||||||
void Clusterizer::updateServer(void)
|
void Clusterizer::updateServer(void)
|
||||||
{
|
{
|
||||||
int recv;
|
int recv;
|
||||||
int didSomething;
|
int didSomething;
|
||||||
|
|
||||||
|
if(!_jobs[WAITING].size() && !_jobs[IN_PROGRESS].size() && _jobs[DONE].size())
|
||||||
|
{
|
||||||
|
std::cout << "clusterized render done, closing output video" << std::endl;
|
||||||
|
_renderer->endRender(this);
|
||||||
|
}
|
||||||
didSomething = 1;
|
didSomething = 1;
|
||||||
while(didSomething)
|
while(didSomething)
|
||||||
{
|
{
|
||||||
didSomething = acceptClients();
|
didSomething = acceptClients();
|
||||||
|
if(handleSendRequests())
|
||||||
|
didSomething = 1;
|
||||||
if(dispatchJobs())
|
if(dispatchJobs())
|
||||||
didSomething = 1;
|
didSomething = 1;
|
||||||
recv = poll(_pollfds, _clients.size(), 1);
|
recv = poll(_pollfds, _clients.size(), 1);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/02/23 23:28:19 by tomoron #+# #+# */
|
/* Created: 2025/02/23 23:28:19 by tomoron #+# #+# */
|
||||||
/* Updated: 2025/02/24 00:44:26 by tomoron ### ########.fr */
|
/* Updated: 2025/02/25 14:47:15 by tomoron ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -121,6 +121,12 @@ void Ffmpeg::addImageToVideo(Scene &scene, std::vector<GLuint> &textures, Shade
|
|||||||
convertAndAddToVid();
|
convertAndAddToVid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Ffmpeg::addImageToVideo(std::vector<uint8_t> &buf)
|
||||||
|
{
|
||||||
|
memcpy(_rgb_frame->data[0], buf.data(), WIDTH * HEIGHT * 3);
|
||||||
|
convertAndAddToVid();
|
||||||
|
}
|
||||||
|
|
||||||
void Ffmpeg::convertAndAddToVid(void)
|
void Ffmpeg::convertAndAddToVid(void)
|
||||||
{
|
{
|
||||||
AVPacket *pkt;
|
AVPacket *pkt;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
|
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/01/22 16:34:53 by tomoron #+# #+# */
|
/* Created: 2025/01/22 16:34:53 by tomoron #+# #+# */
|
||||||
/* Updated: 2025/02/25 00:52:27 by tomoron ### ########.fr */
|
/* Updated: 2025/02/25 19:16:53 by tomoron ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ void Renderer::update(std::vector<GLuint> &textures, ShaderProgram &denoisingPr
|
|||||||
|
|
||||||
_curSamples++;
|
_curSamples++;
|
||||||
if(_headless)
|
if(_headless)
|
||||||
showRenderInfo(0);
|
showRenderInfo(0, 0);
|
||||||
|
|
||||||
if((_testMode && _curSamples < _testSamples) || (!_testMode && _curSamples < _samples))
|
if((_testMode && _curSamples < _testSamples) || (!_testMode && _curSamples < _samples))
|
||||||
return;
|
return;
|
||||||
@ -165,13 +165,13 @@ void Renderer::initRender(Clusterizer *clust)
|
|||||||
throw std::runtime_error("render path is 0 seconds long, aborting");
|
throw std::runtime_error("render path is 0 seconds long, aborting");
|
||||||
|
|
||||||
_curPathIndex = 0;
|
_curPathIndex = 0;
|
||||||
|
_frameCount = 0;
|
||||||
_destPathIndex = _path.size() - 1;
|
_destPathIndex = _path.size() - 1;
|
||||||
_renderStartTime = glfwGetTime();
|
_renderStartTime = glfwGetTime();
|
||||||
if(clust && clust->isServer())
|
if(clust && clust->isServer())
|
||||||
createClusterJobs(*clust);
|
createClusterJobs(*clust);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_frameCount = 0;
|
|
||||||
_curSamples = 0;
|
_curSamples = 0;
|
||||||
_testMode = 0;
|
_testMode = 0;
|
||||||
_scene->getCamera()->setPosition(_path[0].pos);
|
_scene->getCamera()->setPosition(_path[0].pos);
|
||||||
@ -183,15 +183,29 @@ void Renderer::initRender(Clusterizer *clust)
|
|||||||
|
|
||||||
void Renderer::addImageToRender(std::vector<GLuint> &textures, ShaderProgram &denoisingProgram)
|
void Renderer::addImageToRender(std::vector<GLuint> &textures, ShaderProgram &denoisingProgram)
|
||||||
{
|
{
|
||||||
|
if(!_ffmpegVideo)
|
||||||
|
return;
|
||||||
_ffmpegVideo->addImageToVideo(*_scene, textures, denoisingProgram);
|
_ffmpegVideo->addImageToVideo(*_scene, textures, denoisingProgram);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::endRender(void)
|
void Renderer::addImageToRender(std::vector<uint8_t> &buf)
|
||||||
|
{
|
||||||
|
if(!_ffmpegVideo)
|
||||||
|
return;
|
||||||
|
_ffmpegVideo->addImageToVideo(buf);
|
||||||
|
_frameCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Renderer::endRender(Clusterizer *clust)
|
||||||
{
|
{
|
||||||
_destPathIndex = 0;
|
_destPathIndex = 0;
|
||||||
if(_headless)
|
if(_headless)
|
||||||
_shouldClose = 1;
|
_shouldClose = 1;
|
||||||
|
if(_ffmpegVideo)
|
||||||
delete _ffmpegVideo;
|
delete _ffmpegVideo;
|
||||||
|
if(clust && clust->isServer())
|
||||||
|
clust->abortJobs();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Renderer::shouldClose(void) const
|
bool Renderer::shouldClose(void) const
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/02/20 15:54:35 by tomoron #+# #+# */
|
/* Created: 2025/02/20 15:54:35 by tomoron #+# #+# */
|
||||||
/* Updated: 2025/02/24 17:42:35 by tomoron ### ########.fr */
|
/* Updated: 2025/02/25 19:17:19 by tomoron ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ void Renderer::imguiRenderSettings(Clusterizer &clust)
|
|||||||
_renderSettings = 0;
|
_renderSettings = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::showRenderInfo(int isImgui)
|
void Renderer::showRenderInfo(int isImgui, Clusterizer *clust)
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
long int totalFrames;
|
long int totalFrames;
|
||||||
@ -250,7 +250,7 @@ void Renderer::showRenderInfo(int isImgui)
|
|||||||
if(ImGui::Button("stop"))
|
if(ImGui::Button("stop"))
|
||||||
{
|
{
|
||||||
_destPathIndex = 0;
|
_destPathIndex = 0;
|
||||||
endRender();
|
endRender(clust);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -312,7 +312,7 @@ void Renderer::renderImgui(Clusterizer &clust)
|
|||||||
if (ImGui::CollapsingHeader("Renderer"))
|
if (ImGui::CollapsingHeader("Renderer"))
|
||||||
{
|
{
|
||||||
if(rendering() || clust.hasJobs())
|
if(rendering() || clust.hasJobs())
|
||||||
showRenderInfo(1);
|
showRenderInfo(1, &clust);
|
||||||
else if(_renderSettings)
|
else if(_renderSettings)
|
||||||
imguiRenderSettings(clust);
|
imguiRenderSettings(clust);
|
||||||
else
|
else
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/02/20 16:01:59 by tomoron #+# #+# */
|
/* Created: 2025/02/20 16:01:59 by tomoron #+# #+# */
|
||||||
/* Updated: 2025/02/23 22:13:32 by tomoron ### ########.fr */
|
/* Updated: 2025/02/25 19:15:33 by tomoron ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -168,6 +168,6 @@ void Renderer::makeMovement(float time)
|
|||||||
{
|
{
|
||||||
_destPathIndex = 0;
|
_destPathIndex = 0;
|
||||||
if(!_testMode)
|
if(!_testMode)
|
||||||
endRender();
|
endRender(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user