| 735 | |
| 736 | template<typename RTCRay, typename RTCRayHit, int N> |
| 737 | __forceinline void rtcForwardIntersectN(const int* valid, const RTCIntersectFunctionNArguments* args, RTCScene hscene, RTCRay* iray, unsigned int instID, unsigned int instPrimID) |
| 738 | { |
| 739 | Scene* scene = (Scene*) hscene; |
| 740 | RTCRayHit* oray = (RTCRayHit*)args->rayhit; |
| 741 | RTCRayQueryContext* user_context = args->context; |
| 742 | |
| 743 | __aligned(16) float ray_org_x[N]; |
| 744 | __aligned(16) float ray_org_y[N]; |
| 745 | __aligned(16) float ray_org_z[N]; |
| 746 | __aligned(16) float ray_dir_x[N]; |
| 747 | __aligned(16) float ray_dir_y[N]; |
| 748 | __aligned(16) float ray_dir_z[N]; |
| 749 | |
| 750 | copy<N>(ray_org_x,oray->ray.org_x); |
| 751 | copy<N>(ray_org_y,oray->ray.org_y); |
| 752 | copy<N>(ray_org_z,oray->ray.org_z); |
| 753 | copy<N>(ray_dir_x,oray->ray.dir_x); |
| 754 | copy<N>(ray_dir_y,oray->ray.dir_y); |
| 755 | copy<N>(ray_dir_z,oray->ray.dir_z); |
| 756 | |
| 757 | copy<N>(oray->ray.org_x,iray->org_x); |
| 758 | copy<N>(oray->ray.org_y,iray->org_y); |
| 759 | copy<N>(oray->ray.org_z,iray->org_z); |
| 760 | copy<N>(oray->ray.dir_x,iray->dir_x); |
| 761 | copy<N>(oray->ray.dir_y,iray->dir_y); |
| 762 | copy<N>(oray->ray.dir_z,iray->dir_z); |
| 763 | |
| 764 | STAT(size_t cnt=0; for (size_t i=0; i<N; i++) cnt += ((int*)valid)[i] == -1;); |
| 765 | STAT3(normal.travs,cnt,cnt,cnt); |
| 766 | |
| 767 | RTCIntersectArguments* iargs = ((IntersectFunctionNArguments*) args)->args; |
| 768 | RayQueryContext context(scene,user_context,iargs); |
| 769 | |
| 770 | instance_id_stack::push(user_context, instID, instPrimID); |
| 771 | scene->intersectors.intersect(valid,*oray,&context); |
| 772 | instance_id_stack::pop(user_context); |
| 773 | |
| 774 | copy<N>(oray->ray.org_x,ray_org_x); |
| 775 | copy<N>(oray->ray.org_y,ray_org_y); |
| 776 | copy<N>(oray->ray.org_z,ray_org_z); |
| 777 | copy<N>(oray->ray.dir_x,ray_dir_x); |
| 778 | copy<N>(oray->ray.dir_y,ray_dir_y); |
| 779 | copy<N>(oray->ray.dir_z,ray_dir_z); |
| 780 | } |
| 781 | |
| 782 | RTC_API void rtcForwardIntersect4(const int* valid, const RTCIntersectFunctionNArguments* args, RTCScene hscene, RTCRay4* iray, unsigned int instID) |
| 783 | { |