Declaration Remarks Revisions Example See Also
| Declaration
void __stdcall onModelLoad(void);
![Top of page](../../../../images/top.gif)
Remarks
This optional function may be provided by the model. It is called just after the model is loaded. Use it to add model parameters with the functions setParamCount and assignParam. Since this function is only called once it is also a good place to allocate temporary workspace or seed a random number generator, such as randomize, if required.
![Top of page](../../../../images/top.gif)
Revisions
API v1.5
![Top of page](../../../../images/top.gif)
Example
float *workspace = NULL;
void __stdcall onModelLoad(void)
{
setParamCount(4);
// index name [constraints] default value
assignParam(0, "World Width [int,>0]", 30);
assignParam(1, "World Height [int,>0]", 30);
assignParam(2, "Initial Density [>0,<1]", 0.5);
assignParam(3, "Fade Rate [int, >0,<=255]",255);
workspace = new float[100];
randomize();
}
void __stdcall onModelUnload(void)
{
delete [] workspace;
}
![Top of page](../../../../images/top.gif)
See Also
onModelUnload, setParamCount, assignParam.
|