Functions
mk_material_alpha_modefunction
mk_material_alpha_mode_t mk_material_alpha_mode(mk_material_t)
Perform the material alpha mode operation.
| Parameter | Type | Description |
|---|
| mk_material_t | — |
Returns The resulting handle or value.
mk_material_applyfunction
void mk_material_apply(mk_material_t, struct mk_draw_desc *out)
Apply material.
| Parameter | Type | Description |
|---|
| mk_material_t | — |
out | struct mk_draw_desc * | Value for out. |
mk_material_createfunction
mk_material_t mk_material_create(const mk_material_desc *desc)
The general way.
Uniform/sampler names resolve through the shader (which must
| Parameter | Type | Description |
|---|
desc | const mk_material_desc * | Configuration descriptor. |
Returns The resulting handle or value. have declared them, e.g. via mk_shader_load_desc).
mk_material_desc_initfunction
mk_material_desc mk_material_desc_init(void)
Initialize a descriptor including explicit invalid-handle sentinels.
Returns The resulting value.
mk_material_destroyfunction
void mk_material_destroy(mk_material_t)
Destroy the material.
| Parameter | Type | Description |
|---|
| mk_material_t | — |
mk_material_instanced_pipelinefunction
mk_pipeline_t mk_material_instanced_pipeline(mk_material_t)
Perform the material instanced pipeline operation.
| Parameter | Type | Description |
|---|
| mk_material_t | — |
Returns The resulting handle or value.
mk_material_is_validfunction
bool mk_material_is_valid(mk_material_t m)
Test whether the material is valid.
| Parameter | Type | Description |
|---|
m | mk_material_t | Value for m. |
Returns True when the condition holds.
mk_material_litfunction
mk_material_t mk_material_lit(uint32_t base_color, mk_texture_t albedo, float shininess)
Lit (Blinn-Phong), shaded by the frame-level light (lighting.h).
base_color
| Parameter | Type | Description |
|---|
base_color | uint32_t | Value for base color. |
albedo | mk_texture_t | Value for albedo. |
shininess | float | Value for shininess. |
Returns The resulting handle or value. RGBA; albedo optional (MK_TEXTURE_INVALID => white); shininess 0 => default.
mk_material_pass_variantfunction
mk_material_t mk_material_pass_variant(mk_material_t, mk_material_pass_role role)
Perform the material pass variant operation.
| Parameter | Type | Description |
|---|
| mk_material_t | — |
role | mk_material_pass_role | Value for role. |
Returns The resulting handle or value.
mk_material_pinfunction
bool mk_material_pin(mk_material_t)
Perform the material pin operation.
| Parameter | Type | Description |
|---|
| mk_material_t | — |
Returns True when the operation succeeds.
mk_material_pipelinefunction
mk_pipeline_t mk_material_pipeline(mk_material_t)
Perform the material pipeline operation.
| Parameter | Type | Description |
|---|
| mk_material_t | — |
Returns The resulting handle or value.
mk_material_providersfunction
mk_shader_provider_mask_t mk_material_providers(mk_material_t)
Perform the material providers operation.
| Parameter | Type | Description |
|---|
| mk_material_t | — |
Returns The resulting handle or value.
mk_material_set_colorfunction
void mk_material_set_color(mk_material_t, uint32_t rgba)
Set color on the material.
| Parameter | Type | Description |
|---|
| mk_material_t | — |
rgba | uint32_t | Value for RGBA. |
mk_material_set_env_providerfunction
void mk_material_set_env_provider(mk_material_env_provider provider)
Set env provider on the material.
| Parameter | Type | Description |
|---|
provider | mk_material_env_provider | Value for provider. |
mk_material_set_mat4function
void mk_material_set_mat4(mk_material_t, const char *name, const float v[16])
Set mat4 on the material.
| Parameter | Type | Description |
|---|
| mk_material_t | — |
name | const char * | Stable name. |
v | const float | Value for v. |
mk_material_set_pass_variantfunction
mk_result mk_material_set_pass_variant(mk_material_t material, mk_material_pass_role role, mk_material_t variant)
Atomically replace one non-color pass dependency.
Self-reference and dependency cycles are rejected without changing the
| Parameter | Type | Description |
|---|
material | mk_material_t | Value for material. |
role | mk_material_pass_role | Value for role. |
variant | mk_material_t | Value for variant. |
Returns MK_SUCCESS or an error result. previous variant. Pass MK_MATERIAL_INVALID to clear the role.
mk_material_set_texturefunction
void mk_material_set_texture(mk_material_t, uint8_t stage, const char *sampler, mk_texture_t)
Set texture on the material.
| Parameter | Type | Description |
|---|
| mk_material_t | — |
stage | uint8_t | Value for stage. |
sampler | const char * | Value for sampler. |
| mk_texture_t | — |
mk_material_set_texture_samplerfunction
void mk_material_set_texture_sampler(mk_material_t, uint8_t stage, const char *sampler, mk_texture_t, uint32_t sampler_flags)
Set texture sampler on the material.
| Parameter | Type | Description |
|---|
| mk_material_t | — |
stage | uint8_t | Value for stage. |
sampler | const char * | Value for sampler. |
| mk_texture_t | — |
sampler_flags | uint32_t | Value for sampler flags. |
mk_material_set_transmission_providerfunction
void mk_material_set_transmission_provider(mk_material_env_provider provider)
Register the transmission provider invoked for draws requesting MK_PROVIDER_TRANSMISSION (the PBR package registers this from mk_pbr_transmission_capture).
It appends the captured opaque-scene framebuffer +
| Parameter | Type | Description |
|---|
provider | mk_material_env_provider | Value for provider. view-projection + frame params. Pass NULL to unregister. |
mk_material_set_vec4function
void mk_material_set_vec4(mk_material_t, const char *name, const float v[4])
Set vec4 on the material.
| Parameter | Type | Description |
|---|
| mk_material_t | — |
name | const char * | Stable name. |
v | const float | Value for v. |
mk_material_shaderfunction
mk_material_t mk_material_shader(mk_pipeline_t pipeline)
Custom material over a pre-baked pipeline (also the 2D shader-paint path).
| Parameter | Type | Description |
|---|
pipeline | mk_pipeline_t | Value for pipeline. |
Returns The resulting handle or value. Set uniform values/textures via the setters below.
mk_material_system_initfunction
void mk_material_system_init(void)
Initialize the material system.
mk_material_system_shutdownfunction
void mk_material_system_shutdown(void)
Perform the material system shutdown operation.
mk_material_traitsfunction
uint32_t mk_material_traits(mk_material_t)
Perform the material traits operation.
| Parameter | Type | Description |
|---|
| mk_material_t | — |
Returns The resulting value.
mk_material_unlitfunction
mk_material_t mk_material_unlit(uint32_t base_color, mk_texture_t albedo)
Unlit: albedo * base_color * vertex_color.
base_color is RGBA 0xRRGGBBAA;
| Parameter | Type | Description |
|---|
base_color | uint32_t | Value for base color. |
albedo | mk_texture_t | Value for albedo. |
Returns The resulting handle or value. pass MK_TEXTURE_INVALID for albedo to use a white default.
mk_material_unpinfunction
void mk_material_unpin(mk_material_t)
Perform the material unpin operation.
| Parameter | Type | Description |
|---|
| mk_material_t | — |
Typedefs
mk_material_alpha_mode_ttypedef
typedef enum mk_material_alpha_mode_t mk_material_alpha_mode_t
Values for material alpha mode.
mk_material_desctypedef
typedef struct mk_material_desc mk_material_desc
Data for material desc.
mk_material_env_providertypedef
typedef void(*) mk_material_env_provider(struct mk_draw_desc *out)
Register the environment provider invoked for draws requesting MK_PROVIDER_IBL.
The provider appends its uniforms/textures (SH, prefiltered, BRDF LUT, params) to the draw. Pass NULL to unregister. Core has no IBL dependency of its own.
mk_material_pass_roletypedef
typedef enum mk_material_pass_role mk_material_pass_role
Values for material pass role.
mk_material_texturetypedef
typedef struct mk_material_texture mk_material_texture
A texture binding carried by the material.
mk_material_trait_ttypedef
typedef enum mk_material_trait_t mk_material_trait_t
Values for material trait.
typedef struct mk_material_uniform mk_material_uniform
A uniform value carried by the material.
name must match the shader.
mk_shader_provider_mask_ttypedef
typedef uint32_t mk_shader_provider_mask_t
Type used for shader provider mask.