$darkmode
Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
env_manager.c File Reference
#include "env_manager.h"
#include "app_settings.h"
#include "async_loader.h"
#include "gl_common.h"
#include "ibl_coordinator.h"
#include "log.h"
#include "postprocess.h"
#include "scene.h"
#include "shader.h"
#include "texture.h"
#include "utils.h"
#include <float.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for env_manager.c:

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...
 
static void capture_snapshot (Scene *scene, int width, int height)
 
static void finalize_ibl_swap (Scene *scene, PostProcess *postproc, GLuint hdr_tex, GLuint spec_tex, GLuint irr_tex, float threshold, uint64_t frame_count)
 
static void handle_ibl_done_wait_state (EnvManager *mgr, Scene *scene, PostProcess *postproc, uint64_t frame_count)
 
static void handle_ibl_done_loading_state (EnvManager *mgr, Scene *scene, PostProcess *postproc, uint64_t frame_count, int width, int height)
 
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...
 

Variables

static const int MAX_PATH_LENGTH = 256
 

Function Documentation

◆ capture_snapshot()

static void capture_snapshot ( Scene scene,
int  width,
int  height 
)
static

◆ 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:

◆ finalize_ibl_swap()

static void finalize_ibl_swap ( Scene scene,
PostProcess postproc,
GLuint  hdr_tex,
GLuint  spec_tex,
GLuint  irr_tex,
float  threshold,
uint64_t  frame_count 
)
static
Here is the call graph for this function:

◆ handle_ibl_done_loading_state()

static void handle_ibl_done_loading_state ( EnvManager mgr,
Scene scene,
PostProcess postproc,
uint64_t  frame_count,
int  width,
int  height 
)
static
Here is the call graph for this function:

◆ handle_ibl_done_wait_state()

static void handle_ibl_done_wait_state ( EnvManager mgr,
Scene scene,
PostProcess postproc,
uint64_t  frame_count 
)
static
Here is the call graph for this function:

Variable Documentation

◆ MAX_PATH_LENGTH

const int MAX_PATH_LENGTH = 256
static