formZ SDK | 5.0 API Reference | Project | Modeling | Rendering | Shaders

# fz_shdr_get_parm

Description

This function can only be called inside the pre_render or pixel callback function when implementing a plugin or script shader. It retrieves the current value of a shader parameter. The id argument determines which parameter of the shader is accessed. The id is the same as returned by any of the fz_shdr_set_xxx_parm api functions, called in the set_parameters callback function. Assuming id was created with fz_shdr_set_col_parm, the color parameter of a shader can be retrieved with the call :
(id,&data);
fz_type_get_rgb_float(&data,&col);
If possible, a shader parameter should not be retrieved in the pixel callback function, but in the pre_render callback function. It should then be stored in a data structure allocated by the pre_render function, which is passed back to formZ and passed back into the pixel function. This will avoid accessing a shader parameter through an expensive function call for each pixel computation.

Plugin Prototype

fzrt_error_td fz_shdr_get_parm(

fzrt_int | id,
fz_type_td * | data )

Parameters

id [Input]

The id for this parameter. This is the id returned by any of the fz_shdr_set_xxx_parm functions, or the id passed into any of the fz_shdr_set_xxx_parm functions.

data [Result]

parameter data

Returns

none

Availability

5.0.0.0

Function Set

fz_shdr_fset

Defined in

fz_rzne_shdr_api.h