| 230 | //=================================================================== |
| 231 | |
| 232 | void |
| 233 | Texture::processArgs(std::string sArgs) |
| 234 | { |
| 235 | // Options descriptor |
| 236 | struct argparser::option longopts[] = { |
| 237 | {"external", argparser::option::no_argument, &externalFile, 1}, |
| 238 | {"linear-tiling", argparser::option::no_argument, (int*)&tiling, (int)vk::ImageTiling::eLinear}, |
| 239 | {"use-vma", argparser::option::no_argument, (int*)&useSubAlloc, (int)UseSuballocator::Yes}, |
| 240 | {"qcolor", argparser::option::required_argument, NULL, 1}, |
| 241 | {NULL, argparser::option::no_argument, NULL, 0} |
| 242 | }; |
| 243 | |
| 244 | argvector argv(sArgs); |
| 245 | argparser ap(argv); |
| 246 | |
| 247 | int ch; |
| 248 | while ((ch = ap.getopt(nullptr, longopts, nullptr)) != -1) { |
| 249 | switch (ch) { |
| 250 | case 0: break; |
| 251 | case 1: |
| 252 | { |
| 253 | std::istringstream in(ap.optarg); |
| 254 | rgbcolor clr; |
| 255 | int i; |
| 256 | |
| 257 | for (i = 0; i < 4 && !in.eof(); i++) { |
| 258 | in >> clr[0] >> skip(",") >> clr[1] >> skip(",") >> clr[2]; |
| 259 | quadColor[i] = clr; |
| 260 | if (!in.eof()) |
| 261 | in >> skip(","); |
| 262 | } |
| 263 | assert(!in.fail() && (i == 1 || i == 4)); |
| 264 | if (i == 1) { |
| 265 | for(; i < 4; i++) |
| 266 | quadColor[i] = quadColor[0]; |
| 267 | } |
| 268 | break; |
| 269 | } |
| 270 | default: assert(false); // Error in args in sample table. |
| 271 | } |
| 272 | } |
| 273 | assert(ap.optind < argv.size()); |
| 274 | ktxfilename = argv[ap.optind]; |
| 275 | } |
| 276 | |
| 277 | /* ------------------------------------------------------------------------- */ |
| 278 | |