1// Copyright 2009-2021 Intel Corporation
2// SPDX-License-Identifier: Apache-2.0
3
4#pragma once
5
6#include "roundline_intersector.h"
7#include "intersector_epilog.h"
8
9namespace embree
10{
11 namespace isa
12 {
13 template<int M, bool filter>
14 struct RoundLinearCurveMiIntersector1
15 {
16 typedef LineMi<M> Primitive;
17 typedef CurvePrecalculations1 Precalculations;
18
19 static __forceinline void intersect(const Precalculations& pre, RayHit& ray, IntersectContext* context, const Primitive& line)
20 {
21 STAT3(normal.trav_prims,1,1,1);
22 const LineSegments* geom = context->scene->get<LineSegments>(line.geomID());
23 Vec4vf<M> v0,v1,vL,vR; line.gather(v0,v1,vL,vR,geom);
24 const vbool<M> valid = line.valid();
25 RoundLinearCurveIntersector1<M>::intersect(valid,ray,context,geom,pre,v0,v1,vL,vR,Intersect1EpilogM<M,filter>(ray,context,line.geomID(),line.primID()));
26 }
27
28 static __forceinline bool occluded(const Precalculations& pre, Ray& ray, IntersectContext* context, const Primitive& line)
29 {
30 STAT3(shadow.trav_prims,1,1,1);
31 const LineSegments* geom = context->scene->get<LineSegments>(line.geomID());
32 Vec4vf<M> v0,v1,vL,vR; line.gather(v0,v1,vL,vR,geom);
33 const vbool<M> valid = line.valid();
34 return RoundLinearCurveIntersector1<M>::intersect(valid,ray,context,geom,pre,v0,v1,vL,vR,Occluded1EpilogM<M,filter>(ray,context,line.geomID(),line.primID()));
35 }
36
37 static __forceinline bool pointQuery(PointQuery* query, PointQueryContext* context, const Primitive& line)
38 {
39 return PrimitivePointQuery1<Primitive>::pointQuery(query, context, line);
40 }
41 };
42
43 template<int M, bool filter>
44 struct RoundLinearCurveMiMBIntersector1
45 {
46 typedef LineMi<M> Primitive;
47 typedef CurvePrecalculations1 Precalculations;
48
49 static __forceinline void intersect(const Precalculations& pre, RayHit& ray, IntersectContext* context, const Primitive& line)
50 {
51 STAT3(normal.trav_prims,1,1,1);
52 const LineSegments* geom = context->scene->get<LineSegments>(line.geomID());
53 Vec4vf<M> v0,v1,vL,vR; line.gather(v0,v1,vL,vR,geom,ray.time());
54 const vbool<M> valid = line.valid();
55 RoundLinearCurveIntersector1<M>::intersect(valid,ray,context,geom,pre,v0,v1,vL,vR,Intersect1EpilogM<M,filter>(ray,context,line.geomID(),line.primID()));
56 }
57
58 static __forceinline bool occluded(const Precalculations& pre, Ray& ray, IntersectContext* context, const Primitive& line)
59 {
60 STAT3(shadow.trav_prims,1,1,1);
61 const LineSegments* geom = context->scene->get<LineSegments>(line.geomID());
62 Vec4vf<M> v0,v1,vL,vR; line.gather(v0,v1,vL,vR,geom,ray.time());
63 const vbool<M> valid = line.valid();
64 return RoundLinearCurveIntersector1<M>::intersect(valid,ray,context,geom,pre,v0,v1,vL,vR,Occluded1EpilogM<M,filter>(ray,context,line.geomID(),line.primID()));
65 }
66
67 static __forceinline bool pointQuery(PointQuery* query, PointQueryContext* context, const Primitive& line)
68 {
69 return PrimitivePointQuery1<Primitive>::pointQuery(query, context, line);
70 }
71 };
72
73 template<int M, int K, bool filter>
74 struct RoundLinearCurveMiIntersectorK
75 {
76 typedef LineMi<M> Primitive;
77 typedef CurvePrecalculationsK<K> Precalculations;
78
79 static __forceinline void intersect(const Precalculations& pre, RayHitK<K>& ray, size_t k, IntersectContext* context, const Primitive& line)
80 {
81 STAT3(normal.trav_prims,1,1,1);
82 const LineSegments* geom = context->scene->get<LineSegments>(line.geomID());
83 Vec4vf<M> v0,v1,vL,vR; line.gather(v0,v1,vL,vR,geom);
84 const vbool<M> valid = line.valid();
85 RoundLinearCurveIntersectorK<M,K>::intersect(valid,ray,k,context,geom,pre,v0,v1,vL,vR,Intersect1KEpilogM<M,K,filter>(ray,k,context,line.geomID(),line.primID()));
86 }
87
88 static __forceinline bool occluded(const Precalculations& pre, RayK<K>& ray, size_t k, IntersectContext* context, const Primitive& line)
89 {
90 STAT3(shadow.trav_prims,1,1,1);
91 const LineSegments* geom = context->scene->get<LineSegments>(line.geomID());
92 Vec4vf<M> v0,v1,vL,vR; line.gather(v0,v1,vL,vR,geom);
93 const vbool<M> valid = line.valid();
94 return RoundLinearCurveIntersectorK<M,K>::intersect(valid,ray,k,context,geom,pre,v0,v1,vL,vR,Occluded1KEpilogM<M,K,filter>(ray,k,context,line.geomID(),line.primID()));
95 }
96 };
97
98 template<int M, int K, bool filter>
99 struct RoundLinearCurveMiMBIntersectorK
100 {
101 typedef LineMi<M> Primitive;
102 typedef CurvePrecalculationsK<K> Precalculations;
103
104 static __forceinline void intersect(const Precalculations& pre, RayHitK<K>& ray, size_t k, IntersectContext* context, const Primitive& line)
105 {
106 STAT3(normal.trav_prims,1,1,1);
107 const LineSegments* geom = context->scene->get<LineSegments>(line.geomID());
108 Vec4vf<M> v0,v1,vL,vR; line.gather(v0,v1,vL,vR,geom,ray.time()[k]);
109 const vbool<M> valid = line.valid();
110 RoundLinearCurveIntersectorK<M,K>::intersect(valid,ray,k,context,geom,pre,v0,v1,vL,vR,Intersect1KEpilogM<M,K,filter>(ray,k,context,line.geomID(),line.primID()));
111 }
112
113 static __forceinline bool occluded(const Precalculations& pre, RayK<K>& ray, size_t k, IntersectContext* context, const Primitive& line)
114 {
115 STAT3(shadow.trav_prims,1,1,1);
116 const LineSegments* geom = context->scene->get<LineSegments>(line.geomID());
117 Vec4vf<M> v0,v1,vL,vR; line.gather(v0,v1,vL,vR,geom,ray.time()[k]);
118 const vbool<M> valid = line.valid();
119 return RoundLinearCurveIntersectorK<M,K>::intersect(valid,ray,k,context,geom,pre,v0,v1,vL,vR,Occluded1KEpilogM<M,K,filter>(ray,k,context,line.geomID(),line.primID()));
120 }
121 };
122 }
123}
124

source code of qtquick3d/src/3rdparty/embree/kernels/geometry/roundlinei_intersector.h