diff options
author | vimene <vincent.menegaux@gmail.com> | 2023-11-19 07:11:23 +0100 |
---|---|---|
committer | vimene <vincent.menegaux@gmail.com> | 2023-11-19 07:11:23 +0100 |
commit | 5b8a65b15a37d9c1c97fb39db93f1b40db628d70 (patch) | |
tree | 15c34cb32631b6fdd85dd5d5aa734f919e4bad1b /pixfb.h | |
parent | 47280c41d7bee4964dbd2779de81b8c9bf6133c1 (diff) | |
download | engine-5b8a65b15a37d9c1c97fb39db93f1b40db628d70.tar.gz |
improved pixel window rendering
Pixel window rendering is now at the same state as the character rendering.
Diffstat (limited to 'pixfb.h')
-rw-r--r-- | pixfb.h | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -0,0 +1,29 @@ +#ifndef PIXFB_H +#define PIXFB_H + +#include <vector> +#include <cstdint> +#include "math_vector.h" +#include "tri_vertex.h" + +class PixelFrameBuffer { + public: + PixelFrameBuffer(unsigned int w, unsigned int h); + void resize(unsigned int w, unsigned int h); + unsigned int width() const; + unsigned int height() const; + const uint32_t* pixels() const; + void clear(); + void draw_triangle(TriangleVertex4 triangle); + + private: + unsigned int w, h; + std::vector<uint32_t> pixels_vector; + std::vector<float> depth_buf; + int face_ind; + + void _draw_cropped_triangle(TriangleVertex3 triangle); + uint32_t face_color() const; +}; + +#endif // PIXFB_H |