aboutsummaryrefslogtreecommitdiff
path: root/src/fb/pixfb.h
blob: 84bce2c10f6e42e52f02ab051ea3e8d230fd6941 (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
#ifndef FB_PIXFB_H
#define FB_PIXFB_H

#include <vector>
#include <cstdint>
#include "fb/fb.h"

namespace engine::fb {

class PixelFrameBuffer : public FrameBuffer {
    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_point(int x, int y, engine::math::Vector3 loc, const engine::o3d::VertexData& vd);

    private:
        unsigned int w, h;
        std::vector<uint32_t> pixels_vector;
        int face_ind;

        uint32_t face_color(int face_ind) const;
};

}

#endif // FB_PIXFB_H