#ifndef RENDERER_HPP #define RENDERER_HPP #include #include #include "math/vector.hpp" #include "o3d/tri.hpp" #include "o3d/tri_deriv.hpp" #include "o3d/mesh.hpp" #include "fb/fb.hpp" #include "shaders/shaders.hpp" namespace engine { template class Renderer { public: FrameBuffer fb; Shaders shaders; Renderer(FrameBuffer&& fb, Shaders&& shaders); void resize(unsigned int w, unsigned int h); void clear(); void draw_triangle(const o3d::Triangle& triangle); void draw_mesh(const o3d::Mesh& mesh); constexpr unsigned int width() const & { return fb.width(); } constexpr unsigned int height() const & { return fb.height(); } private: std::vector depth_buf; void _draw_cropped_triangle(const o3d::Triangle& root, const o3d::TriangleDerived& triangle); }; } #endif // RENDERER_HPP