hoknamahn Posted March 19, 2005 Share Posted March 19, 2005 Hi! I want to create dso for custom VEX function, say for the addition of two numbers of various types Add(number1, number2) I can create a callback like that static void Add(int, void *argv[], void *) { // Some code } And I think what I can register this function two or more times with different signatures like new VEX_VexOp("Add@&III", Add); // for integer numbers new VEX_VexOp("Add@&FFF", Add); // for float numbers ... How I can know, what type the input parameters? Quote Link to comment Share on other sites More sharing options...
AndrewVK Posted March 20, 2005 Share Posted March 20, 2005 Just call appropriate evaluation function static void vsocker_Evaluate(int, void *argv[], void *) { UT_Vector3 *result = (UT_Vector3 *)argv[0]; float *u = (float *)argv[1]; float *v = (float *)argv[2]; UT_Vector3 *col1 = (UT_Vector3 *)argv[3]; UT_Vector3 *col2 = (UT_Vector3 *)argv[4]; float *flt = (float *)argv[5]; .... .... .... } static void fsocker_Evaluate(int, void *argv[], void *) { float *result = (float *)argv[0]; float *u = (float *)argv[1]; float *v = (float *)argv[2]; float *width = (float *)argv[3]; float *depth = (float *)argv[4]; .... .... .... } static void vpsocker_Evaluate(int, void *argv[], void *) { UT_Vector3 *result = (UT_Vector3 *)argv[0]; UT_Vector3 *pos = (UT_Vector3 *)argv[1]; UT_Vector3 *col1 = (UT_Vector3 *)argv[2]; UT_Vector3 *col2 = (UT_Vector3 *)argv[3]; float *flt = (float *)argv[4]; .... .... .... } static void fpsocker_Evaluate(int, void *argv[], void *) { float *result = (float *)argv[0]; UT_Vector3 *pos = (UT_Vector3 *)argv[1]; float *width = (float *)argv[2]; float *depth = (float *)argv[3]; .... .... .... } void newVEXOp(void *) { new VEX_VexOp("socker@&VFFVVF", vsocker_Evaluate, (VEX_OP_CONTEXT|VEX_SHADING_CONTEXT), 0, 0); new VEX_VexOp("socker@&FFFFF", fsocker_Evaluate, (VEX_OP_CONTEXT|VEX_SHADING_CONTEXT), 0, 0); new VEX_VexOp("socker@&VVVVF", vpsocker_Evaluate, (VEX_OP_CONTEXT|VEX_SHADING_CONTEXT), 0, 0); new VEX_VexOp("socker@&FVFF", fpsocker_Evaluate, (VEX_OP_CONTEXT|VEX_SHADING_CONTEXT), 0, 0); } Quote Link to comment Share on other sites More sharing options...
hoknamahn Posted March 20, 2005 Author Share Posted March 20, 2005 Hehehe... So simple Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.