| 561 | int conversion_num = 0; |
| 562 | |
| 563 | void Textures::ReloadInternal() { |
| 564 | for (unsigned int i = 0; i < textures.size(); i++) { |
| 565 | Texture& texture = textures[i]; |
| 566 | |
| 567 | if (texture.no_live_update) { |
| 568 | continue; |
| 569 | } |
| 570 | |
| 571 | std::vector<unsigned int>::const_iterator it = std::find(free_spaces.begin(), free_spaces.end(), i); |
| 572 | if (it != free_spaces.end()) { |
| 573 | // no texture in this slot |
| 574 | LOG_ASSERT(texture.width == 0); |
| 575 | LOG_ASSERT(texture.height == 0); |
| 576 | LOG_ASSERT(texture.sub_textures.empty()); |
| 577 | LOG_ASSERT(texture.gl_texture_id == UNLOADED_ID); |
| 578 | LOG_ASSERT(texture.gl_buffer_id == UNLOADED_ID); |
| 579 | continue; |
| 580 | } |
| 581 | |
| 582 | LOG_ASSERT(!texture.sub_textures.empty()); |
| 583 | char abs_path[kPathSize]; |
| 584 | |
| 585 | if (texture.sub_textures.size() == 1) { |
| 586 | // ordinary texture |
| 587 | LOG_ASSERT(texture.num_slices == 1); |
| 588 | |
| 589 | SubTexture& sub = texture.sub_textures[0]; |
| 590 | LOG_ASSERT(!sub.texture_name.empty()); |
| 591 | |
| 592 | if (FindImagePath(sub.texture_name.c_str(), abs_path, kPathSize, kDataPaths | kModPaths | kWriteDir | kModWriteDirs, false) == 0) { |
| 593 | if (strcmp(abs_path, sub.load_name.c_str()) == 0 && GetDateModifiedInt64(abs_path) == sub.orig_modified) { |
| 594 | continue; |
| 595 | } |
| 596 | } else { |
| 597 | continue; |
| 598 | } |
| 599 | |
| 600 | std::string name = sub.texture_name; |
| 601 | unsigned char flags = texture.flags; |
| 602 | DisposeTexture(i, false); |
| 603 | loadTexture(name, i, flags | PX_NOCONVERT); |
| 604 | } else { |
| 605 | // array texture |
| 606 | LOG_ASSERT(texture.num_slices > 1); |
| 607 | |
| 608 | LogSystem::LogData(LogSystem::debug, "tex", __FILE__, __LINE__) << "Checking if array texture " << i << " (with " << texture.sub_textures.size() << " slices) needs reload..." << std::endl; |
| 609 | |
| 610 | bool needs_reload = false; |
| 611 | |
| 612 | for (unsigned int s = 0; s < texture.sub_textures.size(); s++) { |
| 613 | SubTexture& sub = texture.sub_textures[s]; |
| 614 | LOG_ASSERT(!sub.texture_name.empty()); |
| 615 | ModID modsource; |
| 616 | if (FindImagePath(sub.texture_name.c_str(), abs_path, kPathSize, kAnyPath, false, NULL, true, true, &modsource) == 0) { |
| 617 | if (strcmp(abs_path, sub.load_name.c_str()) == 0 && GetDateModifiedInt64(abs_path) == sub.orig_modified) { |
| 618 | LogSystem::LogData(LogSystem::debug, "tex", __FILE__, __LINE__) << " slice " << s << ": \"" << sub.texture_name << "\" no" << std::endl; |
| 619 | } else { |
| 620 | LogSystem::LogData(LogSystem::debug, "tex", __FILE__, __LINE__) << " slice " << s << ": \"" << sub.texture_name << "\" yes" << std::endl; |
nothing calls this directly
no test coverage detected