Path: blob/master/thirdparty/embree/kernels/geometry/roundlinei_intersector.h
9905 views
// Copyright 2009-2021 Intel Corporation1// SPDX-License-Identifier: Apache-2.023#pragma once45#include "roundline_intersector.h"6#include "intersector_epilog.h"78namespace embree9{10namespace isa11{12template<int M, bool filter>13struct RoundLinearCurveMiIntersector114{15typedef LineMi<M> Primitive;16typedef CurvePrecalculations1 Precalculations;1718static __forceinline void intersect(const Precalculations& pre, RayHit& ray, RayQueryContext* context, const Primitive& line)19{20STAT3(normal.trav_prims,1,1,1);21const LineSegments* geom = context->scene->get<LineSegments>(line.geomID());22Vec4vf<M> v0,v1,vL,vR; line.gather(v0,v1,vL,vR,geom);23const vbool<M> valid = line.valid();24RoundLinearCurveIntersector1<M>::intersect(valid,ray,context,geom,pre,v0,v1,vL,vR,Intersect1EpilogM<M,filter>(ray,context,line.geomID(),line.primID()));25}2627static __forceinline bool occluded(const Precalculations& pre, Ray& ray, RayQueryContext* context, const Primitive& line)28{29STAT3(shadow.trav_prims,1,1,1);30const LineSegments* geom = context->scene->get<LineSegments>(line.geomID());31Vec4vf<M> v0,v1,vL,vR; line.gather(v0,v1,vL,vR,geom);32const vbool<M> valid = line.valid();33return RoundLinearCurveIntersector1<M>::intersect(valid,ray,context,geom,pre,v0,v1,vL,vR,Occluded1EpilogM<M,filter>(ray,context,line.geomID(),line.primID()));34}3536static __forceinline bool pointQuery(PointQuery* query, PointQueryContext* context, const Primitive& line)37{38return PrimitivePointQuery1<Primitive>::pointQuery(query, context, line);39}40};4142template<int M, bool filter>43struct RoundLinearCurveMiMBIntersector144{45typedef LineMi<M> Primitive;46typedef CurvePrecalculations1 Precalculations;4748static __forceinline void intersect(const Precalculations& pre, RayHit& ray, RayQueryContext* context, const Primitive& line)49{50STAT3(normal.trav_prims,1,1,1);51const LineSegments* geom = context->scene->get<LineSegments>(line.geomID());52Vec4vf<M> v0,v1,vL,vR; line.gather(v0,v1,vL,vR,geom,ray.time());53const vbool<M> valid = line.valid();54RoundLinearCurveIntersector1<M>::intersect(valid,ray,context,geom,pre,v0,v1,vL,vR,Intersect1EpilogM<M,filter>(ray,context,line.geomID(),line.primID()));55}5657static __forceinline bool occluded(const Precalculations& pre, Ray& ray, RayQueryContext* context, const Primitive& line)58{59STAT3(shadow.trav_prims,1,1,1);60const LineSegments* geom = context->scene->get<LineSegments>(line.geomID());61Vec4vf<M> v0,v1,vL,vR; line.gather(v0,v1,vL,vR,geom,ray.time());62const vbool<M> valid = line.valid();63return RoundLinearCurveIntersector1<M>::intersect(valid,ray,context,geom,pre,v0,v1,vL,vR,Occluded1EpilogM<M,filter>(ray,context,line.geomID(),line.primID()));64}6566static __forceinline bool pointQuery(PointQuery* query, PointQueryContext* context, const Primitive& line)67{68return PrimitivePointQuery1<Primitive>::pointQuery(query, context, line);69}70};7172template<int M, int K, bool filter>73struct RoundLinearCurveMiIntersectorK74{75typedef LineMi<M> Primitive;76typedef CurvePrecalculationsK<K> Precalculations;7778static __forceinline void intersect(const Precalculations& pre, RayHitK<K>& ray, size_t k, RayQueryContext* context, const Primitive& line)79{80STAT3(normal.trav_prims,1,1,1);81const LineSegments* geom = context->scene->get<LineSegments>(line.geomID());82Vec4vf<M> v0,v1,vL,vR; line.gather(v0,v1,vL,vR,geom);83const vbool<M> valid = line.valid();84RoundLinearCurveIntersectorK<M,K>::intersect(valid,ray,k,context,geom,pre,v0,v1,vL,vR,Intersect1KEpilogM<M,K,filter>(ray,k,context,line.geomID(),line.primID()));85}8687static __forceinline bool occluded(const Precalculations& pre, RayK<K>& ray, size_t k, RayQueryContext* context, const Primitive& line)88{89STAT3(shadow.trav_prims,1,1,1);90const LineSegments* geom = context->scene->get<LineSegments>(line.geomID());91Vec4vf<M> v0,v1,vL,vR; line.gather(v0,v1,vL,vR,geom);92const vbool<M> valid = line.valid();93return 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()));94}95};9697template<int M, int K, bool filter>98struct RoundLinearCurveMiMBIntersectorK99{100typedef LineMi<M> Primitive;101typedef CurvePrecalculationsK<K> Precalculations;102103static __forceinline void intersect(const Precalculations& pre, RayHitK<K>& ray, size_t k, RayQueryContext* context, const Primitive& line)104{105STAT3(normal.trav_prims,1,1,1);106const LineSegments* geom = context->scene->get<LineSegments>(line.geomID());107Vec4vf<M> v0,v1,vL,vR; line.gather(v0,v1,vL,vR,geom,ray.time()[k]);108const vbool<M> valid = line.valid();109RoundLinearCurveIntersectorK<M,K>::intersect(valid,ray,k,context,geom,pre,v0,v1,vL,vR,Intersect1KEpilogM<M,K,filter>(ray,k,context,line.geomID(),line.primID()));110}111112static __forceinline bool occluded(const Precalculations& pre, RayK<K>& ray, size_t k, RayQueryContext* context, const Primitive& line)113{114STAT3(shadow.trav_prims,1,1,1);115const LineSegments* geom = context->scene->get<LineSegments>(line.geomID());116Vec4vf<M> v0,v1,vL,vR; line.gather(v0,v1,vL,vR,geom,ray.time()[k]);117const vbool<M> valid = line.valid();118return 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()));119}120};121}122}123124125