Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
rtcore.h File Reference
#include <stddef.h>
#include <sys/types.h>
#include "rtcore_scene.h"
#include "rtcore_geometry.h"
#include "rtcore_geometry_user.h"
+ Include dependency graph for rtcore.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  __RTCDevice
 Defines an opaque device type. More...
 

Macros

#define RTCORE_API   extern "C"
 
#define RTCORE_ALIGN(...)   __attribute__((aligned(__VA_ARGS__)))
 
#define RTCORE_DEPRECATED
 
#define RTCORE_VERSION_MAJOR   2
 
#define RTCORE_VERSION_MINOR   9
 
#define RTCORE_VERSION_PATCH   0
 
#define RTCORE_VERSION   20900
 
enum  RTCParameter {
  RTC_SOFTWARE_CACHE_SIZE = 0 , RTC_CONFIG_INTERSECT1 = 1 , RTC_CONFIG_INTERSECT4 = 2 , RTC_CONFIG_INTERSECT8 = 3 ,
  RTC_CONFIG_INTERSECT16 = 4 , RTC_CONFIG_INTERSECTN = 5 , RTC_CONFIG_RAY_MASK = 6 , RTC_CONFIG_BACKFACE_CULLING = 7 ,
  RTC_CONFIG_INTERSECTION_FILTER = 8 , RTC_CONFIG_INTERSECTION_FILTER_RESTORE = 9 , RTC_CONFIG_BUFFER_STRIDE = 10 , RTC_CONFIG_IGNORE_INVALID_RAYS = 11 ,
  RTC_CONFIG_TASKING_SYSTEM = 12 , RTC_CONFIG_VERSION_MAJOR = 13 , RTC_CONFIG_VERSION_MINOR = 14 , RTC_CONFIG_VERSION_PATCH = 15 ,
  RTC_CONFIG_VERSION = 16
}
 Parameters that can get configured using the rtcSetParameter functions. More...
 
enum  RTCError {
  RTC_NO_ERROR = 0 , RTC_UNKNOWN_ERROR = 1 , RTC_INVALID_ARGUMENT = 2 , RTC_INVALID_OPERATION = 3 ,
  RTC_OUT_OF_MEMORY = 4 , RTC_UNSUPPORTED_CPU = 5 , RTC_CANCELLED = 6
}
 Error codes returned by the rtcGetError function. More...
 
typedef struct __RTCDeviceRTCDevice
 Defines an opaque device type.
 
typedef void(* RTCErrorFunc) (const RTCError code, const char *str)
 Type of error callback function.
 
typedef bool(* RTCMemoryMonitorFunc) (const ssize_t bytes, const bool post)
 Type of memory consumption callback function.
 
RTCORE_DEPRECATED typedef RTCErrorFunc RTC_ERROR_FUNCTION
 
RTCORE_DEPRECATED typedef RTCMemoryMonitorFunc RTC_MEMORY_MONITOR_FUNCTION
 
struct RTCORE_ALIGN (16) RTCBounds
 
RTCORE_API RTCDevice rtcNewDevice (const char *cfg=NULL)
 Creates a new Embree device.
 
RTCORE_API void rtcDeleteDevice (RTCDevice device)
 Deletes an Embree device.
 
RTCORE_API RTCORE_DEPRECATED void rtcInit (const char *cfg=NULL)
 Initializes the Embree ray tracing core.
 
RTCORE_API RTCORE_DEPRECATED void rtcExit ()
 Shuts down Embree.
 
RTCORE_API RTCORE_DEPRECATED void rtcSetParameter1i (const RTCParameter parm, ssize_t val)
 Configures some parameters. WARNING: This function is deprecated, use rtcDeviceSetParameter1i instead.
 
RTCORE_API RTCORE_DEPRECATED ssize_t rtcGetParameter1i (const RTCParameter parm)
 Reads some device parameter. WARNING: This function is deprecated, use rtcDeviceGetParameter1i instead.
 
RTCORE_API void rtcDeviceSetParameter1i (RTCDevice device, const RTCParameter parm, ssize_t val)
 Configures some device parameters.
 
RTCORE_API ssize_t rtcDeviceGetParameter1i (RTCDevice device, const RTCParameter parm)
 Reads some device parameter.
 
RTCORE_API RTCORE_DEPRECATED RTCError rtcGetError ()
 Returns the value of the per-thread error flag.
 
RTCORE_API RTCError rtcDeviceGetError (RTCDevice device)
 Returns the value of the per-thread error flag.
 
RTCORE_API RTCORE_DEPRECATED void rtcSetErrorFunction (RTCErrorFunc func)
 Sets a callback function that is called whenever an error occurs. WARNING: This function is deprecated, use rtcDeviceSetErrorFunction instead.
 
RTCORE_API void rtcDeviceSetErrorFunction (RTCDevice device, RTCErrorFunc func)
 Sets a callback function that is called whenever an error occurs.
 
RTCORE_API RTCORE_DEPRECATED void rtcSetMemoryMonitorFunction (RTCMemoryMonitorFunc func)
 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 void rtcDeviceSetMemoryMonitorFunction (RTCDevice device, RTCMemoryMonitorFunc func)
 Sets the memory consumption callback function which is called before or after the library allocates or frees memory.
 
RTCORE_API RTCORE_DEPRECATED void rtcDebug ()
 Implementation specific (do not call).
 
RTCSceneFlags operator| (const RTCSceneFlags a, const RTCSceneFlags b)
 Helper to easily combing scene flags.
 
RTCAlgorithmFlags operator| (const RTCAlgorithmFlags a, const RTCAlgorithmFlags b)
 Helper to easily combing algorithm flags.
 
RTCGeometryFlags operator| (const RTCGeometryFlags a, const RTCGeometryFlags b)
 Helper to easily combing geometry flags.
 

Detailed Description

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.

Definition in file rtcore.h.


Class Documentation

◆ __RTCDevice

struct __RTCDevice

Defines an opaque device type.

Macro Definition Documentation

◆ RTCORE_ALIGN

#define RTCORE_ALIGN (   ...)    __attribute__((aligned(__VA_ARGS__)))

◆ RTCORE_API

#define RTCORE_API   extern "C"

◆ RTCORE_DEPRECATED

#define RTCORE_DEPRECATED

◆ RTCORE_VERSION

#define RTCORE_VERSION   20900

◆ RTCORE_VERSION_MAJOR

#define RTCORE_VERSION_MAJOR   2

Embree API version

◆ RTCORE_VERSION_MINOR

#define RTCORE_VERSION_MINOR   9

◆ RTCORE_VERSION_PATCH

#define RTCORE_VERSION_PATCH   0

Typedef Documentation

◆ RTCDevice

typedef struct __RTCDevice* RTCDevice

Defines an opaque device type.

◆ RTCErrorFunc

typedef void(* RTCErrorFunc) (const RTCError code, const char *str)

Type of error callback function.

◆ RTCMemoryMonitorFunc

typedef bool(* RTCMemoryMonitorFunc) (const ssize_t bytes, const bool post)

Type of memory consumption callback function.

Enumeration Type Documentation

◆ RTCError

enum RTCError

Error codes returned by the rtcGetError function.

Enumerator
RTC_NO_ERROR 

No error has been recorded.

RTC_UNKNOWN_ERROR 

An unknown error has occured.

RTC_INVALID_ARGUMENT 

An invalid argument is specified.

RTC_INVALID_OPERATION 

The operation is not allowed for the specified object.

RTC_OUT_OF_MEMORY 

There is not enough memory left to execute the command.

RTC_UNSUPPORTED_CPU 

The CPU is not supported as it does not support SSE2.

RTC_CANCELLED 

The user has cancelled the operation through the RTC_PROGRESS_MONITOR_FUNCTION callback.

178 {
179 RTC_NO_ERROR = 0,
185 RTC_CANCELLED = 6,
186};
@ RTC_UNKNOWN_ERROR
An unknown error has occured.
Definition rtcore.h:180
@ RTC_UNSUPPORTED_CPU
The CPU is not supported as it does not support SSE2.
Definition rtcore.h:184
@ RTC_INVALID_OPERATION
The operation is not allowed for the specified object.
Definition rtcore.h:182
@ RTC_INVALID_ARGUMENT
An invalid argument is specified.
Definition rtcore.h:181
@ RTC_OUT_OF_MEMORY
There is not enough memory left to execute the command.
Definition rtcore.h:183
@ RTC_CANCELLED
The user has cancelled the operation through the RTC_PROGRESS_MONITOR_FUNCTION callback.
Definition rtcore.h:185
@ RTC_NO_ERROR
No error has been recorded.
Definition rtcore.h:179

◆ RTCParameter

Parameters that can get configured using the rtcSetParameter functions.

Enumerator
RTC_SOFTWARE_CACHE_SIZE 
RTC_CONFIG_INTERSECT1 

checks if rtcIntersect1 is supported (read only)

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_INTERSECT4 

checks if rtcIntersect4 is supported (read only)

RTC_CONFIG_INTERSECT8 

checks if rtcIntersect8 is supported (read only)

RTC_CONFIG_INTERSECT16 

checks if rtcIntersect16 is supported (read only)

RTC_CONFIG_INTERSECTN 

checks if rtcIntersectN is supported (read only)

RTC_CONFIG_RAY_MASK 

checks if ray masks are supported (read only)

RTC_CONFIG_BACKFACE_CULLING 

checks if backface culling is supported (read only)

RTC_CONFIG_INTERSECTION_FILTER 

checks if intersection filters are enabled (read only)

RTC_CONFIG_INTERSECTION_FILTER_RESTORE 

checks if intersection filters restores previous hit (read only)

RTC_CONFIG_BUFFER_STRIDE 

checks if buffer strides are supported (read only)

RTC_CONFIG_IGNORE_INVALID_RAYS 

checks if invalid rays are ignored (read only)

RTC_CONFIG_TASKING_SYSTEM 

return used tasking system (0 = INTERNAL, 1 = TBB) (read only)

RTC_CONFIG_VERSION_MAJOR 

returns Embree major version (read only)

RTC_CONFIG_VERSION_MINOR 

returns Embree minor version (read only)

RTC_CONFIG_VERSION_PATCH 

returns Embree patch version (read only)

RTC_CONFIG_VERSION 

returns Embree version as integer (e.g. Embree v2.8.2 -> 20802) (read only)

133 {
146
154
158 RTC_CONFIG_VERSION = 16,
159};
@ RTC_CONFIG_RAY_MASK
checks if ray masks are supported (read only)
Definition rtcore.h:147
@ RTC_CONFIG_VERSION_PATCH
returns Embree patch version (read only)
Definition rtcore.h:157
@ RTC_CONFIG_INTERSECTION_FILTER
checks if intersection filters are enabled (read only)
Definition rtcore.h:149
@ RTC_CONFIG_TASKING_SYSTEM
return used tasking system (0 = INTERNAL, 1 = TBB) (read only)
Definition rtcore.h:153
@ RTC_CONFIG_VERSION_MINOR
returns Embree minor version (read only)
Definition rtcore.h:156
@ RTC_CONFIG_INTERSECTION_FILTER_RESTORE
checks if intersection filters restores previous hit (read only)
Definition rtcore.h:150
@ RTC_CONFIG_BUFFER_STRIDE
checks if buffer strides are supported (read only)
Definition rtcore.h:151
@ RTC_CONFIG_INTERSECT8
checks if rtcIntersect8 is supported (read only)
Definition rtcore.h:143
@ RTC_CONFIG_BACKFACE_CULLING
checks if backface culling is supported (read only)
Definition rtcore.h:148
@ RTC_SOFTWARE_CACHE_SIZE
Definition rtcore.h:134
@ RTC_CONFIG_VERSION_MAJOR
returns Embree major version (read only)
Definition rtcore.h:155
@ RTC_CONFIG_VERSION
returns Embree version as integer (e.g. Embree v2.8.2 -> 20802) (read only)
Definition rtcore.h:158
@ RTC_CONFIG_IGNORE_INVALID_RAYS
checks if invalid rays are ignored (read only)
Definition rtcore.h:152
@ RTC_CONFIG_INTERSECT4
checks if rtcIntersect4 is supported (read only)
Definition rtcore.h:142
@ RTC_CONFIG_INTERSECT1
checks if rtcIntersect1 is supported (read only)
Definition rtcore.h:141
@ RTC_CONFIG_INTERSECT16
checks if rtcIntersect16 is supported (read only)
Definition rtcore.h:144
@ RTC_CONFIG_INTERSECTN
checks if rtcIntersectN is supported (read only)
Definition rtcore.h:145

Function Documentation

◆ operator|() [1/3]

Helper to easily combing algorithm flags.

246 {
247 return (RTCAlgorithmFlags)((size_t)a | (size_t)b);
248}
RTCAlgorithmFlags
Definition rtcore_scene.h:49

◆ operator|() [2/3]

Helper to easily combing geometry flags.

251 {
252 return (RTCGeometryFlags)((size_t)a | (size_t)b);
253}
RTCGeometryFlags
Supported geometry flags to specify handling in dynamic scenes.
Definition rtcore_geometry.h:59

◆ operator|() [3/3]

RTCSceneFlags operator| ( const RTCSceneFlags  a,
const RTCSceneFlags  b 
)
inline

Helper to easily combing scene flags.

241 {
242 return (RTCSceneFlags)((size_t)a | (size_t)b);
243}
RTCSceneFlags
Definition rtcore_scene.h:32

◆ rtcDebug()

Implementation specific (do not call).

This function is implementation specific and only for debugging purposes. Do not call it.

◆ rtcDeleteDevice()

RTCORE_API void rtcDeleteDevice ( RTCDevice  device)

Deletes an Embree device.

Deletes the Embree device again. After deletion, all scene handles are invalid. The application should invoke this call before terminating.

◆ rtcDeviceGetError()

RTCORE_API RTCError rtcDeviceGetError ( RTCDevice  device)

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.

◆ rtcDeviceGetParameter1i()

RTCORE_API ssize_t rtcDeviceGetParameter1i ( RTCDevice  device,
const RTCParameter  parm 
)

Reads some device parameter.

◆ rtcDeviceSetErrorFunction()

RTCORE_API void rtcDeviceSetErrorFunction ( RTCDevice  device,
RTCErrorFunc  func 
)

Sets a callback function that is called whenever an error occurs.

◆ rtcDeviceSetMemoryMonitorFunction()

RTCORE_API void rtcDeviceSetMemoryMonitorFunction ( RTCDevice  device,
RTCMemoryMonitorFunc  func 
)

Sets the memory consumption callback function which is called before or after the library allocates or frees memory.

◆ rtcDeviceSetParameter1i()

RTCORE_API void rtcDeviceSetParameter1i ( RTCDevice  device,
const RTCParameter  parm,
ssize_t  val 
)

Configures some device parameters.

◆ rtcExit()

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.

Referenced by igl::embree::EmbreeIntersector::global_deinit().

+ Here is the caller graph for this function:

◆ rtcGetError()

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.

Referenced by igl::embree::EmbreeIntersector::deinit(), igl::embree::EmbreeIntersector::global_init(), igl::embree::EmbreeIntersector::init(), and igl::embree::EmbreeIntersector::intersectRay().

+ Here is the caller graph for this function:

◆ rtcGetParameter1i()

RTCORE_API RTCORE_DEPRECATED ssize_t rtcGetParameter1i ( const RTCParameter  parm)

Reads some device parameter. WARNING: This function is deprecated, use rtcDeviceGetParameter1i instead.

◆ rtcInit()

RTCORE_API RTCORE_DEPRECATED void rtcInit ( const char *  cfg = NULL)

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.

Referenced by igl::embree::EmbreeIntersector::global_init().

+ Here is the caller graph for this function:

◆ rtcNewDevice()

RTCORE_API RTCDevice rtcNewDevice ( const char *  cfg = NULL)

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_ALIGN()

struct RTCORE_ALIGN ( 16  )

Axis aligned bounding box representation

Ray structure for packets of 4 rays.

< x coordinate of ray origin

< y coordinate of ray origin

< z coordinate of ray origin

< x coordinate of ray direction

< y coordinate of ray direction

< z coordinate of ray direction

< Start of ray segment

< End of ray segment (set to hit distance)

< Time of this ray for motion blur

< Used to mask out objects during traversal

< x coordinate of geometry normal

< y coordinate of geometry normal

< z coordinate of geometry normal

< Barycentric u coordinate of hit

< Barycentric v coordinate of hit

< geometry ID

< primitive ID

< instance ID

70{
71 float lower_x, lower_y, lower_z, align0;
72 float upper_x, upper_y, upper_z, align1;
73};

◆ rtcSetErrorFunction()

RTCORE_API RTCORE_DEPRECATED void rtcSetErrorFunction ( RTCErrorFunc  func)

Sets a callback function that is called whenever an error occurs. WARNING: This function is deprecated, use rtcDeviceSetErrorFunction instead.

◆ rtcSetMemoryMonitorFunction()

RTCORE_API RTCORE_DEPRECATED void rtcSetMemoryMonitorFunction ( RTCMemoryMonitorFunc  func)

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.

◆ rtcSetParameter1i()

RTCORE_API RTCORE_DEPRECATED void rtcSetParameter1i ( const RTCParameter  parm,
ssize_t  val 
)

Configures some parameters. WARNING: This function is deprecated, use rtcDeviceSetParameter1i instead.

Variable Documentation

◆ RTC_ERROR_FUNCTION

RTCORE_DEPRECATED typedef RTCErrorFunc RTC_ERROR_FUNCTION

◆ RTC_MEMORY_MONITOR_FUNCTION

RTCORE_DEPRECATED typedef RTCMemoryMonitorFunc RTC_MEMORY_MONITOR_FUNCTION