20 #if !defined(__MITSUBA_CORE_AABB_SSE_H_)
21 #define __MITSUBA_CORE_AABB_SSE_H_
36 RayInterval4 &interval)
const {
38 xl1 = _mm_mul_ps(ray.dRcp[0].ps,
39 _mm_sub_ps(_mm_set1_ps(min.x), ray.o[0].ps)),
40 xl2 = _mm_mul_ps(ray.dRcp[0].ps,
41 _mm_sub_ps(_mm_set1_ps(max.x), ray.o[0].ps)),
42 xl1a = _mm_min_ps(xl1, SSEConstants::p_inf.ps),
43 xl2a = _mm_min_ps(xl2, SSEConstants::p_inf.ps),
44 xl1b = _mm_max_ps(xl1, SSEConstants::n_inf.ps),
45 xl2b = _mm_max_ps(xl2, SSEConstants::n_inf.ps);
48 lmax = _mm_max_ps(xl1a, xl2a),
49 lmin = _mm_min_ps(xl1b, xl2b);
52 yl1 = _mm_mul_ps(ray.dRcp[1].ps,
53 _mm_sub_ps(_mm_set1_ps(min.y), ray.o[1].ps)),
54 yl2 = _mm_mul_ps(ray.dRcp[1].ps,
55 _mm_sub_ps(_mm_set1_ps(max.y), ray.o[1].ps)),
56 yl1a = _mm_min_ps(yl1, SSEConstants::p_inf.ps),
57 yl2a = _mm_min_ps(yl2, SSEConstants::p_inf.ps),
58 yl1b = _mm_max_ps(yl1, SSEConstants::n_inf.ps),
59 yl2b = _mm_max_ps(yl2, SSEConstants::n_inf.ps);
61 lmax = _mm_min_ps(_mm_max_ps(yl1a,yl2a), lmax);
62 lmin = _mm_max_ps(_mm_min_ps(yl1b,yl2b), lmin);
65 zl1 = _mm_mul_ps(ray.dRcp[2].ps,
66 _mm_sub_ps(_mm_set1_ps(min.z), ray.o[2].ps)),
67 zl2 = _mm_mul_ps(ray.dRcp[2].ps,
68 _mm_sub_ps(_mm_set1_ps(max.z), ray.o[2].ps)),
69 zl1a = _mm_min_ps(zl1, SSEConstants::p_inf.ps),
70 zl2a = _mm_min_ps(zl2, SSEConstants::p_inf.ps),
71 zl1b = _mm_max_ps(zl1, SSEConstants::n_inf.ps),
72 zl2b = _mm_max_ps(zl2, SSEConstants::n_inf.ps);
74 lmax = _mm_min_ps(_mm_max_ps(zl1a,zl2a), lmax);
75 lmin = _mm_max_ps(_mm_min_ps(zl1b,zl2b), lmin);
77 const bool hasIntersection = _mm_movemask_ps(
79 _mm_cmpge_ps(lmax, _mm_setzero_ps()),
80 _mm_cmple_ps(lmin, lmax))) != 0;
82 interval.mint.ps = lmin;
83 interval.maxt.ps = lmax;
84 return hasIntersection;
FINLINE __m128 rayIntersectPacket(const TriAccel &tri, const RayPacket4 &packet, __m128 mint, __m128 maxt, __m128 inactive, Intersection4 &its)
Definition: triaccel_sse.h:27