56 lines
1.2 KiB
C++
56 lines
1.2 KiB
C++
#ifndef RT_EXP_MESHLET_RENDERER_H
|
|
#define RT_EXP_MESHLET_RENDERER_H
|
|
|
|
#include "runtime/runtime.h"
|
|
|
|
#include "meshlet_generator.hpp"
|
|
|
|
#include <glad/glad.h>
|
|
|
|
struct shader {
|
|
static shader CompileSource(const char *vert_src, const char *frag_src);
|
|
static shader CompileSource(const char *compute_src);
|
|
static shader CompileFile(const char *compute_path);
|
|
|
|
RT_INLINE bool IsValid() const {
|
|
return m_prog != 0;
|
|
}
|
|
|
|
RT_INLINE void Use() const {
|
|
glUseProgram(m_prog);
|
|
}
|
|
|
|
GLuint m_prog;
|
|
};
|
|
|
|
struct meshlet_renderer {
|
|
struct settings {
|
|
bool separate_rendering = true;
|
|
float scale = 1.f;
|
|
float rotation = 0.f;
|
|
float eye[3];
|
|
float target[3];
|
|
float fov;
|
|
};
|
|
|
|
rt_result Initialize();
|
|
|
|
void RenderFlat(const meshlet *meshlets, unsigned int count);
|
|
|
|
void SettingMenu();
|
|
|
|
private:
|
|
void SeparateRendering(const meshlet *meshlets, unsigned int count);
|
|
void DrawIndirectFlat(const meshlet *meshlets, unsigned int count);
|
|
|
|
public:
|
|
settings m_settings;
|
|
|
|
shader m_single_meshlet_shader;
|
|
shader m_flat_cull_shader;
|
|
shader m_meshlet_shader;
|
|
float m_aspect;
|
|
};
|
|
|
|
#endif
|