mk_ibl_destroyfunction
void mk_ibl_destroy(mk_ibl_t env)Destroy an environment and free its GPU resources.
| Parameter | Type | Description |
|---|---|---|
env | mk_ibl_t | Value for env. |
#include <modkit/ibl.h>11 functions · 1 structs · 1 typedefs · 1 macros
Image-based lighting + skybox package (opt-in).
An OPT-IN package (MODKIT_ENABLE_IBL, default OFF). The production path loads a versioned .mkibl bundle containing the pieces a PBR material samples to be lit by the environment:a full-mip environment cubemap for the skyboxSH-9 coefficients for diffuse irradiancefull-mip GGX and Charlie prefiltered cubemapsa static, environment-independent split-sum DFG LUT Use modkit-bake-ibl to build the bundle offline. mk_ibl_load_hdr() remains an explicit development fallback and performs expensive synchronous GPU baking. mk_set_environment() makes an environment active and (once the IBL pieces are baked) registers it with the material system: PBR materials with the MK_PROVIDER_IBL then sample it automatically. With no environment set, PBR falls back to analytic lighting only. mk_ibl_t env = mk_ibl_load("assets/env.mkibl"); mk_set_environment(env); mk_begin_pass(&mk_pass_3d(clear, view, proj)); mk_skybox_draw(env, view, proj); // ... draw PBR objects, lit by env ... mk_end_pass(); Texture stages used by the env provider: 5 = prefiltered specular cube, 6 = BRDF LUT (the PBR material owns 0-4 and extension slots; see pbr.h).
mk_ibl_destroyfunctionvoid mk_ibl_destroy(mk_ibl_t env)Destroy an environment and free its GPU resources.
| Parameter | Type | Description |
|---|---|---|
env | mk_ibl_t | Value for env. |
mk_ibl_is_validfunctionbool mk_ibl_is_valid(mk_ibl_t env)Public validity excludes environments whose owner reference was destroyed.
| Parameter | Type | Description |
|---|---|---|
env | mk_ibl_t | Value for env. |
Returns True when the condition holds.
mk_ibl_loadfunctionmk_ibl_t mk_ibl_load(const char *path)Load a prefiltered, versioned .mkibl bundle produced by modkit-bake-ibl.
| Parameter | Type | Description |
|---|---|---|
path | const char * | Value for path. |
Returns The resulting handle or value. This is the production path and performs no GPU baking or renderer flush.
mk_ibl_load_hdrfunctionmk_ibl_t mk_ibl_load_hdr(const char *path)Load an equirectangular .hdr and bake the environment.
Returns MK_IBL_INVALID
| Parameter | Type | Description |
|---|---|---|
path | const char * | Value for path. |
Returns The resulting handle or value. on failure. This is an explicit development fallback.
mk_ibl_load_memfunctionmk_ibl_t mk_ibl_load_mem(const void *data, size_t size)Load a prefiltered .mkibl bundle from memory.
The bytes need only remain valid
| Parameter | Type | Description |
|---|---|---|
data | const void * | Data buffer. |
size | size_t | Size in bytes. |
Returns The resulting handle or value. for the duration of the call.
mk_ibl_pinfunctionbool mk_ibl_pin(mk_ibl_t env)Retain/release an internal environment reference.
New retains reject pending
| Parameter | Type | Description |
|---|---|---|
env | mk_ibl_t | Value for env. |
Returns True when the operation succeeds. handles; an existing retain keeps its textures alive until released.
mk_ibl_unpinfunctionvoid mk_ibl_unpin(mk_ibl_t env)Perform the ibl unpin operation.
| Parameter | Type | Description |
|---|---|---|
env | mk_ibl_t | Value for env. |
mk_set_env_rotationfunctionvoid mk_set_env_rotation(float radians)Yaw the environment about +Y by radians, applied to the skybox AND all IBL reflections/irradiance together (the glTF Sample Viewer's u_EnvRotation; its UI default is 90 deg).
0 = unrotated. Use it to align an env's azimuth with a
| Parameter | Type | Description |
|---|---|---|
radians | float | Value for radians. reference renderer, or to spin the lighting. |
mk_set_environmentfunctionvoid mk_set_environment(mk_ibl_t env)Set the active environment for PBR materials (registers the env provider with.
| Parameter | Type | Description |
|---|---|---|
env | mk_ibl_t | Value for env. the material system). Pass MK_IBL_INVALID to clear (unregisters). |
mk_skybox_drawfunctionvoid mk_skybox_draw(mk_ibl_t env, const float *view, const float *proj)Draw the environment as the scene background, into the active pass.
Pass the same view/proj as the pass camera; the skybox uses the rotation only
| Parameter | Type | Description |
|---|---|---|
env | mk_ibl_t | Value for env. |
view | const float * | Value for view. |
proj | const float * | Value for proj. (camera-centered) and renders at the far plane. |
mk_skybox_set_blurfunctionvoid mk_skybox_set_blur(float blur)Blur the skybox background.
0 = sharp (the default); >0 samples coarser env-cube mips (1 = fully blurred). Clamped to [0,1]. Affects only the displayed skybox
| Parameter | Type | Description |
|---|---|---|
blur | float | Value for blur. object reflections still blur by material roughness. |
mk_iblstructData for ibl.
| Field | Type | Description |
|---|---|---|
id | uint32_t | The ID. |
mk_ibl_ttypedeftypedef struct mk_ibl mk_ibl_tData for ibl.
MK_IBL_INVALIDdefineMK_IBL_INVALIDInvalid sentinel for ibl.