11// ======================================================================== //
2- // Copyright 2009-2015 Intel Corporation //
2+ // Copyright 2009-2017 Intel Corporation //
33// //
44// Licensed under the Apache License, Version 2.0 (the "License"); //
55// you may not use this file except in compliance with the License. //
2020#include <stddef.h>
2121#include <sys/types.h>
2222
23+ #include "rtcore_version.h"
24+
2325#if defined(_WIN32 )
2426#if defined(_M_X64 )
2527typedef long long ssize_t ;
@@ -29,7 +31,7 @@ typedef int ssize_t;
2931#endif
3032
3133#ifndef RTCORE_API
32- #if defined(_WIN32 ) && !defined(ENABLE_STATIC_LIB )
34+ #if defined(_WIN32 ) && !defined(EMBREE_STATIC_LIB )
3335# define RTCORE_API extern "C" __declspec(dllimport)
3436#else
3537# define RTCORE_API extern "C"
@@ -42,19 +44,21 @@ typedef int ssize_t;
4244# define RTCORE_ALIGN (...) __attribute__((aligned(__VA_ARGS__)))
4345#endif
4446
47+ #if !defined (RTCORE_DEPRECATED )
4548#ifdef __GNUC__
4649 #define RTCORE_DEPRECATED __attribute__((deprecated))
4750#elif defined(_MSC_VER )
4851 #define RTCORE_DEPRECATED __declspec(deprecated)
4952#else
5053 #define RTCORE_DEPRECATED
5154#endif
55+ #endif
5256
53- /*! Embree API version */
54- #define RTCORE_VERSION_MAJOR @EMBREE_VERSION_MAJOR@
55- #define RTCORE_VERSION_MINOR @EMBREE_VERSION_MINOR@
56- #define RTCORE_VERSION_PATCH @EMBREE_VERSION_PATCH@
57- #define RTCORE_VERSION @EMBREE_VERSION_NUMBER@
57+ #if defined( _WIN32 )
58+ # define RTCORE_FORCEINLINE __forceinline
59+ #else
60+ # define RTCORE_FORCEINLINE inline __attribute__((always_inline))
61+ #endif
5862
5963/*! \file rtcore.h Defines the Embree Ray Tracing Kernel API for C and C++
6064
@@ -65,6 +69,13 @@ typedef int ssize_t;
6569
6670/*! \{ */
6771
72+ /*! Axis aligned bounding box representation */
73+ struct RTCORE_ALIGN (16 ) RTCBounds
74+ {
75+ float lower_x , lower_y , lower_z , align0 ;
76+ float upper_x , upper_y , upper_z , align1 ;
77+ };
78+
6879/*! \brief Defines an opaque device type */
6980typedef struct __RTCDevice {}* RTCDevice ;
7081
@@ -89,15 +100,14 @@ RTCORE_API RTCDevice rtcNewDevice(const char* cfg = NULL);
89100/*! \brief Deletes an Embree device.
90101
91102 Deletes the Embree device again. After deletion, all scene handles
92- are invalid. The application should invoke this call before
93- terminating. */
103+ are invalid. */
94104RTCORE_API void rtcDeleteDevice (RTCDevice device );
95105
96106/*! \brief Initializes the Embree ray tracing core
97107
98108 WARNING: This function is deprecated, use rtcNewDevice instead.
99109
100- Initializes the ray tracing core and passed some configuration
110+ Initializes the ray tracing core and passes some configuration
101111 string. The configuration string allows to configure implementation
102112 specific parameters. If this string is NULL, a default configuration
103113 is used. The following configuration flags are supported by the
@@ -124,22 +134,58 @@ RTCORE_API RTCORE_DEPRECATED void rtcExit();
124134
125135/*! \brief Parameters that can get configured using the rtcSetParameter functions. */
126136enum RTCParameter {
127- RTC_SOFTWARE_CACHE_SIZE = 0 /*! Configures the software cache size (used
128- to cache subdivision surfaces for
129- instance). The size is specified as an
130- integer number of bytes. The software
131- cache cannot be configured during
132- rendering. */
137+ RTC_SOFTWARE_CACHE_SIZE = 0 , /*! Configures the software cache size (used
138+ to cache subdivision surfaces for
139+ instance). The size is specified as an
140+ integer number of bytes. The software
141+ cache cannot be configured during
142+ rendering. (write only) */
143+
144+ RTC_CONFIG_INTERSECT1 = 1 , //!< checks if rtcIntersect1 is supported (read only)
145+ RTC_CONFIG_INTERSECT4 = 2 , //!< checks if rtcIntersect4 is supported (read only)
146+ RTC_CONFIG_INTERSECT8 = 3 , //!< checks if rtcIntersect8 is supported (read only)
147+ RTC_CONFIG_INTERSECT16 = 4 , //!< checks if rtcIntersect16 is supported (read only)
148+ RTC_CONFIG_INTERSECT_STREAM = 5 , //!< checks if rtcIntersect1M, rtcIntersectNM and rtcIntersectNp are supported (read only)
149+
150+ RTC_CONFIG_RAY_MASK = 6 , //!< checks if ray masks are supported (read only)
151+ RTC_CONFIG_BACKFACE_CULLING = 7 , //!< checks if backface culling is supported (read only)
152+ RTC_CONFIG_INTERSECTION_FILTER = 8 , //!< checks if intersection filters are enabled (read only)
153+ RTC_CONFIG_INTERSECTION_FILTER_RESTORE = 9 , //!< checks if intersection filters restores previous hit (read only)
154+ RTC_CONFIG_IGNORE_INVALID_RAYS = 11 , //!< checks if invalid rays are ignored (read only)
155+ RTC_CONFIG_TASKING_SYSTEM = 12 , //!< return used tasking system (0 = INTERNAL, 1 = TBB) (read only)
156+
157+ RTC_CONFIG_VERSION_MAJOR = 13 , //!< returns Embree major version (read only)
158+ RTC_CONFIG_VERSION_MINOR = 14 , //!< returns Embree minor version (read only)
159+ RTC_CONFIG_VERSION_PATCH = 15 , //!< returns Embree patch version (read only)
160+ RTC_CONFIG_VERSION = 16 , //!< returns Embree version as integer (e.g. Embree v2.8.2 -> 20802) (read only)
161+
162+ RTC_CONFIG_TRIANGLE_GEOMETRY = 17 , //!< checks if triangle geometries are supported
163+ RTC_CONFIG_QUAD_GEOMETRY = 18 , //!< checks if quad geometries are supported
164+ RTC_CONFIG_LINE_GEOMETRY = 19 , //!< checks if line geometries are supported
165+ RTC_CONFIG_HAIR_GEOMETRY = 20 , //!< checks if hair geometries are supported
166+ RTC_CONFIG_SUBDIV_GEOMETRY = 21 , //!< checks if subdiv geometries are supported
167+ RTC_CONFIG_USER_GEOMETRY = 22 , //!< checks if user geometries are supported
168+
169+ RTC_CONFIG_COMMIT_JOIN = 23 , //!< checks if rtcCommitJoin can be used to join build operation (not supported when compiled with some older TBB versions)
170+ RTC_CONFIG_COMMIT_THREAD = 24 , //!< checks if rtcCommitThread is available (not supported when compiled with some older TBB versions)
133171};
134172
135173/*! \brief Configures some parameters.
136174 WARNING: This function is deprecated, use rtcDeviceSetParameter1i instead.
137175*/
138176RTCORE_API RTCORE_DEPRECATED void rtcSetParameter1i (const RTCParameter parm , ssize_t val );
139177
178+ /*! \brief Reads some device parameter.
179+ WARNING: This function is deprecated, use rtcDeviceGetParameter1i instead.
180+ */
181+ RTCORE_API RTCORE_DEPRECATED ssize_t rtcGetParameter1i (const RTCParameter parm );
182+
140183/*! \brief Configures some device parameters. */
141184RTCORE_API void rtcDeviceSetParameter1i (RTCDevice device , const RTCParameter parm , ssize_t val );
142185
186+ /*! \brief Reads some device parameter. */
187+ RTCORE_API ssize_t rtcDeviceGetParameter1i (RTCDevice device , const RTCParameter parm );
188+
143189/*! \brief Error codes returned by the rtcGetError function. */
144190enum RTCError {
145191 RTC_NO_ERROR = 0 , //!< No error has been recorded.
@@ -167,41 +213,68 @@ RTCORE_API RTCORE_DEPRECATED RTCError rtcGetError();
167213 currently stored error and clears the error flag again. */
168214RTCORE_API RTCError rtcDeviceGetError (RTCDevice device );
169215
170- /*! \brief Type of error callback function. */
171- typedef void (* RTCErrorFunc )(const RTCError code , const char * str );
216+ /*! \brief Type of error callback function.
217+ WARNING: This callback function is deprecated, use RTCErrorFunc2 instead.
218+ */
219+ /*RTCORE_DEPRECATED*/ typedef void (* RTCErrorFunc )(const RTCError code , const char * str );
172220RTCORE_DEPRECATED typedef RTCErrorFunc RTC_ERROR_FUNCTION ;
173221
222+ /*! \brief Type of error callback function. */
223+ typedef void (* RTCErrorFunc2 )(void * userPtr , const RTCError code , const char * str );
224+
174225/*! \brief Sets a callback function that is called whenever an error occurs.
175- WARNING: This function is deprecated, use rtcDeviceSetErrorFunction instead.
226+ WARNING: This function is deprecated, use rtcDeviceSetErrorFunction2 instead.
176227 */
177228RTCORE_API RTCORE_DEPRECATED void rtcSetErrorFunction (RTCErrorFunc func );
178229
230+ /*! \brief Sets a callback function that is called whenever an error occurs.
231+ WARNING: This function is deprecated, use rtcDeviceSetErrorFunction2 instead.
232+ */
233+ RTCORE_API RTCORE_DEPRECATED void rtcDeviceSetErrorFunction (RTCDevice device , RTCErrorFunc func );
234+
179235/*! \brief Sets a callback function that is called whenever an error occurs. */
180- RTCORE_API void rtcDeviceSetErrorFunction (RTCDevice device , RTCErrorFunc func );
236+ RTCORE_API void rtcDeviceSetErrorFunction2 (RTCDevice device , RTCErrorFunc2 func , void * userPtr );
181237
182- /*! \brief Type of memory consumption callback function. */
183- typedef bool (* RTCMemoryMonitorFunc )(const ssize_t bytes , const bool post );
238+ /*! \brief Type of memory consumption callback function.
239+ WARNING: This callback function is deprecated, use RTCMemoryMonitorFunc2 instead.
240+ */
241+ /*RTCORE_DEPRECATED*/ typedef bool (* RTCMemoryMonitorFunc )(const ssize_t bytes , const bool post );
184242RTCORE_DEPRECATED typedef RTCMemoryMonitorFunc RTC_MEMORY_MONITOR_FUNCTION ;
185243
244+ /*! \brief Type of memory consumption callback function. */
245+ typedef bool (* RTCMemoryMonitorFunc2 )(void * ptr , const ssize_t bytes , const bool post );
246+
186247/*! \brief Sets the memory consumption callback function which is
187248 * called before or after the library allocates or frees memory.
188- WARNING: This function is deprecated, use rtcDeviceSetMemoryMonitorFunction instead.
249+ WARNING: This function is deprecated, use rtcDeviceSetMemoryMonitorFunction2 instead.
189250*/
190251RTCORE_API RTCORE_DEPRECATED void rtcSetMemoryMonitorFunction (RTCMemoryMonitorFunc func );
191252
192253/*! \brief Sets the memory consumption callback function which is
193- * called before or after the library allocates or frees memory. */
194- RTCORE_API void rtcDeviceSetMemoryMonitorFunction (RTCDevice device , RTCMemoryMonitorFunc func );
254+ * called before or after the library allocates or frees memory.
255+ WARNING: This function is deprecated, use rtcDeviceSetMemoryMonitorFunction2 instead.
256+ */
257+ RTCORE_API RTCORE_DEPRECATED void rtcDeviceSetMemoryMonitorFunction (RTCDevice device , RTCMemoryMonitorFunc func );
258+
259+ /*! \brief Sets the memory consumption callback function which is
260+ * called before or after the library allocates or frees memory. The
261+ * userPtr pointer is passed to each invokation of the callback
262+ * function. */
263+ RTCORE_API void rtcDeviceSetMemoryMonitorFunction2 (RTCDevice device , RTCMemoryMonitorFunc2 func , void * userPtr );
195264
196- /*! \brief Implementation specific (do not call) .
265+ /*! \brief Implementation specific.
197266
198267 This function is implementation specific and only for debugging
199- purposes. Do not call it. */
268+ purposes.
269+
270+ WARNING: This function is deprecated do not use it.
271+ */
200272RTCORE_API RTCORE_DEPRECATED void rtcDebug (); // FIXME: remove
201273
202274#include "rtcore_scene.h"
203275#include "rtcore_geometry.h"
204276#include "rtcore_geometry_user.h"
277+ #include "rtcore_builder.h"
205278
206279/*! \brief Helper to easily combing scene flags */
207280inline RTCSceneFlags operator |(const RTCSceneFlags a , const RTCSceneFlags b ) {
0 commit comments