bool readImage(const std::string& path, Img& img) { if (endsWith(path, ".ptx")) { img.path = path; // read ptx face-zero image std::string error; PtexTexture* ptx = PtexTexture::open(path.c_str(), error); if (!ptx) { std::cerr << error << std::endl; return 0; } if (ptx->numFaces() != 1) { std::cerr << "Error: Ptex file has multiple faces (not yet supported)" << std::endl; ptx->release(); return 0; } bool ok = PtexToImg(ptx, img, /*faceid*/ 0, /*flip*/ true); ptx->release(); return ok; } else { return img.load(path); } }