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

fz_shdr_get_parm_ptr

Description

This function retrieves the pointer 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. NULL is returned, if the id is not defined. Note, that the returned point is a generic pointer. Depending on what the shader parameter is declared as it may point to a double, rgb color, fzrt_int etc. It is the responsibility of the calling code to use the pointer appropriately.
This function is designed to be called in the fz_shdr_cbak_xxxx_iface_tmpl callback function of a plugin shader to link the shader parameter to a fuim item.
For example, below the parameter pointer of the shader parameter with id "3" is retrieved and used to set the float range of a fuim text item. It is assumed that the shader parameter was declared as a floating point parameter in the set_parameters callback function.

Plugin Prototype

fzrt_error_td fz_shdr_get_parm_ptr(

fz_shdr_ptr

shdr,

fzrt_int

id,

fzrt_ptr *

parm_ptr )

Parameters

shdr [Input]

The shader for which to get the parameter pointer

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.

parm_ptr [Result]

parameter pointer

Returns

none

Availability

5.5.0.0

Plugin Example

fz_shdr_get_parm_ptr(shdr,3,&parm_ptr);
g1 = fz_fuim_new_text_edit(fuim_tmpl, parent, FZ_FUIM_NONE, FZ_FUIM_FLAG_NONE, NULL,NULL); fz_fuim_item_range_float(fuim_tmpl, g1, (float*)parm_ptr, 0.0, 1.0, FZ_FUIM_FORMAT_FLOAT_PERCENT,FZ_FUIM_RANGE_NONE);

Function Set

fz_shdr_fset


Defined in

fz_rzne_shdr_api.h