hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/src/rendering/texture.h
blob: 195605cc1eb34ea1921026e6c2a732f2f183960b (plain)
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
41
42
#pragma once

#include "core/memory.h"

#include <string>
#include <glm/glm.hpp>

namespace Donut
{
    class Texture
    {
    public:
        virtual ~Texture() = default;

        virtual uint32_t get_width()      const = 0;
        virtual uint32_t get_height()     const = 0;
        virtual uint32_t get_renderer_id() const = 0;

        virtual void set_data(void* data, uint32_t size)       = 0;
        virtual void bind(uint32_t slot = 0)            const = 0;
        virtual void bind_as_image(uint32_t slot = 0, 
                                 bool read_only = false) const = 0;

        virtual bool operator==(const Texture& other)   const = 0;
    };

    class Texture2D
        : public Texture
    {
    public:
        static Ref<Texture2D> create(uint32_t width, uint32_t height);
        static Ref<Texture2D> create(const std::string& path);
    };

    class CubemapTexture
        : public Texture
    {
    public:
        static Ref<CubemapTexture> create(uint32_t width, uint32_t height);
        static Ref<CubemapTexture> create_from_hdri(const std::string& path);
    };
};