aboutsummaryrefslogtreecommitdiff
path: root/src/fb/pixfb.h
blob: 81a7ac3962157e9c7ed51037fd30578fccfa0e1f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef FB_PIXFB_H
#define FB_PIXFB_H

#include <vector>
#include <cstdint>
#include "math/vector.h"
#include "o3d/vertex_data.h"

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