initial commit, 4.5 stable
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled

This commit is contained in:
2025-09-16 20:46:46 -04:00
commit 9d30169a8d
13378 changed files with 7050105 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
// Copyright 2009-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "rtcore_config.h"
#include "rtcore_common.h"
#include "rtcore_device.h"
#include "rtcore_buffer.h"
#include "rtcore_ray.h"
#include "rtcore_geometry.h"
#include "rtcore_scene.h"
#include "rtcore_builder.h"
#include "rtcore_quaternion.h"

View File

@@ -0,0 +1,73 @@
// Copyright 2009-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "rtcore_device.h"
RTC_NAMESPACE_BEGIN
/* Types of buffers */
enum RTCBufferType
{
RTC_BUFFER_TYPE_INDEX = 0,
RTC_BUFFER_TYPE_VERTEX = 1,
RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE = 2,
RTC_BUFFER_TYPE_NORMAL = 3,
RTC_BUFFER_TYPE_TANGENT = 4,
RTC_BUFFER_TYPE_NORMAL_DERIVATIVE = 5,
RTC_BUFFER_TYPE_GRID = 8,
RTC_BUFFER_TYPE_FACE = 16,
RTC_BUFFER_TYPE_LEVEL = 17,
RTC_BUFFER_TYPE_EDGE_CREASE_INDEX = 18,
RTC_BUFFER_TYPE_EDGE_CREASE_WEIGHT = 19,
RTC_BUFFER_TYPE_VERTEX_CREASE_INDEX = 20,
RTC_BUFFER_TYPE_VERTEX_CREASE_WEIGHT = 21,
RTC_BUFFER_TYPE_HOLE = 22,
RTC_BUFFER_TYPE_TRANSFORM = 23,
RTC_BUFFER_TYPE_FLAGS = 32
};
/* Opaque buffer type */
typedef struct RTCBufferTy* RTCBuffer;
/* Creates a new buffer. */
RTC_API RTCBuffer rtcNewBuffer(RTCDevice device, size_t byteSize);
/* Creates a new buffer using explicit host device memory. */
RTC_API RTCBuffer rtcNewBufferHostDevice(RTCDevice device, size_t byteSize);
/* Creates a new shared buffer. */
RTC_API RTCBuffer rtcNewSharedBuffer(RTCDevice device, void* ptr, size_t byteSize);
/* Creates a new shared buffer using explicit host device memory. */
RTC_API RTCBuffer rtcNewSharedBufferHostDevice(RTCDevice device, void* ptr, size_t byteSize);
/* Synchronize host and device memory by copying data from host to device. */
RTC_API void rtcCommitBuffer(RTCBuffer buffer);
#if defined(EMBREE_SYCL_SUPPORT) && defined(SYCL_LANGUAGE_VERSION)
RTC_API_CPP sycl::event rtcCommitBufferWithQueue(RTCBuffer buffer, sycl::queue queue);
#endif
/* Returns a pointer to the buffer data. */
RTC_API void* rtcGetBufferData(RTCBuffer buffer);
/* Returns a pointer to the buffer data on the device. Returns the same pointer as
rtcGetBufferData if the device is no SYCL device or if Embree is executed on a
system with unified memory (e.g., iGPUs). */
RTC_API void* rtcGetBufferDataDevice(RTCBuffer buffer);
/* Retains the buffer (increments the reference count). */
RTC_API void rtcRetainBuffer(RTCBuffer buffer);
/* Releases the buffer (decrements the reference count). */
RTC_API void rtcReleaseBuffer(RTCBuffer buffer);
RTC_NAMESPACE_END

View File

@@ -0,0 +1,125 @@
// Copyright 2009-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "rtcore_scene.h"
RTC_NAMESPACE_BEGIN
/* Opaque BVH type */
typedef struct RTCBVHTy* RTCBVH;
/* Input build primitives for the builder */
struct RTC_ALIGN(32) RTCBuildPrimitive
{
float lower_x, lower_y, lower_z;
unsigned int geomID;
float upper_x, upper_y, upper_z;
unsigned int primID;
};
/* Opaque thread local allocator type */
typedef struct RTCThreadLocalAllocatorTy* RTCThreadLocalAllocator;
/* Callback to create a node */
typedef void* (*RTCCreateNodeFunction) (RTCThreadLocalAllocator allocator, unsigned int childCount, void* userPtr);
/* Callback to set the pointer to all children */
typedef void (*RTCSetNodeChildrenFunction) (void* nodePtr, void** children, unsigned int childCount, void* userPtr);
/* Callback to set the bounds of all children */
typedef void (*RTCSetNodeBoundsFunction) (void* nodePtr, const struct RTCBounds** bounds, unsigned int childCount, void* userPtr);
/* Callback to create a leaf node */
typedef void* (*RTCCreateLeafFunction) (RTCThreadLocalAllocator allocator, const struct RTCBuildPrimitive* primitives, size_t primitiveCount, void* userPtr);
/* Callback to split a build primitive */
typedef void (*RTCSplitPrimitiveFunction) (const struct RTCBuildPrimitive* primitive, unsigned int dimension, float position, struct RTCBounds* leftBounds, struct RTCBounds* rightBounds, void* userPtr);
/* Build flags */
enum RTCBuildFlags
{
RTC_BUILD_FLAG_NONE = 0,
RTC_BUILD_FLAG_DYNAMIC = (1 << 0),
};
enum RTCBuildConstants
{
RTC_BUILD_MAX_PRIMITIVES_PER_LEAF = 32
};
/* Input for builders */
struct RTCBuildArguments
{
size_t byteSize;
enum RTCBuildQuality buildQuality;
enum RTCBuildFlags buildFlags;
unsigned int maxBranchingFactor;
unsigned int maxDepth;
unsigned int sahBlockSize;
unsigned int minLeafSize;
unsigned int maxLeafSize;
float traversalCost;
float intersectionCost;
RTCBVH bvh;
struct RTCBuildPrimitive* primitives;
size_t primitiveCount;
size_t primitiveArrayCapacity;
RTCCreateNodeFunction createNode;
RTCSetNodeChildrenFunction setNodeChildren;
RTCSetNodeBoundsFunction setNodeBounds;
RTCCreateLeafFunction createLeaf;
RTCSplitPrimitiveFunction splitPrimitive;
RTCProgressMonitorFunction buildProgress;
void* userPtr;
};
/* Returns the default build settings. */
RTC_FORCEINLINE struct RTCBuildArguments rtcDefaultBuildArguments()
{
struct RTCBuildArguments args;
args.byteSize = sizeof(args);
args.buildQuality = RTC_BUILD_QUALITY_MEDIUM;
args.buildFlags = RTC_BUILD_FLAG_NONE;
args.maxBranchingFactor = 2;
args.maxDepth = 32;
args.sahBlockSize = 1;
args.minLeafSize = 1;
args.maxLeafSize = RTC_BUILD_MAX_PRIMITIVES_PER_LEAF;
args.traversalCost = 1.0f;
args.intersectionCost = 1.0f;
args.bvh = NULL;
args.primitives = NULL;
args.primitiveCount = 0;
args.primitiveArrayCapacity = 0;
args.createNode = NULL;
args.setNodeChildren = NULL;
args.setNodeBounds = NULL;
args.createLeaf = NULL;
args.splitPrimitive = NULL;
args.buildProgress = NULL;
args.userPtr = NULL;
return args;
}
/* Creates a new BVH. */
RTC_API RTCBVH rtcNewBVH(RTCDevice device);
/* Builds a BVH. */
RTC_API void* rtcBuildBVH(const struct RTCBuildArguments* args);
/* Allocates memory using the thread local allocator. */
RTC_API void* rtcThreadLocalAlloc(RTCThreadLocalAllocator allocator, size_t bytes, size_t align);
/* Retains the BVH (increments reference count). */
RTC_API void rtcRetainBVH(RTCBVH bvh);
/* Releases the BVH (decrements reference count). */
RTC_API void rtcReleaseBVH(RTCBVH bvh);
RTC_NAMESPACE_END

View File

@@ -0,0 +1,502 @@
// Copyright 2009-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <stddef.h>
#include <sys/types.h>
#include <stdbool.h>
#include "rtcore_config.h"
RTC_NAMESPACE_BEGIN
#if defined(_WIN32)
#if defined(_M_X64) || defined(_M_ARM64)
typedef long long ssize_t;
#else
typedef int ssize_t;
#endif
#endif
#if defined(_WIN32) && !defined(__MINGW32__)
# define RTC_ALIGN(...) __declspec(align(__VA_ARGS__))
#else
# define RTC_ALIGN(...) __attribute__((aligned(__VA_ARGS__)))
#endif
#if !defined (RTC_DEPRECATED)
#ifdef __GNUC__
#define RTC_DEPRECATED __attribute__((deprecated))
#elif defined(_MSC_VER)
#define RTC_DEPRECATED __declspec(deprecated)
#else
#define RTC_DEPRECATED
#endif
#endif
#if defined(_WIN32)
# define RTC_FORCEINLINE __forceinline
#else
# define RTC_FORCEINLINE inline __attribute__((always_inline))
#endif
#if defined(__cplusplus)
# define RTC_OPTIONAL_ARGUMENT = nullptr
#else
# define RTC_OPTIONAL_ARGUMENT
#endif
/* Invalid geometry ID */
#define RTC_INVALID_GEOMETRY_ID ((unsigned int)-1)
/* Maximum number of time steps */
#define RTC_MAX_TIME_STEP_COUNT 129
/* Formats of buffers and other data structures */
enum RTCFormat
{
RTC_FORMAT_UNDEFINED = 0,
/* 8-bit unsigned integer */
RTC_FORMAT_UCHAR = 0x1001,
RTC_FORMAT_UCHAR2,
RTC_FORMAT_UCHAR3,
RTC_FORMAT_UCHAR4,
/* 8-bit signed integer */
RTC_FORMAT_CHAR = 0x2001,
RTC_FORMAT_CHAR2,
RTC_FORMAT_CHAR3,
RTC_FORMAT_CHAR4,
/* 16-bit unsigned integer */
RTC_FORMAT_USHORT = 0x3001,
RTC_FORMAT_USHORT2,
RTC_FORMAT_USHORT3,
RTC_FORMAT_USHORT4,
/* 16-bit signed integer */
RTC_FORMAT_SHORT = 0x4001,
RTC_FORMAT_SHORT2,
RTC_FORMAT_SHORT3,
RTC_FORMAT_SHORT4,
/* 32-bit unsigned integer */
RTC_FORMAT_UINT = 0x5001,
RTC_FORMAT_UINT2,
RTC_FORMAT_UINT3,
RTC_FORMAT_UINT4,
/* 32-bit signed integer */
RTC_FORMAT_INT = 0x6001,
RTC_FORMAT_INT2,
RTC_FORMAT_INT3,
RTC_FORMAT_INT4,
/* 64-bit unsigned integer */
RTC_FORMAT_ULLONG = 0x7001,
RTC_FORMAT_ULLONG2,
RTC_FORMAT_ULLONG3,
RTC_FORMAT_ULLONG4,
/* 64-bit signed integer */
RTC_FORMAT_LLONG = 0x8001,
RTC_FORMAT_LLONG2,
RTC_FORMAT_LLONG3,
RTC_FORMAT_LLONG4,
/* 32-bit float */
RTC_FORMAT_FLOAT = 0x9001,
RTC_FORMAT_FLOAT2,
RTC_FORMAT_FLOAT3,
RTC_FORMAT_FLOAT4,
RTC_FORMAT_FLOAT5,
RTC_FORMAT_FLOAT6,
RTC_FORMAT_FLOAT7,
RTC_FORMAT_FLOAT8,
RTC_FORMAT_FLOAT9,
RTC_FORMAT_FLOAT10,
RTC_FORMAT_FLOAT11,
RTC_FORMAT_FLOAT12,
RTC_FORMAT_FLOAT13,
RTC_FORMAT_FLOAT14,
RTC_FORMAT_FLOAT15,
RTC_FORMAT_FLOAT16,
/* 32-bit float matrix (row-major order) */
RTC_FORMAT_FLOAT2X2_ROW_MAJOR = 0x9122,
RTC_FORMAT_FLOAT2X3_ROW_MAJOR = 0x9123,
RTC_FORMAT_FLOAT2X4_ROW_MAJOR = 0x9124,
RTC_FORMAT_FLOAT3X2_ROW_MAJOR = 0x9132,
RTC_FORMAT_FLOAT3X3_ROW_MAJOR = 0x9133,
RTC_FORMAT_FLOAT3X4_ROW_MAJOR = 0x9134,
RTC_FORMAT_FLOAT4X2_ROW_MAJOR = 0x9142,
RTC_FORMAT_FLOAT4X3_ROW_MAJOR = 0x9143,
RTC_FORMAT_FLOAT4X4_ROW_MAJOR = 0x9144,
/* 32-bit float matrix (column-major order) */
RTC_FORMAT_FLOAT2X2_COLUMN_MAJOR = 0x9222,
RTC_FORMAT_FLOAT2X3_COLUMN_MAJOR = 0x9223,
RTC_FORMAT_FLOAT2X4_COLUMN_MAJOR = 0x9224,
RTC_FORMAT_FLOAT3X2_COLUMN_MAJOR = 0x9232,
RTC_FORMAT_FLOAT3X3_COLUMN_MAJOR = 0x9233,
RTC_FORMAT_FLOAT3X4_COLUMN_MAJOR = 0x9234,
RTC_FORMAT_FLOAT4X2_COLUMN_MAJOR = 0x9242,
RTC_FORMAT_FLOAT4X3_COLUMN_MAJOR = 0x9243,
RTC_FORMAT_FLOAT4X4_COLUMN_MAJOR = 0x9244,
/* special 12-byte format for grids */
RTC_FORMAT_GRID = 0xA001,
RTC_FORMAT_QUATERNION_DECOMPOSITION = 0xB001,
};
/* Build quality levels */
enum RTCBuildQuality
{
RTC_BUILD_QUALITY_LOW = 0,
RTC_BUILD_QUALITY_MEDIUM = 1,
RTC_BUILD_QUALITY_HIGH = 2,
RTC_BUILD_QUALITY_REFIT = 3,
};
/* Axis-aligned bounding box representation */
struct RTC_ALIGN(16) RTCBounds
{
float lower_x, lower_y, lower_z, align0;
float upper_x, upper_y, upper_z, align1;
};
/* Linear axis-aligned bounding box representation */
struct RTC_ALIGN(16) RTCLinearBounds
{
struct RTCBounds bounds0;
struct RTCBounds bounds1;
};
/* Feature flags for SYCL specialization constants */
enum RTCFeatureFlags
{
RTC_FEATURE_FLAG_NONE = 0,
RTC_FEATURE_FLAG_MOTION_BLUR = 1 << 0,
RTC_FEATURE_FLAG_TRIANGLE = 1 << 1,
RTC_FEATURE_FLAG_QUAD = 1 << 2,
RTC_FEATURE_FLAG_GRID = 1 << 3,
RTC_FEATURE_FLAG_SUBDIVISION = 1 << 4,
RTC_FEATURE_FLAG_CONE_LINEAR_CURVE = 1 << 5,
RTC_FEATURE_FLAG_ROUND_LINEAR_CURVE = 1 << 6,
RTC_FEATURE_FLAG_FLAT_LINEAR_CURVE = 1 << 7,
RTC_FEATURE_FLAG_ROUND_BEZIER_CURVE = 1 << 8,
RTC_FEATURE_FLAG_FLAT_BEZIER_CURVE = 1 << 9,
RTC_FEATURE_FLAG_NORMAL_ORIENTED_BEZIER_CURVE = 1 << 10,
RTC_FEATURE_FLAG_ROUND_BSPLINE_CURVE = 1 << 11,
RTC_FEATURE_FLAG_FLAT_BSPLINE_CURVE = 1 << 12,
RTC_FEATURE_FLAG_NORMAL_ORIENTED_BSPLINE_CURVE = 1 << 13,
RTC_FEATURE_FLAG_ROUND_HERMITE_CURVE = 1 << 14,
RTC_FEATURE_FLAG_FLAT_HERMITE_CURVE = 1 << 15,
RTC_FEATURE_FLAG_NORMAL_ORIENTED_HERMITE_CURVE = 1 << 16,
RTC_FEATURE_FLAG_ROUND_CATMULL_ROM_CURVE = 1 << 17,
RTC_FEATURE_FLAG_FLAT_CATMULL_ROM_CURVE = 1 << 18,
RTC_FEATURE_FLAG_NORMAL_ORIENTED_CATMULL_ROM_CURVE = 1 << 19,
RTC_FEATURE_FLAG_SPHERE_POINT = 1 << 20,
RTC_FEATURE_FLAG_DISC_POINT = 1 << 21,
RTC_FEATURE_FLAG_ORIENTED_DISC_POINT = 1 << 22,
RTC_FEATURE_FLAG_POINT =
RTC_FEATURE_FLAG_SPHERE_POINT |
RTC_FEATURE_FLAG_DISC_POINT |
RTC_FEATURE_FLAG_ORIENTED_DISC_POINT,
RTC_FEATURE_FLAG_ROUND_CURVES =
RTC_FEATURE_FLAG_ROUND_LINEAR_CURVE |
RTC_FEATURE_FLAG_ROUND_BEZIER_CURVE |
RTC_FEATURE_FLAG_ROUND_BSPLINE_CURVE |
RTC_FEATURE_FLAG_ROUND_HERMITE_CURVE |
RTC_FEATURE_FLAG_ROUND_CATMULL_ROM_CURVE,
RTC_FEATURE_FLAG_FLAT_CURVES =
RTC_FEATURE_FLAG_FLAT_LINEAR_CURVE |
RTC_FEATURE_FLAG_FLAT_BEZIER_CURVE |
RTC_FEATURE_FLAG_FLAT_BSPLINE_CURVE |
RTC_FEATURE_FLAG_FLAT_HERMITE_CURVE |
RTC_FEATURE_FLAG_FLAT_CATMULL_ROM_CURVE,
RTC_FEATURE_FLAG_NORMAL_ORIENTED_CURVES =
RTC_FEATURE_FLAG_NORMAL_ORIENTED_BEZIER_CURVE |
RTC_FEATURE_FLAG_NORMAL_ORIENTED_BSPLINE_CURVE |
RTC_FEATURE_FLAG_NORMAL_ORIENTED_HERMITE_CURVE |
RTC_FEATURE_FLAG_NORMAL_ORIENTED_CATMULL_ROM_CURVE,
RTC_FEATURE_FLAG_LINEAR_CURVES =
RTC_FEATURE_FLAG_CONE_LINEAR_CURVE |
RTC_FEATURE_FLAG_ROUND_LINEAR_CURVE |
RTC_FEATURE_FLAG_FLAT_LINEAR_CURVE,
RTC_FEATURE_FLAG_BEZIER_CURVES =
RTC_FEATURE_FLAG_ROUND_BEZIER_CURVE |
RTC_FEATURE_FLAG_FLAT_BEZIER_CURVE |
RTC_FEATURE_FLAG_NORMAL_ORIENTED_BEZIER_CURVE,
RTC_FEATURE_FLAG_BSPLINE_CURVES =
RTC_FEATURE_FLAG_ROUND_BSPLINE_CURVE |
RTC_FEATURE_FLAG_FLAT_BSPLINE_CURVE |
RTC_FEATURE_FLAG_NORMAL_ORIENTED_BSPLINE_CURVE,
RTC_FEATURE_FLAG_HERMITE_CURVES =
RTC_FEATURE_FLAG_ROUND_HERMITE_CURVE |
RTC_FEATURE_FLAG_FLAT_HERMITE_CURVE |
RTC_FEATURE_FLAG_NORMAL_ORIENTED_HERMITE_CURVE,
RTC_FEATURE_FLAG_CURVES =
RTC_FEATURE_FLAG_CONE_LINEAR_CURVE |
RTC_FEATURE_FLAG_ROUND_LINEAR_CURVE |
RTC_FEATURE_FLAG_FLAT_LINEAR_CURVE |
RTC_FEATURE_FLAG_ROUND_BEZIER_CURVE |
RTC_FEATURE_FLAG_FLAT_BEZIER_CURVE |
RTC_FEATURE_FLAG_NORMAL_ORIENTED_BEZIER_CURVE |
RTC_FEATURE_FLAG_ROUND_BSPLINE_CURVE |
RTC_FEATURE_FLAG_FLAT_BSPLINE_CURVE |
RTC_FEATURE_FLAG_NORMAL_ORIENTED_BSPLINE_CURVE |
RTC_FEATURE_FLAG_ROUND_HERMITE_CURVE |
RTC_FEATURE_FLAG_FLAT_HERMITE_CURVE |
RTC_FEATURE_FLAG_NORMAL_ORIENTED_HERMITE_CURVE |
RTC_FEATURE_FLAG_ROUND_CATMULL_ROM_CURVE |
RTC_FEATURE_FLAG_FLAT_CATMULL_ROM_CURVE |
RTC_FEATURE_FLAG_NORMAL_ORIENTED_CATMULL_ROM_CURVE,
RTC_FEATURE_FLAG_INSTANCE = 1 << 23,
RTC_FEATURE_FLAG_FILTER_FUNCTION_IN_ARGUMENTS = 1 << 24,
RTC_FEATURE_FLAG_FILTER_FUNCTION_IN_GEOMETRY = 1 << 25,
RTC_FEATURE_FLAG_FILTER_FUNCTION =
RTC_FEATURE_FLAG_FILTER_FUNCTION_IN_ARGUMENTS |
RTC_FEATURE_FLAG_FILTER_FUNCTION_IN_GEOMETRY,
RTC_FEATURE_FLAG_USER_GEOMETRY_CALLBACK_IN_ARGUMENTS = 1 << 26,
RTC_FEATURE_FLAG_USER_GEOMETRY_CALLBACK_IN_GEOMETRY = 1 << 27,
RTC_FEATURE_FLAG_USER_GEOMETRY =
RTC_FEATURE_FLAG_USER_GEOMETRY_CALLBACK_IN_ARGUMENTS |
RTC_FEATURE_FLAG_USER_GEOMETRY_CALLBACK_IN_GEOMETRY,
RTC_FEATURE_FLAG_32_BIT_RAY_MASK = 1 << 28,
RTC_FEATURE_FLAG_INSTANCE_ARRAY = 1 << 29,
RTC_FEATURE_FLAG_ALL = 0xffffffff,
};
/* Ray query flags */
enum RTCRayQueryFlags
{
/* matching intel_ray_flags_t layout */
RTC_RAY_QUERY_FLAG_NONE = 0,
RTC_RAY_QUERY_FLAG_INVOKE_ARGUMENT_FILTER = (1 << 1), // enable argument filter for each geometry
/* embree specific flags */
RTC_RAY_QUERY_FLAG_INCOHERENT = (0 << 16), // optimize for incoherent rays
RTC_RAY_QUERY_FLAG_COHERENT = (1 << 16), // optimize for coherent rays
};
/* Arguments for RTCFilterFunctionN */
struct RTCFilterFunctionNArguments
{
int* valid;
void* geometryUserPtr;
struct RTCRayQueryContext* context;
struct RTCRayN* ray;
struct RTCHitN* hit;
unsigned int N;
};
/* Filter callback function */
typedef void (*RTCFilterFunctionN)(const struct RTCFilterFunctionNArguments* args);
/* Intersection callback function */
struct RTCIntersectFunctionNArguments;
typedef void (*RTCIntersectFunctionN)(const struct RTCIntersectFunctionNArguments* args);
/* Occlusion callback function */
struct RTCOccludedFunctionNArguments;
typedef void (*RTCOccludedFunctionN)(const struct RTCOccludedFunctionNArguments* args);
/* Ray query context passed to intersect/occluded calls */
struct RTCRayQueryContext
{
#if RTC_MAX_INSTANCE_LEVEL_COUNT > 1
unsigned int instStackSize; // Number of instances currently on the stack.
#endif
unsigned int instID[RTC_MAX_INSTANCE_LEVEL_COUNT]; // The current stack of instance ids.
#if defined(RTC_GEOMETRY_INSTANCE_ARRAY)
unsigned int instPrimID[RTC_MAX_INSTANCE_LEVEL_COUNT]; // The current stack of instance primitive ids.
#endif
};
/* Initializes an ray query context. */
RTC_FORCEINLINE void rtcInitRayQueryContext(struct RTCRayQueryContext* context)
{
unsigned l = 0;
#if RTC_MAX_INSTANCE_LEVEL_COUNT > 1
context->instStackSize = 0;
#endif
for (; l < RTC_MAX_INSTANCE_LEVEL_COUNT; ++l) {
context->instID[l] = RTC_INVALID_GEOMETRY_ID;
#if defined(RTC_GEOMETRY_INSTANCE_ARRAY)
context->instPrimID[l] = RTC_INVALID_GEOMETRY_ID;
#endif
}
}
/* Point query structure for closest point query */
struct RTC_ALIGN(16) RTCPointQuery
{
float x; // x coordinate of the query point
float y; // y coordinate of the query point
float z; // z coordinate of the query point
float time; // time of the point query
float radius; // radius of the point query
};
/* Structure of a packet of 4 query points */
struct RTC_ALIGN(16) RTCPointQuery4
{
float x[4]; // x coordinate of the query point
float y[4]; // y coordinate of the query point
float z[4]; // z coordinate of the query point
float time[4]; // time of the point query
float radius[4]; // radius of the point query
};
/* Structure of a packet of 8 query points */
struct RTC_ALIGN(32) RTCPointQuery8
{
float x[8]; // x coordinate of the query point
float y[8]; // y coordinate of the query point
float z[8]; // z coordinate of the query point
float time[8]; // time of the point query
float radius[8]; // radius ofr the point query
};
/* Structure of a packet of 16 query points */
struct RTC_ALIGN(64) RTCPointQuery16
{
float x[16]; // x coordinate of the query point
float y[16]; // y coordinate of the query point
float z[16]; // z coordinate of the query point
float time[16]; // time of the point quey
float radius[16]; // radius of the point query
};
struct RTCPointQueryN;
struct RTC_ALIGN(16) RTCPointQueryContext
{
// accumulated 4x4 column major matrices from world space to instance space.
// undefined if size == 0.
float world2inst[RTC_MAX_INSTANCE_LEVEL_COUNT][16];
// accumulated 4x4 column major matrices from instance space to world space.
// undefined if size == 0.
float inst2world[RTC_MAX_INSTANCE_LEVEL_COUNT][16];
// instance ids.
unsigned int instID[RTC_MAX_INSTANCE_LEVEL_COUNT];
#if defined(RTC_GEOMETRY_INSTANCE_ARRAY)
// instance prim ids.
unsigned int instPrimID[RTC_MAX_INSTANCE_LEVEL_COUNT];
#endif
// number of instances currently on the stack.
unsigned int instStackSize;
};
/* Initializes an ray query context. */
RTC_FORCEINLINE void rtcInitPointQueryContext(struct RTCPointQueryContext* context)
{
unsigned l = 0;
context->instStackSize = 0;
for (; l < RTC_MAX_INSTANCE_LEVEL_COUNT; ++l) {
context->instID[l] = RTC_INVALID_GEOMETRY_ID;
#if defined(RTC_GEOMETRY_INSTANCE_ARRAY)
context->instPrimID[l] = RTC_INVALID_GEOMETRY_ID;
#endif
}
}
struct RTC_ALIGN(16) RTCPointQueryFunctionArguments
{
// The (world space) query object that was passed as an argument of rtcPointQuery. The
// radius of the query can be decreased inside the callback to shrink the
// search domain. Increasing the radius or modifying the time or position of
// the query results in undefined behaviour.
struct RTCPointQuery* query;
// Used for user input/output data. Will not be read or modified internally.
void* userPtr;
// primitive and geometry ID of primitive
unsigned int primID;
unsigned int geomID;
// the context with transformation and instance ID stack
struct RTCPointQueryContext* context;
// If the current instance transform M (= context->world2inst[context->instStackSize])
// is a similarity matrix, i.e there is a constant factor similarityScale such that
// for all x,y: dist(Mx, My) = similarityScale * dist(x, y),
// The similarity scale is 0, if the current instance transform is not a
// similarity transform and vice versa. The similarity scale allows to compute
// distance information in instance space and scale the distances into world
// space by dividing with the similarity scale, for example, to update the
// query radius. If the current instance transform is not a similarity
// transform (similarityScale = 0), the distance computation has to be
// performed in world space to ensure correctness. if there is no instance
// transform (context->instStackSize == 0), the similarity scale is 1.
float similarityScale;
};
typedef bool (*RTCPointQueryFunction)(struct RTCPointQueryFunctionArguments* args);
#if defined(EMBREE_SYCL_SUPPORT) && defined(SYCL_LANGUAGE_VERSION)
/* returns function pointer to be usable in SYCL kernel */
template<auto F>
inline decltype(F) rtcGetSYCLDeviceFunctionPointer(sycl::queue& queue)
{
sycl::buffer<cl_ulong> fptr_buf(1);
{
auto fptr_acc = fptr_buf.get_host_access();
fptr_acc[0] = 0;
}
queue.submit([&](sycl::handler& cgh) {
auto fptr_acc = fptr_buf.get_access<sycl::access::mode::discard_write>(cgh);
cgh.single_task([=]() {
fptr_acc[0] = reinterpret_cast<cl_ulong>(F);
});
});
queue.wait_and_throw();
auto fptr_acc = fptr_buf.get_host_access();
return (decltype(F)) fptr_acc[0];
}
#endif
RTC_NAMESPACE_END

View File

@@ -0,0 +1,102 @@
// Copyright 2009-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#pragma once
#if !defined(EMBREE_SYCL_SUPPORT)
// #cmakedefine EMBREE_SYCL_SUPPORT
#endif
#define RTC_VERSION_MAJOR 4
#define RTC_VERSION_MINOR 4
#define RTC_VERSION_PATCH 0
#define RTC_VERSION 40400
#define RTC_VERSION_STRING "4.4.0"
#define RTC_MAX_INSTANCE_LEVEL_COUNT 1
// #cmakedefine EMBREE_GEOMETRY_INSTANCE_ARRAY
#if defined(EMBREE_GEOMETRY_INSTANCE_ARRAY)
#define RTC_GEOMETRY_INSTANCE_ARRAY
#endif
// #cmakedefine01 EMBREE_SYCL_GEOMETRY_CALLBACK
#define EMBREE_MIN_WIDTH 0
#define RTC_MIN_WIDTH EMBREE_MIN_WIDTH
#if !defined(EMBREE_STATIC_LIB)
#define EMBREE_STATIC_LIB
#endif
// #cmakedefine EMBREE_API_NAMESPACE
#if defined(EMBREE_API_NAMESPACE)
# define RTC_NAMESPACE
# define RTC_NAMESPACE_BEGIN namespace {
# define RTC_NAMESPACE_END }
# define RTC_NAMESPACE_USE using namespace;
# define RTC_API_EXTERN_C
# define RTC_API_EXTERN_CPP
# undef EMBREE_API_NAMESPACE
#else
# define RTC_NAMESPACE_BEGIN
# define RTC_NAMESPACE_END
# define RTC_NAMESPACE_USE
# if defined(__cplusplus)
# define RTC_API_EXTERN_C extern "C"
# define RTC_API_EXTERN_CPP extern "C++"
# else
# define RTC_API_EXTERN_C
# endif
#endif
#if defined(ISPC)
# define RTC_API_IMPORT extern "C" unmasked
# define RTC_API_EXPORT extern "C" unmasked
#elif defined(EMBREE_STATIC_LIB)
# define RTC_API_IMPORT RTC_API_EXTERN_C
# define RTC_API_EXPORT RTC_API_EXTERN_C
#elif defined(_WIN32)
# define RTC_API_IMPORT RTC_API_EXTERN_C __declspec(dllimport)
# define RTC_API_EXPORT RTC_API_EXTERN_C __declspec(dllexport)
#else
# define RTC_API_IMPORT RTC_API_EXTERN_C
# define RTC_API_EXPORT RTC_API_EXTERN_C __attribute__ ((visibility ("default")))
#endif
#if defined(ISPC)
# define RTC_API_IMPORT_CPP extern "C++" unmasked
# define RTC_API_EXPORT_CPP extern "C++" unmasked
#elif defined(EMBREE_STATIC_LIB)
# define RTC_API_IMPORT_CPP RTC_API_EXTERN_CPP
# define RTC_API_EXPORT_CPP RTC_API_EXTERN_CPP
#elif defined(_WIN32)
# define RTC_API_IMPORT_CPP RTC_API_EXTERN_CPP __declspec(dllimport)
# define RTC_API_EXPORT_CPP RTC_API_EXTERN_CPP __declspec(dllexport)
#else
# define RTC_API_IMPORT_CPP RTC_API_EXTERN_CPP
# define RTC_API_EXPORT_CPP RTC_API_EXTERN_CPP __attribute__ ((visibility ("default")))
#endif
#if defined(RTC_EXPORT_API)
# define RTC_API RTC_API_EXPORT
#else
# define RTC_API RTC_API_IMPORT
#endif
#if defined(RTC_EXPORT_API)
# define RTC_API_CPP RTC_API_EXPORT_CPP
#else
# define RTC_API_CPP RTC_API_IMPORT_CPP
#endif
#if defined(ISPC)
# define RTC_SYCL_INDIRECTLY_CALLABLE
#elif defined(__SYCL_DEVICE_ONLY__)
# define RTC_SYCL_INDIRECTLY_CALLABLE [[intel::device_indirectly_callable]] SYCL_EXTERNAL
# define RTC_SYCL_API SYCL_EXTERNAL
#else
# define RTC_SYCL_INDIRECTLY_CALLABLE
# define RTC_SYCL_API RTC_API
#endif

View File

@@ -0,0 +1,125 @@
// Copyright 2009-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "rtcore_common.h"
RTC_NAMESPACE_BEGIN
/* Opaque device type */
typedef struct RTCDeviceTy* RTCDevice;
typedef struct RTCSceneTy* RTCScene;
/* Creates a new Embree device. */
RTC_API RTCDevice rtcNewDevice(const char* config);
#if defined(EMBREE_SYCL_SUPPORT) && defined(SYCL_LANGUAGE_VERSION)
/*
Creates a new Embree SYCL device. It will internally select the first SYCL device of
the SYCL context as the default device for memory allocations. You can set a specific
SYCL device that's part of the SYCL context by calling rtcSetDeviceSYCLDevice.
*/
RTC_API_EXTERN_C RTCDevice rtcNewSYCLDevice(sycl::context context, const char* config);
/* Checks if SYCL device is supported by Embree. */
RTC_API bool rtcIsSYCLDeviceSupported(const sycl::device sycl_device);
/* SYCL selector for Embree supported devices */
RTC_API int rtcSYCLDeviceSelector(const sycl::device sycl_device);
/* Set the SYCL device to be used to allocate data */
RTC_API void rtcSetDeviceSYCLDevice(RTCDevice device, const sycl::device sycl_device);
/* rtcCommitSceneWithQueue is asynchronous, user has to call queue.wait()
for synchronization. rtcCommitScene is blocking. */
RTC_API_CPP sycl::event rtcCommitSceneWithQueue(RTCScene scene, sycl::queue queue);
#endif
/* Retains the Embree device (increments the reference count). */
RTC_API void rtcRetainDevice(RTCDevice device);
/* Releases an Embree device (decrements the reference count). */
RTC_API void rtcReleaseDevice(RTCDevice device);
/* Device properties */
enum RTCDeviceProperty
{
RTC_DEVICE_PROPERTY_VERSION = 0,
RTC_DEVICE_PROPERTY_VERSION_MAJOR = 1,
RTC_DEVICE_PROPERTY_VERSION_MINOR = 2,
RTC_DEVICE_PROPERTY_VERSION_PATCH = 3,
RTC_DEVICE_PROPERTY_NATIVE_RAY4_SUPPORTED = 32,
RTC_DEVICE_PROPERTY_NATIVE_RAY8_SUPPORTED = 33,
RTC_DEVICE_PROPERTY_NATIVE_RAY16_SUPPORTED = 34,
RTC_DEVICE_PROPERTY_BACKFACE_CULLING_SPHERES_ENABLED = 62,
RTC_DEVICE_PROPERTY_BACKFACE_CULLING_CURVES_ENABLED = 63,
RTC_DEVICE_PROPERTY_RAY_MASK_SUPPORTED = 64,
RTC_DEVICE_PROPERTY_BACKFACE_CULLING_ENABLED = 65,
RTC_DEVICE_PROPERTY_FILTER_FUNCTION_SUPPORTED = 66,
RTC_DEVICE_PROPERTY_IGNORE_INVALID_RAYS_ENABLED = 67,
RTC_DEVICE_PROPERTY_COMPACT_POLYS_ENABLED = 68,
RTC_DEVICE_PROPERTY_TRIANGLE_GEOMETRY_SUPPORTED = 96,
RTC_DEVICE_PROPERTY_QUAD_GEOMETRY_SUPPORTED = 97,
RTC_DEVICE_PROPERTY_SUBDIVISION_GEOMETRY_SUPPORTED = 98,
RTC_DEVICE_PROPERTY_CURVE_GEOMETRY_SUPPORTED = 99,
RTC_DEVICE_PROPERTY_USER_GEOMETRY_SUPPORTED = 100,
RTC_DEVICE_PROPERTY_POINT_GEOMETRY_SUPPORTED = 101,
RTC_DEVICE_PROPERTY_TASKING_SYSTEM = 128,
RTC_DEVICE_PROPERTY_JOIN_COMMIT_SUPPORTED = 129,
RTC_DEVICE_PROPERTY_PARALLEL_COMMIT_SUPPORTED = 130,
RTC_DEVICE_PROPERTY_CPU_DEVICE = 140,
RTC_DEVICE_PROPERTY_SYCL_DEVICE = 141
};
/* Gets a device property. */
RTC_API ssize_t rtcGetDeviceProperty(RTCDevice device, enum RTCDeviceProperty prop);
/* Sets a device property. */
RTC_API void rtcSetDeviceProperty(RTCDevice device, const enum RTCDeviceProperty prop, ssize_t value);
/* Error codes */
enum RTCError
{
RTC_ERROR_NONE = 0,
RTC_ERROR_UNKNOWN = 1,
RTC_ERROR_INVALID_ARGUMENT = 2,
RTC_ERROR_INVALID_OPERATION = 3,
RTC_ERROR_OUT_OF_MEMORY = 4,
RTC_ERROR_UNSUPPORTED_CPU = 5,
RTC_ERROR_CANCELLED = 6,
RTC_ERROR_LEVEL_ZERO_RAYTRACING_SUPPORT_MISSING = 7,
};
/* Returns the string representation for the error code. For example, for RTC_ERROR_UNKNOWN the string "RTC_ERROR_UNKNOWN" will be returned. */
RTC_API const char* rtcGetErrorString(enum RTCError error);
/* Returns the error code. */
RTC_API enum RTCError rtcGetDeviceError(RTCDevice device);
/* Returns a message corresponding to the last error code (returned by rtcGetDeviceError) which provides details about the error that happened.
The same message will be written to console when verbosity is > 0 or when an error callback function is set for the device.
However, when device creation itself fails this is the only way to get additional information about the error. */
RTC_API const char* rtcGetDeviceLastErrorMessage(RTCDevice device);
/* Error callback function */
typedef void (*RTCErrorFunction)(void* userPtr, enum RTCError code, const char* str);
/* Sets the error callback function. */
RTC_API void rtcSetDeviceErrorFunction(RTCDevice device, RTCErrorFunction error, void* userPtr);
/* Memory monitor callback function */
typedef bool (*RTCMemoryMonitorFunction)(void* ptr, ssize_t bytes, bool post);
/* Sets the memory monitor callback function. */
RTC_API void rtcSetDeviceMemoryMonitorFunction(RTCDevice device, RTCMemoryMonitorFunction memoryMonitor, void* userPtr);
RTC_NAMESPACE_END

View File

@@ -0,0 +1,399 @@
// Copyright 2009-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "rtcore_buffer.h"
#include "rtcore_quaternion.h"
RTC_NAMESPACE_BEGIN
/* Opaque scene type */
typedef struct RTCSceneTy* RTCScene;
/* Opaque geometry type */
typedef struct RTCGeometryTy* RTCGeometry;
/* Types of geometries */
enum RTCGeometryType
{
RTC_GEOMETRY_TYPE_TRIANGLE = 0, // triangle mesh
RTC_GEOMETRY_TYPE_QUAD = 1, // quad (triangle pair) mesh
RTC_GEOMETRY_TYPE_GRID = 2, // grid mesh
RTC_GEOMETRY_TYPE_SUBDIVISION = 8, // Catmull-Clark subdivision surface
RTC_GEOMETRY_TYPE_CONE_LINEAR_CURVE = 15, // Cone linear curves - discontinuous at edge boundaries
RTC_GEOMETRY_TYPE_ROUND_LINEAR_CURVE = 16, // Round (rounded cone like) linear curves
RTC_GEOMETRY_TYPE_FLAT_LINEAR_CURVE = 17, // flat (ribbon-like) linear curves
RTC_GEOMETRY_TYPE_ROUND_BEZIER_CURVE = 24, // round (tube-like) Bezier curves
RTC_GEOMETRY_TYPE_FLAT_BEZIER_CURVE = 25, // flat (ribbon-like) Bezier curves
RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_BEZIER_CURVE = 26, // flat normal-oriented Bezier curves
RTC_GEOMETRY_TYPE_ROUND_BSPLINE_CURVE = 32, // round (tube-like) B-spline curves
RTC_GEOMETRY_TYPE_FLAT_BSPLINE_CURVE = 33, // flat (ribbon-like) B-spline curves
RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_BSPLINE_CURVE = 34, // flat normal-oriented B-spline curves
RTC_GEOMETRY_TYPE_ROUND_HERMITE_CURVE = 40, // round (tube-like) Hermite curves
RTC_GEOMETRY_TYPE_FLAT_HERMITE_CURVE = 41, // flat (ribbon-like) Hermite curves
RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_HERMITE_CURVE = 42, // flat normal-oriented Hermite curves
RTC_GEOMETRY_TYPE_SPHERE_POINT = 50,
RTC_GEOMETRY_TYPE_DISC_POINT = 51,
RTC_GEOMETRY_TYPE_ORIENTED_DISC_POINT = 52,
RTC_GEOMETRY_TYPE_ROUND_CATMULL_ROM_CURVE = 58, // round (tube-like) Catmull-Rom curves
RTC_GEOMETRY_TYPE_FLAT_CATMULL_ROM_CURVE = 59, // flat (ribbon-like) Catmull-Rom curves
RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_CATMULL_ROM_CURVE = 60, // flat normal-oriented Catmull-Rom curves
RTC_GEOMETRY_TYPE_USER = 120, // user-defined geometry
RTC_GEOMETRY_TYPE_INSTANCE = 121, // scene instance
RTC_GEOMETRY_TYPE_INSTANCE_ARRAY = 122, // scene instance array
};
/* Interpolation modes for subdivision surfaces */
enum RTCSubdivisionMode
{
RTC_SUBDIVISION_MODE_NO_BOUNDARY = 0,
RTC_SUBDIVISION_MODE_SMOOTH_BOUNDARY = 1,
RTC_SUBDIVISION_MODE_PIN_CORNERS = 2,
RTC_SUBDIVISION_MODE_PIN_BOUNDARY = 3,
RTC_SUBDIVISION_MODE_PIN_ALL = 4,
};
/* Curve segment flags */
enum RTCCurveFlags
{
RTC_CURVE_FLAG_NEIGHBOR_LEFT = (1 << 0), // left segments exists
RTC_CURVE_FLAG_NEIGHBOR_RIGHT = (1 << 1) // right segment exists
};
/* Arguments for RTCBoundsFunction */
struct RTCBoundsFunctionArguments
{
void* geometryUserPtr;
unsigned int primID;
unsigned int timeStep;
struct RTCBounds* bounds_o;
};
/* Bounding callback function */
typedef void (*RTCBoundsFunction)(const struct RTCBoundsFunctionArguments* args);
/* Arguments for RTCIntersectFunctionN */
struct RTCIntersectFunctionNArguments
{
int* valid;
void* geometryUserPtr;
unsigned int primID;
struct RTCRayQueryContext* context;
struct RTCRayHitN* rayhit;
unsigned int N;
unsigned int geomID;
};
/* Arguments for RTCOccludedFunctionN */
struct RTCOccludedFunctionNArguments
{
int* valid;
void* geometryUserPtr;
unsigned int primID;
struct RTCRayQueryContext* context;
struct RTCRayN* ray;
unsigned int N;
unsigned int geomID;
};
/* Arguments for RTCDisplacementFunctionN */
struct RTCDisplacementFunctionNArguments
{
void* geometryUserPtr;
RTCGeometry geometry;
unsigned int primID;
unsigned int timeStep;
const float* u;
const float* v;
const float* Ng_x;
const float* Ng_y;
const float* Ng_z;
float* P_x;
float* P_y;
float* P_z;
unsigned int N;
};
/* Displacement mapping callback function */
typedef void (*RTCDisplacementFunctionN)(const struct RTCDisplacementFunctionNArguments* args);
/* Creates a new geometry of specified type. */
RTC_API RTCGeometry rtcNewGeometry(RTCDevice device, enum RTCGeometryType type);
/* Retains the geometry (increments the reference count). */
RTC_API void rtcRetainGeometry(RTCGeometry geometry);
/* Releases the geometry (decrements the reference count) */
RTC_API void rtcReleaseGeometry(RTCGeometry geometry);
/* Commits the geometry. */
RTC_API void rtcCommitGeometry(RTCGeometry geometry);
/* Enables the geometry. */
RTC_API void rtcEnableGeometry(RTCGeometry geometry);
/* Disables the geometry. */
RTC_API void rtcDisableGeometry(RTCGeometry geometry);
/* Sets the number of motion blur time steps of the geometry. */
RTC_API void rtcSetGeometryTimeStepCount(RTCGeometry geometry, unsigned int timeStepCount);
/* Sets the motion blur time range of the geometry. */
RTC_API void rtcSetGeometryTimeRange(RTCGeometry geometry, float startTime, float endTime);
/* Sets the number of vertex attributes of the geometry. */
RTC_API void rtcSetGeometryVertexAttributeCount(RTCGeometry geometry, unsigned int vertexAttributeCount);
/* Sets the ray mask of the geometry. */
RTC_API void rtcSetGeometryMask(RTCGeometry geometry, unsigned int mask);
/* Sets the build quality of the geometry. */
RTC_API void rtcSetGeometryBuildQuality(RTCGeometry geometry, enum RTCBuildQuality quality);
/* Sets the maximal curve or point radius scale allowed by min-width feature. */
RTC_API void rtcSetGeometryMaxRadiusScale(RTCGeometry geometry, float maxRadiusScale);
/* Sets a geometry buffer. */
RTC_API void rtcSetGeometryBuffer(RTCGeometry geometry, enum RTCBufferType type, unsigned int slot, enum RTCFormat format, RTCBuffer buffer, size_t byteOffset, size_t byteStride, size_t itemCount);
/* Sets a shared geometry buffer. */
RTC_API void rtcSetSharedGeometryBuffer(RTCGeometry geometry, enum RTCBufferType type, unsigned int slot, enum RTCFormat format, const void* ptr, size_t byteOffset, size_t byteStride, size_t itemCount);
/* Sets a shared host/device geometry buffer pair. */
RTC_API void rtcSetSharedGeometryBufferHostDevice(RTCGeometry geometry, enum RTCBufferType bufferType, unsigned int slot, enum RTCFormat format, const void* ptr, const void* dptr, size_t byteOffset, size_t byteStride, size_t itemCount);
/* Creates and sets a new geometry buffer. */
RTC_API void* rtcSetNewGeometryBuffer(RTCGeometry geometry, enum RTCBufferType type, unsigned int slot, enum RTCFormat format, size_t byteStride, size_t itemCount);
/* Creates and sets a new host/device geometry buffer pair. */
RTC_API void rtcSetNewGeometryBufferHostDevice(RTCGeometry geometry, enum RTCBufferType bufferType, unsigned int slot, enum RTCFormat format, size_t byteStride, size_t itemCount, void** ptr, void** dptr);
/* Returns the pointer to the data of a buffer. */
RTC_API void* rtcGetGeometryBufferData(RTCGeometry geometry, enum RTCBufferType type, unsigned int slot);
/* Returns a pointer to the buffer data on the device. Returns the same pointer as
rtcGetGeometryBufferData if the device is no SYCL device or if Embree is executed on a
system with unified memory (e.g., iGPUs). */
RTC_API void* rtcGetGeometryBufferDataDevice(RTCGeometry geometry, enum RTCBufferType type, unsigned int slot);
/* Updates a geometry buffer. */
RTC_API void rtcUpdateGeometryBuffer(RTCGeometry geometry, enum RTCBufferType type, unsigned int slot);
/* Sets the intersection filter callback function of the geometry. */
RTC_API void rtcSetGeometryIntersectFilterFunction(RTCGeometry geometry, RTCFilterFunctionN filter);
/* Sets the occlusion filter callback function of the geometry. */
RTC_API void rtcSetGeometryOccludedFilterFunction(RTCGeometry geometry, RTCFilterFunctionN filter);
/* Enables argument version of intersection or occlusion filter function. */
RTC_API void rtcSetGeometryEnableFilterFunctionFromArguments(RTCGeometry geometry, bool enable);
/* Sets the user-defined data pointer of the geometry. */
RTC_API void rtcSetGeometryUserData(RTCGeometry geometry, void* ptr);
/* Gets the user-defined data pointer of the geometry. */
RTC_API void* rtcGetGeometryUserData(RTCGeometry geometry);
/* Set the point query callback function of a geometry. */
RTC_API void rtcSetGeometryPointQueryFunction(RTCGeometry geometry, RTCPointQueryFunction pointQuery);
/* Sets the number of primitives of a user geometry. */
RTC_API void rtcSetGeometryUserPrimitiveCount(RTCGeometry geometry, unsigned int userPrimitiveCount);
/* Sets the bounding callback function to calculate bounding boxes for user primitives. */
RTC_API void rtcSetGeometryBoundsFunction(RTCGeometry geometry, RTCBoundsFunction bounds, void* userPtr);
/* Set the intersect callback function of a user geometry. */
RTC_API void rtcSetGeometryIntersectFunction(RTCGeometry geometry, RTCIntersectFunctionN intersect);
/* Set the occlusion callback function of a user geometry. */
RTC_API void rtcSetGeometryOccludedFunction(RTCGeometry geometry, RTCOccludedFunctionN occluded);
/* Invokes the intersection filter from the intersection callback function. */
RTC_SYCL_API void rtcInvokeIntersectFilterFromGeometry(const struct RTCIntersectFunctionNArguments* args, const struct RTCFilterFunctionNArguments* filterArgs);
/* Invokes the occlusion filter from the occlusion callback function. */
RTC_SYCL_API void rtcInvokeOccludedFilterFromGeometry(const struct RTCOccludedFunctionNArguments* args, const struct RTCFilterFunctionNArguments* filterArgs);
/* Sets the instanced scene of an instance geometry. */
RTC_API void rtcSetGeometryInstancedScene(RTCGeometry geometry, RTCScene scene);
/* Sets the instanced scenes of an instance array geometry. */
RTC_API void rtcSetGeometryInstancedScenes(RTCGeometry geometry, RTCScene* scenes, size_t numScenes);
/* Sets the transformation of an instance for the specified time step. */
RTC_API void rtcSetGeometryTransform(RTCGeometry geometry, unsigned int timeStep, enum RTCFormat format, const void* xfm);
/* Sets the transformation quaternion of an instance for the specified time step. */
RTC_API void rtcSetGeometryTransformQuaternion(RTCGeometry geometry, unsigned int timeStep, const struct RTCQuaternionDecomposition* qd);
/* Returns the interpolated transformation of an instance for the specified time. */
RTC_API void rtcGetGeometryTransform(RTCGeometry geometry, float time, enum RTCFormat format, void* xfm);
/*
* Returns the interpolated transformation of the instPrimID'th instance of an
* instance array for the specified time. If geometry is an regular instance,
* instPrimID must be 0.
*/
RTC_API void rtcGetGeometryTransformEx(RTCGeometry geometry, unsigned int instPrimID, float time, enum RTCFormat format, void* xfm);
/* Sets the uniform tessellation rate of the geometry. */
RTC_API void rtcSetGeometryTessellationRate(RTCGeometry geometry, float tessellationRate);
/* Sets the number of topologies of a subdivision surface. */
RTC_API void rtcSetGeometryTopologyCount(RTCGeometry geometry, unsigned int topologyCount);
/* Sets the subdivision interpolation mode. */
RTC_API void rtcSetGeometrySubdivisionMode(RTCGeometry geometry, unsigned int topologyID, enum RTCSubdivisionMode mode);
/* Binds a vertex attribute to a topology of the geometry. */
RTC_API void rtcSetGeometryVertexAttributeTopology(RTCGeometry geometry, unsigned int vertexAttributeID, unsigned int topologyID);
/* Sets the displacement callback function of a subdivision surface. */
RTC_API void rtcSetGeometryDisplacementFunction(RTCGeometry geometry, RTCDisplacementFunctionN displacement);
/* Returns the first half edge of a face. */
RTC_API unsigned int rtcGetGeometryFirstHalfEdge(RTCGeometry geometry, unsigned int faceID);
/* Returns the face the half edge belongs to. */
RTC_API unsigned int rtcGetGeometryFace(RTCGeometry geometry, unsigned int edgeID);
/* Returns next half edge. */
RTC_API unsigned int rtcGetGeometryNextHalfEdge(RTCGeometry geometry, unsigned int edgeID);
/* Returns previous half edge. */
RTC_API unsigned int rtcGetGeometryPreviousHalfEdge(RTCGeometry geometry, unsigned int edgeID);
/* Returns opposite half edge. */
RTC_API unsigned int rtcGetGeometryOppositeHalfEdge(RTCGeometry geometry, unsigned int topologyID, unsigned int edgeID);
/* Arguments for rtcInterpolate */
struct RTCInterpolateArguments
{
RTCGeometry geometry;
unsigned int primID;
float u;
float v;
enum RTCBufferType bufferType;
unsigned int bufferSlot;
float* P;
float* dPdu;
float* dPdv;
float* ddPdudu;
float* ddPdvdv;
float* ddPdudv;
unsigned int valueCount;
};
/* Interpolates vertex data to some u/v location and optionally calculates all derivatives. */
RTC_API void rtcInterpolate(const struct RTCInterpolateArguments* args);
/* Interpolates vertex data to some u/v location. */
RTC_FORCEINLINE void rtcInterpolate0(RTCGeometry geometry, unsigned int primID, float u, float v, enum RTCBufferType bufferType, unsigned int bufferSlot, float* P, unsigned int valueCount)
{
struct RTCInterpolateArguments args;
args.geometry = geometry;
args.primID = primID;
args.u = u;
args.v = v;
args.bufferType = bufferType;
args.bufferSlot = bufferSlot;
args.P = P;
args.dPdu = NULL;
args.dPdv = NULL;
args.ddPdudu = NULL;
args.ddPdvdv = NULL;
args.ddPdudv = NULL;
args.valueCount = valueCount;
rtcInterpolate(&args);
}
/* Interpolates vertex data to some u/v location and calculates first order derivatives. */
RTC_FORCEINLINE void rtcInterpolate1(RTCGeometry geometry, unsigned int primID, float u, float v, enum RTCBufferType bufferType, unsigned int bufferSlot,
float* P, float* dPdu, float* dPdv, unsigned int valueCount)
{
struct RTCInterpolateArguments args;
args.geometry = geometry;
args.primID = primID;
args.u = u;
args.v = v;
args.bufferType = bufferType;
args.bufferSlot = bufferSlot;
args.P = P;
args.dPdu = dPdu;
args.dPdv = dPdv;
args.ddPdudu = NULL;
args.ddPdvdv = NULL;
args.ddPdudv = NULL;
args.valueCount = valueCount;
rtcInterpolate(&args);
}
/* Interpolates vertex data to some u/v location and calculates first and second order derivatives. */
RTC_FORCEINLINE void rtcInterpolate2(RTCGeometry geometry, unsigned int primID, float u, float v, enum RTCBufferType bufferType, unsigned int bufferSlot,
float* P, float* dPdu, float* dPdv, float* ddPdudu, float* ddPdvdv, float* ddPdudv, unsigned int valueCount)
{
struct RTCInterpolateArguments args;
args.geometry = geometry;
args.primID = primID;
args.u = u;
args.v = v;
args.bufferType = bufferType;
args.bufferSlot = bufferSlot;
args.P = P;
args.dPdu = dPdu;
args.dPdv = dPdv;
args.ddPdudu = ddPdudu;
args.ddPdvdv = ddPdvdv;
args.ddPdudv = ddPdudv;
args.valueCount = valueCount;
rtcInterpolate(&args);
}
/* Arguments for rtcInterpolateN */
struct RTCInterpolateNArguments
{
RTCGeometry geometry;
const void* valid;
const unsigned int* primIDs;
const float* u;
const float* v;
unsigned int N;
enum RTCBufferType bufferType;
unsigned int bufferSlot;
float* P;
float* dPdu;
float* dPdv;
float* ddPdudu;
float* ddPdvdv;
float* ddPdudv;
unsigned int valueCount;
};
/* Interpolates vertex data to an array of u/v locations. */
RTC_API void rtcInterpolateN(const struct RTCInterpolateNArguments* args);
/* RTCGrid primitive for grid mesh */
struct RTCGrid
{
unsigned int startVertexID;
unsigned int stride;
unsigned short width,height; // max is a 32k x 32k grid
};
RTC_NAMESPACE_END

View File

@@ -0,0 +1,101 @@
// Copyright 2009-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "rtcore_common.h"
RTC_NAMESPACE_BEGIN
/*
* Structure for transformation representation as a matrix decomposition using
* a quaternion
*/
struct RTC_ALIGN(16) RTCQuaternionDecomposition
{
float scale_x;
float scale_y;
float scale_z;
float skew_xy;
float skew_xz;
float skew_yz;
float shift_x;
float shift_y;
float shift_z;
float quaternion_r;
float quaternion_i;
float quaternion_j;
float quaternion_k;
float translation_x;
float translation_y;
float translation_z;
};
RTC_FORCEINLINE void rtcInitQuaternionDecomposition(struct RTCQuaternionDecomposition* qdecomp)
{
qdecomp->scale_x = 1.f;
qdecomp->scale_y = 1.f;
qdecomp->scale_z = 1.f;
qdecomp->skew_xy = 0.f;
qdecomp->skew_xz = 0.f;
qdecomp->skew_yz = 0.f;
qdecomp->shift_x = 0.f;
qdecomp->shift_y = 0.f;
qdecomp->shift_z = 0.f;
qdecomp->quaternion_r = 1.f;
qdecomp->quaternion_i = 0.f;
qdecomp->quaternion_j = 0.f;
qdecomp->quaternion_k = 0.f;
qdecomp->translation_x = 0.f;
qdecomp->translation_y = 0.f;
qdecomp->translation_z = 0.f;
}
RTC_FORCEINLINE void rtcQuaternionDecompositionSetQuaternion(
struct RTCQuaternionDecomposition* qdecomp,
float r, float i, float j, float k)
{
qdecomp->quaternion_r = r;
qdecomp->quaternion_i = i;
qdecomp->quaternion_j = j;
qdecomp->quaternion_k = k;
}
RTC_FORCEINLINE void rtcQuaternionDecompositionSetScale(
struct RTCQuaternionDecomposition* qdecomp,
float scale_x, float scale_y, float scale_z)
{
qdecomp->scale_x = scale_x;
qdecomp->scale_y = scale_y;
qdecomp->scale_z = scale_z;
}
RTC_FORCEINLINE void rtcQuaternionDecompositionSetSkew(
struct RTCQuaternionDecomposition* qdecomp,
float skew_xy, float skew_xz, float skew_yz)
{
qdecomp->skew_xy = skew_xy;
qdecomp->skew_xz = skew_xz;
qdecomp->skew_yz = skew_yz;
}
RTC_FORCEINLINE void rtcQuaternionDecompositionSetShift(
struct RTCQuaternionDecomposition* qdecomp,
float shift_x, float shift_y, float shift_z)
{
qdecomp->shift_x = shift_x;
qdecomp->shift_y = shift_y;
qdecomp->shift_z = shift_z;
}
RTC_FORCEINLINE void rtcQuaternionDecompositionSetTranslation(
struct RTCQuaternionDecomposition* qdecomp,
float translation_x, float translation_y, float translation_z)
{
qdecomp->translation_x = translation_x;
qdecomp->translation_y = translation_y;
qdecomp->translation_z = translation_z;
}
RTC_NAMESPACE_END

View File

@@ -0,0 +1,367 @@
// Copyright 2009-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "rtcore_common.h"
RTC_NAMESPACE_BEGIN
/* Ray structure for a single ray */
struct RTC_ALIGN(16) RTCRay
{
float org_x; // x coordinate of ray origin
float org_y; // y coordinate of ray origin
float org_z; // z coordinate of ray origin
float tnear; // start of ray segment
float dir_x; // x coordinate of ray direction
float dir_y; // y coordinate of ray direction
float dir_z; // z coordinate of ray direction
float time; // time of this ray for motion blur
float tfar; // end of ray segment (set to hit distance)
unsigned int mask; // ray mask
unsigned int id; // ray ID
unsigned int flags; // ray flags
};
/* Hit structure for a single ray */
struct RTC_ALIGN(16) RTCHit
{
float Ng_x; // x coordinate of geometry normal
float Ng_y; // y coordinate of geometry normal
float Ng_z; // z coordinate of geometry normal
float u; // barycentric u coordinate of hit
float v; // barycentric v coordinate of hit
unsigned int primID; // primitive ID
unsigned int geomID; // geometry ID
unsigned int instID[RTC_MAX_INSTANCE_LEVEL_COUNT]; // instance ID
#if defined(RTC_GEOMETRY_INSTANCE_ARRAY)
unsigned int instPrimID[RTC_MAX_INSTANCE_LEVEL_COUNT]; // instance primitive ID
#endif
};
/* Combined ray/hit structure for a single ray */
struct RTCRayHit
{
struct RTCRay ray;
struct RTCHit hit;
};
/* Ray structure for a packet of 4 rays */
struct RTC_ALIGN(16) RTCRay4
{
float org_x[4];
float org_y[4];
float org_z[4];
float tnear[4];
float dir_x[4];
float dir_y[4];
float dir_z[4];
float time[4];
float tfar[4];
unsigned int mask[4];
unsigned int id[4];
unsigned int flags[4];
};
/* Hit structure for a packet of 4 rays */
struct RTC_ALIGN(16) RTCHit4
{
float Ng_x[4];
float Ng_y[4];
float Ng_z[4];
float u[4];
float v[4];
unsigned int primID[4];
unsigned int geomID[4];
unsigned int instID[RTC_MAX_INSTANCE_LEVEL_COUNT][4];
#if defined(RTC_GEOMETRY_INSTANCE_ARRAY)
unsigned int instPrimID[RTC_MAX_INSTANCE_LEVEL_COUNT][4];
#endif
};
/* Combined ray/hit structure for a packet of 4 rays */
struct RTCRayHit4
{
struct RTCRay4 ray;
struct RTCHit4 hit;
};
/* Ray structure for a packet of 8 rays */
struct RTC_ALIGN(32) RTCRay8
{
float org_x[8];
float org_y[8];
float org_z[8];
float tnear[8];
float dir_x[8];
float dir_y[8];
float dir_z[8];
float time[8];
float tfar[8];
unsigned int mask[8];
unsigned int id[8];
unsigned int flags[8];
};
/* Hit structure for a packet of 8 rays */
struct RTC_ALIGN(32) RTCHit8
{
float Ng_x[8];
float Ng_y[8];
float Ng_z[8];
float u[8];
float v[8];
unsigned int primID[8];
unsigned int geomID[8];
unsigned int instID[RTC_MAX_INSTANCE_LEVEL_COUNT][8];
#if defined(RTC_GEOMETRY_INSTANCE_ARRAY)
unsigned int instPrimID[RTC_MAX_INSTANCE_LEVEL_COUNT][8];
#endif
};
/* Combined ray/hit structure for a packet of 8 rays */
struct RTCRayHit8
{
struct RTCRay8 ray;
struct RTCHit8 hit;
};
/* Ray structure for a packet of 16 rays */
struct RTC_ALIGN(64) RTCRay16
{
float org_x[16];
float org_y[16];
float org_z[16];
float tnear[16];
float dir_x[16];
float dir_y[16];
float dir_z[16];
float time[16];
float tfar[16];
unsigned int mask[16];
unsigned int id[16];
unsigned int flags[16];
};
/* Hit structure for a packet of 16 rays */
struct RTC_ALIGN(64) RTCHit16
{
float Ng_x[16];
float Ng_y[16];
float Ng_z[16];
float u[16];
float v[16];
unsigned int primID[16];
unsigned int geomID[16];
unsigned int instID[RTC_MAX_INSTANCE_LEVEL_COUNT][16];
#if defined(RTC_GEOMETRY_INSTANCE_ARRAY)
unsigned int instPrimID[RTC_MAX_INSTANCE_LEVEL_COUNT][16];
#endif
};
/* Combined ray/hit structure for a packet of 16 rays */
struct RTCRayHit16
{
struct RTCRay16 ray;
struct RTCHit16 hit;
};
struct RTCRayN;
struct RTCHitN;
struct RTCRayHitN;
#if defined(__cplusplus)
/* Helper functions to access ray packets of runtime size N */
RTC_FORCEINLINE float& RTCRayN_org_x(RTCRayN* ray, unsigned int N, unsigned int i) { return ((float*)ray)[0*N+i]; }
RTC_FORCEINLINE float& RTCRayN_org_y(RTCRayN* ray, unsigned int N, unsigned int i) { return ((float*)ray)[1*N+i]; }
RTC_FORCEINLINE float& RTCRayN_org_z(RTCRayN* ray, unsigned int N, unsigned int i) { return ((float*)ray)[2*N+i]; }
RTC_FORCEINLINE float& RTCRayN_tnear(RTCRayN* ray, unsigned int N, unsigned int i) { return ((float*)ray)[3*N+i]; }
RTC_FORCEINLINE float& RTCRayN_dir_x(RTCRayN* ray, unsigned int N, unsigned int i) { return ((float*)ray)[4*N+i]; }
RTC_FORCEINLINE float& RTCRayN_dir_y(RTCRayN* ray, unsigned int N, unsigned int i) { return ((float*)ray)[5*N+i]; }
RTC_FORCEINLINE float& RTCRayN_dir_z(RTCRayN* ray, unsigned int N, unsigned int i) { return ((float*)ray)[6*N+i]; }
RTC_FORCEINLINE float& RTCRayN_time (RTCRayN* ray, unsigned int N, unsigned int i) { return ((float*)ray)[7*N+i]; }
RTC_FORCEINLINE float& RTCRayN_tfar (RTCRayN* ray, unsigned int N, unsigned int i) { return ((float*)ray)[8*N+i]; }
RTC_FORCEINLINE unsigned int& RTCRayN_mask (RTCRayN* ray, unsigned int N, unsigned int i) { return ((unsigned*)ray)[9*N+i]; }
RTC_FORCEINLINE unsigned int& RTCRayN_id (RTCRayN* ray, unsigned int N, unsigned int i) { return ((unsigned*)ray)[10*N+i]; }
RTC_FORCEINLINE unsigned int& RTCRayN_flags(RTCRayN* ray, unsigned int N, unsigned int i) { return ((unsigned*)ray)[11*N+i]; }
/* Helper functions to access hit packets of runtime size N */
RTC_FORCEINLINE float& RTCHitN_Ng_x(RTCHitN* hit, unsigned int N, unsigned int i) { return ((float*)hit)[0*N+i]; }
RTC_FORCEINLINE float& RTCHitN_Ng_y(RTCHitN* hit, unsigned int N, unsigned int i) { return ((float*)hit)[1*N+i]; }
RTC_FORCEINLINE float& RTCHitN_Ng_z(RTCHitN* hit, unsigned int N, unsigned int i) { return ((float*)hit)[2*N+i]; }
RTC_FORCEINLINE float& RTCHitN_u(RTCHitN* hit, unsigned int N, unsigned int i) { return ((float*)hit)[3*N+i]; }
RTC_FORCEINLINE float& RTCHitN_v(RTCHitN* hit, unsigned int N, unsigned int i) { return ((float*)hit)[4*N+i]; }
RTC_FORCEINLINE unsigned int& RTCHitN_primID (RTCHitN* hit, unsigned int N, unsigned int i) { return ((unsigned*)hit)[5*N+i]; }
RTC_FORCEINLINE unsigned int& RTCHitN_geomID (RTCHitN* hit, unsigned int N, unsigned int i) { return ((unsigned*)hit)[6*N+i]; }
RTC_FORCEINLINE unsigned int& RTCHitN_instID (RTCHitN* hit, unsigned int N, unsigned int i, unsigned int l) { return ((unsigned*)hit)[7*N + N*l + i]; }
#if defined(RTC_GEOMETRY_INSTANCE_ARRAY)
RTC_FORCEINLINE unsigned int& RTCHitN_instPrimID(RTCHitN* hit, unsigned int N, unsigned int i, unsigned int l) { return ((unsigned*)hit)[7*N + N*RTC_MAX_INSTANCE_LEVEL_COUNT + N*l + i]; }
#endif
/* Helper functions to extract RTCRayN and RTCHitN from RTCRayHitN */
RTC_FORCEINLINE RTCRayN* RTCRayHitN_RayN(RTCRayHitN* rayhit, unsigned int N) { return (RTCRayN*)&((float*)rayhit)[0*N]; }
RTC_FORCEINLINE RTCHitN* RTCRayHitN_HitN(RTCRayHitN* rayhit, unsigned int N) { return (RTCHitN*)&((float*)rayhit)[12*N]; }
/* Helper structure for a ray packet of compile-time size N */
template<unsigned int N>
struct RTC_ALIGN((N && !(N & (N - 1)) ? (N * 4 > 16 ? N * 4 : 16) : 16)) RTCRayNt
{
float org_x[N];
float org_y[N];
float org_z[N];
float tnear[N];
float dir_x[N];
float dir_y[N];
float dir_z[N];
float time[N];
float tfar[N];
unsigned int mask[N];
unsigned int id[N];
unsigned int flags[N];
};
/* Helper structure for a hit packet of compile-time size N */
template<unsigned int N>
struct RTC_ALIGN((N && !(N & (N - 1)) ? (N * 4 > 16 ? N * 4 : 16) : 16)) RTCHitNt
{
float Ng_x[N];
float Ng_y[N];
float Ng_z[N];
float u[N];
float v[N];
unsigned int primID[N];
unsigned int geomID[N];
unsigned int instID[RTC_MAX_INSTANCE_LEVEL_COUNT][N];
#if defined(RTC_GEOMETRY_INSTANCE_ARRAY)
unsigned int instPrimID[RTC_MAX_INSTANCE_LEVEL_COUNT][N];
#endif
};
/* Helper structure for a combined ray/hit packet of compile-time size N */
template<int N>
struct RTCRayHitNt
{
RTCRayNt<N> ray;
RTCHitNt<N> hit;
};
RTC_FORCEINLINE RTCRay rtcGetRayFromRayN(RTCRayN* rayN, unsigned int N, unsigned int i)
{
RTCRay ray;
ray.org_x = RTCRayN_org_x(rayN,N,i);
ray.org_y = RTCRayN_org_y(rayN,N,i);
ray.org_z = RTCRayN_org_z(rayN,N,i);
ray.tnear = RTCRayN_tnear(rayN,N,i);
ray.dir_x = RTCRayN_dir_x(rayN,N,i);
ray.dir_y = RTCRayN_dir_y(rayN,N,i);
ray.dir_z = RTCRayN_dir_z(rayN,N,i);
ray.time = RTCRayN_time(rayN,N,i);
ray.tfar = RTCRayN_tfar(rayN,N,i);
ray.mask = RTCRayN_mask(rayN,N,i);
ray.id = RTCRayN_id(rayN,N,i);
ray.flags = RTCRayN_flags(rayN,N,i);
return ray;
}
RTC_FORCEINLINE RTCHit rtcGetHitFromHitN(RTCHitN* hitN, unsigned int N, unsigned int i)
{
RTCHit hit;
hit.Ng_x = RTCHitN_Ng_x(hitN,N,i);
hit.Ng_y = RTCHitN_Ng_y(hitN,N,i);
hit.Ng_z = RTCHitN_Ng_z(hitN,N,i);
hit.u = RTCHitN_u(hitN,N,i);
hit.v = RTCHitN_v(hitN,N,i);
hit.primID = RTCHitN_primID(hitN,N,i);
hit.geomID = RTCHitN_geomID(hitN,N,i);
for (unsigned int l = 0; l < RTC_MAX_INSTANCE_LEVEL_COUNT; l++) {
hit.instID[l] = RTCHitN_instID(hitN,N,i,l);
#if defined(RTC_GEOMETRY_INSTANCE_ARRAY)
hit.instPrimID[l] = RTCHitN_instPrimID(hitN,N,i,l);
#endif
}
return hit;
}
RTC_FORCEINLINE void rtcCopyHitToHitN(RTCHitN* hitN, const RTCHit* hit, unsigned int N, unsigned int i)
{
RTCHitN_Ng_x(hitN,N,i) = hit->Ng_x;
RTCHitN_Ng_y(hitN,N,i) = hit->Ng_y;
RTCHitN_Ng_z(hitN,N,i) = hit->Ng_z;
RTCHitN_u(hitN,N,i) = hit->u;
RTCHitN_v(hitN,N,i) = hit->v;
RTCHitN_primID(hitN,N,i) = hit->primID;
RTCHitN_geomID(hitN,N,i) = hit->geomID;
for (unsigned int l = 0; l < RTC_MAX_INSTANCE_LEVEL_COUNT; l++) {
RTCHitN_instID(hitN,N,i,l) = hit->instID[l];
#if defined(RTC_GEOMETRY_INSTANCE_ARRAY)
RTCHitN_instPrimID(hitN,N,i,l) = hit->instPrimID[l];
#endif
}
}
RTC_FORCEINLINE RTCRayHit rtcGetRayHitFromRayHitN(RTCRayHitN* rayhitN, unsigned int N, unsigned int i)
{
RTCRayHit rh;
RTCRayN* ray = RTCRayHitN_RayN(rayhitN,N);
rh.ray.org_x = RTCRayN_org_x(ray,N,i);
rh.ray.org_y = RTCRayN_org_y(ray,N,i);
rh.ray.org_z = RTCRayN_org_z(ray,N,i);
rh.ray.tnear = RTCRayN_tnear(ray,N,i);
rh.ray.dir_x = RTCRayN_dir_x(ray,N,i);
rh.ray.dir_y = RTCRayN_dir_y(ray,N,i);
rh.ray.dir_z = RTCRayN_dir_z(ray,N,i);
rh.ray.time = RTCRayN_time(ray,N,i);
rh.ray.tfar = RTCRayN_tfar(ray,N,i);
rh.ray.mask = RTCRayN_mask(ray,N,i);
rh.ray.id = RTCRayN_id(ray,N,i);
rh.ray.flags = RTCRayN_flags(ray,N,i);
RTCHitN* hit = RTCRayHitN_HitN(rayhitN,N);
rh.hit.Ng_x = RTCHitN_Ng_x(hit,N,i);
rh.hit.Ng_y = RTCHitN_Ng_y(hit,N,i);
rh.hit.Ng_z = RTCHitN_Ng_z(hit,N,i);
rh.hit.u = RTCHitN_u(hit,N,i);
rh.hit.v = RTCHitN_v(hit,N,i);
rh.hit.primID = RTCHitN_primID(hit,N,i);
rh.hit.geomID = RTCHitN_geomID(hit,N,i);
for (unsigned int l = 0; l < RTC_MAX_INSTANCE_LEVEL_COUNT; l++) {
rh.hit.instID[l] = RTCHitN_instID(hit,N,i,l);
#if defined(RTC_GEOMETRY_INSTANCE_ARRAY)
rh.hit.instPrimID[l] = RTCHitN_instPrimID(hit,N,i,l);
#endif
}
return rh;
}
#endif
RTC_NAMESPACE_END

View File

@@ -0,0 +1,355 @@
// Copyright 2009-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "rtcore_device.h"
RTC_NAMESPACE_BEGIN
/* Opaque traversable type */
typedef struct RTCTraversableTy* RTCTraversable;
/* Forward declarations for ray structures */
struct RTCRayHit;
struct RTCRayHit4;
struct RTCRayHit8;
struct RTCRayHit16;
/* Scene flags */
enum RTCSceneFlags
{
RTC_SCENE_FLAG_NONE = 0,
RTC_SCENE_FLAG_DYNAMIC = (1 << 0),
RTC_SCENE_FLAG_COMPACT = (1 << 1),
RTC_SCENE_FLAG_ROBUST = (1 << 2),
RTC_SCENE_FLAG_FILTER_FUNCTION_IN_ARGUMENTS = (1 << 3),
RTC_SCENE_FLAG_PREFETCH_USM_SHARED_ON_GPU = (1 << 4),
};
/* Additional arguments for rtcIntersect1/4/8/16 calls */
struct RTCIntersectArguments
{
enum RTCRayQueryFlags flags; // intersection flags
enum RTCFeatureFlags feature_mask; // selectively enable features for traversal
struct RTCRayQueryContext* context; // optional pointer to ray query context
RTCFilterFunctionN filter; // filter function to execute
RTCIntersectFunctionN intersect; // user geometry intersection callback to execute
#if RTC_MIN_WIDTH
float minWidthDistanceFactor; // curve radius is set to this factor times distance to ray origin
#endif
};
/* Initializes intersection arguments. */
RTC_FORCEINLINE void rtcInitIntersectArguments(struct RTCIntersectArguments* args)
{
args->flags = RTC_RAY_QUERY_FLAG_INCOHERENT;
args->feature_mask = RTC_FEATURE_FLAG_ALL;
args->context = NULL;
args->filter = NULL;
args->intersect = NULL;
#if RTC_MIN_WIDTH
args->minWidthDistanceFactor = 0.0f;
#endif
}
/* Additional arguments for rtcOccluded1/4/8/16 calls */
struct RTCOccludedArguments
{
enum RTCRayQueryFlags flags; // intersection flags
enum RTCFeatureFlags feature_mask; // selectively enable features for traversal
struct RTCRayQueryContext* context; // optional pointer to ray query context
RTCFilterFunctionN filter; // filter function to execute
RTCOccludedFunctionN occluded; // user geometry occlusion callback to execute
#if RTC_MIN_WIDTH
float minWidthDistanceFactor; // curve radius is set to this factor times distance to ray origin
#endif
};
/* Initializes an intersection arguments. */
RTC_FORCEINLINE void rtcInitOccludedArguments(struct RTCOccludedArguments* args)
{
args->flags = RTC_RAY_QUERY_FLAG_INCOHERENT;
args->feature_mask = RTC_FEATURE_FLAG_ALL;
args->context = NULL;
args->filter = NULL;
args->occluded = NULL;
#if RTC_MIN_WIDTH
args->minWidthDistanceFactor = 0.0f;
#endif
}
/* Creates a new scene. */
RTC_API RTCScene rtcNewScene(RTCDevice device);
/* Returns the device the scene got created in. The reference count of
* the device is incremented by this function. */
RTC_API RTCDevice rtcGetSceneDevice(RTCScene hscene);
/* Retains the scene (increments the reference count). */
RTC_API void rtcRetainScene(RTCScene scene);
/* Releases the scene (decrements the reference count). */
RTC_API void rtcReleaseScene(RTCScene scene);
/* Returns the traversable object of the scene which can be passed to ray queries. */
RTC_API RTCTraversable rtcGetSceneTraversable(RTCScene scene);
/* Attaches the geometry to a scene. */
RTC_API unsigned int rtcAttachGeometry(RTCScene scene, RTCGeometry geometry);
/* Attaches the geometry to a scene using the specified geometry ID. */
RTC_API void rtcAttachGeometryByID(RTCScene scene, RTCGeometry geometry, unsigned int geomID);
/* Detaches the geometry from the scene. */
RTC_API void rtcDetachGeometry(RTCScene scene, unsigned int geomID);
/* Gets a geometry handle from the scene. This function is not thread safe and should get used during rendering. */
RTC_API RTCGeometry rtcGetGeometry(RTCScene scene, unsigned int geomID);
/* Gets a geometry handle from the scene. This function is thread safe and should NOT get used during rendering. */
RTC_API RTCGeometry rtcGetGeometryThreadSafe(RTCScene scene, unsigned int geomID);
/* Commits the scene. */
RTC_API void rtcCommitScene(RTCScene scene);
/* Commits the scene from multiple threads. */
RTC_API void rtcJoinCommitScene(RTCScene scene);
/* Progress monitor callback function */
typedef bool (*RTCProgressMonitorFunction)(void* ptr, double n);
/* Sets the progress monitor callback function of the scene. */
RTC_API void rtcSetSceneProgressMonitorFunction(RTCScene scene, RTCProgressMonitorFunction progress, void* ptr);
/* Sets the build quality of the scene. */
RTC_API void rtcSetSceneBuildQuality(RTCScene scene, enum RTCBuildQuality quality);
/* Sets the scene flags. */
RTC_API void rtcSetSceneFlags(RTCScene scene, enum RTCSceneFlags flags);
/* Returns the scene flags. */
RTC_API enum RTCSceneFlags rtcGetSceneFlags(RTCScene scene);
/* Returns the axis-aligned bounds of the scene. */
RTC_API void rtcGetSceneBounds(RTCScene scene, struct RTCBounds* bounds_o);
/* Returns the linear axis-aligned bounds of the scene. */
RTC_API void rtcGetSceneLinearBounds(RTCScene scene, struct RTCLinearBounds* bounds_o);
#if !defined(__SYCL_DEVICE_ONLY__)
/* Gets the user-defined data pointer of the geometry. This function is not thread safe and should get used during rendering. */
RTC_SYCL_API void* rtcGetGeometryUserDataFromScene(RTCScene scene, unsigned int geomID);
/* Returns the interpolated transformation of an instance for the specified time. */
RTC_SYCL_API void rtcGetGeometryTransformFromScene(RTCScene scene, unsigned int geomID, float time, enum RTCFormat format, void* xfm);
/* Perform a closest point query of the scene. */
RTC_API bool rtcPointQuery(RTCScene scene, struct RTCPointQuery* query, struct RTCPointQueryContext* context, RTCPointQueryFunction queryFunc, void* userPtr);
/* Perform a closest point query with a packet of 4 points with the scene. */
RTC_API bool rtcPointQuery4(const int* valid, RTCScene scene, struct RTCPointQuery4* query, struct RTCPointQueryContext* context, RTCPointQueryFunction queryFunc, void** userPtr);
/* Perform a closest point query with a packet of 4 points with the scene. */
RTC_API bool rtcPointQuery8(const int* valid, RTCScene scene, struct RTCPointQuery8* query, struct RTCPointQueryContext* context, RTCPointQueryFunction queryFunc, void** userPtr);
/* Perform a closest point query with a packet of 4 points with the scene. */
RTC_API bool rtcPointQuery16(const int* valid, RTCScene scene, struct RTCPointQuery16* query, struct RTCPointQueryContext* context, RTCPointQueryFunction queryFunc, void** userPtr);
/* Intersects a single ray with the scene. */
RTC_SYCL_API void rtcIntersect1(RTCScene scene, struct RTCRayHit* rayhit, struct RTCIntersectArguments* args RTC_OPTIONAL_ARGUMENT);
/* Intersects a packet of 4 rays with the scene. */
RTC_API void rtcIntersect4(const int* valid, RTCScene scene, struct RTCRayHit4* rayhit, struct RTCIntersectArguments* args RTC_OPTIONAL_ARGUMENT);
/* Intersects a packet of 8 rays with the scene. */
RTC_API void rtcIntersect8(const int* valid, RTCScene scene, struct RTCRayHit8* rayhit, struct RTCIntersectArguments* args RTC_OPTIONAL_ARGUMENT);
/* Intersects a packet of 16 rays with the scene. */
RTC_API void rtcIntersect16(const int* valid, RTCScene scene, struct RTCRayHit16* rayhit, struct RTCIntersectArguments* args RTC_OPTIONAL_ARGUMENT);
/* Forwards ray inside user geometry callback. */
RTC_SYCL_API void rtcForwardIntersect1(const struct RTCIntersectFunctionNArguments* args, RTCScene scene, struct RTCRay* ray, unsigned int instID);
/* Forwards ray inside user geometry callback. Extended to handle instance arrays using instPrimID parameter. */
RTC_SYCL_API void rtcForwardIntersect1Ex(const struct RTCIntersectFunctionNArguments* args, RTCScene scene, struct RTCRay* ray, unsigned int instID, unsigned int instPrimID);
/* Forwards ray packet of size 4 inside user geometry callback. */
RTC_API void rtcForwardIntersect4(const int* valid, const struct RTCIntersectFunctionNArguments* args, RTCScene scene, struct RTCRay4* ray, unsigned int instID);
/* Forwards ray packet of size 4 inside user geometry callback. Extended to handle instance arrays using instPrimID parameter. */
RTC_API void rtcForwardIntersect4Ex(const int* valid, const struct RTCIntersectFunctionNArguments* args, RTCScene scene, struct RTCRay4* ray, unsigned int instID, unsigned int primInstID);
/* Forwards ray packet of size 8 inside user geometry callback. */
RTC_API void rtcForwardIntersect8(const int* valid, const struct RTCIntersectFunctionNArguments* args, RTCScene scene, struct RTCRay8* ray, unsigned int instID);
/* Forwards ray packet of size 4 inside user geometry callback. Extended to handle instance arrays using instPrimID parameter. */
RTC_API void rtcForwardIntersect8Ex(const int* valid, const struct RTCIntersectFunctionNArguments* args, RTCScene scene, struct RTCRay8* ray, unsigned int instID, unsigned int primInstID);
/* Forwards ray packet of size 16 inside user geometry callback. */
RTC_API void rtcForwardIntersect16(const int* valid, const struct RTCIntersectFunctionNArguments* args, RTCScene scene, struct RTCRay16* ray, unsigned int instID);
/* Forwards ray packet of size 4 inside user geometry callback. Extended to handle instance arrays using instPrimID parameter. */
RTC_API void rtcForwardIntersect16Ex(const int* valid, const struct RTCIntersectFunctionNArguments* args, RTCScene scene, struct RTCRay16* ray, unsigned int instID, unsigned int primInstID);
/* Tests a single ray for occlusion with the scene. */
RTC_SYCL_API void rtcOccluded1(RTCScene scene, struct RTCRay* ray, struct RTCOccludedArguments* args RTC_OPTIONAL_ARGUMENT);
/* Tests a packet of 4 rays for occlusion occluded with the scene. */
RTC_API void rtcOccluded4(const int* valid, RTCScene scene, struct RTCRay4* ray, struct RTCOccludedArguments* args RTC_OPTIONAL_ARGUMENT);
/* Tests a packet of 8 rays for occlusion with the scene. */
RTC_API void rtcOccluded8(const int* valid, RTCScene scene, struct RTCRay8* ray, struct RTCOccludedArguments* args RTC_OPTIONAL_ARGUMENT);
/* Tests a packet of 16 rays for occlusion with the scene. */
RTC_API void rtcOccluded16(const int* valid, RTCScene scene, struct RTCRay16* ray, struct RTCOccludedArguments* args RTC_OPTIONAL_ARGUMENT);
/* Forwards single occlusion ray inside user geometry callback. */
RTC_SYCL_API void rtcForwardOccluded1(const struct RTCOccludedFunctionNArguments* args, RTCScene scene, struct RTCRay* ray, unsigned int instID);
/* Forwards single occlusion ray inside user geometry callback. Extended to handle instance arrays using instPrimID parameter. */
RTC_SYCL_API void rtcForwardOccluded1Ex(const struct RTCOccludedFunctionNArguments* args, RTCScene scene, struct RTCRay* ray, unsigned int instID, unsigned int instPrimID);
/* Forwards occlusion ray packet of size 4 inside user geometry callback. */
RTC_API void rtcForwardOccluded4(const int* valid, const struct RTCOccludedFunctionNArguments* args, RTCScene scene, struct RTCRay4* ray, unsigned int instID);
/* Forwards occlusion ray packet of size 4 inside user geometry callback. Extended to handle instance arrays using instPrimID parameter. */
RTC_API void rtcForwardOccluded4Ex(const int* valid, const struct RTCOccludedFunctionNArguments* args, RTCScene scene, struct RTCRay4* ray, unsigned int instID, unsigned int instPrimID);
/* Forwards occlusion ray packet of size 8 inside user geometry callback. */
RTC_API void rtcForwardOccluded8(const int* valid, const struct RTCOccludedFunctionNArguments* args, RTCScene scene, struct RTCRay8* ray, unsigned int instID);
/* Forwards occlusion ray packet of size 8 inside user geometry callback. Extended to handle instance arrays using instPrimID parameter. */
RTC_API void rtcForwardOccluded8Ex(const int* valid, const struct RTCOccludedFunctionNArguments* args, RTCScene scene, struct RTCRay8* ray, unsigned int instID, unsigned int instPrimID);
/* Forwards occlusion ray packet of size 16 inside user geometry callback. */
RTC_API void rtcForwardOccluded16(const int* valid, const struct RTCOccludedFunctionNArguments* args, RTCScene scene, struct RTCRay16* ray, unsigned int instID);
/* Forwards occlusion ray packet of size 16 inside user geometry callback. Extended to handle instance arrays using instPrimID parameter. */
RTC_API void rtcForwardOccluded16Ex(const int* valid, const struct RTCOccludedFunctionNArguments* args, RTCScene scene, struct RTCRay16* ray, unsigned int instID, unsigned int instPrimID);
#endif
/* Gets the user-defined data pointer of the geometry. This function is not thread safe and should get used during rendering. */
RTC_SYCL_API void* rtcGetGeometryUserDataFromTraversable(RTCTraversable traversable, unsigned int geomID);
/* Returns the interpolated transformation of an instance for the specified time. */
RTC_SYCL_API void rtcGetGeometryTransformFromTraversable(RTCTraversable traversable, unsigned int geomID, float time, enum RTCFormat format, void* xfm);
/* Perform a closest point query of the scene. */
RTC_API bool rtcTraversablePointQuery(RTCTraversable traversable, struct RTCPointQuery* query, struct RTCPointQueryContext* context, RTCPointQueryFunction queryFunc, void* userPtr);
/* Perform a closest point query with a packet of 4 points with the scene. */
RTC_API bool rtcTraversablePointQuery4(const int* valid, RTCTraversable traversable, struct RTCPointQuery4* query, struct RTCPointQueryContext* context, RTCPointQueryFunction queryFunc, void** userPtr);
/* Perform a closest point query with a packet of 4 points with the scene. */
RTC_API bool rtcTraversablePointQuery8(const int* valid, RTCTraversable traversable, struct RTCPointQuery8* query, struct RTCPointQueryContext* context, RTCPointQueryFunction queryFunc, void** userPtr);
/* Perform a closest point query with a packet of 4 points with the scene. */
RTC_API bool rtcTraversablePointQuery16(const int* valid, RTCTraversable traversable, struct RTCPointQuery16* query, struct RTCPointQueryContext* context, RTCPointQueryFunction queryFunc, void** userPtr);
/* Intersects a single ray with the scene. */
RTC_SYCL_API void rtcTraversableIntersect1(RTCTraversable traversable, struct RTCRayHit* rayhit, struct RTCIntersectArguments* args RTC_OPTIONAL_ARGUMENT);
/* Intersects a packet of 4 rays with the scene. */
RTC_API void rtcTraversableIntersect4(const int* valid, RTCTraversable traversable, struct RTCRayHit4* rayhit, struct RTCIntersectArguments* args RTC_OPTIONAL_ARGUMENT);
/* Intersects a packet of 8 rays with the scene. */
RTC_API void rtcTraversableIntersect8(const int* valid, RTCTraversable traversable, struct RTCRayHit8* rayhit, struct RTCIntersectArguments* args RTC_OPTIONAL_ARGUMENT);
/* Intersects a packet of 16 rays with the scene. */
RTC_API void rtcTraversableIntersect16(const int* valid, RTCTraversable traversable, struct RTCRayHit16* rayhit, struct RTCIntersectArguments* args RTC_OPTIONAL_ARGUMENT);
/* Forwards ray inside user geometry callback. */
RTC_SYCL_API void rtcTraversableForwardIntersect1(const struct RTCIntersectFunctionNArguments* args, RTCTraversable traversable, struct RTCRay* ray, unsigned int instID);
/* Forwards ray inside user geometry callback. Extended to handle instance arrays using instPrimID parameter. */
RTC_SYCL_API void rtcTraversableForwardIntersect1Ex(const struct RTCIntersectFunctionNArguments* args, RTCTraversable traversable, struct RTCRay* ray, unsigned int instID, unsigned int instPrimID);
/* Forwards ray packet of size 4 inside user geometry callback. */
RTC_API void rtcTraversableForwardIntersect4(const int* valid, const struct RTCIntersectFunctionNArguments* args, RTCTraversable traversable, struct RTCRay4* ray, unsigned int instID);
/* Forwards ray packet of size 4 inside user geometry callback. Extended to handle instance arrays using instPrimID parameter. */
RTC_API void rtcTraversableForwardIntersect4Ex(const int* valid, const struct RTCIntersectFunctionNArguments* args, RTCTraversable traversable, struct RTCRay4* ray, unsigned int instID, unsigned int primInstID);
/* Forwards ray packet of size 8 inside user geometry callback. */
RTC_API void rtcTraversableForwardIntersect8(const int* valid, const struct RTCIntersectFunctionNArguments* args, RTCTraversable traversable, struct RTCRay8* ray, unsigned int instID);
/* Forwards ray packet of size 4 inside user geometry callback. Extended to handle instance arrays using instPrimID parameter. */
RTC_API void rtcTraversableForwardIntersect8Ex(const int* valid, const struct RTCIntersectFunctionNArguments* args, RTCTraversable traversable, struct RTCRay8* ray, unsigned int instID, unsigned int primInstID);
/* Forwards ray packet of size 16 inside user geometry callback. */
RTC_API void rtcTraversableForwardIntersect16(const int* valid, const struct RTCIntersectFunctionNArguments* args, RTCTraversable traversable, struct RTCRay16* ray, unsigned int instID);
/* Forwards ray packet of size 4 inside user geometry callback. Extended to handle instance arrays using instPrimID parameter. */
RTC_API void rtcTraversableForwardIntersect16Ex(const int* valid, const struct RTCIntersectFunctionNArguments* args, RTCTraversable traversable, struct RTCRay16* ray, unsigned int instID, unsigned int primInstID);
/* Tests a single ray for occlusion with the scene. */
RTC_SYCL_API void rtcTraversableOccluded1(RTCTraversable traversable, struct RTCRay* ray, struct RTCOccludedArguments* args RTC_OPTIONAL_ARGUMENT);
/* Tests a packet of 4 rays for occlusion occluded with the scene. */
RTC_API void rtcTraversableOccluded4(const int* valid, RTCTraversable traversable, struct RTCRay4* ray, struct RTCOccludedArguments* args RTC_OPTIONAL_ARGUMENT);
/* Tests a packet of 8 rays for occlusion with the scene. */
RTC_API void rtcTraversableOccluded8(const int* valid, RTCTraversable traversable, struct RTCRay8* ray, struct RTCOccludedArguments* args RTC_OPTIONAL_ARGUMENT);
/* Tests a packet of 16 rays for occlusion with the scene. */
RTC_API void rtcTraversableOccluded16(const int* valid, RTCTraversable traversable, struct RTCRay16* ray, struct RTCOccludedArguments* args RTC_OPTIONAL_ARGUMENT);
/* Forwards single occlusion ray inside user geometry callback. */
RTC_SYCL_API void rtcTraversableForwardOccluded1(const struct RTCOccludedFunctionNArguments* args, RTCTraversable traversable, struct RTCRay* ray, unsigned int instID);
/* Forwards single occlusion ray inside user geometry callback. Extended to handle instance arrays using instPrimID parameter. */
RTC_SYCL_API void rtcTraversableForwardOccluded1Ex(const struct RTCOccludedFunctionNArguments* args, RTCTraversable traversable, struct RTCRay* ray, unsigned int instID, unsigned int instPrimID);
/* Forwards occlusion ray packet of size 4 inside user geometry callback. */
RTC_API void rtcTraversableForwardOccluded4(const int* valid, const struct RTCOccludedFunctionNArguments* args, RTCTraversable traversable, struct RTCRay4* ray, unsigned int instID);
/* Forwards occlusion ray packet of size 4 inside user geometry callback. Extended to handle instance arrays using instPrimID parameter. */
RTC_API void rtcTraversableForwardOccluded4Ex(const int* valid, const struct RTCOccludedFunctionNArguments* args, RTCTraversable traversable, struct RTCRay4* ray, unsigned int instID, unsigned int instPrimID);
/* Forwards occlusion ray packet of size 8 inside user geometry callback. */
RTC_API void rtcTraversableForwardOccluded8(const int* valid, const struct RTCOccludedFunctionNArguments* args, RTCTraversable traversable, struct RTCRay8* ray, unsigned int instID);
/* Forwards occlusion ray packet of size 8 inside user geometry callback. Extended to handle instance arrays using instPrimID parameter. */
RTC_API void rtcTraversableForwardOccluded8Ex(const int* valid, const struct RTCOccludedFunctionNArguments* args, RTCTraversable traversable, struct RTCRay8* ray, unsigned int instID, unsigned int instPrimID);
/* Forwards occlusion ray packet of size 16 inside user geometry callback. */
RTC_API void rtcTraversableForwardOccluded16(const int* valid, const struct RTCOccludedFunctionNArguments* args, RTCTraversable traversable, struct RTCRay16* ray, unsigned int instID);
/* Forwards occlusion ray packet of size 16 inside user geometry callback. Extended to handle instance arrays using instPrimID parameter. */
RTC_API void rtcTraversableForwardOccluded16Ex(const int* valid, const struct RTCOccludedFunctionNArguments* args, RTCTraversable traversable, struct RTCRay16* ray, unsigned int instID, unsigned int instPrimID);
/*! collision callback */
struct RTCCollision { unsigned int geomID0; unsigned int primID0; unsigned int geomID1; unsigned int primID1; };
typedef void (*RTCCollideFunc) (void* userPtr, struct RTCCollision* collisions, unsigned int num_collisions);
/*! Performs collision detection of two scenes */
RTC_API void rtcCollide (RTCScene scene0, RTCScene scene1, RTCCollideFunc callback, void* userPtr);
#if defined(__cplusplus)
/* Helper for easily combining scene flags */
inline RTCSceneFlags operator|(RTCSceneFlags a, RTCSceneFlags b) {
return (RTCSceneFlags)((size_t)a | (size_t)b);
}
#endif
RTC_NAMESPACE_END