Files
b_engine/src/Texture.h

36 lines
801 B
C
Raw Normal View History

//
// Created by lbmas on 4/29/2026.
//
#ifndef B_ENGINE_TEXTURE_H
#define B_ENGINE_TEXTURE_H
#include <memory>
#include <string_view>
#include <string>
class Texture
{
public:
static std::shared_ptr<Texture> load_from_file(std::string_view filePath);
static std::shared_ptr<Texture> load_from_data(unsigned char* data, int width, int height, int channels);
Texture() = default;
~Texture();
void bind(unsigned int slot);
void unbind();
[[nodiscard]] int get_width() const { return width; }
[[nodiscard]] int get_height() const { return height; }
[[nodiscard]] int get_channels() const { return channels; }
private:
unsigned int id = 0;
std::string filePath;
int width = 0;
int height = 0;
int channels = 0;
};
#endif //B_ENGINE_TEXTURE_H