These functions allow access to shader parameters. They can be used to incrementally change parameter values without redefining the entire shader parameter block every time a GUI slider is moved. Note that it is still necessary to access the shader miFunction with mi_scene_edit and mi_scene_edit_end if a new parameter value is written to inform raylib that a change was made.
typedef struct { /* info about p type : */ miParam_type type; /* expected value type */ int size; /* size in bytes of one */ int nval; /* max # of values */ char code; /* code char for decl */ char *name; /* type name string */ } miApi_typeinfo; miApi_typeinfo *mi_api_get_typeinfo( miParam_type type);
The miApi_typeinfo structure may change in future versions. It is used to inform other modules that access function and declaration parameters about parameter types without keeping the same information in many different places.
miBoolean mi_api_parameter_lookup( miParam_type *type, /* type of <name> */ miBoolean *is_array, /* true for arrays */ int *offs, /* offset in param blk */ miTag decl_tag, /* decl to look up in */ miBoolean out, /* output or input? */ char *name) /* name to look up */
Given a parameter name, return the offset into the parameter struct where the value is stored. The parameter name may contain dots but no array subscripts because the array member layout is not known until we actually get values and know how many members exist. This function can parse both the output struct and the input parameters. It returns the parameter type type, a flag is_array if it is an array, and an offset offs into the parameter block where the value is stored, or return miFALSE on failure.
miBoolean mi_api_parameter_path_lookup( miTag *tag, /* tag of miFunction */ int *offs, /* func->param offset */ int *size, /* size of value */ miParam_type *ptype, /* type of parameter */ char *path) /* gui->control names */
Given a dot-separated shader parameter path, return the tag of the referenced miFunction, the offset offs into that function's parameter block, the size of the value referenced there, and the type ptype of the parameter. The path begins with the shader instance name, followed by a dot, followed by the parameter name. If the parameter name has substructures, the names are again dot-separated. Return miFALSE on failure.
miBoolean mi_api_parameter_offset_lookup( miParam_type *type, /* type of <name> */ miBoolean *is_array, /* flag, true for arrays */ char **name, /* parameter name */ int *code_idx, /* code string index */ miTag decl_tag, /* decl to look up in */ miBoolean out, /* output or input? */ int offs) /* offset in param blk */
Given a parameter offset, return the name of the parameter at that offset. This is the reverse operation to mi_api_parameter_lookup. The returned parameter name may contain dots. If the offset does not point to the beginning of a parameter, the result is undefined. As a special case, asking for the unnamed shader output at offset 0 always succeeds without name matching.
Copyright © 1986, 2015 NVIDIA ARC GmbH. All rights reserved.