Function bgfx_sys::bgfx_create_uniform
source · pub unsafe extern "C" fn bgfx_create_uniform(
_name: *const c_char,
_type: bgfx_uniform_type_t,
_num: u16
) -> bgfx_uniform_handle_t
Expand description
Create shader uniform parameter. @remarks
- Uniform names are unique. It’s valid to call
bgfx::createUniform
multiple times with the same uniform name. The library will always return the same handle, but the handle reference count will be incremented. This means that the same number ofbgfx::destroyUniform
must be called to properly destroy the uniform. - Predefined uniforms (declared in
bgfx_shader.sh
):u_viewRect vec4(x, y, width, height)
- view rectangle for current view, in pixels.u_viewTexel vec4(1.0/width, 1.0/height, undef, undef)
- inverse width and heightu_view mat4
- view matrixu_invView mat4
- inverted view matrixu_proj mat4
- projection matrixu_invProj mat4
- inverted projection matrixu_viewProj mat4
- concatenated view projection matrixu_invViewProj mat4
- concatenated inverted view projection matrixu_model mat4[BGFX_CONFIG_MAX_BONES]
- array of model matrices.u_modelView mat4
- concatenated model view matrix, only first model matrix from array is used.u_modelViewProj mat4
- concatenated model view projection matrix.u_alphaRef float
- alpha reference value for alpha test.
@param[in] _name Uniform name in shader.
@param[in] _type Type of uniform (See: bgfx::UniformType
).
@param[in] _num Number of elements in array.
@returns Handle to uniform object.