code wiki / (root) / nx_hairdyn_pose_batch_candidate_t284.nx

nx_hairdyn_pose_batch_candidate_t284.nx source

↩ module page · 23 lines · 1250 B

1// Batch composition over the existing posed-rest solver. Counts describe caller-owned 2// storage; no allocation, renderer, duplicate integrator or anatomical proxy is added. 3// One batch shares a posed collider set (normally one character). 4import "nx_hairdyn_pose_candidate_t263.nx" 5func hd_tick_batch_posed_collide(st:*i64,state_words:i64,posed:*i64,posed_words:i64,guides:i64,nseg:i64,K:i64,C:i64,maxd:i64,caps:*i64,caps_words:i64,ncap:i64,scratch:*i64,scratch_words:i64)->i64 { 6 if guides<0||nseg<1||ncap<0||state_words<0||posed_words<0||caps_words<0{return 0-1} 7 if K<0||C<0||maxd<0{return 0-4} 8 if guides==0{return 0} 9 if (st as i64)==0||(posed as i64)==0||(scratch as i64)==0{return 0-3} 10 if scratch_words<3{return 0-2} 11 // Division checks avoid overflowing the extent products before validation. 12 if guides>state_words/nseg/SD_STRIDE{return 0-2} 13 if posed_words/3<guides{return 0-2} 14 if nseg>posed_words/3/guides-1{return 0-2} 15 if ncap>caps_words/7{return 0-2} 16 if ncap>0{if (caps as i64)==0{return 0-3}} 17 var g:i64=0;var contacts:i64=0 18 while g<guides { 19 contacts=contacts+hd_tick_posed_collide(((st as i64)+g*nseg*SD_STRIDE*8) as *i64,nseg,((posed as i64)+g*(nseg+1)*3*8) as *i64,K,C,maxd,caps,ncap,scratch) 20 g=g+1 21 } 22 return contacts 23}