star-3d

Surface structuring for efficient 3D geometric queries
git clone git://git.meso-star.fr/star-3d.git
Log | Files | Refs | README | LICENSE

commit 11a367c7346f634c6a7eaa716b51b03e2fb30109
parent 1e1facbf1e6a0727360be5241f00e465c3de1795
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Mon, 21 Sep 2015 16:29:52 +0200

Update the Embree dependency to 2.7

Fix deprecation warnings.

Diffstat:
Mcmake/EmbreeConfig.cmake | 1+
Msrc/s3d_device.c | 14++------------
Msrc/s3d_device_c.h | 4++++
Msrc/s3d_scene.c | 4++--
4 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/cmake/EmbreeConfig.cmake b/cmake/EmbreeConfig.cmake @@ -42,6 +42,7 @@ unset(Embree_LIBRARY_DEBUG CACHE) unset(Embree_LIBRARY_RELWITHDEBINFO CACHE) unset(Embree_LIBRARY_MINSIZEREL CACHE) find_library(Embree_LIBRARY embree DOC "Path to the library embree.") +message(STATUS ${Embree_LIBRARY}) # Create the imported library target if(CMAKE_HOST_WIN32) diff --git a/src/s3d_device.c b/src/s3d_device.c @@ -37,10 +37,6 @@ #include <rsys/logger.h> #include <rsys/mem_allocator.h> -/* Only one instance of embree can be launched. This global variable register - * whether an Embree instance is running or not */ -static ATOMIC g_EmbreeIsInitialized = 0; - /******************************************************************************* * Helper functions ******************************************************************************/ @@ -51,9 +47,8 @@ device_release(ref_T* ref) ASSERT(ref); dev = CONTAINER_OF(ref, struct s3d_device, ref); flist_name_release(&dev->names); + rtcDeleteDevice(dev->rtc); MEM_RM(dev->allocator, dev); - rtcExit(); - ATOMIC_SET(&g_EmbreeIsInitialized, 0); } /******************************************************************************* @@ -74,10 +69,6 @@ s3d_device_create res = RES_BAD_ARG; goto error; } - if(g_EmbreeIsInitialized) { - res = RES_BAD_ARG; - goto error; - } allocator = mem_allocator ? mem_allocator : &mem_default_allocator; dev = (struct s3d_device*)MEM_CALLOC(allocator, 1, sizeof(struct s3d_device)); @@ -90,8 +81,7 @@ s3d_device_create dev->verbose = verbose; flist_name_init(allocator, &dev->names); ref_init(&dev->ref); - rtcInit(verbose ? "verbose=1" : NULL); - g_EmbreeIsInitialized = 1; + dev->rtc = rtcNewDevice(verbose ? "verbose=1" : NULL); exit: if(out_dev) *out_dev = dev; diff --git a/src/s3d_device_c.h b/src/s3d_device_c.h @@ -33,6 +33,8 @@ #ifndef S3D_DEVICE_C_H #define S3D_DEVICE_C_H +#include "s3d_backend.h" + #include <rsys/ref_count.h> #include <rsys/free_list.h> @@ -45,6 +47,8 @@ struct s3d_device { struct logger* logger; struct mem_allocator* allocator; + RTCDevice rtc; /* Embree device */ + struct flist_name names; /* List of shape id */ ref_T ref; diff --git a/src/s3d_scene.c b/src/s3d_scene.c @@ -575,8 +575,8 @@ s3d_scene_create(struct s3d_device* dev, struct s3d_scene** out_scn) S3D(device_ref_get(dev)); scn->dev = dev; scn->session_mask = 0; - scn->rtc_scn = rtcNewScene - (RTC_SCENE_DYNAMIC | RTC_SCENE_INCOHERENT | RTC_SCENE_ROBUST, + scn->rtc_scn = rtcDeviceNewScene + (dev->rtc, RTC_SCENE_DYNAMIC | RTC_SCENE_INCOHERENT | RTC_SCENE_ROBUST, RTC_INTERSECT1 | RTC_INTERSECT4); if(!scn->rtc_scn) { res = RES_MEM_ERR;