virtualx-engine/thirdparty/embree/kernels/geometry/instance_intersector.h

85 lines
3.3 KiB
C++
Raw Normal View History

// Copyright 2009-2021 Intel Corporation
2021-04-20 18:38:09 +02:00
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "instance.h"
#include "../common/ray.h"
#include "../common/point_query.h"
namespace embree
{
namespace isa
{
struct InstanceIntersector1
{
typedef InstancePrimitive Primitive;
struct Precalculations {
__forceinline Precalculations (const Ray& ray, const void *ptr) {}
};
2024-02-24 12:40:55 +01:00
static void intersect(const Precalculations& pre, RayHit& ray, RayQueryContext* context, const Primitive& prim);
static bool occluded(const Precalculations& pre, Ray& ray, RayQueryContext* context, const Primitive& prim);
2021-04-20 18:38:09 +02:00
static bool pointQuery(PointQuery* query, PointQueryContext* context, const Primitive& prim);
};
struct InstanceIntersector1MB
{
typedef InstancePrimitive Primitive;
struct Precalculations {
__forceinline Precalculations (const Ray& ray, const void *ptr) {}
};
2024-02-24 12:40:55 +01:00
static void intersect(const Precalculations& pre, RayHit& ray, RayQueryContext* context, const Primitive& prim);
static bool occluded(const Precalculations& pre, Ray& ray, RayQueryContext* context, const Primitive& prim);
2021-04-20 18:38:09 +02:00
static bool pointQuery(PointQuery* query, PointQueryContext* context, const Primitive& prim);
};
template<int K>
struct InstanceIntersectorK
{
typedef InstancePrimitive Primitive;
struct Precalculations {
__forceinline Precalculations (const vbool<K>& valid, const RayK<K>& ray) {}
};
2024-02-24 12:40:55 +01:00
static void intersect(const vbool<K>& valid_i, const Precalculations& pre, RayHitK<K>& ray, RayQueryContext* context, const Primitive& prim);
static vbool<K> occluded(const vbool<K>& valid_i, const Precalculations& pre, RayK<K>& ray, RayQueryContext* context, const Primitive& prim);
2021-04-20 18:38:09 +02:00
2024-02-24 12:40:55 +01:00
static __forceinline void intersect(Precalculations& pre, RayHitK<K>& ray, size_t k, RayQueryContext* context, const Primitive& prim) {
2021-04-20 18:38:09 +02:00
intersect(vbool<K>(1<<int(k)),pre,ray,context,prim);
}
2024-02-24 12:40:55 +01:00
static __forceinline bool occluded(Precalculations& pre, RayK<K>& ray, size_t k, RayQueryContext* context, const Primitive& prim) {
2021-04-20 18:38:09 +02:00
occluded(vbool<K>(1<<int(k)),pre,ray,context,prim);
return ray.tfar[k] < 0.0f;
}
};
template<int K>
struct InstanceIntersectorKMB
{
typedef InstancePrimitive Primitive;
struct Precalculations {
__forceinline Precalculations (const vbool<K>& valid, const RayK<K>& ray) {}
};
2024-02-24 12:40:55 +01:00
static void intersect(const vbool<K>& valid_i, const Precalculations& pre, RayHitK<K>& ray, RayQueryContext* context, const Primitive& prim);
static vbool<K> occluded(const vbool<K>& valid_i, const Precalculations& pre, RayK<K>& ray, RayQueryContext* context, const Primitive& prim);
2021-04-20 18:38:09 +02:00
2024-02-24 12:40:55 +01:00
static __forceinline void intersect(Precalculations& pre, RayHitK<K>& ray, size_t k, RayQueryContext* context, const Primitive& prim) {
2021-04-20 18:38:09 +02:00
intersect(vbool<K>(1<<int(k)),pre,ray,context,prim);
}
2024-02-24 12:40:55 +01:00
static __forceinline bool occluded(Precalculations& pre, RayK<K>& ray, size_t k, RayQueryContext* context, const Primitive& prim) {
2021-04-20 18:38:09 +02:00
occluded(vbool<K>(1<<int(k)),pre,ray,context,prim);
return ray.tfar[k] < 0.0f;
}
};
}
}