11 int width, height, channels;
14 stbi_uc* pixels = stbi_load(
15 std::filesystem::absolute(path).generic_string().c_str(),
23 std::cerr <<
"Failed to load image at path: "
24 << std::filesystem::absolute(path).generic_string()
26 throw std::runtime_error(
"Failed to load texture image!");
30 size_t imageSize =
static_cast<size_t>(width) * height * 4;
33 std::vector<unsigned char> imageData(pixels, pixels + imageSize);
36 stbi_image_free(pixels);
39 return std::make_unique<TextureLoadData>(std::move(imageData), width, height, 4);
std::unique_ptr< TextureLoadData > loadImage(const std::filesystem::path &path)