aboutsummaryrefslogtreecommitdiff
path: root/src/fb/pixfb.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/fb/pixfb.hpp')
-rw-r--r--src/fb/pixfb.hpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/fb/pixfb.hpp b/src/fb/pixfb.hpp
new file mode 100644
index 0000000..f7a7acb
--- /dev/null
+++ b/src/fb/pixfb.hpp
@@ -0,0 +1,40 @@
+#ifndef FB_PIXFB_H
+#define FB_PIXFB_H
+
+#include <vector>
+#include <cstdint>
+#include "math/vector.hpp"
+#include "o3d/vertex_data.hpp"
+
+namespace engine::fb {
+
+using engine::math::Vector3, engine::o3d::VertexData;
+
+class PixelFrameBuffer {
+ public:
+ PixelFrameBuffer(unsigned int w, unsigned int h);
+ void resize(unsigned int w, unsigned int h);
+ void clear();
+ void draw_point(int x, int y, const Vector3& loc, const VertexData& vd, const Vector3& normal);
+
+ constexpr unsigned int width() const & {
+ return w;
+ }
+
+ constexpr unsigned int height() const & {
+ return h;
+ }
+
+ constexpr const uint32_t* pixels() const & {
+ return pixels_vector.data();
+ }
+
+ private:
+ unsigned int w, h;
+ std::vector<uint32_t> pixels_vector;
+ int face_ind;
+};
+
+}
+
+#endif // FB_PIXFB_H