Path: blob/master/thirdparty/embree/kernels/geometry/conelinei_intersector.h
9905 views
// Copyright 2009-2021 Intel Corporation1// SPDX-License-Identifier: Apache-2.023#pragma once45#include "coneline_intersector.h"6#include "intersector_epilog.h"78namespace embree9{10namespace isa11{12template<int M, bool filter>13struct ConeCurveMiIntersector114{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;23vbool<M> cL,cR;24line.gather(v0,v1,cL,cR,geom);25const vbool<M> valid = line.valid();26ConeCurveIntersector1<M>::intersect(valid,ray,context,geom,pre,v0,v1,cL,cR,Intersect1EpilogM<M,filter>(ray,context,line.geomID(),line.primID()));27}2829static __forceinline bool occluded(const Precalculations& pre, Ray& ray, RayQueryContext* context, const Primitive& line)30{31STAT3(shadow.trav_prims,1,1,1);32const LineSegments* geom = context->scene->get<LineSegments>(line.geomID());33Vec4vf<M> v0,v1;34vbool<M> cL,cR;35line.gather(v0,v1,cL,cR,geom);36const vbool<M> valid = line.valid();37return ConeCurveIntersector1<M>::intersect(valid,ray,context,geom,pre,v0,v1,cL,cR,Occluded1EpilogM<M,filter>(ray,context,line.geomID(),line.primID()));38return false;39}4041static __forceinline bool pointQuery(PointQuery* query, PointQueryContext* context, const Primitive& line)42{43return PrimitivePointQuery1<Primitive>::pointQuery(query, context, line);44}45};4647template<int M, bool filter>48struct ConeCurveMiMBIntersector149{50typedef LineMi<M> Primitive;51typedef CurvePrecalculations1 Precalculations;5253static __forceinline void intersect(const Precalculations& pre, RayHit& ray, RayQueryContext* context, const Primitive& line)54{55STAT3(normal.trav_prims,1,1,1);56const LineSegments* geom = context->scene->get<LineSegments>(line.geomID());57Vec4vf<M> v0,v1;58vbool<M> cL,cR;59line.gather(v0,v1,cL,cR,geom,ray.time());60const vbool<M> valid = line.valid();61ConeCurveIntersector1<M>::intersect(valid,ray,context,geom,pre,v0,v1,cL,cR,Intersect1EpilogM<M,filter>(ray,context,line.geomID(),line.primID()));62}6364static __forceinline bool occluded(const Precalculations& pre, Ray& ray, RayQueryContext* context, const Primitive& line)65{66STAT3(shadow.trav_prims,1,1,1);67const LineSegments* geom = context->scene->get<LineSegments>(line.geomID());68Vec4vf<M> v0,v1;69vbool<M> cL,cR;70line.gather(v0,v1,cL,cR,geom,ray.time());71const vbool<M> valid = line.valid();72return ConeCurveIntersector1<M>::intersect(valid,ray,context,geom,pre,v0,v1,cL,cR,Occluded1EpilogM<M,filter>(ray,context,line.geomID(),line.primID()));73return false;74}7576static __forceinline bool pointQuery(PointQuery* query, PointQueryContext* context, const Primitive& line)77{78return PrimitivePointQuery1<Primitive>::pointQuery(query, context, line);79}80};8182template<int M, int K, bool filter>83struct ConeCurveMiIntersectorK84{85typedef LineMi<M> Primitive;86typedef CurvePrecalculationsK<K> Precalculations;8788static __forceinline void intersect(const Precalculations& pre, RayHitK<K>& ray, size_t k, RayQueryContext* context, const Primitive& line)89{90STAT3(normal.trav_prims,1,1,1);91const LineSegments* geom = context->scene->get<LineSegments>(line.geomID());92Vec4vf<M> v0,v1;93vbool<M> cL,cR;94line.gather(v0,v1,cL,cR,geom);95const vbool<M> valid = line.valid();96ConeCurveIntersectorK<M,K>::intersect(valid,ray,k,context,geom,pre,v0,v1,cL,cR,Intersect1KEpilogM<M,K,filter>(ray,k,context,line.geomID(),line.primID()));97}9899static __forceinline bool occluded(const Precalculations& pre, RayK<K>& ray, size_t k, RayQueryContext* context, const Primitive& line)100{101STAT3(shadow.trav_prims,1,1,1);102const LineSegments* geom = context->scene->get<LineSegments>(line.geomID());103Vec4vf<M> v0,v1;104vbool<M> cL,cR;105line.gather(v0,v1,cL,cR,geom);106const vbool<M> valid = line.valid();107return ConeCurveIntersectorK<M,K>::intersect(valid,ray,k,context,geom,pre,v0,v1,cL,cR,Occluded1KEpilogM<M,K,filter>(ray,k,context,line.geomID(),line.primID()));108}109};110111template<int M, int K, bool filter>112struct ConeCurveMiMBIntersectorK113{114typedef LineMi<M> Primitive;115typedef CurvePrecalculationsK<K> Precalculations;116117static __forceinline void intersect(const Precalculations& pre, RayHitK<K>& ray, size_t k, RayQueryContext* context, const Primitive& line)118{119STAT3(normal.trav_prims,1,1,1);120const LineSegments* geom = context->scene->get<LineSegments>(line.geomID());121Vec4vf<M> v0,v1;122vbool<M> cL,cR;123line.gather(v0,v1,cL,cR,geom,ray.time()[k]);124const vbool<M> valid = line.valid();125ConeCurveIntersectorK<M,K>::intersect(valid,ray,k,context,geom,pre,v0,v1,cL,cR,Intersect1KEpilogM<M,K,filter>(ray,k,context,line.geomID(),line.primID()));126}127128static __forceinline bool occluded(const Precalculations& pre, RayK<K>& ray, size_t k, RayQueryContext* context, const Primitive& line)129{130STAT3(shadow.trav_prims,1,1,1);131const LineSegments* geom = context->scene->get<LineSegments>(line.geomID());132Vec4vf<M> v0,v1;133vbool<M> cL,cR;134line.gather(v0,v1,cL,cR,geom,ray.time()[k]);135const vbool<M> valid = line.valid();136return ConeCurveIntersectorK<M,K>::intersect(valid,ray,k,context,geom,pre,v0,v1,cL,cR,Occluded1KEpilogM<M,K,filter>(ray,k,context,line.geomID(),line.primID()));137}138};139}140}141142143