#ifndef shaveSDKCALLBACKS_h #define shaveSDKCALLBACKS_h // Shave and a Haircut // (c) 2019 Epic Games // US Patent 6720962 #include "shaveSDKTYPES.h" #ifndef USECPP #ifdef __cplusplus extern "C" { #endif #endif // This is where you want to put display update, I've finished a tile, show it extern void SHAVEdraw_tile_callback(VERT *a,VERT *b) ; // Callback functions (shave calls you) extern float SHAVEapply_falloff( int lightNUM, VERT pos, float cone ); // SHAVEapply_GI needs to be in the special softimage namespaces // so do not delcare it here, declare it in shaveSDKFUNC.h #ifndef XSI_SOFT3D_ONLY VERT SHAVEapply_GI( VERT vv, CURVEINFO * ci ); #endif // Returns global illumination at the specified position in space. extern void SHAVEapply_inst_color( WFTYPE * instance_geom, int hairID, int slgID, unsigned long shaveINSTID ); extern VERT SHAVEdisplace_root( VERT * root, CURVEINFO * ci, int ID ); // this is usedfull for subdiv surfaces. You return a vector to displace // the whole hair by (should be the difference between the position on the // subdiv and root extern int SHAVEprogress( int actual, int estimated_total ); // this function gets called every 100 hairs (when rendering) // so that you can make a progress bar. Estimated total is the number of times // this function should get called during a render // if you want to cancell the render you should return killit==1 for the rest of // the calls to this function until the render releases control extern void SHAVEcoord_convertTOSHAVE( VERT * in ); // if this function is empty then all data is MAYAcentric or SOFTIMAGEcentric // here's how you convert for lightwave & cinema4d: //in->z = -in->z; //SHAVEflip_normals(); // here's how you convert for max (I think): // VERT swap; // swap.x= in->x; // swap.z= in->y; // swap.y= in->z; // swap.z= -swap.z; //in->x = swap.x; //in->y = swap.y; //in->z = swap.z; //SHAVEflip_normals(); extern void SHAVEcoord_convertFROMSHAVE( VERT * in ); // if this function is empty then all data is MAYAcentric or SOFTIMAGEcentric // here's how you convert for lightwave & cinema4d: //in->z = -in->z; //SHAVEflip_normals(); // here's how you convert for max (I think): // VERT swap; // swap.x= in->x; // swap.z= in->y; // swap.y= in->z; // swap.z= -swap.z; //in->x = swap.x; //in->y = swap.y; //in->z = swap.z; //SHAVEflip_normals(); float SHAVEapply_texture( CURVEINFO * ci, VERT rest_root_worldpos, unsigned long shaveINSTID, int parm, float inbound_value ); // this function callback gives you the opportunity to apply external // texture to any/every channel in shave // CURVEINFO contains all kinds of basis information // rest_root_worldpos is the world coord for the hair's root in the rest // position // shaveINSTID contains the ID you burned the restMEM (at creation) that's // being rendered // parm tells you which channel is being evaluated from SHAVEPARMS // this function is called during rendering // inbound contains the param value as evaluated internally (slider * // weight * texture) // do something to inbound value here before it's returned // this needs to be here as well, but you won't be using it // the 'MAYA' in the name is due to back compatibility with a MAYAShave version extern void MAYAexternal_forces( VERT * lastpos, VERT * velocity, int y ); extern void MAYAcache_forces(int clearCache); extern void MAYAapply_cached_forces(int guideNum, int vertNum, VERT* velocity); extern void MAYAexternal_collision( SOFTGUIDE * lastpos, SOFTGUIDE * vect, float seglen ); // this is an illumination callback (see docs) extern VERT SHAVEapply_illumination( int LIGHTID, VERT wpos, VERT vector, VERT color ); // ranges are 0.0 - 1.0 (return isn't clipped until after shading) // modify or replace 'color' - it contains light info for current test before // shave shadows are applied extern void SHAVEapply_illuminationWF( int LIGHTID, WFTYPE * samples ); // ranges are 0.0 - 1.0 (return isn't clipped until after shading) // modify or replace 'samples->color' - it contains light info for current test before // shave shadows are applied // samples->v is the position // samples->totalverts is the total number of points // return(samples); // this is a callback for applying atmospherics/depth cueing extern VERT SHAVEapply_atmosphere( VERT wpos, VERT inbound_color ); // range = 0.0 - 1.0 (shave will clip out of bound returns) // do your tint here based on wpos // here's how: // fogval=your_compute_func_for_fog(wpos); // if (fog_val>1.0) fog_val=1.0; // if (fog_val<0.0) fog_val=0.0; // inbound_color.x=inbound_color.x*(1.0-fog_val)+fog_color.x*fog_val; // inbound_color.y=inbound_color.y*(1.0-fog_val)+fog_color.y*fog_val; // inbound_color.z=inbound_color.z*(1.0-fog_val)+fog_color.z*fog_val; extern float SHAVEapply_VMAP( long SHAVEINSTID, int VERTID, int chan, float inbound_value ); // this function callback gives you the opportunity to apply external // vertpaint to any/every channel in shave // normally the inbound_value will be 1.0 (unless you've painted a map // inside shave) // the return, should contain a value who's range is (float) 0-1 extern void SHAVEdraw_tile_callback(VERT *a, VERT *b); // this function is called by shave after each tile has finished rendering. #ifndef USECPP #ifdef __cplusplus } #endif #endif #endif /* shaveSDKCALLBACKS_h */