| 477 | } |
| 478 | |
| 479 | void Sky::LoadResources() { |
| 480 | Dispose(); |
| 481 | PROFILER_GPU_ZONE(g_profiler_ctx, "Sky::LoadResources"); |
| 482 | // Scale down skybox if using low-res textures |
| 483 | int sky_box_res = kSkyBoxRes / Graphics::Instance()->config_.texture_reduction_factor(); |
| 484 | sky_box_res = max(kDiffuseBoxRes, sky_box_res); |
| 485 | |
| 486 | // Check if the dds cache files are missing |
| 487 | // bool missing_a_cubemap = false; |
| 488 | char abs_path[kPathSize]; |
| 489 | FindImagePath(dome_texture_name.c_str(), abs_path, kPathSize, kDataPaths | kModPaths); |
| 490 | int64_t src_modified = GetDateModifiedInt64(abs_path); |
| 491 | int64_t cache_modified = src_modified; |
| 492 | int64_t curr_modified; |
| 493 | std::string path[2]; |
| 494 | for (int i = 0; i < 2; i++) { |
| 495 | switch (i) { |
| 496 | case 0: |
| 497 | path[i] = dome_texture_name + "_" + level_name + "_cube.dds"; |
| 498 | break; |
| 499 | case 1: |
| 500 | path[i] = dome_texture_name + "_" + level_name + "_cube_blur.dds"; |
| 501 | break; |
| 502 | } |
| 503 | |
| 504 | // Pick most recently modified cubemap from install dir or user write dir |
| 505 | FindFilePath(path[i].c_str(), abs_path, kPathSize, kDataPaths | kModPaths, false); |
| 506 | curr_modified = GetDateModifiedInt64(abs_path); |
| 507 | FindFilePath(path[i].c_str(), abs_path, kPathSize, kWriteDir | kModWriteDirs, false); |
| 508 | int64_t write_modified = GetDateModifiedInt64(abs_path); |
| 509 | if (curr_modified == -1 || write_modified > curr_modified) { |
| 510 | curr_modified = write_modified; |
| 511 | } |
| 512 | cache_modified = min(cache_modified, curr_modified); |
| 513 | if (curr_modified == -1) { |
| 514 | // missing_a_cubemap = true; |
| 515 | } |
| 516 | } |
| 517 | |
| 518 | // If source texture not found, or cubemap is up to date, then load the cubemap |
| 519 | /*if(!missing_a_cubemap && (src_modified == -1 || (src_modified <= cache_modified && !lighting_changed))) { |
| 520 | modified = cache_modified; |
| 521 | cube_map_texture_ref = Textures::Instance()->returnTextureAssetRef(path[0].c_str()); |
| 522 | spec_cube_map_texture_ref = Textures::Instance()->returnTextureAssetRef(path[1].c_str(), PX_SRGB); |
| 523 | cached = true; |
| 524 | displaying_YCOCG_sky = true; |
| 525 | } else {*/ |
| 526 | modified = src_modified; |
| 527 | cached = false; |
| 528 | //} |
| 529 | |
| 530 | sky_box_model.LoadObj("Data/Models/skybox.obj"); |
| 531 | |
| 532 | // Allocate resources for skybox creation and blurring |
| 533 | if (!cached) { |
| 534 | if (sky_dome_model.vertices.empty()) { |
| 535 | sky_dome_model.LoadObj("Data/Models/skydome.obj"); |
| 536 | sky_land_model.LoadObj("Data/Models/skyland.obj"); |
nothing calls this directly
no test coverage detected