58 size_t size = 4 * width * height;
59 std::vector<unsigned char> pixels(size);
61 unsigned char r =
static_cast<unsigned char>(glm::clamp(color.r, 0.0f, 1.0f) * 255.0f);
62 unsigned char g =
static_cast<unsigned char>(glm::clamp(color.g, 0.0f, 1.0f) * 255.0f);
63 unsigned char b =
static_cast<unsigned char>(glm::clamp(color.b, 0.0f, 1.0f) * 255.0f);
64 unsigned char a =
static_cast<unsigned char>(glm::clamp(color.a, 0.0f, 1.0f) * 255.0f);
66 for (
int i = 0; i < size; i += 4)
static TexturePtr RegisterTexture(TexturePtr texture)
static TexturePtr LoadTextureAsync(const std::string &path, TextureType usage=TextureType::Diffuse)
bool MatchesPath(std::string pathToMatch)
static TexturePtr CreateFromData(unsigned char *data, TextureMetadata &meta)
static TexturePtr CreateFromColor(const glm::vec3 &color, const std::string &name, uint32_t width=1, uint32_t height=1)
static TexturePtr CreateFromFile(const std::string &path, TextureType usage=TextureType::Diffuse)