source/Texture.cpp
bool Texture::loadImage(const std::vector<std::string> &urls,
                        std::vector<uint8_t *> *pixels) {
  stbi_set_flip_vertically_on_load(mFlip);
  for (auto filename : urls) {
    uint8_t *pixel = stbi_load(filename.c_str(), &mWidth, &mHeight, 0, 4);
    if (pixel == 0) {
      std::cout << stderr << "Couldn't open input file" << filename
                << std::endl;
      return false;
    }
    pixels->push_back(pixel);
  }
  return true;
}
// Force loading 3 channel images to 4 channel by stb becasue Dawn doesn't
// support 3 channel formats currently. The group is discussing on whether
// webgpu shoud support 3 channel format.
// https://github.com/gpuweb/gpuweb/issues/66#issuecomment-410021505
Force loading 3 channel images to 4 channel by stb becasue Dawn doesn't
support 3 channel formats currently. The group is discussing on whether
webgpu shoud support 3 channel format.
Force loading 3 channel images to 4 channel by stb becasue Dawn doesn ' t support 3 channel formats currently . The group is discussing on whether webgpu shoud support 3 channel format .
bool Texture::loadImage(const std::vector<std::string> &urls,
                        std::vector<uint8_t *> *pixels) {
  stbi_set_flip_vertically_on_load(mFlip);
  for (auto filename : urls) {
    uint8_t *pixel = stbi_load(filename.c_str(), &mWidth, &mHeight, 0, 4);
    if (pixel == 0) {
      std::cout << stderr << "Couldn't open input file" << filename
                << std::endl;
      return false;
    }
    pixels->push_back(pixel);
  }
  return true;
}
bool Texture :: loadImage ( const std :: vector < std :: string > & urls , std :: vector < uint8_t * > * pixels ) { stbi_set_flip_vertically_on_load ( mFlip ) ; for ( auto filename : urls ) { uint8_t * pixel = stbi_load ( filename . c_str ( ) , & mWidth , & mHeight , 0 , 4 ) ; if ( pixel == 0 ) { std :: cout << stderr << " " << filename << std :: endl ; return false ; } pixels -> push_back ( pixel ) ; } return true ; }
Force loading 3 channel images to 4 channel by stb becasue Dawn doesn't
support 3 channel formats currently.
Force loading 3 channel images to 4 channel by stb becasue Dawn doesn ' t support 3 channel formats currently .