$darkmode
Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
env_manager.h File Reference

Environment and IBL management module. More...

#include "app_settings.h"
#include "async_loader.h"
#include "gl_common.h"
#include "ibl_coordinator.h"
#include "postprocess.h"
Include dependency graph for env_manager.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  EnvManager
 Encapsulates state for environment loading, transitions, and IBL. More...
 

Functions

int env_manager_load (EnvManager *mgr, AsyncLoader *loader, const char *filename)
 Starts an asynchronous load of an environment map. More...
 
void env_manager_process_loading_step (EnvManager *mgr, GLuint *recycled_hdr_tex, IBLCoordinator *ibl)
 Processes the multi-frame HDR environment loading state machine. More...
 
int env_manager_trigger_transition (EnvManager *mgr, AsyncLoader *loader, const char *filename)
 Triggers a new environment transition. More...
 
void env_manager_update_ibl (EnvManager *mgr, Scene *scene, PostProcess *postproc, uint64_t frame_count, int width, int height)
 Updates the IBL state machine and handles transition events. More...
 
void env_manager_update_transition (EnvManager *mgr, Scene *scene, PostProcess *postproc, double delta_time, uint64_t frame_count)
 Updates the environment transition animation. More...
 
void env_manager_render_overlay (const EnvManager *mgr, const Scene *scene)
 Renders the transition overlay (fade/crossfade). More...
 

Detailed Description

Environment and IBL management module.

This module handles HDR texture file scanning, environment map loading, and manages the state machine for progressive Image-Based Lighting (IBL) updates.

Function Documentation

◆ env_manager_load()

int env_manager_load ( EnvManager mgr,
AsyncLoader loader,
const char *  filename 
)

Starts an asynchronous load of an environment map.

Parameters
mgrPointer to the environment manager.
loaderPointer to the async loader.
filenameBasename of the HDR file to load.
Returns
1 on success, 0 on failure.
Here is the call graph for this function:

◆ env_manager_process_loading_step()

void env_manager_process_loading_step ( EnvManager mgr,
GLuint *  recycled_hdr_tex,
IBLCoordinator ibl 
)

Processes the multi-frame HDR environment loading state machine.

Parameters
mgrPointer to the environment manager.
recycled_hdr_texPointer to the recycled HDR texture handle.
iblPointer to the IBL coordinator.
Here is the call graph for this function:

◆ env_manager_render_overlay()

void env_manager_render_overlay ( const EnvManager mgr,
const Scene scene 
)

Renders the transition overlay (fade/crossfade).

Parameters
mgrPointer to the environment manager.
scenePointer to the scene (contains debug shader and quad).
Here is the call graph for this function:

◆ env_manager_trigger_transition()

int env_manager_trigger_transition ( EnvManager mgr,
AsyncLoader loader,
const char *  filename 
)

Triggers a new environment transition.

Parameters
mgrPointer to the environment manager.
loaderPointer to the async loader.
filenameHDR file to load.
Returns
1 on success.
Here is the call graph for this function:

◆ env_manager_update_ibl()

void env_manager_update_ibl ( EnvManager mgr,
Scene scene,
PostProcess postproc,
uint64_t  frame_count,
int  width,
int  height 
)

Updates the IBL state machine and handles transition events.

This function combines the logic of checking IBL progress and updating the transition state (loading -> fade out/in).

Parameters
mgrPointer to the environment manager.
scenePointer to the scene (for texture management).
postprocPointer to post-process (for exposure).
frame_countCurrent frame count.
widthCurrent window width (for snapshot).
heightCurrent window height (for snapshot).
Here is the call graph for this function:

◆ env_manager_update_transition()

void env_manager_update_transition ( EnvManager mgr,
Scene scene,
PostProcess postproc,
double  delta_time,
uint64_t  frame_count 
)

Updates the environment transition animation.

Parameters
mgrPointer to the environment manager.
scenePointer to the scene.
postprocPointer to post-process.
delta_timeTime elapsed since last frame.
frame_countCurrent frame count.
Here is the call graph for this function: