MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / LoadReflectionCaptureCubemaps

Method LoadReflectionCaptureCubemaps

Source/Main/scenegraph.cpp:3045–3067  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3043}
3044
3045void 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.
3070void SceneGraph::UnloadReflectionCaptureCubemaps() {

Callers 3

DrawMethod · 0.80
LoadLevelMethod · 0.80

Calls 9

FormatStringFunction · 0.85
FindFilePathFunction · 0.85
GetOriginalPathMethod · 0.80
ASGetIntMethod · 0.80
GetScriptParamsMethod · 0.80
GetTypeMethod · 0.45
GetIDMethod · 0.45
validMethod · 0.45

Tested by

no test coverage detected