engine/include/resources/texture.h

29 lines
771 B
C
Raw Permalink Normal View History

2024-03-31 10:11:22 +00:00
#pragma once
2022-12-15 15:54:11 +00:00
#include <string>
2023-05-01 13:13:35 +00:00
#include "application.h"
#include "gfx_device.h"
2023-05-01 12:55:49 +00:00
namespace engine {
2022-12-15 15:54:11 +00:00
class Texture {
2023-11-05 01:04:05 +00:00
public:
2024-02-03 00:01:01 +00:00
Texture(Renderer* renderer, const uint8_t* bitmap, int width, int height, gfx::SamplerInfo samplerInfo, bool srgb);
2023-11-05 01:04:05 +00:00
~Texture();
Texture(const Texture&) = delete;
Texture& operator=(const Texture&) = delete;
const gfx::Image* GetImage() { return image_; }
const gfx::Sampler* GetSampler() { return sampler_; }
private:
GFXDevice* gfx_;
const gfx::Image* image_;
const gfx::Sampler* sampler_; // not owned by Texture, owned by Renderer
2022-12-15 15:54:11 +00:00
};
2024-02-03 00:01:01 +00:00
std::unique_ptr<Texture> LoadTextureFromFile(const std::string& path, gfx::SamplerInfo samplerInfo, Renderer* renderer, bool srgb = true);
2023-11-05 01:04:05 +00:00
2024-03-31 10:11:22 +00:00
} // namespace engine