// Shave and a Haircut // (c) 2019 Epic Games // US Patent 6720962 #include #include "shaveSDKTYPES.h" #include "shaveSDKCALLBACKS2.h" #include "shaveMRShaderConst.h" #include "shaveMRShaderUtil.h" void SHAVE2apply_inst_color( WFTYPE* instance_geom, int hairID, int slgID, unsigned long shaveINSTID ) { } VERT SHAVE2displace_root(VERT* root, CURVEINFO* ci, int ID) { VERT ret; ret.x=0; ret.y=0; ret.z=0; return ret; } int SHAVE2progress(int actual, int estimated_total) { if (!shaveProgress_enabled) return 0; if ((actual > 0) && (--shaveProgress_ticksLeft > 0)) return 0; shaveProgress_ticksLeft = shaveProgress_ticksPerMsg; if (actual > estimated_total) actual = estimated_total; mi_progress( "Shave: %s done %f%%.\n", shaveProgress_action, (float)actual * 100.0 / (float)estimated_total ); return 0; } void SHAVE2coord_convertTOSHAVE(VERT* in) { } void SHAVE2coord_convertFROMSHAVE(VERT* in) { } float SHAVE2apply_texture( CURVEINFO* ci, VERT rest_root_worldpos, unsigned long shaveINSTID, int parm, float inbound_value ) { return inbound_value; } void MAYA2external_forces(VERT* lastpos, VERT* velocity, int y) { } VERT SHAVE2apply_GI(VERT v,CURVEINFO *cinfo) { // // The irradiance funcs cannot be called from an output shader, so we // just return zero irradiance. // static VERT shaveIrrad = { 0.0f, 0.0f, 0.0f }; return shaveIrrad; } float SHAVE2apply_falloff(int lightNUM, VERT p, float intensity) { if (intensity > 0.0f) { ShaveMRDecayRate decay = kDecayNone; miTag lightInst; if (shaveMR_getLightInfoByID(lightNUM, &lightInst, &decay) && (decay != kDecayNone)) { // // Get the light's world position and calculate the distance // from it to 'p'. // miScalar dist; const miVector localLightPos = { 0.0f, 0.0f, 0.0f }; miVector* p2 = (miVector*)&p; miMatrix* pMat; miVector worldLightPos; mi_query(miQ_INST_LOCAL_TO_GLOBAL, NULL, lightInst, (void*)&pMat); mi_point_transform(&worldLightPos, &localLightPos, *pMat); dist = (miScalar)mi_vector_dist(&worldLightPos, p2); // // Decay doesn't begin until one unit out from the light. // if (dist > 1.0f) { switch (decay) { case kDecayLinear: intensity = intensity / dist; break; case kDecayQuadratic: intensity = intensity / (dist * dist); break; case kDecayCubic: intensity = intensity / (dist * dist * dist); break; default: break; } } } } return intensity; } VERT SHAVE2apply_illumination(int LIGHTID, VERT wpos, VERT vector, VERT color) { return color; } void SHAVE2apply_illuminationWF(int LIGHTID, WFTYPE* samples) { } VERT SHAVE2apply_atmosphere(VERT wpos, VERT inbound_color) { return inbound_color; } float SHAVE2apply_VMAP(long SHAVEINSTID,int VERTID,int chan, float inbound_value) { return inbound_value; } void SHAVEdraw_tile_callback2(VERT *a, VERT *b) { }