mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-11 16:00:17 -07:00
Merged branch 'dev_native' into lm_sla_supports_auto
Added igl library files
This commit is contained in:
commit
7681d00ee5
2865 changed files with 142806 additions and 22325 deletions
257
src/igl/embree/embree2/rtcore.h
Normal file
257
src/igl/embree/embree2/rtcore.h
Normal file
|
|
@ -0,0 +1,257 @@
|
|||
// ======================================================================== //
|
||||
// Copyright 2009-2015 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#ifndef __RTCORE_H__
|
||||
#define __RTCORE_H__
|
||||
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if defined(_M_X64)
|
||||
typedef long long ssize_t;
|
||||
#else
|
||||
typedef int ssize_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef RTCORE_API
|
||||
#if defined(_WIN32) && !defined(ENABLE_STATIC_LIB)
|
||||
# define RTCORE_API extern "C" __declspec(dllimport)
|
||||
#else
|
||||
# define RTCORE_API extern "C"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# define RTCORE_ALIGN(...) __declspec(align(__VA_ARGS__))
|
||||
#else
|
||||
# define RTCORE_ALIGN(...) __attribute__((aligned(__VA_ARGS__)))
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define RTCORE_DEPRECATED __attribute__((deprecated))
|
||||
#elif defined(_MSC_VER)
|
||||
#define RTCORE_DEPRECATED __declspec(deprecated)
|
||||
#else
|
||||
#define RTCORE_DEPRECATED
|
||||
#endif
|
||||
|
||||
/*! Embree API version */
|
||||
#define RTCORE_VERSION_MAJOR 2
|
||||
#define RTCORE_VERSION_MINOR 9
|
||||
#define RTCORE_VERSION_PATCH 0
|
||||
#define RTCORE_VERSION 20900
|
||||
|
||||
/*! \file rtcore.h Defines the Embree Ray Tracing Kernel API for C and C++
|
||||
|
||||
This file defines the Embree ray tracing kernel API for C and
|
||||
C++. The user is supposed to include this file, and alternatively
|
||||
the rtcore_ray.h file, but none of the other .h files in this
|
||||
folder. */
|
||||
|
||||
/*! \{ */
|
||||
|
||||
/*! Axis aligned bounding box representation */
|
||||
struct RTCORE_ALIGN(16) RTCBounds
|
||||
{
|
||||
float lower_x, lower_y, lower_z, align0;
|
||||
float upper_x, upper_y, upper_z, align1;
|
||||
};
|
||||
|
||||
/*! \brief Defines an opaque device type */
|
||||
typedef struct __RTCDevice {}* RTCDevice;
|
||||
|
||||
/*! \brief Creates a new Embree device.
|
||||
|
||||
Creates a new Embree device to be used by the application. An
|
||||
application typically creates only a single Embree device, but it is
|
||||
valid to use multiple devices inside an application. A configuration
|
||||
string can be passed at construction time, that allows to configure
|
||||
implementation specific parameters. If this string is NULL, a
|
||||
default configuration is used. The following configuration flags are
|
||||
supported by the Embree implementation of the API:
|
||||
|
||||
verbose = num, // sets verbosity level (default is 0)
|
||||
|
||||
If Embree is started on an unsupported CPU, rtcNewDevice will fail and
|
||||
set the RTC_UNSUPPORTED_CPU error code.
|
||||
|
||||
*/
|
||||
RTCORE_API RTCDevice rtcNewDevice(const char* cfg = NULL);
|
||||
|
||||
/*! \brief Deletes an Embree device.
|
||||
|
||||
Deletes the Embree device again. After deletion, all scene handles
|
||||
are invalid. The application should invoke this call before
|
||||
terminating. */
|
||||
RTCORE_API void rtcDeleteDevice(RTCDevice device);
|
||||
|
||||
/*! \brief Initializes the Embree ray tracing core
|
||||
|
||||
WARNING: This function is deprecated, use rtcNewDevice instead.
|
||||
|
||||
Initializes the ray tracing core and passed some configuration
|
||||
string. The configuration string allows to configure implementation
|
||||
specific parameters. If this string is NULL, a default configuration
|
||||
is used. The following configuration flags are supported by the
|
||||
Embree implementation of the API:
|
||||
|
||||
verbose = num, // sets verbosity level (default is 0)
|
||||
|
||||
If Embree is started on an unsupported CPU, rtcInit will fail and
|
||||
set the RTC_UNSUPPORTED_CPU error code.
|
||||
|
||||
*/
|
||||
RTCORE_API RTCORE_DEPRECATED void rtcInit(const char* cfg = NULL);
|
||||
|
||||
/*! \brief Shuts down Embree
|
||||
|
||||
WARNING: This function is deprecated, use rtcDeleteDevice instead.
|
||||
|
||||
Shuts down the ray tracing core. After shutdown, all scene handles
|
||||
are invalid, and invoking any API call except rtcInit is not
|
||||
allowed. The application should invoke this call before
|
||||
terminating. It is safe to call rtcInit again after an rtcExit
|
||||
call. */
|
||||
RTCORE_API RTCORE_DEPRECATED void rtcExit();
|
||||
|
||||
/*! \brief Parameters that can get configured using the rtcSetParameter functions. */
|
||||
enum RTCParameter {
|
||||
RTC_SOFTWARE_CACHE_SIZE = 0, /*! Configures the software cache size (used
|
||||
to cache subdivision surfaces for
|
||||
instance). The size is specified as an
|
||||
integer number of bytes. The software
|
||||
cache cannot be configured during
|
||||
rendering. (write only) */
|
||||
|
||||
RTC_CONFIG_INTERSECT1 = 1, //!< checks if rtcIntersect1 is supported (read only)
|
||||
RTC_CONFIG_INTERSECT4 = 2, //!< checks if rtcIntersect4 is supported (read only)
|
||||
RTC_CONFIG_INTERSECT8 = 3, //!< checks if rtcIntersect8 is supported (read only)
|
||||
RTC_CONFIG_INTERSECT16 = 4, //!< checks if rtcIntersect16 is supported (read only)
|
||||
RTC_CONFIG_INTERSECTN = 5, //!< checks if rtcIntersectN is supported (read only)
|
||||
|
||||
RTC_CONFIG_RAY_MASK = 6, //!< checks if ray masks are supported (read only)
|
||||
RTC_CONFIG_BACKFACE_CULLING = 7, //!< checks if backface culling is supported (read only)
|
||||
RTC_CONFIG_INTERSECTION_FILTER = 8, //!< checks if intersection filters are enabled (read only)
|
||||
RTC_CONFIG_INTERSECTION_FILTER_RESTORE = 9, //!< checks if intersection filters restores previous hit (read only)
|
||||
RTC_CONFIG_BUFFER_STRIDE = 10, //!< checks if buffer strides are supported (read only)
|
||||
RTC_CONFIG_IGNORE_INVALID_RAYS = 11, //!< checks if invalid rays are ignored (read only)
|
||||
RTC_CONFIG_TASKING_SYSTEM = 12, //!< return used tasking system (0 = INTERNAL, 1 = TBB) (read only)
|
||||
|
||||
RTC_CONFIG_VERSION_MAJOR = 13, //!< returns Embree major version (read only)
|
||||
RTC_CONFIG_VERSION_MINOR = 14, //!< returns Embree minor version (read only)
|
||||
RTC_CONFIG_VERSION_PATCH = 15, //!< returns Embree patch version (read only)
|
||||
RTC_CONFIG_VERSION = 16, //!< returns Embree version as integer (e.g. Embree v2.8.2 -> 20802) (read only)
|
||||
};
|
||||
|
||||
/*! \brief Configures some parameters.
|
||||
WARNING: This function is deprecated, use rtcDeviceSetParameter1i instead.
|
||||
*/
|
||||
RTCORE_API RTCORE_DEPRECATED void rtcSetParameter1i(const RTCParameter parm, ssize_t val);
|
||||
|
||||
/*! \brief Reads some device parameter.
|
||||
WARNING: This function is deprecated, use rtcDeviceGetParameter1i instead.
|
||||
*/
|
||||
RTCORE_API RTCORE_DEPRECATED ssize_t rtcGetParameter1i(const RTCParameter parm);
|
||||
|
||||
/*! \brief Configures some device parameters. */
|
||||
RTCORE_API void rtcDeviceSetParameter1i(RTCDevice device, const RTCParameter parm, ssize_t val);
|
||||
|
||||
/*! \brief Reads some device parameter. */
|
||||
RTCORE_API ssize_t rtcDeviceGetParameter1i(RTCDevice device, const RTCParameter parm);
|
||||
|
||||
/*! \brief Error codes returned by the rtcGetError function. */
|
||||
enum RTCError {
|
||||
RTC_NO_ERROR = 0, //!< No error has been recorded.
|
||||
RTC_UNKNOWN_ERROR = 1, //!< An unknown error has occured.
|
||||
RTC_INVALID_ARGUMENT = 2, //!< An invalid argument is specified
|
||||
RTC_INVALID_OPERATION = 3, //!< The operation is not allowed for the specified object.
|
||||
RTC_OUT_OF_MEMORY = 4, //!< There is not enough memory left to execute the command.
|
||||
RTC_UNSUPPORTED_CPU = 5, //!< The CPU is not supported as it does not support SSE2.
|
||||
RTC_CANCELLED = 6, //!< The user has cancelled the operation through the RTC_PROGRESS_MONITOR_FUNCTION callback
|
||||
};
|
||||
|
||||
/*! \brief Returns the value of the per-thread error flag.
|
||||
|
||||
WARNING: This function is deprecated, use rtcDeviceGetError instead.
|
||||
|
||||
If an error occurs this flag is set to an error code if it stores no
|
||||
previous error. The rtcGetError function reads and returns the
|
||||
currently stored error and clears the error flag again. */
|
||||
RTCORE_API RTCORE_DEPRECATED RTCError rtcGetError();
|
||||
|
||||
/*! \brief Returns the value of the per-thread error flag.
|
||||
|
||||
If an error occurs this flag is set to an error code if it stores no
|
||||
previous error. The rtcGetError function reads and returns the
|
||||
currently stored error and clears the error flag again. */
|
||||
RTCORE_API RTCError rtcDeviceGetError(RTCDevice device);
|
||||
|
||||
/*! \brief Type of error callback function. */
|
||||
typedef void (*RTCErrorFunc)(const RTCError code, const char* str);
|
||||
RTCORE_DEPRECATED typedef RTCErrorFunc RTC_ERROR_FUNCTION;
|
||||
|
||||
/*! \brief Sets a callback function that is called whenever an error occurs.
|
||||
WARNING: This function is deprecated, use rtcDeviceSetErrorFunction instead.
|
||||
*/
|
||||
RTCORE_API RTCORE_DEPRECATED void rtcSetErrorFunction(RTCErrorFunc func);
|
||||
|
||||
/*! \brief Sets a callback function that is called whenever an error occurs. */
|
||||
RTCORE_API void rtcDeviceSetErrorFunction(RTCDevice device, RTCErrorFunc func);
|
||||
|
||||
/*! \brief Type of memory consumption callback function. */
|
||||
typedef bool (*RTCMemoryMonitorFunc)(const ssize_t bytes, const bool post);
|
||||
RTCORE_DEPRECATED typedef RTCMemoryMonitorFunc RTC_MEMORY_MONITOR_FUNCTION;
|
||||
|
||||
/*! \brief Sets the memory consumption callback function which is
|
||||
* called before or after the library allocates or frees memory.
|
||||
WARNING: This function is deprecated, use rtcDeviceSetMemoryMonitorFunction instead.
|
||||
*/
|
||||
RTCORE_API RTCORE_DEPRECATED void rtcSetMemoryMonitorFunction(RTCMemoryMonitorFunc func);
|
||||
|
||||
/*! \brief Sets the memory consumption callback function which is
|
||||
* called before or after the library allocates or frees memory. */
|
||||
RTCORE_API void rtcDeviceSetMemoryMonitorFunction(RTCDevice device, RTCMemoryMonitorFunc func);
|
||||
|
||||
/*! \brief Implementation specific (do not call).
|
||||
|
||||
This function is implementation specific and only for debugging
|
||||
purposes. Do not call it. */
|
||||
RTCORE_API RTCORE_DEPRECATED void rtcDebug(); // FIXME: remove
|
||||
|
||||
#include "rtcore_scene.h"
|
||||
#include "rtcore_geometry.h"
|
||||
#include "rtcore_geometry_user.h"
|
||||
|
||||
/*! \brief Helper to easily combing scene flags */
|
||||
inline RTCSceneFlags operator|(const RTCSceneFlags a, const RTCSceneFlags b) {
|
||||
return (RTCSceneFlags)((size_t)a | (size_t)b);
|
||||
}
|
||||
|
||||
/*! \brief Helper to easily combing algorithm flags */
|
||||
inline RTCAlgorithmFlags operator|(const RTCAlgorithmFlags a, const RTCAlgorithmFlags b) {
|
||||
return (RTCAlgorithmFlags)((size_t)a | (size_t)b);
|
||||
}
|
||||
|
||||
/*! \brief Helper to easily combing geometry flags */
|
||||
inline RTCGeometryFlags operator|(const RTCGeometryFlags a, const RTCGeometryFlags b) {
|
||||
return (RTCGeometryFlags)((size_t)a | (size_t)b);
|
||||
}
|
||||
|
||||
/*! \} */
|
||||
|
||||
#endif
|
||||
220
src/igl/embree/embree2/rtcore.isph
Normal file
220
src/igl/embree/embree2/rtcore.isph
Normal file
|
|
@ -0,0 +1,220 @@
|
|||
// ======================================================================== //
|
||||
// Copyright 2009-2015 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#ifndef __RTCORE_ISPH__
|
||||
#define __RTCORE_ISPH__
|
||||
|
||||
#ifdef _WIN32
|
||||
# define RTCORE_ALIGN(...) // FIXME: need to specify alignment
|
||||
#else
|
||||
# define RTCORE_ALIGN(...) // FIXME: need to specify alignment
|
||||
#endif
|
||||
|
||||
#define RTCORE_DEPRECATED // FIXME: deprecation not supported by ISPC
|
||||
|
||||
/*! Embree API version */
|
||||
#define RTCORE_VERSION_MAJOR 2
|
||||
#define RTCORE_VERSION_MINOR 9
|
||||
#define RTCORE_VERSION_PATCH 0
|
||||
#define RTCORE_VERSION 20900
|
||||
|
||||
/*! \file rtcore.isph Defines the Embree Ray Tracing Kernel API for ISPC.
|
||||
|
||||
This file defines the Embree ray tracing kernel API for C and
|
||||
C++. The user is supposed to include this file, and alternatively
|
||||
the rtcore_ray.isph file, but none of the other .isph files in this
|
||||
folder. */
|
||||
|
||||
/*! \{ */
|
||||
|
||||
/*! Axis aligned bounding box representation */
|
||||
RTCORE_ALIGN(16) struct RTCBounds
|
||||
{
|
||||
float lower_x, lower_y, lower_z, align0;
|
||||
float upper_x, upper_y, upper_z, align1;
|
||||
};
|
||||
|
||||
/*! \brief Defines an opaque device type */
|
||||
typedef uniform struct __RTCDevice {}* uniform RTCDevice;
|
||||
|
||||
/*! \brief Creates a new Embree device.
|
||||
|
||||
Creates a new Embree device to be used by the application. An
|
||||
application typically creates only a single Embree device, but it is
|
||||
valid to use multiple devices inside an application. A configuration
|
||||
string can be passed at construction time, that allows to configure
|
||||
implementation specific parameters. If this string is NULL, a
|
||||
default configuration is used. The following configuration flags are
|
||||
supported by the Embree implementation of the API:
|
||||
|
||||
verbose = num, // sets verbosity level (default is 0)
|
||||
|
||||
If Embree is started on an unsupported CPU, rtcNewDevice will fail and
|
||||
set the RTC_UNSUPPORTED_CPU error code.
|
||||
|
||||
*/
|
||||
RTCDevice rtcNewDevice(const uniform int8* uniform cfg = NULL);
|
||||
|
||||
/*! \brief Deletes an Embree device.
|
||||
|
||||
Deletes the Embree device again. After deletion, all scene handles
|
||||
are invalid. The application should invoke this call before
|
||||
terminating. */
|
||||
void rtcDeleteDevice(RTCDevice device);
|
||||
|
||||
/*! \brief Initializes the Embree ray tracing core
|
||||
|
||||
WARNING: This function is deprecated, use rtcNewDevice instead.
|
||||
|
||||
Initializes the ray tracing core and passed some configuration
|
||||
string. The configuration string allows to configure implementation
|
||||
specific parameters. If this string is NULL, a default configuration
|
||||
is used. The following configuration flags are supported by the
|
||||
Embree implementation of the API:
|
||||
|
||||
verbose = num, // sets verbosity level (default is 0)
|
||||
|
||||
If Embree is started on an unsupported CPU, rtcInit will fail and
|
||||
set the RTC_UNSUPPORTED_CPU error code.
|
||||
|
||||
*/
|
||||
RTCORE_DEPRECATED void rtcInit(const uniform int8* uniform cfg = NULL);
|
||||
|
||||
/*! \brief Shuts down Embree.
|
||||
|
||||
WARNING: This function is deprecated, use rtcDeleteDevice instead.
|
||||
|
||||
Shuts down the ray tracing core. After shutdown, all scene handles
|
||||
are invalid, and invoking any API call except rtcInit is not
|
||||
allowed. The application should invoke this call before
|
||||
terminating. It is safe to call rtcInit again after an rtcExit
|
||||
call. */
|
||||
RTCORE_DEPRECATED void rtcExit();
|
||||
|
||||
/*! \brief Parameters that can get configured using the rtcSetParameter functions. */
|
||||
enum RTCParameter {
|
||||
RTC_SOFTWARE_CACHE_SIZE = 0, /*! Configures the software cache size (used
|
||||
to cache subdivision surfaces for
|
||||
instance). The size is specified as an
|
||||
integer number of bytes. The software
|
||||
cache cannot be configured during
|
||||
rendering. (write only) */
|
||||
|
||||
RTC_CONFIG_INTERSECT1 = 1, //!< checks if rtcIntersect1 is supported (read only)
|
||||
RTC_CONFIG_INTERSECT4 = 2, //!< checks if rtcIntersect4 is supported (read only)
|
||||
RTC_CONFIG_INTERSECT8 = 3, //!< checks if rtcIntersect8 is supported (read only)
|
||||
RTC_CONFIG_INTERSECT16 = 4, //!< checks if rtcIntersect16 is supported (read only)
|
||||
RTC_CONFIG_INTERSECTN = 5, //!< checks if rtcIntersectN is supported (read only)
|
||||
|
||||
RTC_CONFIG_RAY_MASK = 6, //!< checks if ray masks are supported (read only)
|
||||
RTC_CONFIG_BACKFACE_CULLING = 7, //!< checks if backface culling is supported (read only)
|
||||
RTC_CONFIG_INTERSECTION_FILTER = 8, //!< checks if intersection filters are enabled (read only)
|
||||
RTC_CONFIG_INTERSECTION_FILTER_RESTORE = 9, //!< checks if intersection filters restores previous hit (read only)
|
||||
RTC_CONFIG_BUFFER_STRIDE = 10, //!< checks if buffer strides are supported (read only)
|
||||
RTC_CONFIG_IGNORE_INVALID_RAYS = 11, //!< checks if invalid rays are ignored (read only)
|
||||
RTC_CONFIG_TASKING_SYSTEM = 12, //!< return used tasking system (0 = INTERNAL, 1 = TBB) (read only)
|
||||
|
||||
|
||||
RTC_CONFIG_VERSION_MAJOR = 13, //!< returns Embree major version (read only)
|
||||
RTC_CONFIG_VERSION_MINOR = 14, //!< returns Embree minor version (read only)
|
||||
RTC_CONFIG_VERSION_PATCH = 15, //!< returns Embree patch version (read only)
|
||||
RTC_CONFIG_VERSION = 16, //!< returns Embree version as integer (e.g. Embree v2.8.2 -> 20802) (read only)
|
||||
};
|
||||
|
||||
/*! \brief Configures some parameters.
|
||||
WARNING: This function is deprecated, use rtcDeviceSetParameter1i instead.
|
||||
*/
|
||||
RTCORE_DEPRECATED void rtcSetParameter1i(const uniform RTCParameter parm, uniform size_t val); // FIXME: should be ssize_t
|
||||
|
||||
/*! \brief Reads some parameters.
|
||||
WARNING: This function is deprecated, use rtcDeviceGetParameter1i instead.
|
||||
*/
|
||||
uniform size_t rtcGetParameter1i(const uniform RTCParameter parm); // FIXME: should return ssize_t
|
||||
|
||||
/*! \brief Configures some device parameters.*/
|
||||
void rtcDeviceSetParameter1i(RTCDevice device, const uniform RTCParameter parm, uniform size_t val); // FIXME: should be ssize_t
|
||||
|
||||
/*! \brief Reads some device parameters. */
|
||||
uniform size_t rtcDeviceGetParameter1i(RTCDevice device, const uniform RTCParameter parm); // FIXME: should return ssize_t
|
||||
|
||||
/*! \brief Error codes returned by the rtcGetError function. */
|
||||
enum RTCError {
|
||||
RTC_NO_ERROR = 0, //!< No error has been recorded.
|
||||
RTC_UNKNOWN_ERROR = 1, //!< An unknown error has occured.
|
||||
RTC_INVALID_ARGUMENT = 2, //!< An invalid argument is specified
|
||||
RTC_INVALID_OPERATION = 3, //!< The operation is not allowed for the specified object.
|
||||
RTC_OUT_OF_MEMORY = 4, //!< There is not enough memory left to execute the command.
|
||||
RTC_UNSUPPORTED_CPU = 5, //!< The CPU is not supported as it does not support SSE2.
|
||||
RTC_CANCELLED = 6 //!< The user has cancelled the operation through the RTCProgressMonitorFunc callback
|
||||
};
|
||||
|
||||
/*! \brief Returns the value of the per-thread error flag.
|
||||
|
||||
WARNING: This function is deprecated, use rtcDeviceGetError instead.
|
||||
|
||||
If an error occurs this flag is set to an error code if it stores no
|
||||
previous error. The rtcGetError function reads and returns the
|
||||
currently stored error and clears the error flag again. */
|
||||
RTCORE_DEPRECATED uniform RTCError rtcGetError();
|
||||
|
||||
/*! \brief Returns the value of the per-thread error flag.
|
||||
|
||||
If an error occurs this flag is set to an error code if it stores no
|
||||
previous error. The rtcGetError function reads and returns the
|
||||
currently stored error and clears the error flag again. */
|
||||
uniform RTCError rtcDeviceGetError(RTCDevice device);
|
||||
|
||||
/*! \brief Type of error callback function. */
|
||||
typedef void (*uniform RTCErrorFunc)(const uniform RTCError code, const uniform int8* uniform str);
|
||||
RTCORE_DEPRECATED typedef RTCErrorFunc RTC_ERROR_FUNCTION;
|
||||
|
||||
/*! \brief Sets a callback function that is called whenever an error occurs.
|
||||
WARNING: This function is deprecated, use rtcDeviceSetErrorFunction instead.
|
||||
*/
|
||||
RTCORE_DEPRECATED void rtcSetErrorFunction(uniform RTCErrorFunc func);
|
||||
|
||||
/*! \brief Sets a callback function that is called whenever an error occurs. */
|
||||
void rtcDeviceSetErrorFunction(RTCDevice device, uniform RTCErrorFunc func);
|
||||
|
||||
/*! \brief Type of memory consumption callback function. */
|
||||
typedef uniform bool (*uniform RTCMemoryMonitorFunc)(const uniform size_t bytes, const uniform bool post); // FIXME: should be ssize_t
|
||||
RTCORE_DEPRECATED typedef RTCMemoryMonitorFunc RTC_MEMORY_MONITOR_FUNCTION;
|
||||
|
||||
/*! \brief Sets the memory consumption callback function which is
|
||||
* called before the library allocates or after the library frees
|
||||
* memory.
|
||||
* WARNING: This function is deprecated, use rtcDeviceSetMemoryMonitorFunction instead.
|
||||
*/
|
||||
RTCORE_DEPRECATED void rtcSetMemoryMonitorFunction(RTCMemoryMonitorFunc func);
|
||||
|
||||
/*! \brief Sets the memory consumption callback function which is
|
||||
* called before the library allocates or after the library frees
|
||||
* memory. */
|
||||
void rtcDeviceSetMemoryMonitorFunction(RTCDevice device, RTCMemoryMonitorFunc func);
|
||||
|
||||
/*! \brief Implementation specific (do not call).
|
||||
|
||||
This function is implementation specific and only for debugging
|
||||
purposes. Do not call it. */
|
||||
RTCORE_DEPRECATED void rtcDebug(); // FIXME: remove
|
||||
|
||||
#include "rtcore_scene.isph"
|
||||
#include "rtcore_geometry.isph"
|
||||
#include "rtcore_geometry_user.isph"
|
||||
|
||||
/*! \} */
|
||||
|
||||
#endif
|
||||
483
src/igl/embree/embree2/rtcore_geometry.h
Normal file
483
src/igl/embree/embree2/rtcore_geometry.h
Normal file
|
|
@ -0,0 +1,483 @@
|
|||
// ======================================================================== //
|
||||
// Copyright 2009-2015 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#ifndef __RTCORE_GEOMETRY_H__
|
||||
#define __RTCORE_GEOMETRY_H__
|
||||
|
||||
/*! \ingroup embree_kernel_api */
|
||||
/*! \{ */
|
||||
|
||||
/*! invalid geometry ID */
|
||||
#define RTC_INVALID_GEOMETRY_ID ((unsigned)-1)
|
||||
|
||||
/*! \brief Specifies the type of buffers when mapping buffers */
|
||||
enum RTCBufferType {
|
||||
RTC_INDEX_BUFFER = 0x01000000,
|
||||
|
||||
RTC_VERTEX_BUFFER = 0x02000000,
|
||||
RTC_VERTEX_BUFFER0 = 0x02000000,
|
||||
RTC_VERTEX_BUFFER1 = 0x02000001,
|
||||
|
||||
RTC_USER_VERTEX_BUFFER = 0x02100000,
|
||||
RTC_USER_VERTEX_BUFFER0 = 0x02100000,
|
||||
RTC_USER_VERTEX_BUFFER1 = 0x02100001,
|
||||
|
||||
RTC_FACE_BUFFER = 0x03000000,
|
||||
RTC_LEVEL_BUFFER = 0x04000001,
|
||||
|
||||
RTC_EDGE_CREASE_INDEX_BUFFER = 0x05000000,
|
||||
RTC_EDGE_CREASE_WEIGHT_BUFFER = 0x06000000,
|
||||
|
||||
RTC_VERTEX_CREASE_INDEX_BUFFER = 0x07000000,
|
||||
RTC_VERTEX_CREASE_WEIGHT_BUFFER = 0x08000000,
|
||||
|
||||
RTC_HOLE_BUFFER = 0x09000001,
|
||||
};
|
||||
|
||||
/*! \brief Supported types of matrix layout for functions involving matrices */
|
||||
enum RTCMatrixType {
|
||||
RTC_MATRIX_ROW_MAJOR = 0,
|
||||
RTC_MATRIX_COLUMN_MAJOR = 1,
|
||||
RTC_MATRIX_COLUMN_MAJOR_ALIGNED16 = 2,
|
||||
};
|
||||
|
||||
/*! \brief Supported geometry flags to specify handling in dynamic scenes. */
|
||||
enum RTCGeometryFlags
|
||||
{
|
||||
RTC_GEOMETRY_STATIC = 0, //!< specifies static geometry that will change rarely
|
||||
RTC_GEOMETRY_DEFORMABLE = 1, //!< specifies dynamic geometry with deformable motion (BVH refit possible)
|
||||
RTC_GEOMETRY_DYNAMIC = 2, //!< specifies dynamic geometry with arbitrary motion (BVH refit not possible)
|
||||
};
|
||||
|
||||
/*! \brief Boundary interpolation mode for subdivision surfaces */
|
||||
enum RTCBoundaryMode
|
||||
{
|
||||
RTC_BOUNDARY_NONE = 0, //!< ignores border patches
|
||||
RTC_BOUNDARY_EDGE_ONLY = 1, //!< soft boundary (default)
|
||||
RTC_BOUNDARY_EDGE_AND_CORNER = 2 //!< boundary corner vertices are sharp vertices
|
||||
};
|
||||
|
||||
/*! Intersection filter function for single rays. */
|
||||
typedef void (*RTCFilterFunc)(void* ptr, /*!< pointer to user data */
|
||||
RTCRay& ray /*!< intersection to filter */);
|
||||
|
||||
/*! Intersection filter function for ray packets of size 4. */
|
||||
typedef void (*RTCFilterFunc4)(const void* valid, /*!< pointer to valid mask */
|
||||
void* ptr, /*!< pointer to user data */
|
||||
RTCRay4& ray /*!< intersection to filter */);
|
||||
|
||||
/*! Intersection filter function for ray packets of size 8. */
|
||||
typedef void (*RTCFilterFunc8)(const void* valid, /*!< pointer to valid mask */
|
||||
void* ptr, /*!< pointer to user data */
|
||||
RTCRay8& ray /*!< intersection to filter */);
|
||||
|
||||
/*! Intersection filter function for ray packets of size 16. */
|
||||
typedef void (*RTCFilterFunc16)(const void* valid, /*!< pointer to valid mask */
|
||||
void* ptr, /*!< pointer to user data */
|
||||
RTCRay16& ray /*!< intersection to filter */);
|
||||
|
||||
/*! Displacement mapping function. */
|
||||
typedef void (*RTCDisplacementFunc)(void* ptr, /*!< pointer to user data of geometry */
|
||||
unsigned geomID, /*!< ID of geometry to displace */
|
||||
unsigned primID, /*!< ID of primitive of geometry to displace */
|
||||
const float* u, /*!< u coordinates (source) */
|
||||
const float* v, /*!< v coordinates (source) */
|
||||
const float* nx, /*!< x coordinates of normalized normal at point to displace (source) */
|
||||
const float* ny, /*!< y coordinates of normalized normal at point to displace (source) */
|
||||
const float* nz, /*!< z coordinates of normalized normal at point to displace (source) */
|
||||
float* px, /*!< x coordinates of points to displace (source and target) */
|
||||
float* py, /*!< y coordinates of points to displace (source and target) */
|
||||
float* pz, /*!< z coordinates of points to displace (source and target) */
|
||||
size_t N /*!< number of points to displace */ );
|
||||
|
||||
/*! \brief Creates a new scene instance.
|
||||
|
||||
A scene instance contains a reference to a scene to instantiate and
|
||||
the transformation to instantiate the scene with. An implementation
|
||||
will typically transform the ray with the inverse of the provided
|
||||
transformation and continue traversing the ray through the provided
|
||||
scene. If any geometry is hit, the instance ID (instID) member of
|
||||
the ray will get set to the geometry ID of the instance. */
|
||||
RTCORE_API unsigned rtcNewInstance (RTCScene target, //!< the scene the instance belongs to
|
||||
RTCScene source //!< the scene to instantiate
|
||||
);
|
||||
|
||||
/*! \brief Creates a new scene instance.
|
||||
|
||||
A scene instance contains a reference to a scene to instantiate and
|
||||
the transformation to instantiate the scene with. For motion blurred
|
||||
instances, a number of timesteps can get specified (currently only 1
|
||||
or 2 timesteps are supported). An implementation will typically
|
||||
transform the ray with the inverse of the provided transformation
|
||||
and continue traversing the ray through the provided scene. If any
|
||||
geometry is hit, the instance ID (instID) member of the ray will get
|
||||
set to the geometry ID of the instance. */
|
||||
RTCORE_API unsigned rtcNewInstance2 (RTCScene target, //!< the scene the instance belongs to
|
||||
RTCScene source, //!< the scene to instantiate
|
||||
size_t numTimeSteps = 1); //!< number of timesteps, one matrix per timestep
|
||||
|
||||
/*! \brief Sets transformation of the instance */
|
||||
RTCORE_API void rtcSetTransform (RTCScene scene, //!< scene handle
|
||||
unsigned geomID, //!< ID of geometry
|
||||
RTCMatrixType layout, //!< layout of transformation matrix
|
||||
const float* xfm //!< pointer to transformation matrix
|
||||
);
|
||||
|
||||
|
||||
/*! \brief Sets transformation of the instance for specified timestep */
|
||||
RTCORE_API void rtcSetTransform2 (RTCScene scene, //!< scene handle
|
||||
unsigned int geomID, //!< ID of geometry
|
||||
RTCMatrixType layout, //!< layout of transformation matrix
|
||||
const float* xfm, //!< pointer to transformation matrix
|
||||
size_t timeStep = 0 //!< timestep to set the matrix for
|
||||
);
|
||||
|
||||
/*! \brief Creates a new triangle mesh. The number of triangles
|
||||
(numTriangles), number of vertices (numVertices), and number of time
|
||||
steps (1 for normal meshes, and 2 for linear motion blur), have to
|
||||
get specified. The triangle indices can be set be mapping and
|
||||
writing to the index buffer (RTC_INDEX_BUFFER) and the triangle
|
||||
vertices can be set by mapping and writing into the vertex buffer
|
||||
(RTC_VERTEX_BUFFER). In case of linear motion blur, two vertex
|
||||
buffers have to get filled (RTC_VERTEX_BUFFER0, RTC_VERTEX_BUFFER1),
|
||||
one for each time step. The index buffer has the default layout of
|
||||
three 32 bit integer indices for each triangle. An index points to
|
||||
the ith vertex. The vertex buffer stores single precision x,y,z
|
||||
floating point coordinates aligned to 16 bytes. The value of the 4th
|
||||
float used for alignment can be arbitrary. */
|
||||
RTCORE_API unsigned rtcNewTriangleMesh (RTCScene scene, //!< the scene the mesh belongs to
|
||||
RTCGeometryFlags flags, //!< geometry flags
|
||||
size_t numTriangles, //!< number of triangles
|
||||
size_t numVertices, //!< number of vertices
|
||||
size_t numTimeSteps = 1 //!< number of motion blur time steps
|
||||
);
|
||||
|
||||
|
||||
/*! \brief Creates a new quad mesh. The number of quads
|
||||
(numQuads), number of vertices (numVertices), and number of time
|
||||
steps (1 for normal meshes, and 2 for linear motion blur), have to
|
||||
get specified. The quad indices can be set be mapping and
|
||||
writing to the index buffer (RTC_INDEX_BUFFER) and the quad
|
||||
vertices can be set by mapping and writing into the vertex buffer
|
||||
(RTC_VERTEX_BUFFER). In case of linear motion blur, two vertex
|
||||
buffers have to get filled (RTC_VERTEX_BUFFER0, RTC_VERTEX_BUFFER1),
|
||||
one for each time step. The index buffer has the default layout of
|
||||
three 32 bit integer indices for each quad. An index points to
|
||||
the ith vertex. The vertex buffer stores single precision x,y,z
|
||||
floating point coordinates aligned to 16 bytes. The value of the 4th
|
||||
float used for alignment can be arbitrary. */
|
||||
RTCORE_API unsigned rtcNewQuadMesh (RTCScene scene, //!< the scene the mesh belongs to
|
||||
RTCGeometryFlags flags, //!< geometry flags
|
||||
size_t numQuads, //!< number of quads
|
||||
size_t numVertices, //!< number of vertices
|
||||
size_t numTimeSteps = 1 //!< number of motion blur time steps
|
||||
);
|
||||
|
||||
/*! \brief Creates a new subdivision mesh. The number of faces
|
||||
(numFaces), edges/indices (numEdges), vertices (numVertices), edge
|
||||
creases (numEdgeCreases), vertex creases (numVertexCreases), holes
|
||||
(numHoles), and time steps (numTimeSteps) have to get speficied at
|
||||
construction time.
|
||||
|
||||
The following buffers have to get filled by the application: the face
|
||||
buffer (RTC_FACE_BUFFER) contains the number edges/indices (3 or 4)
|
||||
of each of the numFaces faces, the index buffer (RTC_INDEX_BUFFER)
|
||||
contains multiple (3 or 4) 32bit vertex indices for each face and
|
||||
numEdges indices in total, the vertex buffer (RTC_VERTEX_BUFFER)
|
||||
stores numVertices vertices as single precision x,y,z floating point
|
||||
coordinates aligned to 16 bytes. The value of the 4th float used for
|
||||
alignment can be arbitrary.
|
||||
|
||||
Optionally, the application can fill the hole buffer
|
||||
(RTC_HOLE_BUFFER) with numHoles many 32 bit indices of faces that
|
||||
should be considered non-existing.
|
||||
|
||||
Optionally, the application can fill the level buffer
|
||||
(RTC_LEVEL_BUFFER) with a tessellation level for each of the numEdges
|
||||
edges. The subdivision level is a positive floating point value, that
|
||||
specifies how many quads along the edge should get generated during
|
||||
tessellation. The tessellation level is a lower bound, thus the
|
||||
implementation is free to choose a larger level. If no level buffer
|
||||
is specified a level of 1 is used.
|
||||
|
||||
Optionally, the application can fill the sparse edge crease buffers
|
||||
to make some edges appear sharper. The edge crease index buffer
|
||||
(RTC_EDGE_CREASE_INDEX_BUFFER) contains numEdgeCreases many pairs of
|
||||
32 bit vertex indices that specify unoriented edges. The edge crease
|
||||
weight buffer (RTC_EDGE_CREASE_WEIGHT_BUFFER) stores for each of
|
||||
theses crease edges a positive floating point weight. The larger this
|
||||
weight, the sharper the edge. Specifying a weight of infinify is
|
||||
supported and marks an edge as infinitely sharp. Storing an edge
|
||||
multiple times with the same crease weight is allowed, but has lower
|
||||
performance. Storing the an edge multiple times with different
|
||||
crease weights results in undefined behaviour. For a stored edge
|
||||
(i,j), the reverse direction edges (j,i) does not have to get stored,
|
||||
as both are considered the same edge.
|
||||
|
||||
Optionally, the application can fill the sparse vertex crease buffers
|
||||
to make some vertices appear sharper. The vertex crease index buffer
|
||||
(RTC_VERTEX_CREASE_INDEX_BUFFER), contains numVertexCreases many 32
|
||||
bit vertex indices to speficy a set of vertices. The vertex crease
|
||||
weight buffer (RTC_VERTEX_CREASE_WEIGHT_BUFFER) specifies for each of
|
||||
these vertices a positive floating point weight. The larger this
|
||||
weight, the sharper the vertex. Specifying a weight of infinity is
|
||||
supported and makes the vertex infinitely sharp. Storing a vertex
|
||||
multiple times with the same crease weight is allowed, but has lower
|
||||
performance. Storing a vertex multiple times with different crease
|
||||
weights results in undefined behaviour.
|
||||
|
||||
*/
|
||||
RTCORE_API unsigned rtcNewSubdivisionMesh (RTCScene scene, //!< the scene the mesh belongs to
|
||||
RTCGeometryFlags flags, //!< geometry flags
|
||||
size_t numFaces, //!< number of faces
|
||||
size_t numEdges, //!< number of edges
|
||||
size_t numVertices, //!< number of vertices
|
||||
size_t numEdgeCreases, //!< number of edge creases
|
||||
size_t numVertexCreases, //!< number of vertex creases
|
||||
size_t numHoles, //!< number of holes
|
||||
size_t numTimeSteps = 1 //!< number of motion blur time steps
|
||||
);
|
||||
|
||||
/*! \brief Creates a new hair geometry, consisting of multiple hairs
|
||||
represented as cubic bezier curves with varying radii. The number of
|
||||
curves (numCurves), number of vertices (numVertices), and number of
|
||||
time steps (1 for normal curves, and 2 for linear motion blur), have
|
||||
to get specified at construction time. Further, the curve index
|
||||
buffer (RTC_INDEX_BUFFER) and the curve vertex buffer
|
||||
(RTC_VERTEX_BUFFER) have to get set by mapping and writing to the
|
||||
appropiate buffers. In case of linear motion blur, two vertex
|
||||
buffers have to get filled (RTC_VERTEX_BUFFER0, RTC_VERTEX_BUFFER1),
|
||||
one for each time step. The index buffer has the default layout of a
|
||||
single 32 bit integer index for each curve, that references the
|
||||
start vertex of the curve. The vertex buffer stores 4 control points
|
||||
per curve, each such control point consists of a single precision
|
||||
(x,y,z) position and radius, stored in that order in
|
||||
memory. Individual hairs are considered to be subpixel sized which
|
||||
allows the implementation to approximate the intersection
|
||||
calculation. This in particular means that zooming onto one hair
|
||||
might show geometric artefacts. */
|
||||
RTCORE_API unsigned rtcNewHairGeometry (RTCScene scene, //!< the scene the curves belong to
|
||||
RTCGeometryFlags flags, //!< geometry flags
|
||||
size_t numCurves, //!< number of curves
|
||||
size_t numVertices, //!< number of vertices
|
||||
size_t numTimeSteps = 1 //!< number of motion blur time steps
|
||||
);
|
||||
|
||||
/*! Sets a uniform tessellation rate for subdiv meshes and hair
|
||||
* geometry. For subdivision meshes the RTC_LEVEL_BUFFER can also be used
|
||||
* optionally to set a different tessellation rate per edge.*/
|
||||
RTCORE_API void rtcSetTessellationRate (RTCScene scene, unsigned geomID, float tessellationRate);
|
||||
|
||||
/*! \brief Creates a new line segment geometry, consisting of multiple
|
||||
segments with varying radii. The number of line segments (numSegments),
|
||||
number of vertices (numVertices), and number of time steps (1 for
|
||||
normal line segments, and 2 for linear motion blur), have to get
|
||||
specified at construction time. Further, the segment index buffer
|
||||
(RTC_INDEX_BUFFER) and the segment vertex buffer (RTC_VERTEX_BUFFER)
|
||||
have to get set by mapping and writing to the appropiate buffers. In
|
||||
case of linear motion blur, two vertex buffers have to get filled
|
||||
(RTC_VERTEX_BUFFER0, RTC_VERTEX_BUFFER1), one for each time step. The
|
||||
index buffer has the default layout of a single 32 bit integer index
|
||||
for each line segment, that references the start vertex of the segment.
|
||||
The vertex buffer stores 2 end points per line segment, each such point
|
||||
consists of a single precision (x,y,z) position and radius, stored in
|
||||
that order in memory. Individual segments are considered to be subpixel
|
||||
sized which allows the implementation to approximate the intersection
|
||||
calculation. This in particular means that zooming onto one line segment
|
||||
might show geometric artefacts. */
|
||||
RTCORE_API unsigned rtcNewLineSegments (RTCScene scene, //!< the scene the line segments belong to
|
||||
RTCGeometryFlags flags, //!< geometry flags
|
||||
size_t numSegments, //!< number of line segments
|
||||
size_t numVertices, //!< number of vertices
|
||||
size_t numTimeSteps = 1 //!< number of motion blur time steps
|
||||
);
|
||||
|
||||
/*! \brief Sets 32 bit ray mask. */
|
||||
RTCORE_API void rtcSetMask (RTCScene scene, unsigned geomID, int mask);
|
||||
|
||||
/*! \brief Sets boundary interpolation mode for subdivision surfaces */
|
||||
RTCORE_API void rtcSetBoundaryMode(RTCScene scene, unsigned geomID, RTCBoundaryMode mode);
|
||||
|
||||
/*! \brief Maps specified buffer. This function can be used to set index and
|
||||
* vertex buffers of geometries. */
|
||||
RTCORE_API void* rtcMapBuffer(RTCScene scene, unsigned geomID, RTCBufferType type);
|
||||
|
||||
/*! \brief Unmaps specified buffer.
|
||||
|
||||
A buffer has to be unmapped before the rtcEnable, rtcDisable,
|
||||
rtcUpdate, or rtcDeleteGeometry calls are executed. */
|
||||
RTCORE_API void rtcUnmapBuffer(RTCScene scene, unsigned geomID, RTCBufferType type);
|
||||
|
||||
/*! \brief Shares a data buffer between the application and
|
||||
* Embree. The passed buffer is used by Embree to store index and
|
||||
* vertex data. It has to remain valid as long as the mesh exists,
|
||||
* and the user is responsible to free the data when the mesh gets
|
||||
* deleted. One can optionally speficy a byte offset and byte stride
|
||||
* of the elements stored inside the buffer. The addresses
|
||||
* ptr+offset+i*stride have to be aligned to 4 bytes on Xeon CPUs and
|
||||
* 16 bytes on Xeon Phi accelerators. For vertex buffers, the 4 bytes
|
||||
* after the z-coordinate of the last vertex have to be readable memory,
|
||||
* thus padding is required for some layouts. If this function is not
|
||||
* called, Embree will allocate and manage buffers of the default
|
||||
* layout. */
|
||||
RTCORE_API void rtcSetBuffer(RTCScene scene, unsigned geomID, RTCBufferType type,
|
||||
const void* ptr, size_t byteOffset, size_t byteStride);
|
||||
|
||||
/*! \brief Enable geometry. Enabled geometry can be hit by a ray. */
|
||||
RTCORE_API void rtcEnable (RTCScene scene, unsigned geomID);
|
||||
|
||||
/*! \brief Update all geometry buffers.
|
||||
|
||||
Each time geometry buffers got modified, the user has to call some
|
||||
update function to tell the ray tracing engine which buffers got
|
||||
modified. The rtcUpdate function taggs each geometry buffer of the
|
||||
specified geometry as modified. */
|
||||
RTCORE_API void rtcUpdate (RTCScene scene, unsigned geomID);
|
||||
|
||||
/*! \brief Update spefific geometry buffer.
|
||||
|
||||
Each time geometry buffers got modified, the user has to call some
|
||||
update function to tell the ray tracing engine which buffers got
|
||||
modified. The rtcUpdateBuffer function taggs a specific buffer of
|
||||
some geometry as modified. */
|
||||
RTCORE_API void rtcUpdateBuffer (RTCScene scene, unsigned geomID, RTCBufferType type);
|
||||
|
||||
/*! \brief Disable geometry.
|
||||
|
||||
Disabled geometry is not hit by any ray. Disabling and enabling
|
||||
geometry gives higher performance than deleting and recreating
|
||||
geometry. */
|
||||
RTCORE_API void rtcDisable (RTCScene scene, unsigned geomID);
|
||||
|
||||
/*! \brief Sets the displacement function. */
|
||||
RTCORE_API void rtcSetDisplacementFunction (RTCScene scene, unsigned geomID, RTCDisplacementFunc func, RTCBounds* bounds);
|
||||
|
||||
/*! \brief Sets the intersection filter function for single rays. */
|
||||
RTCORE_API void rtcSetIntersectionFilterFunction (RTCScene scene, unsigned geomID, RTCFilterFunc func);
|
||||
|
||||
/*! \brief Sets the intersection filter function for ray packets of size 4. */
|
||||
RTCORE_API void rtcSetIntersectionFilterFunction4 (RTCScene scene, unsigned geomID, RTCFilterFunc4 func);
|
||||
|
||||
/*! \brief Sets the intersection filter function for ray packets of size 8. */
|
||||
RTCORE_API void rtcSetIntersectionFilterFunction8 (RTCScene scene, unsigned geomID, RTCFilterFunc8 func);
|
||||
|
||||
/*! \brief Sets the intersection filter function for ray packets of size 16. */
|
||||
RTCORE_API void rtcSetIntersectionFilterFunction16 (RTCScene scene, unsigned geomID, RTCFilterFunc16 func);
|
||||
|
||||
/*! \brief Sets the occlusion filter function for single rays. */
|
||||
RTCORE_API void rtcSetOcclusionFilterFunction (RTCScene scene, unsigned geomID, RTCFilterFunc func);
|
||||
|
||||
/*! \brief Sets the occlusion filter function for ray packets of size 4. */
|
||||
RTCORE_API void rtcSetOcclusionFilterFunction4 (RTCScene scene, unsigned geomID, RTCFilterFunc4 func);
|
||||
|
||||
/*! \brief Sets the occlusion filter function for ray packets of size 8. */
|
||||
RTCORE_API void rtcSetOcclusionFilterFunction8 (RTCScene scene, unsigned geomID, RTCFilterFunc8 func);
|
||||
|
||||
/*! \brief Sets the occlusion filter function for ray packets of size 16. */
|
||||
RTCORE_API void rtcSetOcclusionFilterFunction16 (RTCScene scene, unsigned geomID, RTCFilterFunc16 func);
|
||||
|
||||
/*! Set pointer for user defined data per geometry. Invokations
|
||||
* of the various user intersect and occluded functions get passed
|
||||
* this data pointer when called. */
|
||||
RTCORE_API void rtcSetUserData (RTCScene scene, unsigned geomID, void* ptr);
|
||||
|
||||
/*! Get pointer for user defined data per geometry based on geomID. */
|
||||
RTCORE_API void* rtcGetUserData (RTCScene scene, unsigned geomID);
|
||||
|
||||
/*! Interpolates user data to some u/v location. The data buffer
|
||||
* specifies per vertex data to interpolate and can be one of the
|
||||
* RTC_VERTEX_BUFFER0/1 or RTC_USER_VERTEX_BUFFER0/1 and has to
|
||||
* contain numFloats floating point values to interpolate for each
|
||||
* vertex of the geometry. The dP array will get filled with the
|
||||
* interpolated data and the dPdu and dPdv arrays with the u and v
|
||||
* derivative of the interpolation. If the pointers dP is NULL, the
|
||||
* value will not get calculated. If dPdu and dPdv are NULL the
|
||||
* derivatives will not get calculated. Both dPdu and dPdv have to be
|
||||
* either valid or NULL. The buffer has to be padded at the end such
|
||||
* that the last element can be read safely using SSE
|
||||
* instructions. */
|
||||
RTCORE_API void rtcInterpolate(RTCScene scene, unsigned geomID, unsigned primID, float u, float v, RTCBufferType buffer,
|
||||
float* P, float* dPdu, float* dPdv, size_t numFloats);
|
||||
|
||||
/*! Interpolates user data to some u/v location. The data buffer
|
||||
* specifies per vertex data to interpolate and can be one of the
|
||||
* RTC_VERTEX_BUFFER0/1 or RTC_USER_VERTEX_BUFFER0/1 and has to
|
||||
* contain numFloats floating point values to interpolate for each
|
||||
* vertex of the geometry. The P array will get filled with the
|
||||
* interpolated datam the dPdu and dPdv arrays with the u and v
|
||||
* derivative of the interpolation, and the ddPdudu, ddPdvdv, and
|
||||
* ddPdudv arrays with the respective second derivatives. One can
|
||||
* disable 1) the calculation of the interpolated value by setting P
|
||||
* to NULL, 2) the calculation of the 1st order derivatives by
|
||||
* setting dPdu and dPdv to NULL, 3) the calculation of the second
|
||||
* order derivatives by setting ddPdudu, ddPdvdv, and ddPdudv to
|
||||
* NULL. The buffers have to be padded at the end such that the last
|
||||
* element can be read or written safely using SSE instructions. */
|
||||
RTCORE_API void rtcInterpolate2(RTCScene scene, unsigned geomID, unsigned primID, float u, float v, RTCBufferType buffer,
|
||||
float* P, float* dPdu, float* dPdv, float* ddPdudu, float* ddPdvdv, float* ddPdudv, size_t numFloats);
|
||||
|
||||
/*! Interpolates user data to an array of u/v locations. The valid
|
||||
* pointer points to an integer array that specified which entries in
|
||||
* the u/v arrays are valid (-1 denotes valid, and 0 invalid). If the
|
||||
* valid pointer is NULL all elements are considers valid. The data
|
||||
* buffer specifies per vertex data to interpolate and can be one of
|
||||
* the RTC_VERTEX_BUFFER0/1 or RTC_USER_VERTEX_BUFFER0/1 and has to
|
||||
* contain numFloats floating point values to interpolate for each
|
||||
* vertex of the geometry. The P array will get filled with the
|
||||
* interpolated data, and the dPdu and dPdv arrays with the u and v
|
||||
* derivative of the interpolation. If the pointers P is NULL, the
|
||||
* value will not get calculated. If dPdu and dPdv are NULL the
|
||||
* derivatives will not get calculated. Both dPdu and dPdv have to be
|
||||
* either valid or NULL. These destination arrays are filled in
|
||||
* structure of array (SoA) layout. The buffer has to be padded at
|
||||
* the end such that the last element can be read safely using SSE
|
||||
* instructions.*/
|
||||
RTCORE_API void rtcInterpolateN(RTCScene scene, unsigned geomID,
|
||||
const void* valid, const unsigned* primIDs, const float* u, const float* v, size_t numUVs,
|
||||
RTCBufferType buffer,
|
||||
float* P, float* dPdu, float* dPdv, size_t numFloats);
|
||||
|
||||
/*! Interpolates user data to an array of u/v locations. The valid
|
||||
* pointer points to an integer array that specified which entries in
|
||||
* the u/v arrays are valid (-1 denotes valid, and 0 invalid). If the
|
||||
* valid pointer is NULL all elements are considers valid. The data
|
||||
* buffer specifies per vertex data to interpolate and can be one of
|
||||
* the RTC_VERTEX_BUFFER0/1 or RTC_USER_VERTEX_BUFFER0/1 and has to
|
||||
* contain numFloats floating point values to interpolate for each
|
||||
* vertex of the geometry. The P array will get filled with the
|
||||
* interpolated datam the dPdu and dPdv arrays with the u and v
|
||||
* derivative of the interpolation, and the ddPdudu, ddPdvdv, and
|
||||
* ddPdudv arrays with the respective second derivatives. One can
|
||||
* disable 1) the calculation of the interpolated value by setting P
|
||||
* to NULL, 2) the calculation of the 1st order derivatives by
|
||||
* setting dPdu and dPdv to NULL, 3) the calculation of the second
|
||||
* order derivatives by setting ddPdudu, ddPdvdv, and ddPdudv to
|
||||
* NULL. These destination arrays are filled in structure of array
|
||||
* (SoA) layout. The buffer has to be padded at the end such that
|
||||
* the last element can be read safely using SSE
|
||||
* instructions. */
|
||||
RTCORE_API void rtcInterpolateN2(RTCScene scene, unsigned geomID,
|
||||
const void* valid, const unsigned* primIDs, const float* u, const float* v, size_t numUVs,
|
||||
RTCBufferType buffer,
|
||||
float* P, float* dPdu, float* dPdv, float* ddPdudu, float* ddPdvdv, float* ddPdudv, size_t numFloats);
|
||||
|
||||
/*! \brief Deletes the geometry. */
|
||||
RTCORE_API void rtcDeleteGeometry (RTCScene scene, unsigned geomID);
|
||||
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif
|
||||
405
src/igl/embree/embree2/rtcore_geometry.isph
Normal file
405
src/igl/embree/embree2/rtcore_geometry.isph
Normal file
|
|
@ -0,0 +1,405 @@
|
|||
// ======================================================================== //
|
||||
// Copyright 2009-2015 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#ifndef __RTCORE_GEOMETRY_ISPH__
|
||||
#define __RTCORE_GEOMETRY_ISPH__
|
||||
|
||||
/*! \ingroup embree_kernel_api_ispc */
|
||||
/*! \{ */
|
||||
|
||||
/*! invalid geometry ID */
|
||||
#define RTC_INVALID_GEOMETRY_ID ((uniform unsigned int)-1)
|
||||
|
||||
/*! \brief Specifies the type of buffers when mapping buffers */
|
||||
enum RTCBufferType {
|
||||
RTC_INDEX_BUFFER = 0x01000000,
|
||||
|
||||
RTC_VERTEX_BUFFER = 0x02000000,
|
||||
RTC_VERTEX_BUFFER0 = 0x02000000,
|
||||
RTC_VERTEX_BUFFER1 = 0x02000001,
|
||||
|
||||
RTC_USER_VERTEX_BUFFER = 0x02100000,
|
||||
RTC_USER_VERTEX_BUFFER0 = 0x02100000,
|
||||
RTC_USER_VERTEX_BUFFER1 = 0x02100001,
|
||||
|
||||
RTC_FACE_BUFFER = 0x03000000,
|
||||
RTC_LEVEL_BUFFER = 0x04000001,
|
||||
|
||||
RTC_EDGE_CREASE_INDEX_BUFFER = 0x05000000,
|
||||
RTC_EDGE_CREASE_WEIGHT_BUFFER = 0x06000000,
|
||||
|
||||
RTC_VERTEX_CREASE_INDEX_BUFFER = 0x07000000,
|
||||
RTC_VERTEX_CREASE_WEIGHT_BUFFER = 0x08000000,
|
||||
|
||||
RTC_HOLE_BUFFER = 0x09000001,
|
||||
};
|
||||
|
||||
/*! \brief Supported types of matrix layout for functions involving matrices */
|
||||
enum RTCMatrixType {
|
||||
RTC_MATRIX_ROW_MAJOR = 0,
|
||||
RTC_MATRIX_COLUMN_MAJOR = 1,
|
||||
RTC_MATRIX_COLUMN_MAJOR_ALIGNED16 = 2,
|
||||
};
|
||||
|
||||
/*! \brief Supported geometry flags to specify handling in dynamic scenes. */
|
||||
enum RTCGeometryFlags
|
||||
{
|
||||
RTC_GEOMETRY_STATIC = 0, //!< specifies static geometry that will change rarely
|
||||
RTC_GEOMETRY_DEFORMABLE = 1, //!< specifies dynamic geometry with deformable motion (BVH refit possible)
|
||||
RTC_GEOMETRY_DYNAMIC = 2, //!< specifies dynamic geometry with arbitrary motion (BVH refit not possible)
|
||||
};
|
||||
|
||||
/*! \brief Boundary interpolation mode for subdivision surfaces */
|
||||
enum RTCBoundaryMode
|
||||
{
|
||||
RTC_BOUNDARY_NONE = 0, //!< ignores border patches
|
||||
RTC_BOUNDARY_EDGE_ONLY = 1, //!< soft boundary (default)
|
||||
RTC_BOUNDARY_EDGE_AND_CORNER = 2 //!< boundary corner vertices are sharp vertices
|
||||
};
|
||||
|
||||
/*! Intersection filter function for uniform rays. */
|
||||
typedef void (*uniform RTCFilterFuncUniform)(void* uniform ptr, /*!< pointer to user data */
|
||||
uniform RTCRay1& ray /*!< intersection to filter */);
|
||||
|
||||
/*! Intersection filter function for varying rays. */
|
||||
typedef void (*uniform RTCFilterFuncVarying)(void* uniform ptr, /*!< pointer to user data */
|
||||
varying RTCRay& ray /*!< intersection to filter */);
|
||||
|
||||
|
||||
/*! \brief Creates a new scene instance.
|
||||
|
||||
A scene instance contains a reference to a scene to instantiate and
|
||||
the transformation to instantiate the scene with. An implementation
|
||||
will typically transform the ray with the inverse of the provided
|
||||
transformation and continue traversing the ray through the provided
|
||||
scene. If any geometry is hit, the instance ID (instID) member of
|
||||
the ray will get set to the geometry ID of the instance. */
|
||||
uniform unsigned int rtcNewInstance (RTCScene target, //!< the scene the instance belongs to
|
||||
RTCScene source //!< the geometry to instantiate
|
||||
);
|
||||
|
||||
/*! \brief Creates a new scene instance.
|
||||
|
||||
A scene instance contains a reference to a scene to instantiate and
|
||||
the transformation to instantiate the scene with. For motion blurred
|
||||
instances, a number of timesteps can get specified (currently only 1
|
||||
or 2 timesteps are supported). An implementation will typically
|
||||
transform the ray with the inverse of the provided transformation
|
||||
and continue traversing the ray through the provided scene. If any
|
||||
geometry is hit, the instance ID (instID) member of the ray will get
|
||||
set to the geometry ID of the instance. */
|
||||
uniform unsigned rtcNewInstance2 (RTCScene target, //!< the scene the instance belongs to
|
||||
RTCScene source, //!< the scene to instantiate
|
||||
uniform size_t numTimeSteps = 1); //!< number of timesteps, one matrix per timestep
|
||||
|
||||
|
||||
/*! \brief Sets transformation of the instance */
|
||||
void rtcSetTransform (RTCScene scene, //!< scene handle
|
||||
uniform unsigned int geomID, //!< ID of geometry
|
||||
uniform RTCMatrixType layout, //!< layout of transformation matrix
|
||||
const uniform float* uniform xfm //!< pointer to transformation matrix
|
||||
);
|
||||
|
||||
/*! \brief Sets transformation of the instance for specified timestep */
|
||||
void rtcSetTransform2 (RTCScene scene, //!< scene handle
|
||||
uniform unsigned int geomID, //!< ID of geometry
|
||||
uniform RTCMatrixType layout, //!< layout of transformation matrix
|
||||
const uniform float* uniform xfm, //!< pointer to transformation matrix
|
||||
uniform size_t timeStep = 0 //!< timestep to set the matrix for
|
||||
);
|
||||
|
||||
/*! \brief Creates a new triangle mesh. The number of triangles
|
||||
(numTriangles), number of vertices (numVertices), and number of time
|
||||
steps (1 for normal meshes, and 2 for linear motion blur), have to
|
||||
get specified. The triangle indices can be set be mapping and
|
||||
writing to the index buffer (RTC_INDEX_BUFFER) and the triangle
|
||||
vertices can be set by mapping and writing into the vertex buffer
|
||||
(RTC_VERTEX_BUFFER). In case of linear motion blur, two vertex
|
||||
buffers have to get filled (RTC_VERTEX_BUFFER0, RTC_VERTEX_BUFFER1),
|
||||
one for each time step. The index buffer has the default layout of
|
||||
three 32 bit integer indices for each triangle. An index points to
|
||||
the ith vertex. The vertex buffer stores single precision x,y,z
|
||||
floating point coordinates aligned to 16 bytes. The value of the 4th
|
||||
float used for alignment can be arbitrary. */
|
||||
uniform unsigned int rtcNewTriangleMesh (RTCScene scene, //!< the scene the mesh belongs to
|
||||
uniform RTCGeometryFlags flags, //!< geometry flags
|
||||
uniform size_t numTriangles, //!< number of triangles
|
||||
uniform size_t numVertices, //!< number of vertices
|
||||
uniform size_t numTimeSteps = 1 //!< number of motion blur time steps
|
||||
);
|
||||
|
||||
/*! \brief Creates a new quad mesh. The number of quads
|
||||
(numQuads), number of vertices (numVertices), and number of time
|
||||
steps (1 for normal meshes, and 2 for linear motion blur), have to
|
||||
get specified. The quad indices can be set be mapping and
|
||||
writing to the index buffer (RTC_INDEX_BUFFER) and the quad
|
||||
vertices can be set by mapping and writing into the vertex buffer
|
||||
(RTC_VERTEX_BUFFER). In case of linear motion blur, two vertex
|
||||
buffers have to get filled (RTC_VERTEX_BUFFER0, RTC_VERTEX_BUFFER1),
|
||||
one for each time step. The index buffer has the default layout of
|
||||
three 32 bit integer indices for each quad. An index points to
|
||||
the ith vertex. The vertex buffer stores single precision x,y,z
|
||||
floating point coordinates aligned to 16 bytes. The value of the 4th
|
||||
float used for alignment can be arbitrary. */
|
||||
uniform unsigned int rtcNewQuadMesh (RTCScene scene, //!< the scene the mesh belongs to
|
||||
uniform RTCGeometryFlags flags, //!< geometry flags
|
||||
uniform size_t numQuads, //!< number of quads
|
||||
uniform size_t numVertices, //!< number of vertices
|
||||
uniform size_t numTimeSteps = 1 //!< number of motion blur time steps
|
||||
);
|
||||
|
||||
/*! \brief Creates a new subdivision mesh. The number of faces
|
||||
(numFaces), edges/indices (numEdges), vertices (numVertices), edge
|
||||
creases (numEdgeCreases), vertex creases (numVertexCreases), holes
|
||||
(numHoles), and time steps (numTimeSteps) have to get speficied at
|
||||
construction time.
|
||||
|
||||
The following buffers have to get filled by the application: the face
|
||||
buffer (RTC_FACE_BUFFER) contains the number edges/indices (3 or 4)
|
||||
of each of the numFaces faces, the index buffer (RTC_INDEX_BUFFER)
|
||||
contains multiple (3 or 4) 32bit vertex indices for each face and
|
||||
numEdges indices in total, the vertex buffer (RTC_VERTEX_BUFFER)
|
||||
stores numVertices vertices as single precision x,y,z floating point
|
||||
coordinates aligned to 16 bytes. The value of the 4th float used for
|
||||
alignment can be arbitrary.
|
||||
|
||||
Optionally, the application can fill the hole buffer
|
||||
(RTC_HOLE_BUFFER) with numHoles many 32 bit indices of faces that
|
||||
should be considered non-existing.
|
||||
|
||||
Optionally, the application can fill the level buffer
|
||||
(RTC_LEVEL_BUFFER) with a tessellation level for each of the numEdges
|
||||
edges. The subdivision level is a positive floating point value, that
|
||||
specifies how many quads along the edge should get generated during
|
||||
tessellation. The tessellation level is a lower bound, thus the
|
||||
implementation is free to choose a larger level. If no level buffer
|
||||
is specified a level of 1 is used.
|
||||
|
||||
Optionally, the application can fill the sparse edge crease buffers
|
||||
to make some edges appear sharper. The edge crease index buffer
|
||||
(RTC_EDGE_CREASE_INDEX_BUFFER) contains numEdgeCreases many pairs of
|
||||
32 bit vertex indices that specify unoriented edges. The edge crease
|
||||
weight buffer (RTC_EDGE_CREASE_WEIGHT_BUFFER) stores for each of
|
||||
theses crease edges a positive floating point weight. The larger this
|
||||
weight, the sharper the edge. Specifying a weight of infinify is
|
||||
supported and marks an edge as infinitely sharp. Storing an edge
|
||||
multiple times with the same crease weight is allowed, but has lower
|
||||
performance. Storing the an edge multiple times with different
|
||||
crease weights results in undefined behaviour. For a stored edge
|
||||
(i,j), the reverse direction edges (j,i) does not have to get stored,
|
||||
as both are considered the same edge.
|
||||
|
||||
Optionally, the application can fill the sparse vertex crease buffers
|
||||
to make some vertices appear sharper. The vertex crease index buffer
|
||||
(RTC_VERTEX_CREASE_INDEX_BUFFER), contains numVertexCreases many 32
|
||||
bit vertex indices to speficy a set of vertices. The vertex crease
|
||||
weight buffer (RTC_VERTEX_CREASE_WEIGHT_BUFFER) specifies for each of
|
||||
these vertices a positive floating point weight. The larger this
|
||||
weight, the sharper the vertex. Specifying a weight of infinity is
|
||||
supported and makes the vertex infinitely sharp. Storing a vertex
|
||||
multiple times with the same crease weight is allowed, but has lower
|
||||
performance. Storing a vertex multiple times with different crease
|
||||
weights results in undefined behaviour.
|
||||
|
||||
*/
|
||||
|
||||
uniform unsigned int rtcNewSubdivisionMesh (RTCScene scene, //!< the scene the mesh belongs to
|
||||
uniform RTCGeometryFlags flags, //!< geometry flags
|
||||
uniform size_t numFaces, //!< number of faces
|
||||
uniform size_t numEdges, //!< number of edges
|
||||
uniform size_t numVertices, //!< number of vertices
|
||||
uniform size_t numEdgeCreases, //!< number of edge creases
|
||||
uniform size_t numVertexCreases, //!< number of vertex creases
|
||||
uniform size_t numHoles, //!< number of holes
|
||||
uniform size_t numTimeSteps = 1 //!< number of motion blur time steps
|
||||
);
|
||||
|
||||
/*! \brief Creates a new hair geometry, consisting of multiple hairs
|
||||
represented as cubic bezier curves with varying radii. The number of
|
||||
curves (numCurves), number of vertices (numVertices), and number of
|
||||
time steps (1 for normal curves, and 2 for linear motion blur), have
|
||||
to get specified at construction time. Further, the curve index
|
||||
buffer (RTC_INDEX_BUFFER) and the curve vertex buffer
|
||||
(RTC_VERTEX_BUFFER) have to get set by mapping and writing to the
|
||||
appropiate buffers. In case of linear motion blur, two vertex
|
||||
buffers have to get filled (RTC_VERTEX_BUFFER0, RTC_VERTEX_BUFFER1),
|
||||
one for each time step. The index buffer has the default layout of a
|
||||
single 32 bit integer index for each curve, that references the
|
||||
start vertex of the curve. The vertex buffer stores 4 control points
|
||||
per curve, each such control point consists of a single precision
|
||||
(x,y,z) position and radius, stored in that order in
|
||||
memory. Individual hairs are considered to be subpixel sized which
|
||||
allows the implementation to approximate the intersection
|
||||
calculation. This in particular means that zooming onto one hair
|
||||
might show geometric artefacts. */
|
||||
uniform unsigned int rtcNewHairGeometry (RTCScene scene, //!< the scene the curves belong to
|
||||
uniform RTCGeometryFlags flags, //!< geometry flags
|
||||
uniform size_t numCurves, //!< number of curves
|
||||
uniform size_t numVertices, //!< number of vertices
|
||||
uniform size_t numTimeSteps = 1 //!< number of motion blur time steps
|
||||
);
|
||||
|
||||
/*! Sets a uniform tessellation rate for subdiv meshes and hair
|
||||
* geometry. For subdivision meshes the RTC_LEVEL_BUFFER can also be used
|
||||
* optionally to set a different tessellation rate per edge.*/
|
||||
void rtcSetTessellationRate (RTCScene scene, uniform unsigned geomID, uniform float tessellationRate);
|
||||
|
||||
/*! \brief Creates a new line segment geometry, consisting of multiple
|
||||
segments with varying radii. The number of line segments (numSegments),
|
||||
number of vertices (numVertices), and number of time steps (1 for
|
||||
normal line segments, and 2 for linear motion blur), have to get
|
||||
specified at construction time. Further, the segment index buffer
|
||||
(RTC_INDEX_BUFFER) and the segment vertex buffer (RTC_VERTEX_BUFFER)
|
||||
have to get set by mapping and writing to the appropiate buffers. In
|
||||
case of linear motion blur, two vertex buffers have to get filled
|
||||
(RTC_VERTEX_BUFFER0, RTC_VERTEX_BUFFER1), one for each time step. The
|
||||
index buffer has the default layout of a single 32 bit integer index
|
||||
for each line segment, that references the start vertex of the segment.
|
||||
The vertex buffer stores 2 end points per line segment, each such point
|
||||
consists of a single precision (x,y,z) position and radius, stored in
|
||||
that order in memory. Individual segments are considered to be subpixel
|
||||
sized which allows the implementation to approximate the intersection
|
||||
calculation. This in particular means that zooming onto one line segment
|
||||
might show geometric artefacts. */
|
||||
uniform unsigned int rtcNewLineSegments (RTCScene scene, //!< the scene the line segments belong to
|
||||
uniform RTCGeometryFlags flags, //!< geometry flags
|
||||
uniform size_t numSegments, //!< number of line segments
|
||||
uniform size_t numVertices, //!< number of vertices
|
||||
uniform size_t numTimeSteps = 1 //!< number of motion blur time steps
|
||||
);
|
||||
|
||||
/*! \brief Sets 32 bit ray mask. */
|
||||
void rtcSetMask (RTCScene scene, uniform unsigned int geomID, uniform int mask);
|
||||
|
||||
/*! \brief Sets boundary interpolation mode for subdivision surfaces */
|
||||
void rtcSetBoundaryMode(RTCScene scene, uniform unsigned int geomID, uniform RTCBoundaryMode mode);
|
||||
|
||||
/*! \brief Maps specified buffer. This function can be used to set index and
|
||||
* vertex buffers of geometries. */
|
||||
void* uniform rtcMapBuffer(RTCScene scene, uniform unsigned int geomID, uniform RTCBufferType type);
|
||||
|
||||
/*! \brief Unmaps specified buffer.
|
||||
|
||||
A buffer has to be unmapped before the rtcEnable, rtcDisable,
|
||||
rtcUpdate, or rtcDeleteGeometry calls are executed. */
|
||||
void rtcUnmapBuffer(RTCScene scene, uniform unsigned int geomID, uniform RTCBufferType type);
|
||||
|
||||
/*! \brief Shares a data buffer between the application and
|
||||
* Embree. The passed buffer is used by Embree to store index and
|
||||
* vertex data. It has to remain valid as long as the mesh exists,
|
||||
* and the user is responsible to free the data when the mesh gets
|
||||
* deleted. One can optionally speficy a byte offset and byte stride
|
||||
* of the elements stored inside the buffer. The addresses
|
||||
* ptr+offset+i*stride have to be aligned to 4 bytes on Xeon CPUs and
|
||||
* 16 bytes on Xeon Phi accelerators. For vertex buffers, the 4 bytes
|
||||
* after the z-coordinate of the last vertex have to be readable memory,
|
||||
* thus padding is required for some layouts. If this function is not
|
||||
* called, Embree will allocate and manage buffers of the default
|
||||
* layout. */
|
||||
void rtcSetBuffer(RTCScene scene, uniform unsigned int geomID, uniform RTCBufferType type,
|
||||
const void* uniform ptr, uniform size_t byteOffset, uniform size_t byteStride);
|
||||
|
||||
/*! \brief Enable geometry. Enabled geometry can be hit by a ray. */
|
||||
void rtcEnable (RTCScene scene, uniform unsigned int geomID);
|
||||
|
||||
/*! \brief Update spefific geometry buffer.
|
||||
|
||||
Each time geometry buffers got modified, the user has to call some
|
||||
update function to tell the ray tracing engine which buffers got
|
||||
modified. The rtcUpdateBuffer function taggs a specific buffer of
|
||||
some geometry as modified. */
|
||||
void rtcUpdate (RTCScene scene, uniform unsigned int geomID);
|
||||
|
||||
/*! \brief Update spefific geometry buffer.
|
||||
|
||||
Each time geometry buffers got modified, the user has to call some
|
||||
update function to tell the ray tracing engine which buffers got
|
||||
modified. The rtcUpdateBuffer function taggs a specific buffer of
|
||||
some geometry as modified. */
|
||||
void rtcUpdateBuffer (RTCScene scene, uniform unsigned int geomID, uniform RTCBufferType type);
|
||||
|
||||
/*! \brief Disable geometry.
|
||||
|
||||
Disabled geometry is not hit by any ray. Disabling and enabling
|
||||
geometry gives higher performance than deleting and recreating
|
||||
geometry. */
|
||||
void rtcDisable (RTCScene scene, uniform unsigned int geomID);
|
||||
|
||||
/*! \brief Sets the intersection filter function for uniform rays. */
|
||||
void rtcSetIntersectionFilterFunction1 (RTCScene scene, uniform unsigned int geomID, uniform RTCFilterFuncUniform func);
|
||||
|
||||
/*! \brief Sets the intersection filter function for varying rays. */
|
||||
void rtcSetIntersectionFilterFunction (RTCScene scene, uniform unsigned int geomID, uniform RTCFilterFuncVarying func);
|
||||
|
||||
/*! \brief Sets the occlusion filter function for uniform rays. */
|
||||
void rtcSetOcclusionFilterFunction1 (RTCScene scene, uniform unsigned int geomID, uniform RTCFilterFuncUniform func);
|
||||
|
||||
/*! \brief Sets the occlusion filter function for varying rays. */
|
||||
void rtcSetOcclusionFilterFunction (RTCScene scene, uniform unsigned int geomID, uniform RTCFilterFuncVarying func);
|
||||
|
||||
/*! Set pointer for user defined data per geometry. Invokations
|
||||
* of the various user intersect and occluded functions get passed
|
||||
* this data pointer when called. */
|
||||
void rtcSetUserData (RTCScene scene, uniform unsigned int geomID, void* uniform ptr);
|
||||
|
||||
/*! Get pointer for user defined data per geometry based on geomID. */
|
||||
void* uniform rtcGetUserData (RTCScene scene, uniform unsigned int geomID);
|
||||
|
||||
/*! Interpolates user data to some varying u/v location. The data
|
||||
* buffer specifies per vertex data to interpolate and can be one of
|
||||
* the RTC_VERTEX_BUFFER0/1 or RTC_USER_VERTEX_BUFFER0/1 and has to contain
|
||||
* numFloats floating point values to interpolate for each vertex of
|
||||
* the geometry. The P array will get filled with the interpolated
|
||||
* data, and the dPdu and dPdv arrays with the u and v derivative of
|
||||
* the interpolation. If the pointers P is NULL, the value will not
|
||||
* get calculated. If dPdu and dPdv are NULL the derivatives will not
|
||||
* get calculated. Both dPdu and dPdv have to be either valid or
|
||||
* NULL. These destination arrays are filled in structure of array
|
||||
* (SoA) layout. The buffer has to be padded at the end such
|
||||
* that the last element can be read safely using SSE
|
||||
* instructions. */
|
||||
void rtcInterpolate(RTCScene scene, uniform unsigned int geomID, varying unsigned int primIDs, varying float u, varying float v,
|
||||
uniform RTCBufferType buffer,
|
||||
varying float* uniform P, varying float* uniform dPdu, varying float* uniform dPdv, uniform size_t numFloats);
|
||||
|
||||
/*! Interpolates user data to some varying u/v location. The data
|
||||
* buffer specifies per vertex data to interpolate and can be one of
|
||||
* the RTC_VERTEX_BUFFER0/1 or RTC_USER_VERTEX_BUFFER0/1 and has to contain
|
||||
* numFloats floating point values to interpolate for each vertex of
|
||||
* the geometry. The P array will get filled with the
|
||||
* interpolated datam the dPdu and dPdv arrays with the u and v
|
||||
* derivative of the interpolation, and the ddPdudu, ddPdvdv, and
|
||||
* ddPdudv arrays with the respective second derivatives. One can
|
||||
* disable 1) the calculation of the interpolated value by setting P
|
||||
* to NULL, 2) the calculation of the 1st order derivatives by
|
||||
* setting dPdu and dPdv to NULL, 3) the calculation of the second
|
||||
* order derivatives by setting ddPdudu, ddPdvdv, and ddPdudv to
|
||||
* NULL. These destination arrays are filled in structure of array
|
||||
* (SoA) layout. The buffer has to be padded at the end such that
|
||||
* the last element can be read safely using SSE
|
||||
* instructions. */
|
||||
void rtcInterpolate2(RTCScene scene, uniform unsigned int geomID, varying unsigned int primIDs, varying float u, varying float v,
|
||||
uniform RTCBufferType buffer,
|
||||
varying float* uniform P, varying float* uniform dPdu, varying float* uniform dPdv,
|
||||
varying float* uniform ddPdudu, varying float* uniform ddPdvdv, varying float* uniform ddPdudv,
|
||||
uniform size_t numFloats);
|
||||
|
||||
/*! \brief Deletes the geometry. */
|
||||
void rtcDeleteGeometry (RTCScene scene, uniform unsigned int geomID);
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif
|
||||
154
src/igl/embree/embree2/rtcore_geometry_user.h
Normal file
154
src/igl/embree/embree2/rtcore_geometry_user.h
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
// ======================================================================== //
|
||||
// Copyright 2009-2015 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#ifndef __RTCORE_USER_GEOMETRY_H__
|
||||
#define __RTCORE_USER_GEOMETRY_H__
|
||||
|
||||
/*! \ingroup embree_kernel_api */
|
||||
/*! \{ */
|
||||
|
||||
/*! Type of bounding function. */
|
||||
typedef void (*RTCBoundsFunc)(void* ptr, /*!< pointer to user data */
|
||||
size_t item, /*!< item to calculate bounds for */
|
||||
RTCBounds& bounds_o /*!< returns calculated bounds */);
|
||||
|
||||
/*! Type of bounding function. */
|
||||
typedef void (*RTCBoundsFunc2)(void* userPtr, /*!< pointer to user data */
|
||||
void* geomUserPtr, /*!< pointer to geometry user data */
|
||||
size_t item, /*!< item to calculate bounds for */
|
||||
RTCBounds* bounds_o /*!< returns calculated bounds */);
|
||||
|
||||
/*! Type of intersect function pointer for single rays. */
|
||||
typedef void (*RTCIntersectFunc)(void* ptr, /*!< pointer to user data */
|
||||
RTCRay& ray, /*!< ray to intersect */
|
||||
size_t item /*!< item to intersect */);
|
||||
|
||||
/*! Type of intersect function pointer for ray packets of size 4. */
|
||||
typedef void (*RTCIntersectFunc4)(const void* valid, /*!< pointer to valid mask */
|
||||
void* ptr, /*!< pointer to user data */
|
||||
RTCRay4& ray, /*!< ray packet to intersect */
|
||||
size_t item /*!< item to intersect */);
|
||||
|
||||
/*! Type of intersect function pointer for ray packets of size 8. */
|
||||
typedef void (*RTCIntersectFunc8)(const void* valid, /*!< pointer to valid mask */
|
||||
void* ptr, /*!< pointer to user data */
|
||||
RTCRay8& ray, /*!< ray packet to intersect */
|
||||
size_t item /*!< item to intersect */);
|
||||
|
||||
/*! Type of intersect function pointer for ray packets of size 16. */
|
||||
typedef void (*RTCIntersectFunc16)(const void* valid, /*!< pointer to valid mask */
|
||||
void* ptr, /*!< pointer to user data */
|
||||
RTCRay16& ray, /*!< ray packet to intersect */
|
||||
size_t item /*!< item to intersect */);
|
||||
|
||||
/*! Type of occlusion function pointer for single rays. */
|
||||
typedef void (*RTCOccludedFunc) (void* ptr, /*!< pointer to user data */
|
||||
RTCRay& ray, /*!< ray to test occlusion */
|
||||
size_t item /*!< item to test for occlusion */);
|
||||
|
||||
/*! Type of occlusion function pointer for ray packets of size 4. */
|
||||
typedef void (*RTCOccludedFunc4) (const void* valid, /*! pointer to valid mask */
|
||||
void* ptr, /*!< pointer to user data */
|
||||
RTCRay4& ray, /*!< Ray packet to test occlusion. */
|
||||
size_t item /*!< item to test for occlusion */);
|
||||
|
||||
/*! Type of occlusion function pointer for ray packets of size 8. */
|
||||
typedef void (*RTCOccludedFunc8) (const void* valid, /*! pointer to valid mask */
|
||||
void* ptr, /*!< pointer to user data */
|
||||
RTCRay8& ray, /*!< Ray packet to test occlusion. */
|
||||
size_t item /*!< item to test for occlusion */);
|
||||
|
||||
/*! Type of occlusion function pointer for ray packets of size 16. */
|
||||
typedef void (*RTCOccludedFunc16) (const void* valid, /*! pointer to valid mask */
|
||||
void* ptr, /*!< pointer to user data */
|
||||
RTCRay16& ray, /*!< Ray packet to test occlusion. */
|
||||
size_t item /*!< item to test for occlusion */);
|
||||
|
||||
/*! Creates a new user geometry object. This feature makes it possible
|
||||
* to add arbitrary types of geometry to the scene by providing
|
||||
* appropiate bounding, intersect and occluded functions. A user
|
||||
* geometry object is a set of user geometries. As the rtcIntersect
|
||||
* and rtcOccluded functions support different ray packet sizes, the
|
||||
* user also has to provide different versions of intersect and
|
||||
* occluded function pointers for these packet sizes. However, the
|
||||
* ray packet size of the called function pointer always matches the
|
||||
* packet size of the originally invoked rtcIntersect and rtcOccluded
|
||||
* functions. A user data pointer, that points to a user specified
|
||||
* representation of the geometry, is passed to each intersect and
|
||||
* occluded function invokation, as well as the index of the geometry
|
||||
* of the set to intersect. */
|
||||
RTCORE_API unsigned rtcNewUserGeometry (RTCScene scene, /*!< the scene the user geometry set is created in */
|
||||
size_t numGeometries /*!< the number of geometries contained in the set */);
|
||||
|
||||
RTCORE_API unsigned rtcNewUserGeometry2 (RTCScene scene, /*!< the scene the user geometry set is created in */
|
||||
size_t numGeometries, /*!< the number of geometries contained in the set */
|
||||
size_t numTimeSteps = 1 /*!< number of motion blur time steps */);
|
||||
|
||||
/*! Sets the bounding function to calculate bounding boxes of the user
|
||||
* geometry items when building spatial index structures. The
|
||||
* calculated bounding box have to be conservative and should be
|
||||
* tight. */
|
||||
RTCORE_API void rtcSetBoundsFunction (RTCScene scene, unsigned geomID, RTCBoundsFunc bounds);
|
||||
|
||||
/*! Sets the bounding function to calculate bounding boxes of the user
|
||||
* geometry items when building spatial index structures. The
|
||||
* calculated bounding box have to be conservative and should be
|
||||
* tight. */
|
||||
RTCORE_API void rtcSetBoundsFunction2 (RTCScene scene, unsigned geomID, RTCBoundsFunc2 bounds, void* userPtr);
|
||||
|
||||
/*! Set intersect function for single rays. The rtcIntersect function
|
||||
* will call the passed function for intersecting the user
|
||||
* geometry. */
|
||||
RTCORE_API void rtcSetIntersectFunction (RTCScene scene, unsigned geomID, RTCIntersectFunc intersect);
|
||||
|
||||
/*! Set intersect function for ray packets of size 4. The
|
||||
* rtcIntersect4 function will call the passed function for
|
||||
* intersecting the user geometry. */
|
||||
RTCORE_API void rtcSetIntersectFunction4 (RTCScene scene, unsigned geomID, RTCIntersectFunc4 intersect4);
|
||||
|
||||
/*! Set intersect function for ray packets of size 8. The
|
||||
* rtcIntersect8 function will call the passed function for
|
||||
* intersecting the user geometry.*/
|
||||
RTCORE_API void rtcSetIntersectFunction8 (RTCScene scene, unsigned geomID, RTCIntersectFunc8 intersect8);
|
||||
|
||||
/*! Set intersect function for ray packets of size 16. The
|
||||
* rtcIntersect16 function will call the passed function for
|
||||
* intersecting the user geometry. */
|
||||
RTCORE_API void rtcSetIntersectFunction16 (RTCScene scene, unsigned geomID, RTCIntersectFunc16 intersect16);
|
||||
|
||||
/*! Set occlusion function for single rays. The rtcOccluded function
|
||||
* will call the passed function for intersecting the user
|
||||
* geometry. */
|
||||
RTCORE_API void rtcSetOccludedFunction (RTCScene scene, unsigned geomID, RTCOccludedFunc occluded);
|
||||
|
||||
/*! Set occlusion function for ray packets of size 4. The rtcOccluded4
|
||||
* function will call the passed function for intersecting the user
|
||||
* geometry. */
|
||||
RTCORE_API void rtcSetOccludedFunction4 (RTCScene scene, unsigned geomID, RTCOccludedFunc4 occluded4);
|
||||
|
||||
/*! Set occlusion function for ray packets of size 8. The rtcOccluded8
|
||||
* function will call the passed function for intersecting the user
|
||||
* geometry. */
|
||||
RTCORE_API void rtcSetOccludedFunction8 (RTCScene scene, unsigned geomID, RTCOccludedFunc8 occluded8);
|
||||
|
||||
/*! Set occlusion function for ray packets of size 16. The
|
||||
* rtcOccluded16 function will call the passed function for
|
||||
* intersecting the user geometry. */
|
||||
RTCORE_API void rtcSetOccludedFunction16 (RTCScene scene, unsigned geomID, RTCOccludedFunc16 occluded16);
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif
|
||||
128
src/igl/embree/embree2/rtcore_geometry_user.isph
Normal file
128
src/igl/embree/embree2/rtcore_geometry_user.isph
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
// ======================================================================== //
|
||||
// Copyright 2009-2015 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#ifndef __RTCORE_USER_GEOMETRY_ISPH__
|
||||
#define __RTCORE_USER_GEOMETRY_ISPH__
|
||||
|
||||
/*! \ingroup embree_kernel_api_ispc */
|
||||
/*! \{ */
|
||||
|
||||
/*! Type of bounding function. */
|
||||
typedef void (*RTCBoundsFunc)(void* uniform ptr, /*!< pointer to user data */
|
||||
uniform size_t item, /*!< item to calculate bounds for */
|
||||
uniform RTCBounds& bounds_o /*!< returns calculated bounds */);
|
||||
|
||||
/*! Type of bounding function. */
|
||||
typedef void (*RTCBoundsFunc2)(void* uniform userPtr, /*!< pointer to user data */
|
||||
void* uniform geomUserPtr, /*!< pointer to geometry user data */
|
||||
uniform size_t item, /*!< item to calculate bounds for */
|
||||
RTCBounds* uniform bounds_o /*!< returns calculated bounds */);
|
||||
|
||||
/*! Type of intersect function pointer for uniform rays. */
|
||||
typedef void (*RTCIntersectFuncUniform)(void* uniform ptr, /*!< pointer to user data */
|
||||
uniform RTCRay1& ray, /*!< ray to intersect */
|
||||
uniform size_t item /*< item to intersect */);
|
||||
|
||||
/*! Type of intersect function pointer for varying rays. */
|
||||
typedef void (*RTCIntersectFuncVarying)(void* uniform ptr, /*!< pointer to user data */
|
||||
varying RTCRay& ray, /*!< ray to intersect */
|
||||
uniform size_t item /*< item to intersect */);
|
||||
|
||||
/*! Type of occlusion function pointer for uniform rays. */
|
||||
typedef void (*RTCOccludedFuncUniform) (void* uniform ptr, /*!< pointer to user data */
|
||||
uniform RTCRay1& ray, /*!< ray to test occlusion */
|
||||
uniform size_t item /*< item to test for occlusion */);
|
||||
|
||||
|
||||
/*! Type of occlusion function pointer for varying rays. */
|
||||
typedef void (*RTCOccludedFuncVarying) (void* uniform ptr, /*!< pointer to user data */
|
||||
varying RTCRay& ray, /*!< ray to test occlusion */
|
||||
uniform size_t item /*< item to test for occlusion */);
|
||||
|
||||
|
||||
typedef void (*RTCDisplacementFunc)(void* uniform ptr, /*!< pointer to user data of geometry */
|
||||
uniform unsigned int geomID, /*!< ID of geometry to displace */
|
||||
uniform unsigned int primID, /*!< ID of primitive of geometry to displace */
|
||||
uniform const float* uniform u, /*!< u coordinates (source) */
|
||||
uniform const float* uniform v, /*!< v coordinates (source) */
|
||||
uniform const float* uniform nx, /*!< x coordinates of normal at point to displace (source) */
|
||||
uniform const float* uniform ny, /*!< y coordinates of normal at point to displace (source) */
|
||||
uniform const float* uniform nz, /*!< z coordinates of normal at point to displace (source) */
|
||||
uniform float* uniform px, /*!< x coordinates of points to displace (source and target) */
|
||||
uniform float* uniform py, /*!< y coordinates of points to displace (source and target) */
|
||||
uniform float* uniform pz, /*!< z coordinates of points to displace (source and target) */
|
||||
uniform size_t N /*!< number of points to displace */ );
|
||||
|
||||
|
||||
/*! Creates a new user geometry object. This feature makes it possible
|
||||
* to add arbitrary types of geometry to the scene by providing
|
||||
* appropiate intersect and occluded functions, as well as a bounding
|
||||
* box of the implemented geometry. As the rtcIntersect and
|
||||
* rtcOccluded functions support different ray packet sizes, the user
|
||||
* also has to provide different versions of intersect and occluded
|
||||
* function pointers for the different packet sized. However, only
|
||||
* rtcIntersect and rtcOccluded functions of specific packet sizes
|
||||
* are called, it is sufficient to provide only the corresponding
|
||||
* function pointer for the user geometry. However, the functions
|
||||
* provided have to intersect the same geometry. A user data pointer,
|
||||
* that points to a user specified representation of the geometry, is
|
||||
* passed to each intersect and occluded function invokation. */
|
||||
uniform unsigned int rtcNewUserGeometry (RTCScene scene, /*!< the scene the user geometry set is created in */
|
||||
uniform size_t numGeometries /*!< the number of geometries contained in the set */);
|
||||
|
||||
uniform unsigned int rtcNewUserGeometry2 (RTCScene scene, /*!< the scene the user geometry set is created in */
|
||||
uniform size_t numGeometries, /*!< the number of geometries contained in the set */
|
||||
uniform size_t numTimeSteps = 1 /*!< number of motion blur time steps */);
|
||||
|
||||
/*! Sets the bounding function to calculate bounding boxes of the user
|
||||
* geometry items when building spatial index structures. The
|
||||
* calculated bounding box have to be conservative and should be
|
||||
* tight.*/
|
||||
void rtcSetBoundsFunction (RTCScene scene, uniform unsigned int geomID, uniform RTCBoundsFunc bounds);
|
||||
|
||||
/*! Sets the bounding function to calculate bounding boxes of the user
|
||||
* geometry items when building spatial index structures. The
|
||||
* calculated bounding box have to be conservative and should be
|
||||
* tight.*/
|
||||
void rtcSetBoundsFunction2 (RTCScene scene, uniform unsigned int geomID, uniform RTCBoundsFunc2 bounds, void* uniform userPtr);
|
||||
|
||||
/*! Set intersect function for uniform rays. The rtcIntersect1
|
||||
* function will call the passed function for intersecting the user
|
||||
* geometry. */
|
||||
void rtcSetIntersectFunction1 (RTCScene scene, uniform unsigned int geomID, uniform RTCIntersectFuncUniform intersect);
|
||||
|
||||
/*! Set intersect function for varying rays. The rtcIntersect function
|
||||
* will call the passed function for intersecting the user
|
||||
* geometry. */
|
||||
void rtcSetIntersectFunction (RTCScene scene, uniform unsigned int geomID, uniform RTCIntersectFuncVarying intersect);
|
||||
|
||||
/*! Set occlusion function for uniform rays. The rtcOccluded1 function
|
||||
* will call the passed function for intersecting the user
|
||||
* geometry. */
|
||||
void rtcSetOccludedFunction1 (RTCScene scene, uniform unsigned int geomID, uniform RTCOccludedFuncUniform occluded);
|
||||
|
||||
/*! Set occlusion function for varying rays. The rtcOccluded function
|
||||
* will call the passed function for intersecting the user
|
||||
* geometry. */
|
||||
void rtcSetOccludedFunction (RTCScene scene, uniform unsigned int geomID, uniform RTCOccludedFuncVarying occluded);
|
||||
|
||||
|
||||
/*! \brief Sets the displacement function. */
|
||||
void rtcSetDisplacementFunction (RTCScene scene, uniform unsigned int geomID, uniform RTCDisplacementFunc func, uniform RTCBounds *uniform bounds);
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif
|
||||
195
src/igl/embree/embree2/rtcore_ray.h
Normal file
195
src/igl/embree/embree2/rtcore_ray.h
Normal file
|
|
@ -0,0 +1,195 @@
|
|||
// ======================================================================== //
|
||||
// Copyright 2009-2015 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#ifndef __RTCORE_RAY_H__
|
||||
#define __RTCORE_RAY_H__
|
||||
|
||||
/*! \ingroup embree_kernel_api */
|
||||
/*! \{ */
|
||||
|
||||
/*! \brief Ray structure for an individual ray */
|
||||
struct RTCORE_ALIGN(16) RTCRay
|
||||
{
|
||||
/* ray data */
|
||||
public:
|
||||
float org[3]; //!< Ray origin
|
||||
float align0;
|
||||
|
||||
float dir[3]; //!< Ray direction
|
||||
float align1;
|
||||
|
||||
float tnear; //!< Start of ray segment
|
||||
float tfar; //!< End of ray segment (set to hit distance)
|
||||
|
||||
float time; //!< Time of this ray for motion blur
|
||||
unsigned mask; //!< Used to mask out objects during traversal
|
||||
|
||||
/* hit data */
|
||||
public:
|
||||
float Ng[3]; //!< Unnormalized geometry normal
|
||||
float align2;
|
||||
|
||||
float u; //!< Barycentric u coordinate of hit
|
||||
float v; //!< Barycentric v coordinate of hit
|
||||
|
||||
unsigned geomID; //!< geometry ID
|
||||
unsigned primID; //!< primitive ID
|
||||
unsigned instID; //!< instance ID
|
||||
};
|
||||
|
||||
/*! Ray structure for packets of 4 rays. */
|
||||
struct RTCORE_ALIGN(16) RTCRay4
|
||||
{
|
||||
/* ray data */
|
||||
public:
|
||||
float orgx[4]; //!< x coordinate of ray origin
|
||||
float orgy[4]; //!< y coordinate of ray origin
|
||||
float orgz[4]; //!< z coordinate of ray origin
|
||||
|
||||
float dirx[4]; //!< x coordinate of ray direction
|
||||
float diry[4]; //!< y coordinate of ray direction
|
||||
float dirz[4]; //!< z coordinate of ray direction
|
||||
|
||||
float tnear[4]; //!< Start of ray segment
|
||||
float tfar[4]; //!< End of ray segment (set to hit distance)
|
||||
|
||||
float time[4]; //!< Time of this ray for motion blur
|
||||
unsigned mask[4]; //!< Used to mask out objects during traversal
|
||||
|
||||
/* hit data */
|
||||
public:
|
||||
float Ngx[4]; //!< x coordinate of geometry normal
|
||||
float Ngy[4]; //!< y coordinate of geometry normal
|
||||
float Ngz[4]; //!< z coordinate of geometry normal
|
||||
|
||||
float u[4]; //!< Barycentric u coordinate of hit
|
||||
float v[4]; //!< Barycentric v coordinate of hit
|
||||
|
||||
unsigned geomID[4]; //!< geometry ID
|
||||
unsigned primID[4]; //!< primitive ID
|
||||
unsigned instID[4]; //!< instance ID
|
||||
};
|
||||
|
||||
/*! Ray structure for packets of 8 rays. */
|
||||
struct RTCORE_ALIGN(32) RTCRay8
|
||||
{
|
||||
/* ray data */
|
||||
public:
|
||||
float orgx[8]; //!< x coordinate of ray origin
|
||||
float orgy[8]; //!< y coordinate of ray origin
|
||||
float orgz[8]; //!< z coordinate of ray origin
|
||||
|
||||
float dirx[8]; //!< x coordinate of ray direction
|
||||
float diry[8]; //!< y coordinate of ray direction
|
||||
float dirz[8]; //!< z coordinate of ray direction
|
||||
|
||||
float tnear[8]; //!< Start of ray segment
|
||||
float tfar[8]; //!< End of ray segment (set to hit distance)
|
||||
|
||||
float time[8]; //!< Time of this ray for motion blur
|
||||
unsigned mask[8]; //!< Used to mask out objects during traversal
|
||||
|
||||
/* hit data */
|
||||
public:
|
||||
float Ngx[8]; //!< x coordinate of geometry normal
|
||||
float Ngy[8]; //!< y coordinate of geometry normal
|
||||
float Ngz[8]; //!< z coordinate of geometry normal
|
||||
|
||||
float u[8]; //!< Barycentric u coordinate of hit
|
||||
float v[8]; //!< Barycentric v coordinate of hit
|
||||
|
||||
unsigned geomID[8]; //!< geometry ID
|
||||
unsigned primID[8]; //!< primitive ID
|
||||
unsigned instID[8]; //!< instance ID
|
||||
};
|
||||
|
||||
/*! \brief Ray structure for packets of 16 rays. */
|
||||
struct RTCORE_ALIGN(64) RTCRay16
|
||||
{
|
||||
/* ray data */
|
||||
public:
|
||||
float orgx[16]; //!< x coordinate of ray origin
|
||||
float orgy[16]; //!< y coordinate of ray origin
|
||||
float orgz[16]; //!< z coordinate of ray origin
|
||||
|
||||
float dirx[16]; //!< x coordinate of ray direction
|
||||
float diry[16]; //!< y coordinate of ray direction
|
||||
float dirz[16]; //!< z coordinate of ray direction
|
||||
|
||||
float tnear[16]; //!< Start of ray segment
|
||||
float tfar[16]; //!< End of ray segment (set to hit distance)
|
||||
|
||||
float time[16]; //!< Time of this ray for motion blur
|
||||
unsigned mask[16]; //!< Used to mask out objects during traversal
|
||||
|
||||
/* hit data */
|
||||
public:
|
||||
float Ngx[16]; //!< x coordinate of geometry normal
|
||||
float Ngy[16]; //!< y coordinate of geometry normal
|
||||
float Ngz[16]; //!< z coordinate of geometry normal
|
||||
|
||||
float u[16]; //!< Barycentric u coordinate of hit
|
||||
float v[16]; //!< Barycentric v coordinate of hit
|
||||
|
||||
unsigned geomID[16]; //!< geometry ID
|
||||
unsigned primID[16]; //!< primitive ID
|
||||
unsigned instID[16]; //!< instance ID
|
||||
};
|
||||
|
||||
|
||||
/*! \brief Ray structure template for packets of N rays in SOA layout. */
|
||||
struct RTCRaySOA
|
||||
{
|
||||
/* ray data */
|
||||
public:
|
||||
|
||||
float* orgx; //!< x coordinate of ray origin
|
||||
float* orgy; //!< y coordinate of ray origin
|
||||
float* orgz; //!< z coordinate of ray origin
|
||||
|
||||
float* dirx; //!< x coordinate of ray direction
|
||||
float* diry; //!< y coordinate of ray direction
|
||||
float* dirz; //!< z coordinate of ray direction
|
||||
|
||||
float* tnear; //!< Start of ray segment (optional)
|
||||
float* tfar; //!< End of ray segment (set to hit distance)
|
||||
|
||||
|
||||
float* time; //!< Time of this ray for motion blur (optional)
|
||||
unsigned* mask; //!< Used to mask out objects during traversal (optional)
|
||||
|
||||
/* hit data */
|
||||
|
||||
public:
|
||||
|
||||
float* Ngx; //!< x coordinate of geometry normal (optional)
|
||||
float* Ngy; //!< y coordinate of geometry normal (optional)
|
||||
float* Ngz; //!< z coordinate of geometry normal (optional)
|
||||
|
||||
|
||||
|
||||
float* u; //!< Barycentric u coordinate of hit
|
||||
float* v; //!< Barycentric v coordinate of hit
|
||||
|
||||
|
||||
unsigned* geomID; //!< geometry ID
|
||||
unsigned* primID; //!< primitive ID
|
||||
unsigned* instID; //!< instance ID (optional)
|
||||
};
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif
|
||||
117
src/igl/embree/embree2/rtcore_ray.isph
Normal file
117
src/igl/embree/embree2/rtcore_ray.isph
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
// ======================================================================== //
|
||||
// Copyright 2009-2015 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#ifndef __RTCORE_RAY_ISPH__
|
||||
#define __RTCORE_RAY_ISPH__
|
||||
|
||||
/*! \ingroup embree_kernel_api_ispc */
|
||||
/*! \{ */
|
||||
|
||||
/*! Ray structure for uniform (single) rays. */
|
||||
struct RTCRay1
|
||||
{
|
||||
/* ray data */
|
||||
float org[3]; //!< Ray origin
|
||||
float align0; //!< unused member to force alignment of following members
|
||||
|
||||
float dir[3]; //!< Ray direction
|
||||
float align1; //!< unused member to force alignment of following members
|
||||
|
||||
float tnear; //!< Start of ray segment
|
||||
float tfar; //!< End of ray segment (set to hit distance)
|
||||
float time; //!< Time of this ray for motion blur
|
||||
unsigned mask; //!< Used to mask out objects during traversal
|
||||
|
||||
/* hit data */
|
||||
float Ng[3]; //!< Unnormalized geometry normal
|
||||
float align2;
|
||||
|
||||
float u; //!< Barycentric u coordinate of hit
|
||||
float v; //!< Barycentric v coordinate of hit
|
||||
|
||||
unsigned geomID; //!< geometry ID
|
||||
unsigned primID; //!< primitive ID
|
||||
unsigned instID; //!< instance ID
|
||||
varying unsigned align[0]; //!< aligns ray on stack to at least 16 bytes
|
||||
};
|
||||
|
||||
/*! Ray structure for packets of 4 rays. */
|
||||
struct RTCRay
|
||||
{
|
||||
/* ray data */
|
||||
float orgx; //!< x coordinate of ray origin
|
||||
float orgy; //!< y coordinate of ray origin
|
||||
float orgz; //!< z coordinate of ray origin
|
||||
|
||||
float dirx; //!< x coordinate of ray direction
|
||||
float diry; //!< y coordinate of ray direction
|
||||
float dirz; //!< z coordinate of ray direction
|
||||
|
||||
float tnear; //!< Start of ray segment
|
||||
float tfar; //!< End of ray segment
|
||||
float time; //!< Time of this ray for motion blur
|
||||
unsigned mask; //!< Used to mask out objects during traversal
|
||||
|
||||
/* hit data */
|
||||
float Ngx; //!< x coordinate of geometry normal
|
||||
float Ngy; //!< y coordinate of geometry normal
|
||||
float Ngz; //!< z coordinate of geometry normal
|
||||
|
||||
float u; //!< Barycentric u coordinate of hit
|
||||
float v; //!< Barycentric v coordinate of hit
|
||||
|
||||
unsigned geomID; //!< geometry ID
|
||||
unsigned primID; //!< primitive ID
|
||||
unsigned instID; //!< instance ID
|
||||
};
|
||||
|
||||
|
||||
struct RTCRaySOA
|
||||
{
|
||||
/* ray data */
|
||||
|
||||
uniform float* uniform orgx; //!< x coordinate of ray origin
|
||||
uniform float* uniform orgy; //!< y coordinate of ray origin
|
||||
uniform float* uniform orgz; //!< z coordinate of ray origin
|
||||
|
||||
uniform float* uniform dirx; //!< x coordinate of ray direction
|
||||
uniform float* uniform diry; //!< y coordinate of ray direction
|
||||
uniform float* uniform dirz; //!< z coordinate of ray direction
|
||||
|
||||
uniform float* uniform tnear; //!< Start of ray segment (optional)
|
||||
uniform float* uniform tfar; //!< End of ray segment (set to hit distance)
|
||||
|
||||
uniform float* uniform time; //!< Time of this ray for motion blur (optional)
|
||||
uniform unsigned* uniform mask; //!< Used to mask out objects during traversal (optional)
|
||||
|
||||
/* hit data */
|
||||
|
||||
uniform float* uniform Ngx; //!< x coordinate of geometry normal (optional)
|
||||
uniform float* uniform Ngy; //!< y coordinate of geometry normal (optional)
|
||||
uniform float* uniform Ngz; //!< z coordinate of geometry normal (optional)
|
||||
|
||||
uniform float* uniform u; //!< Barycentric u coordinate of hit
|
||||
uniform float* uniform v; //!< Barycentric v coordinate of hit
|
||||
|
||||
uniform unsigned* uniform geomID; //!< geometry ID
|
||||
uniform unsigned* uniform primID; //!< primitive ID
|
||||
uniform unsigned* uniform instID; //!< instance ID (optional)
|
||||
};
|
||||
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif
|
||||
187
src/igl/embree/embree2/rtcore_scene.h
Normal file
187
src/igl/embree/embree2/rtcore_scene.h
Normal file
|
|
@ -0,0 +1,187 @@
|
|||
// ======================================================================== //
|
||||
// Copyright 2009-2015 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#ifndef __RTCORE_SCENE_H__
|
||||
#define __RTCORE_SCENE_H__
|
||||
|
||||
/*! \ingroup embree_kernel_api */
|
||||
/*! \{ */
|
||||
|
||||
/*! forward declarations for ray structures */
|
||||
struct RTCRay;
|
||||
struct RTCRay4;
|
||||
struct RTCRay8;
|
||||
struct RTCRay16;
|
||||
struct RTCRaySOA;
|
||||
|
||||
/*! scene flags */
|
||||
enum RTCSceneFlags
|
||||
{
|
||||
/* dynamic type flags */
|
||||
RTC_SCENE_STATIC = (0 << 0), //!< specifies static scene
|
||||
RTC_SCENE_DYNAMIC = (1 << 0), //!< specifies dynamic scene
|
||||
|
||||
/* acceleration structure flags */
|
||||
RTC_SCENE_COMPACT = (1 << 8), //!< use memory conservative data structures
|
||||
RTC_SCENE_COHERENT = (1 << 9), //!< optimize data structures for coherent rays
|
||||
RTC_SCENE_INCOHERENT = (1 << 10), //!< optimize data structures for in-coherent rays (enabled by default)
|
||||
RTC_SCENE_HIGH_QUALITY = (1 << 11), //!< create higher quality data structures
|
||||
|
||||
/* traversal algorithm flags */
|
||||
RTC_SCENE_ROBUST = (1 << 16) //!< use more robust traversal algorithms
|
||||
};
|
||||
|
||||
/*! enabled algorithm flags */
|
||||
enum RTCAlgorithmFlags
|
||||
{
|
||||
RTC_INTERSECT1 = (1 << 0), //!< enables the rtcIntersect1 and rtcOccluded1 functions for this scene
|
||||
RTC_INTERSECT4 = (1 << 1), //!< enables the rtcIntersect4 and rtcOccluded4 functions for this scene
|
||||
RTC_INTERSECT8 = (1 << 2), //!< enables the rtcIntersect8 and rtcOccluded8 functions for this scene
|
||||
RTC_INTERSECT16 = (1 << 3), //!< enables the rtcIntersect16 and rtcOccluded16 functions for this scene
|
||||
RTC_INTERPOLATE = (1 << 4), //!< enables the rtcInterpolate function for this scene
|
||||
|
||||
RTC_INTERSECTN = (1 << 5), //!< enables the rtcIntersectN and rtcOccludedN functions for this scene
|
||||
};
|
||||
|
||||
/*! layout flags for ray streams */
|
||||
enum RTCRayNFlags
|
||||
{
|
||||
RTC_RAYN_DEFAULT = (1 << 0)
|
||||
};
|
||||
|
||||
|
||||
/*! \brief Defines an opaque scene type */
|
||||
typedef struct __RTCScene {}* RTCScene;
|
||||
|
||||
/*! Creates a new scene.
|
||||
WARNING: This function is deprecated, use rtcDeviceNewScene instead.
|
||||
*/
|
||||
RTCORE_API RTCORE_DEPRECATED RTCScene rtcNewScene (RTCSceneFlags flags, RTCAlgorithmFlags aflags);
|
||||
|
||||
/*! Creates a new scene. */
|
||||
RTCORE_API RTCScene rtcDeviceNewScene (RTCDevice device, RTCSceneFlags flags, RTCAlgorithmFlags aflags);
|
||||
|
||||
/*! \brief Type of progress callback function. */
|
||||
typedef bool (*RTCProgressMonitorFunc)(void* ptr, const double n);
|
||||
RTCORE_DEPRECATED typedef RTCProgressMonitorFunc RTC_PROGRESS_MONITOR_FUNCTION;
|
||||
|
||||
/*! \brief Sets the progress callback function which is called during hierarchy build of this scene. */
|
||||
RTCORE_API void rtcSetProgressMonitorFunction(RTCScene scene, RTCProgressMonitorFunc func, void* ptr);
|
||||
|
||||
/*! Commits the geometry of the scene. After initializing or modifying
|
||||
* geometries, commit has to get called before tracing
|
||||
* rays. */
|
||||
RTCORE_API void rtcCommit (RTCScene scene);
|
||||
|
||||
/*! Commits the geometry of the scene. The calling threads will be
|
||||
* used internally as a worker threads on some implementations. The
|
||||
* function will wait until 'numThreads' threads have called this
|
||||
* function and all threads return from the function after the scene
|
||||
* commit is finished. The application threads will not be used as
|
||||
* worker threads when the TBB tasking system is enabled (which is
|
||||
* the default). On CPUs, we recommend also using TBB inside your
|
||||
* application to share threads. We recommend using the
|
||||
* rtcCommitThread feature to share threads on the Xeon Phi
|
||||
* coprocessor. */
|
||||
RTCORE_API void rtcCommitThread(RTCScene scene, unsigned int threadID, unsigned int numThreads);
|
||||
|
||||
/*! Returns to AABB of the scene. rtcCommit has to get called
|
||||
* previously to this function. */
|
||||
RTCORE_API void rtcGetBounds(RTCScene scene, RTCBounds& bounds_o);
|
||||
|
||||
/*! Intersects a single ray with the scene. The ray has to be aligned
|
||||
* to 16 bytes. This function can only be called for scenes with the
|
||||
* RTC_INTERSECT1 flag set. */
|
||||
RTCORE_API void rtcIntersect (RTCScene scene, RTCRay& ray);
|
||||
|
||||
/*! Intersects a packet of 4 rays with the scene. The valid mask and
|
||||
* ray have both to be aligned to 16 bytes. This function can only be
|
||||
* called for scenes with the RTC_INTERSECT4 flag set. */
|
||||
RTCORE_API void rtcIntersect4 (const void* valid, RTCScene scene, RTCRay4& ray);
|
||||
|
||||
/*! Intersects a packet of 8 rays with the scene. The valid mask and
|
||||
* ray have both to be aligned to 32 bytes. This function can only be
|
||||
* called for scenes with the RTC_INTERSECT8 flag set. For performance
|
||||
* reasons, the rtcIntersect8 function should only get called if the
|
||||
* CPU supports AVX. */
|
||||
RTCORE_API void rtcIntersect8 (const void* valid, RTCScene scene, RTCRay8& ray);
|
||||
|
||||
/*! Intersects a packet of 16 rays with the scene. The valid mask and
|
||||
* ray have both to be aligned to 64 bytes. This function can only be
|
||||
* called for scenes with the RTC_INTERSECT16 flag set. For
|
||||
* performance reasons, the rtcIntersect16 function should only get
|
||||
* called if the CPU supports the 16-wide SIMD instructions. */
|
||||
RTCORE_API void rtcIntersect16 (const void* valid, RTCScene scene, RTCRay16& ray);
|
||||
|
||||
/*! Intersects a stream of N rays in AOS layout with the scene. This
|
||||
* function can only be called for scenes with the RTC_INTERSECTN
|
||||
* flag set. The stride specifies the offset between rays in
|
||||
* bytes. */
|
||||
RTCORE_API void rtcIntersectN (RTCScene scene, RTCRay* rayN, const size_t N, const size_t stride, const size_t flags = RTC_RAYN_DEFAULT);
|
||||
|
||||
/*! Intersects one or multiple streams of N rays in compact SOA layout
|
||||
* with the scene. This function can only be called for scenes with
|
||||
* the RTC_INTERSECTN flag set. 'streams' specifies the number of
|
||||
* dense SOA ray streams, and 'stride' the offset in bytes between
|
||||
* those. */
|
||||
RTCORE_API void rtcIntersectN_SOA (RTCScene scene, RTCRaySOA& rayN, const size_t N, const size_t streams, const size_t stride, const size_t flags = RTC_RAYN_DEFAULT);
|
||||
|
||||
|
||||
/*! Tests if a single ray is occluded by the scene. The ray has to be
|
||||
* aligned to 16 bytes. This function can only be called for scenes
|
||||
* with the RTC_INTERSECT1 flag set. */
|
||||
RTCORE_API void rtcOccluded (RTCScene scene, RTCRay& ray);
|
||||
|
||||
/*! Tests if a packet of 4 rays is occluded by the scene. This
|
||||
* function can only be called for scenes with the RTC_INTERSECT4
|
||||
* flag set. The valid mask and ray have both to be aligned to 16
|
||||
* bytes. */
|
||||
RTCORE_API void rtcOccluded4 (const void* valid, RTCScene scene, RTCRay4& ray);
|
||||
|
||||
/*! Tests if a packet of 8 rays is occluded by the scene. The valid
|
||||
* mask and ray have both to be aligned to 32 bytes. This function
|
||||
* can only be called for scenes with the RTC_INTERSECT8 flag
|
||||
* set. For performance reasons, the rtcOccluded8 function should
|
||||
* only get called if the CPU supports AVX. */
|
||||
RTCORE_API void rtcOccluded8 (const void* valid, RTCScene scene, RTCRay8& ray);
|
||||
|
||||
/*! Tests if a packet of 16 rays is occluded by the scene. The valid
|
||||
* mask and ray have both to be aligned to 64 bytes. This function
|
||||
* can only be called for scenes with the RTC_INTERSECT16 flag
|
||||
* set. For performance reasons, the rtcOccluded16 function should
|
||||
* only get called if the CPU supports the 16-wide SIMD
|
||||
* instructions. */
|
||||
RTCORE_API void rtcOccluded16 (const void* valid, RTCScene scene, RTCRay16& ray);
|
||||
|
||||
/*! Tests if a stream of N rays on AOS layout is occluded by the
|
||||
* scene. This function can only be called for scenes with the
|
||||
* RTC_INTERSECTN flag set. The stride specifies the offset between
|
||||
* rays in bytes.*/
|
||||
RTCORE_API void rtcOccludedN (RTCScene scene, RTCRay* rayN, const size_t N, const size_t stride, const size_t flags = RTC_RAYN_DEFAULT);
|
||||
|
||||
/*! Intersects one or multiple streams of N rays in compact SOA layout
|
||||
* with the scene. This function can only be called for scenes with
|
||||
* the RTC_INTERSECTN flag set. 'streams' specifies the number of
|
||||
* dense SOA ray streams, and 'stride' the offset in bytes between
|
||||
* those. */
|
||||
RTCORE_API void rtcOccludedN_SOA (RTCScene scene, RTCRaySOA& rayN, const size_t N, const size_t streams, const size_t stride, const size_t flags = RTC_RAYN_DEFAULT);
|
||||
|
||||
/*! Deletes the scene. All contained geometry get also destroyed. */
|
||||
RTCORE_API void rtcDeleteScene (RTCScene scene);
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif
|
||||
152
src/igl/embree/embree2/rtcore_scene.isph
Normal file
152
src/igl/embree/embree2/rtcore_scene.isph
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
// ======================================================================== //
|
||||
// Copyright 2009-2015 Intel Corporation //
|
||||
// //
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); //
|
||||
// you may not use this file except in compliance with the License. //
|
||||
// You may obtain a copy of the License at //
|
||||
// //
|
||||
// http://www.apache.org/licenses/LICENSE-2.0 //
|
||||
// //
|
||||
// Unless required by applicable law or agreed to in writing, software //
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, //
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
|
||||
// See the License for the specific language governing permissions and //
|
||||
// limitations under the License. //
|
||||
// ======================================================================== //
|
||||
|
||||
#ifndef __RTCORE_SCENE_ISPH__
|
||||
#define __RTCORE_SCENE_ISPH__
|
||||
|
||||
/*! \ingroup embree_kernel_api */
|
||||
/*! \{ */
|
||||
|
||||
/*! forward declarations for ray structures */
|
||||
struct RTCRay1;
|
||||
struct RTCRay;
|
||||
struct RTCRaySOA;
|
||||
|
||||
/*! scene flags */
|
||||
enum RTCSceneFlags
|
||||
{
|
||||
/* dynamic type flags */
|
||||
RTC_SCENE_STATIC = (0 << 0), //!< specifies static scene
|
||||
RTC_SCENE_DYNAMIC = (1 << 0), //!< specifies dynamic scene
|
||||
|
||||
/* acceleration structure flags */
|
||||
RTC_SCENE_COMPACT = (1 << 8), //!< use memory conservative data structures
|
||||
RTC_SCENE_COHERENT = (1 << 9), //!< optimize data structures for coherent rays (enabled by default)
|
||||
RTC_SCENE_INCOHERENT = (1 << 10), //!< optimize data structures for in-coherent rays
|
||||
RTC_SCENE_HIGH_QUALITY = (1 << 11), //!< create higher quality data structures
|
||||
|
||||
/* traversal algorithm flags */
|
||||
RTC_SCENE_ROBUST = (1 << 16) //!< use more robust traversal algorithms
|
||||
};
|
||||
|
||||
/*! enabled algorithm flags */
|
||||
enum RTCAlgorithmFlags
|
||||
{
|
||||
RTC_INTERSECT_UNIFORM = (1 << 0), //!< enables the uniform rtcIntersect1 and uniform rtcOccluded1 functions for this scene
|
||||
RTC_INTERSECT_VARYING = (1 << 1), //!< enables the varying rtcIntersect and varying rtcOccluded functions for this scene
|
||||
RTC_INTERPOLATE = (1 << 4) //!< enables the rtcInterpolate function for this scene
|
||||
};
|
||||
|
||||
/*! layout flags for ray streams */
|
||||
enum RTCRayNFlags
|
||||
{
|
||||
RTC_RAYN_DEFAULT = (1 << 0)
|
||||
};
|
||||
|
||||
|
||||
/*! \brief Defines an opaque scene type */
|
||||
typedef uniform struct __RTCScene {}* uniform RTCScene;
|
||||
|
||||
/*! Creates a new scene.
|
||||
WARNING: This function is deprecated, use rtcDeviceNewScene instead.
|
||||
*/
|
||||
RTCORE_DEPRECATED RTCScene rtcNewScene (uniform RTCSceneFlags flags, uniform RTCAlgorithmFlags aflags);
|
||||
|
||||
/*! Creates a new scene. */
|
||||
RTCScene rtcDeviceNewScene (RTCDevice device, uniform RTCSceneFlags flags, uniform RTCAlgorithmFlags aflags);
|
||||
|
||||
/*! \brief Type of progress callback function. */
|
||||
typedef uniform bool (*uniform RTC_PROGRESS_MONITOR_FUNCTION)(void* uniform ptr, const uniform double n);
|
||||
|
||||
/*! \brief Sets the progress callback function which is called during hierarchy build. */
|
||||
void rtcSetProgressMonitorFunction(RTCScene scene, RTC_PROGRESS_MONITOR_FUNCTION func, void* uniform ptr);
|
||||
|
||||
/*! Commits the geometry of the scene. After initializing or modifying
|
||||
* geometries, commit has to get called before tracing
|
||||
* rays. */
|
||||
void rtcCommit (RTCScene scene);
|
||||
|
||||
/*! Commits the geometry of the scene. The calling threads will be
|
||||
* used internally as a worker threads on some implementations. The
|
||||
* function will wait until 'numThreads' threads have called this
|
||||
* function and all threads return from the function after the scene
|
||||
* commit is finished. The application threads will not be used as
|
||||
* worker threads when the TBB tasking system is enabled (which is
|
||||
* the default). On CPUs, we recommend also using TBB inside your
|
||||
* application to share threads. We recommend using the
|
||||
* rtcCommitThread feature to share threads on the Xeon Phi
|
||||
* coprocessor. */
|
||||
void rtcCommitThread(RTCScene scene, uniform unsigned int threadID, uniform unsigned int numThreads);
|
||||
|
||||
/*! Returns to AABB of the scene. rtcCommit has to get called
|
||||
* previously to this function. */
|
||||
void rtcGetBounds(RTCScene scene, uniform RTCBounds& bounds_o);
|
||||
|
||||
/*! Intersects a uniform ray with the scene. This function can only be
|
||||
* called for scenes with the RTC_INTERSECT_UNIFORM flag set. The ray
|
||||
* has to be aligned to 16 bytes. */
|
||||
void rtcIntersect1 (RTCScene scene, uniform RTCRay1& ray);
|
||||
|
||||
/*! Intersects a varying ray with the scene. This function can only be
|
||||
* called for scenes with the RTC_INTERSECT_VARYING flag set. The
|
||||
* valid mask and ray have both to be aligned to sizeof(varing float)
|
||||
* bytes. */
|
||||
void rtcIntersect (RTCScene scene, varying RTCRay& ray);
|
||||
|
||||
|
||||
/*! Intersects a stream of N rays in AOS layout with the scene. This
|
||||
* function can only be called for scenes with the RTC_INTERSECTN
|
||||
* flag set. The stride specifies the offset between rays in
|
||||
* bytes. */
|
||||
void rtcIntersectN (RTCScene scene, uniform RTCRay* uniform rayN, const uniform size_t N, const uniform size_t stride, const uniform size_t flags);
|
||||
|
||||
/*! Intersects one or multiple streams of N rays in compact SOA layout with the scene. This
|
||||
* function can only be called for scenes with the RTC_INTERSECTN
|
||||
* flag set. 'streams' specifies the number of dense SOA ray
|
||||
* streams, and 'stride' the offset in bytes between those. */
|
||||
void rtcIntersectN_SOA (RTCScene scene, uniform RTCRaySOA& rayN, const uniform size_t N, const uniform size_t streams, const uniform size_t offset, const uniform size_t flags);
|
||||
|
||||
|
||||
/*! Tests if a uniform ray is occluded by the scene. This function can
|
||||
* only be called for scenes with the RTC_INTERSECT_UNIFORM flag
|
||||
* set. The ray has to be aligned to 16 bytes. */
|
||||
void rtcOccluded1 (RTCScene scene, uniform RTCRay1& ray);
|
||||
|
||||
/*! Tests if a varying ray is occluded by the scene. This function can
|
||||
* only be called for scenes with the RTC_INTERSECT_VARYING flag
|
||||
* set. The valid mask and ray have both to be aligned to
|
||||
* sizeof(varing float) bytes. */
|
||||
void rtcOccluded (RTCScene scene, varying RTCRay& ray);
|
||||
|
||||
|
||||
/*! Tests if a stream of N rays on AOS layout is occluded by the
|
||||
* scene. This function can only be called for scenes with the
|
||||
* RTC_INTERSECTN flag set. The stride specifies the offset between
|
||||
* rays in bytes.*/
|
||||
void rtcOccludedN (RTCScene scene, uniform RTCRay* uniform rayN, const uniform size_t N, const uniform size_t stride, const uniform size_t flags);
|
||||
|
||||
/*! Intersects one or multiple streams of N rays in compact SOA layout with the scene. This
|
||||
* function can only be called for scenes with the RTC_INTERSECTN
|
||||
* flag set. 'streams' specifies the number of dense SOA ray
|
||||
* streams, and 'stride' the offset in bytes between those. */
|
||||
void rtcOccludedN_SOA (RTCScene scene, uniform RTCRaySOA& rayN, const uniform size_t N, const uniform size_t streams, const uniform size_t offset, const uniform size_t flags);
|
||||
|
||||
/*! Deletes the geometry again. */
|
||||
void rtcDeleteScene (RTCScene scene);
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue