// Copyright 2009-2021 Intel Corporation // SPDX-License-Identifier: Apache-2.0 #pragma once #include "disc_intersector.h" #include "intersector_epilog.h" #include "pointi.h" namespace embree { namespace isa { template struct DiscMiIntersector1 { typedef PointMi Primitive; typedef CurvePrecalculations1 Precalculations; static __forceinline void intersect(const Precalculations& pre, RayHit& ray, RayQueryContext* context, const Primitive& Disc) { STAT3(normal.trav_prims, 1, 1, 1); const Points* geom = context->scene->get(Disc.geomID()); Vec4vf v0; Disc.gather(v0, geom); const vbool valid = Disc.valid(); DiscIntersector1::intersect( valid, ray, context, geom, pre, v0, Intersect1EpilogM(ray, context, Disc.geomID(), Disc.primID())); } static __forceinline bool occluded(const Precalculations& pre, Ray& ray, RayQueryContext* context, const Primitive& Disc) { STAT3(shadow.trav_prims, 1, 1, 1); const Points* geom = context->scene->get(Disc.geomID()); Vec4vf v0; Disc.gather(v0, geom); const vbool valid = Disc.valid(); return DiscIntersector1::intersect( valid, ray, context, geom, pre, v0, Occluded1EpilogM(ray, context, Disc.geomID(), Disc.primID())); } }; template struct DiscMiMBIntersector1 { typedef PointMi Primitive; typedef CurvePrecalculations1 Precalculations; static __forceinline void intersect(const Precalculations& pre, RayHit& ray, RayQueryContext* context, const Primitive& Disc) { STAT3(normal.trav_prims, 1, 1, 1); const Points* geom = context->scene->get(Disc.geomID()); Vec4vf v0; Disc.gather(v0, geom, ray.time()); const vbool valid = Disc.valid(); DiscIntersector1::intersect( valid, ray, context, geom, pre, v0, Intersect1EpilogM(ray, context, Disc.geomID(), Disc.primID())); } static __forceinline bool occluded(const Precalculations& pre, Ray& ray, RayQueryContext* context, const Primitive& Disc) { STAT3(shadow.trav_prims, 1, 1, 1); const Points* geom = context->scene->get(Disc.geomID()); Vec4vf v0; Disc.gather(v0, geom, ray.time()); const vbool valid = Disc.valid(); return DiscIntersector1::intersect( valid, ray, context, geom, pre, v0, Occluded1EpilogM(ray, context, Disc.geomID(), Disc.primID())); } }; template struct DiscMiIntersectorK { typedef PointMi Primitive; typedef CurvePrecalculationsK Precalculations; static __forceinline void intersect( const Precalculations& pre, RayHitK& ray, size_t k, RayQueryContext* context, const Primitive& Disc) { STAT3(normal.trav_prims, 1, 1, 1); const Points* geom = context->scene->get(Disc.geomID()); Vec4vf v0; Disc.gather(v0, geom); const vbool valid = Disc.valid(); DiscIntersectorK::intersect( valid, ray, k, context, geom, pre, v0, Intersect1KEpilogM(ray, k, context, Disc.geomID(), Disc.primID())); } static __forceinline bool occluded( const Precalculations& pre, RayK& ray, size_t k, RayQueryContext* context, const Primitive& Disc) { STAT3(shadow.trav_prims, 1, 1, 1); const Points* geom = context->scene->get(Disc.geomID()); Vec4vf v0; Disc.gather(v0, geom); const vbool valid = Disc.valid(); return DiscIntersectorK::intersect( valid, ray, k, context, geom, pre, v0, Occluded1KEpilogM(ray, k, context, Disc.geomID(), Disc.primID())); } }; template struct DiscMiMBIntersectorK { typedef PointMi Primitive; typedef CurvePrecalculationsK Precalculations; static __forceinline void intersect( const Precalculations& pre, RayHitK& ray, size_t k, RayQueryContext* context, const Primitive& Disc) { STAT3(normal.trav_prims, 1, 1, 1); const Points* geom = context->scene->get(Disc.geomID()); Vec4vf v0; Disc.gather(v0, geom, ray.time()[k]); const vbool valid = Disc.valid(); DiscIntersectorK::intersect( valid, ray, k, context, geom, pre, v0, Intersect1KEpilogM(ray, k, context, Disc.geomID(), Disc.primID())); } static __forceinline bool occluded( const Precalculations& pre, RayK& ray, size_t k, RayQueryContext* context, const Primitive& Disc) { STAT3(shadow.trav_prims, 1, 1, 1); const Points* geom = context->scene->get(Disc.geomID()); Vec4vf v0; Disc.gather(v0, geom, ray.time()[k]); const vbool valid = Disc.valid(); return DiscIntersectorK::intersect( valid, ray, k, context, geom, pre, v0, Occluded1KEpilogM(ray, k, context, Disc.geomID(), Disc.primID())); } }; template struct OrientedDiscMiIntersector1 { typedef PointMi Primitive; typedef CurvePrecalculations1 Precalculations; static __forceinline void intersect(const Precalculations& pre, RayHit& ray, RayQueryContext* context, const Primitive& Disc) { STAT3(normal.trav_prims, 1, 1, 1); const Points* geom = context->scene->get(Disc.geomID()); Vec4vf v0; Vec3vf n0; Disc.gather(v0, n0, geom); const vbool valid = Disc.valid(); DiscIntersector1::intersect( valid, ray, context, geom, pre, v0, n0, Intersect1EpilogM(ray, context, Disc.geomID(), Disc.primID())); } static __forceinline bool occluded(const Precalculations& pre, Ray& ray, RayQueryContext* context, const Primitive& Disc) { STAT3(shadow.trav_prims, 1, 1, 1); const Points* geom = context->scene->get(Disc.geomID()); Vec4vf v0; Vec3vf n0; Disc.gather(v0, n0, geom); const vbool valid = Disc.valid(); return DiscIntersector1::intersect( valid, ray, context, geom, pre, v0, n0, Occluded1EpilogM(ray, context, Disc.geomID(), Disc.primID())); } }; template struct OrientedDiscMiMBIntersector1 { typedef PointMi Primitive; typedef CurvePrecalculations1 Precalculations; static __forceinline void intersect(const Precalculations& pre, RayHit& ray, RayQueryContext* context, const Primitive& Disc) { STAT3(normal.trav_prims, 1, 1, 1); const Points* geom = context->scene->get(Disc.geomID()); Vec4vf v0; Vec3vf n0; Disc.gather(v0, n0, geom, ray.time()); const vbool valid = Disc.valid(); DiscIntersector1::intersect( valid, ray, context, geom, pre, v0, n0, Intersect1EpilogM(ray, context, Disc.geomID(), Disc.primID())); } static __forceinline bool occluded(const Precalculations& pre, Ray& ray, RayQueryContext* context, const Primitive& Disc) { STAT3(shadow.trav_prims, 1, 1, 1); const Points* geom = context->scene->get(Disc.geomID()); Vec4vf v0; Vec3vf n0; Disc.gather(v0, n0, geom, ray.time()); const vbool valid = Disc.valid(); return DiscIntersector1::intersect( valid, ray, context, geom, pre, v0, n0, Occluded1EpilogM(ray, context, Disc.geomID(), Disc.primID())); } }; template struct OrientedDiscMiIntersectorK { typedef PointMi Primitive; typedef CurvePrecalculationsK Precalculations; static __forceinline void intersect( const Precalculations& pre, RayHitK& ray, size_t k, RayQueryContext* context, const Primitive& Disc) { STAT3(normal.trav_prims, 1, 1, 1); const Points* geom = context->scene->get(Disc.geomID()); Vec4vf v0; Vec3vf n0; Disc.gather(v0, n0, geom); const vbool valid = Disc.valid(); DiscIntersectorK::intersect( valid, ray, k, context, geom, pre, v0, n0, Intersect1KEpilogM(ray, k, context, Disc.geomID(), Disc.primID())); } static __forceinline bool occluded( const Precalculations& pre, RayK& ray, size_t k, RayQueryContext* context, const Primitive& Disc) { STAT3(shadow.trav_prims, 1, 1, 1); const Points* geom = context->scene->get(Disc.geomID()); Vec4vf v0; Vec3vf n0; Disc.gather(v0, n0, geom); const vbool valid = Disc.valid(); return DiscIntersectorK::intersect( valid, ray, k, context, geom, pre, v0, n0, Occluded1KEpilogM(ray, k, context, Disc.geomID(), Disc.primID())); } }; template struct OrientedDiscMiMBIntersectorK { typedef PointMi Primitive; typedef CurvePrecalculationsK Precalculations; static __forceinline void intersect( const Precalculations& pre, RayHitK& ray, size_t k, RayQueryContext* context, const Primitive& Disc) { STAT3(normal.trav_prims, 1, 1, 1); const Points* geom = context->scene->get(Disc.geomID()); Vec4vf v0; Vec3vf n0; Disc.gather(v0, n0, geom, ray.time()[k]); const vbool valid = Disc.valid(); DiscIntersectorK::intersect( valid, ray, k, context, geom, pre, v0, n0, Intersect1KEpilogM(ray, k, context, Disc.geomID(), Disc.primID())); } static __forceinline bool occluded( const Precalculations& pre, RayK& ray, size_t k, RayQueryContext* context, const Primitive& Disc) { STAT3(shadow.trav_prims, 1, 1, 1); const Points* geom = context->scene->get(Disc.geomID()); Vec4vf v0; Vec3vf n0; Disc.gather(v0, n0, geom, ray.time()[k]); const vbool valid = Disc.valid(); return DiscIntersectorK::intersect( valid, ray, k, context, geom, pre, v0, n0, Occluded1KEpilogM(ray, k, context, Disc.geomID(), Disc.primID())); } }; } // namespace isa } // namespace embree