| 3043 | } |
| 3044 | |
| 3045 | void SceneGraph::LoadReflectionCaptureCubemaps() { |
| 3046 | PROFILER_ZONE(g_profiler_ctx, "Load reflection capture cubemaps"); |
| 3047 | for (auto obj : objects_) { |
| 3048 | if (obj->GetType() == _reflection_capture_object) { |
| 3049 | char save_path[kPathSize]; |
| 3050 | FormatString(save_path, kPathSize, "%s_refl_cap_%d.hdrcube", level_path_.GetOriginalPath(), obj->GetID()); |
| 3051 | char abs_path[kPathSize]; |
| 3052 | if (FindFilePath(save_path, abs_path, kPathSize, kAnyPath, false) != -1) { |
| 3053 | ReflectionCaptureObject* rco = (ReflectionCaptureObject*)obj; |
| 3054 | rco->cube_map_ref = Textures::LoadCubeMapMipmapsHDR(abs_path); // TODO: if no_reflection_capture is true, only the global capture cube should be loaded. |
| 3055 | if (rco->cube_map_ref.valid()) { |
| 3056 | rco->dirty = false; |
| 3057 | if (rco->GetScriptParams()->ASGetInt("Global") == 1) { |
| 3058 | sky->SetSpecularCubeMapTexture(rco->cube_map_ref); |
| 3059 | } |
| 3060 | } else { |
| 3061 | rco->dirty = true; |
| 3062 | } |
| 3063 | } |
| 3064 | } |
| 3065 | } |
| 3066 | reflection_data_loaded = true; |
| 3067 | } |
| 3068 | |
| 3069 | // TODO: make a version that only clears the dynamic cubemaps. |
| 3070 | void SceneGraph::UnloadReflectionCaptureCubemaps() { |
no test coverage detected