mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 18:48:36 +02:00
merge renderer with main
This commit is contained in:
91
includes/RT/Renderer.hpp
Normal file
91
includes/RT/Renderer.hpp
Normal file
@ -0,0 +1,91 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Renderer.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef RENDERER_HPP
|
||||
# define RENDERER_HPP
|
||||
|
||||
# include "RT.hpp"
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavutil/avutil.h>
|
||||
#include <libavutil/imgutils.h>
|
||||
#include <libswscale/swscale.h>
|
||||
}
|
||||
|
||||
class Scene;
|
||||
class Window;
|
||||
class Shader;
|
||||
|
||||
typedef struct s_pathPoint
|
||||
{
|
||||
glm::vec3 pos;
|
||||
glm::vec2 dir;
|
||||
double time;
|
||||
} t_pathPoint;
|
||||
|
||||
class Renderer
|
||||
{
|
||||
public:
|
||||
Renderer(Scene *scene, Window *win);
|
||||
void renderImgui(void);
|
||||
void update(Shader &shader);
|
||||
int rendering(void) const;
|
||||
|
||||
private:
|
||||
void addPoint(float time);
|
||||
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);
|
||||
glm::vec2 bezierSphereInterpolate(glm::vec4 control, glm::vec2 from, glm::vec2 to, float time);
|
||||
void updateAvailableCodecs(void);
|
||||
void fillGoodCodecList(std::vector<AVCodecID> &lst);
|
||||
glm::vec3 hermiteInterpolate(glm::vec3 points[4], double alpha);
|
||||
|
||||
int _min;
|
||||
int _sec;
|
||||
int _samples;
|
||||
int _testSamples;
|
||||
bool _autoTime;
|
||||
int _fps;
|
||||
char _filenameBuffer[512];
|
||||
std::vector<t_pathPoint> _path;
|
||||
std::string _outputFilename;
|
||||
Scene *_scene;
|
||||
Window *_win;
|
||||
std::vector<const AVCodec *> _codecList;
|
||||
std::vector<const char *> _codecListStr;
|
||||
int _codecIndex;
|
||||
|
||||
int _curPathIndex;
|
||||
int _destPathIndex;
|
||||
double _curSplitStart;
|
||||
int _curSamples;
|
||||
int _testMode;
|
||||
long int _frameCount;
|
||||
float _renderStartTime;
|
||||
|
||||
AVFormatContext *_format;
|
||||
AVCodecContext *_codec_context;
|
||||
AVFrame *_rgb_frame;
|
||||
AVFrame *_yuv_frame;
|
||||
SwsContext *_sws_context;
|
||||
AVStream *_stream;
|
||||
AVDictionary *_codecOptions;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -6,7 +6,7 @@
|
||||
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/13 18:10:10 by TheRed #+# #+# */
|
||||
/* Updated: 2025/01/30 17:52:20 by ycontre ### ########.fr */
|
||||
/* Updated: 2025/01/30 22:27:43 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -37,6 +37,8 @@ class Shader
|
||||
|
||||
GLuint getProgram(void) const;
|
||||
GLuint getProgramCompute(void) const;
|
||||
|
||||
std::vector<float> getOutputImage(void);
|
||||
|
||||
|
||||
private:
|
||||
@ -57,4 +59,4 @@ class Shader
|
||||
void checkCompileErrors(unsigned int shader);
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/13 16:15:41 by TheRed #+# #+# */
|
||||
/* Updated: 2025/01/11 16:14:11 by tomoron ### ########.fr */
|
||||
/* Updated: 2025/01/25 03:09:23 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -26,7 +26,7 @@ class Window
|
||||
void display();
|
||||
void pollEvents();
|
||||
bool shouldClose();
|
||||
|
||||
|
||||
void process_input();
|
||||
|
||||
static void keyCallback(GLFWwindow *window, int key, int scancode, int action, int mods);
|
||||
@ -44,9 +44,13 @@ class Window
|
||||
|
||||
bool &getAccumulate(void);
|
||||
|
||||
void setFrameCount(int nb);
|
||||
|
||||
void rendererUpdate(Shader &shader);
|
||||
private:
|
||||
GLFWwindow *_window;
|
||||
Scene *_scene;
|
||||
Renderer *_renderer;
|
||||
|
||||
float _fps;
|
||||
float _delta;
|
||||
|
Reference in New Issue
Block a user