mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 10:48:34 +02:00
start server part of clusterizer
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/27 14:52:10 by TheRed #+# #+# */
|
||||
/* Updated: 2025/02/04 23:39:14 by tomoron ### ########.fr */
|
||||
/* Updated: 2025/02/20 21:28:15 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -45,6 +45,11 @@
|
||||
# include <set>
|
||||
# include <map>
|
||||
|
||||
# include <sys/socket.h>
|
||||
# include <netinet/in.h>
|
||||
# include <fcntl.h>
|
||||
# include <arpa/inet.h>
|
||||
|
||||
struct Vertex {
|
||||
glm::vec2 position;
|
||||
glm::vec2 texCoord;
|
||||
@ -70,6 +75,7 @@ struct Vertex {
|
||||
# include "SceneParser.hpp"
|
||||
# include "ObjParser.hpp"
|
||||
# include "BVH.hpp"
|
||||
# include "Clusterizer.hpp"
|
||||
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/04 01:07:08 by tomoron #+# #+# */
|
||||
/* Updated: 2025/02/04 22:04:04 by tomoron ### ########.fr */
|
||||
/* Updated: 2025/02/20 19:52:31 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -31,10 +31,17 @@ class Arguments
|
||||
bool error(void) const;
|
||||
void show(void);
|
||||
|
||||
bool getBoolean(std::string name);
|
||||
std::string *getString(std::string name);
|
||||
|
||||
std::string &getSceneName(void);
|
||||
std::string *getRenderPath(void);
|
||||
bool getHeadless(void);
|
||||
|
||||
bool isServer(void);
|
||||
bool isClient(void);
|
||||
std::string *getServerIp(void);
|
||||
|
||||
private:
|
||||
void printUsage();
|
||||
|
||||
|
60
includes/RT/Clusterizer.hpp
Normal file
60
includes/RT/Clusterizer.hpp
Normal file
@ -0,0 +1,60 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Clusterizer.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/20 18:25:18 by tomoron #+# #+# */
|
||||
/* Updated: 2025/02/20 22:41:05 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef CLUSTERIZER_HPP
|
||||
# define CLUSTERIZER_HPP
|
||||
|
||||
# include "RT.hpp"
|
||||
|
||||
typedef struct s_job
|
||||
{
|
||||
std::string scene;
|
||||
glm::vec3 pos;
|
||||
glm::vec2 dir;
|
||||
size_t samples;
|
||||
} t_job;
|
||||
|
||||
class Clusterizer
|
||||
{
|
||||
public:
|
||||
Clusterizer(Arguments args);
|
||||
~Clusterizer();
|
||||
|
||||
private:
|
||||
void update(void);
|
||||
bool getError(void);
|
||||
|
||||
bool _isActive;
|
||||
bool _isServer;
|
||||
bool _error;
|
||||
std::vector<t_job> _jobs;
|
||||
|
||||
private: //client
|
||||
void initClient(void);
|
||||
void updateClient(void);
|
||||
|
||||
std::string _serverIp;
|
||||
|
||||
private: //server
|
||||
void initServer(std::string port);
|
||||
void updateServer(void);
|
||||
|
||||
void initServerSocket(uint16_t port);
|
||||
|
||||
int _serverSocket;
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user