Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
Loading...
Searching...
No Matches
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 <stdbool.h>
#include "app_subsystem.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...
 

Macros

#define APP_ENV_MGR_DESCRIPTOR    {"env_mgr", env_mgr_subsys_init, env_mgr_subsys_cleanup}
 

Enumerations

enum  EnvMapLoadingState { EML_STOP = 0 , EML_UPLOAD_HDR_FROM_PBO , EML_MIPMAP , EML_START_IBL }
 

Functions

int env_manager_load (EnvManager *mgr, AsyncLoader *loader, const char *filename)
 Starts an asynchronous load of an environment map.
 
void env_manager_process_loading_step (EnvManager *mgr, GLuint *recycled_hdr_tex, IBLCoordinator *ibl)
 Processes the multi-frame HDR environment loading state machine.
 
int env_manager_trigger_transition (EnvManager *mgr, AsyncLoader *loader, const char *filename)
 Triggers a new environment transition.
 
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.
 
void env_manager_update_transition (EnvManager *mgr, Scene *scene, PostProcess *postproc, double delta_time, uint64_t frame_count)
 Updates the environment transition animation.
 
void env_manager_render_overlay (const EnvManager *mgr, const Scene *scene)
 Renders the transition overlay (fade/crossfade).
 
int env_mgr_subsys_init (struct App *app)
 
void env_mgr_subsys_cleanup (struct App *app)
 

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.

Macro Definition Documentation

◆ APP_ENV_MGR_DESCRIPTOR

#define APP_ENV_MGR_DESCRIPTOR    {"env_mgr", env_mgr_subsys_init, env_mgr_subsys_cleanup}

Enumeration Type Documentation

◆ EnvMapLoadingState

Enumerator
EML_STOP 
EML_UPLOAD_HDR_FROM_PBO 
EML_MIPMAP 
EML_START_IBL 

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:

◆ env_mgr_subsys_cleanup()

void env_mgr_subsys_cleanup ( struct App *  app)

◆ env_mgr_subsys_init()

int env_mgr_subsys_init ( struct App *  app)