11// ======================================================================== //
2- // Copyright 2009-2014 Intel Corporation //
2+ // Copyright 2009-2015 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. //
1818#define __RTCORE_H__
1919
2020#include <stddef.h>
21- // read configuration generated by CMake
22- #include "config.h"
21+ #include <sys/types.h>
22+
23+ #if defined(_WIN32 )
24+ #if defined(_M_X64 )
25+ typedef long long ssize_t ;
26+ #else
27+ typedef int ssize_t ;
28+ #endif
29+ #endif
2330
2431#ifndef RTCORE_API
25- #if defined(_WIN32 ) && defined(BUILD_EMBREE_SHARED_LIB )
32+ #if defined(_WIN32 ) && ! defined(ENABLE_STATIC_LIB )
2633# define RTCORE_API extern "C" __declspec(dllimport)
2734#else
2835# define RTCORE_API extern "C"
3542# define RTCORE_ALIGN (...) __attribute__((aligned(__VA_ARGS__)))
3643#endif
3744
38- #include "rtcore_scene.h"
39- #include "rtcore_geometry.h"
40- #include "rtcore_geometry_user.h"
45+ #ifdef __GNUC__
46+ #define RTCORE_DEPRECATED __attribute__((deprecated))
47+ #elif defined(_MSC_VER )
48+ #define RTCORE_DEPRECATED __declspec(deprecated)
49+ #else
50+ #define RTCORE_DEPRECATED
51+ #endif
52+
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@
4158
4259/*! \file rtcore.h Defines the Embree Ray Tracing Kernel API for C and C++
4360
4865
4966/*! \{ */
5067
68+ /*! \brief Defines an opaque device type */
69+ typedef struct __RTCDevice {}* RTCDevice ;
70+
71+ /*! \brief Creates a new Embree device.
72+
73+ Creates a new Embree device to be used by the application. An
74+ application typically creates only a single Embree device, but it is
75+ valid to use multiple devices inside an application. A configuration
76+ string can be passed at construction time, that allows to configure
77+ implementation specific parameters. If this string is NULL, a
78+ default configuration is used. The following configuration flags are
79+ supported by the Embree implementation of the API:
80+
81+ verbose = num, // sets verbosity level (default is 0)
82+
83+ If Embree is started on an unsupported CPU, rtcNewDevice will fail and
84+ set the RTC_UNSUPPORTED_CPU error code.
85+
86+ */
87+ RTCORE_API RTCDevice rtcNewDevice (const char * cfg = NULL );
88+
89+ /*! \brief Deletes an Embree device.
90+
91+ Deletes the Embree device again. After deletion, all scene handles
92+ are invalid. The application should invoke this call before
93+ terminating. */
94+ RTCORE_API void rtcDeleteDevice (RTCDevice device );
95+
5196/*! \brief Initializes the Embree ray tracing core
5297
98+ WARNING: This function is deprecated, use rtcNewDevice instead.
99+
53100 Initializes the ray tracing core and passed some configuration
54101 string. The configuration string allows to configure implementation
55102 specific parameters. If this string is NULL, a default configuration
56103 is used. The following configuration flags are supported by the
57104 Embree implementation of the API:
58105
59- threads = num, // sets the number of threads to use (default is to use all threads)
60106 verbose = num, // sets verbosity level (default is 0)
61107
62108 If Embree is started on an unsupported CPU, rtcInit will fail and
63109 set the RTC_UNSUPPORTED_CPU error code.
64110
65111*/
66- RTCORE_API void rtcInit (const char * cfg = NULL );
112+ RTCORE_API RTCORE_DEPRECATED void rtcInit (const char * cfg = NULL );
67113
68- /*! \brief Shuts down Embree.
114+ /*! \brief Shuts down Embree
115+
116+ WARNING: This function is deprecated, use rtcDeleteDevice instead.
69117
70118 Shuts down the ray tracing core. After shutdown, all scene handles
71119 are invalid, and invoking any API call except rtcInit is not
72120 allowed. The application should invoke this call before
73121 terminating. It is safe to call rtcInit again after an rtcExit
74122 call. */
75- RTCORE_API void rtcExit ();
123+ RTCORE_API RTCORE_DEPRECATED void rtcExit ();
124+
125+ /*! \brief Parameters that can get configured using the rtcSetParameter functions. */
126+ enum 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. */
133+ };
134+
135+ /*! \brief Configures some parameters.
136+ WARNING: This function is deprecated, use rtcDeviceSetParameter1i instead.
137+ */
138+ RTCORE_API RTCORE_DEPRECATED void rtcSetParameter1i (const RTCParameter parm , ssize_t val );
139+
140+ /*! \brief Configures some device parameters. */
141+ RTCORE_API void rtcDeviceSetParameter1i (RTCDevice device , const RTCParameter parm , ssize_t val );
76142
77143/*! \brief Error codes returned by the rtcGetError function. */
78144enum RTCError {
@@ -82,26 +148,60 @@ enum RTCError {
82148 RTC_INVALID_OPERATION = 3 , //!< The operation is not allowed for the specified object.
83149 RTC_OUT_OF_MEMORY = 4 , //!< There is not enough memory left to execute the command.
84150 RTC_UNSUPPORTED_CPU = 5 , //!< The CPU is not supported as it does not support SSE2.
151+ RTC_CANCELLED = 6 , //!< The user has cancelled the operation through the RTC_PROGRESS_MONITOR_FUNCTION callback
85152};
86153
87154/*! \brief Returns the value of the per-thread error flag.
88155
156+ WARNING: This function is deprecated, use rtcDeviceGetError instead.
157+
89158 If an error occurs this flag is set to an error code if it stores no
90159 previous error. The rtcGetError function reads and returns the
91160 currently stored error and clears the error flag again. */
92- RTCORE_API RTCError rtcGetError ();
161+ RTCORE_API RTCORE_DEPRECATED RTCError rtcGetError ();
162+
163+ /*! \brief Returns the value of the per-thread error flag.
164+
165+ If an error occurs this flag is set to an error code if it stores no
166+ previous error. The rtcGetError function reads and returns the
167+ currently stored error and clears the error flag again. */
168+ RTCORE_API RTCError rtcDeviceGetError (RTCDevice device );
93169
94170/*! \brief Type of error callback function. */
95- typedef void (* RTC_ERROR_FUNCTION )(const RTCError code , const char * str );
171+ typedef void (* RTCErrorFunc )(const RTCError code , const char * str );
172+ RTCORE_DEPRECATED typedef RTCErrorFunc RTC_ERROR_FUNCTION ;
173+
174+ /*! \brief Sets a callback function that is called whenever an error occurs.
175+ WARNING: This function is deprecated, use rtcDeviceSetErrorFunction instead.
176+ */
177+ RTCORE_API RTCORE_DEPRECATED void rtcSetErrorFunction (RTCErrorFunc func );
96178
97179/*! \brief Sets a callback function that is called whenever an error occurs. */
98- RTCORE_API void rtcSetErrorFunction (RTC_ERROR_FUNCTION func );
180+ RTCORE_API void rtcDeviceSetErrorFunction (RTCDevice device , RTCErrorFunc func );
181+
182+ /*! \brief Type of memory consumption callback function. */
183+ typedef bool (* RTCMemoryMonitorFunc )(const ssize_t bytes , const bool post );
184+ RTCORE_DEPRECATED typedef RTCMemoryMonitorFunc RTC_MEMORY_MONITOR_FUNCTION ;
185+
186+ /*! \brief Sets the memory consumption callback function which is
187+ * called before or after the library allocates or frees memory.
188+ WARNING: This function is deprecated, use rtcDeviceSetMemoryMonitorFunction instead.
189+ */
190+ RTCORE_API RTCORE_DEPRECATED void rtcSetMemoryMonitorFunction (RTCMemoryMonitorFunc func );
191+
192+ /*! \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 );
99195
100196/*! \brief Implementation specific (do not call).
101197
102198 This function is implementation specific and only for debugging
103199 purposes. Do not call it. */
104- RTCORE_API void rtcDebug ();
200+ RTCORE_API RTCORE_DEPRECATED void rtcDebug (); // FIXME: remove
201+
202+ #include "rtcore_scene.h"
203+ #include "rtcore_geometry.h"
204+ #include "rtcore_geometry_user.h"
105205
106206/*! \brief Helper to easily combing scene flags */
107207inline RTCSceneFlags operator |(const RTCSceneFlags a , const RTCSceneFlags b ) {
0 commit comments