mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 18:48:36 +02:00
start changing parsing of arguments to add settings and start a render with no input
This commit is contained in:
50
includes/RT/Arguments.hpp
Normal file
50
includes/RT/Arguments.hpp
Normal file
@ -0,0 +1,50 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Arguments.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/04 01:07:08 by tomoron #+# #+# */
|
||||
/* Updated: 2025/02/04 03:10:58 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef ARGUMENTS_HPP
|
||||
# define ARGUMENTS_HPP
|
||||
|
||||
#include "RT.hpp"
|
||||
|
||||
typedef struct s_arg
|
||||
{
|
||||
char shortName;
|
||||
std::string longName;
|
||||
int isFlag;
|
||||
} t_arg;
|
||||
|
||||
class Arguments
|
||||
{
|
||||
public :
|
||||
Arguments(int argc, char **argv);
|
||||
bool getHeadless(void) const;
|
||||
std::string &getSceneName(void);
|
||||
std::string getRenderPathName(void);
|
||||
bool error(void) const;
|
||||
|
||||
private:
|
||||
void printUsage();
|
||||
|
||||
int handleArg(char **argv, int argc, int *i);
|
||||
void initArguments(void);
|
||||
void addArgument(char shortName, std::string longName, int isFlag);
|
||||
|
||||
void parseRenderPathName(char * path);
|
||||
|
||||
bool _headless;
|
||||
bool _err;
|
||||
|
||||
std::vector<t_arg> _args;
|
||||
std::map<std::string, std::string> _values;
|
||||
};
|
||||
|
||||
#endif
|
@ -6,7 +6,7 @@
|
||||
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/01/22 16:29:26 by tomoron #+# #+# */
|
||||
/* Updated: 2025/01/30 22:15:55 by tomoron ### ########.fr */
|
||||
/* Updated: 2025/02/04 00:41:10 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -37,21 +37,28 @@ class Renderer
|
||||
{
|
||||
public:
|
||||
Renderer(Scene *scene, Window *win);
|
||||
Renderer(Scene *scene, Window *win, std::string filename);
|
||||
void renderImgui(void);
|
||||
void update(Shader &shader);
|
||||
int rendering(void) const;
|
||||
bool shouldClose(void) const;
|
||||
|
||||
private:
|
||||
void addPoint(float time);
|
||||
void init(Scene *scene, Window *win);
|
||||
void savePath(void);
|
||||
void rawRead(std::ifstream &file, void *buf, size_t len);
|
||||
void loadPath(std::string filename);
|
||||
void makeMovement(float timeFromStart, float curSplitTimeReset);
|
||||
void initRender();
|
||||
void addImageToRender(Shader &shader);
|
||||
void endRender(void);
|
||||
void imguiPathCreation(void);
|
||||
void imguiRenderInfo(void);
|
||||
std::string floatToTime(float timef);
|
||||
void imguiRenderSettings(void);
|
||||
std::string floatToTime(double timef);
|
||||
glm::vec2 bezierSphereInterpolate(glm::vec4 control, glm::vec2 from, glm::vec2 to, float time);
|
||||
void updateAvailableCodecs(void);
|
||||
void updateAvailableCodecs(int mode, AVCodecID id);
|
||||
void fillGoodCodecList(std::vector<AVCodecID> &lst);
|
||||
glm::vec3 hermiteInterpolate(glm::vec3 points[4], double alpha);
|
||||
|
||||
@ -69,6 +76,10 @@ class Renderer
|
||||
std::vector<const AVCodec *> _codecList;
|
||||
std::vector<const char *> _codecListStr;
|
||||
int _codecIndex;
|
||||
bool _renderSettings;
|
||||
bool _ignoreUnavailableCodec;
|
||||
bool _headless;
|
||||
bool _shouldClose;
|
||||
|
||||
int _curPathIndex;
|
||||
int _destPathIndex;
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/12/23 18:30:18 by ycontre #+# #+# */
|
||||
/* Updated: 2025/01/28 19:05:16 by ycontre ### ########.fr */
|
||||
/* Updated: 2025/02/04 03:11:36 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -105,11 +105,9 @@ class Camera;
|
||||
class Scene
|
||||
{
|
||||
public:
|
||||
Scene();
|
||||
Scene(std::string &name);
|
||||
~Scene();
|
||||
|
||||
bool parseScene(char *name);
|
||||
|
||||
void addObject(Object *object);
|
||||
void addMaterial(Material *material);
|
||||
void addTexture(std::string path);
|
||||
@ -141,7 +139,11 @@ class Scene
|
||||
Camera *getCamera(void) const;
|
||||
GPUMaterial getMaterial(int material_index);
|
||||
|
||||
bool fail(void) const;
|
||||
|
||||
private:
|
||||
|
||||
bool _fail;
|
||||
std::vector<GPUBvhData> _gpu_bvh_data;
|
||||
std::vector<GPUBvh> _gpu_bvh;
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: TheRed <TheRed@students.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/12/26 21:37:37 by TheRed #+# #+# */
|
||||
/* Updated: 2025/01/21 15:15:13 by tomoron ### ########.fr */
|
||||
/* Updated: 2025/02/04 01:21:28 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
class SceneParser
|
||||
{
|
||||
public:
|
||||
SceneParser(Scene *scene, char *filename);
|
||||
SceneParser(Scene *scene, std::string filename);
|
||||
|
||||
bool parseLine(const std::string &line);
|
||||
|
||||
|
Reference in New Issue
Block a user