Skip to content

Commit c8fec13

Browse files
Port to Embree 4.x
1 parent 6d3b7c7 commit c8fec13

File tree

11 files changed

+24
-28
lines changed

11 files changed

+24
-28
lines changed

cmake/modules/FindEmbree.cmake

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
#=============================================================================
2121

2222
if (APPLE)
23-
set (EMBREE_LIB_NAME libembree3.dylib)
23+
set (EMBREE_LIB_NAME libembree4.dylib)
2424
elseif (UNIX)
25-
set (EMBREE_LIB_NAME libembree3.so)
25+
set (EMBREE_LIB_NAME libembree4.so)
2626
elseif (WIN32)
27-
set (EMBREE_LIB_NAME embree3.lib)
27+
set (EMBREE_LIB_NAME embree4.lib)
2828
endif()
2929

3030
find_library(EMBREE_LIBRARY
@@ -39,20 +39,20 @@ find_library(EMBREE_LIBRARY
3939
)
4040

4141
find_path(EMBREE_INCLUDE_DIR
42-
embree3/rtcore.h
42+
embree4/rtcore.h
4343
HINTS
4444
"${EMBREE_LOCATION}/include"
4545
"$ENV{EMBREE_LOCATION}/include"
4646
DOC
4747
"Embree headers path"
4848
)
4949

50-
if (EMBREE_INCLUDE_DIR AND EXISTS "${EMBREE_INCLUDE_DIR}/embree3/rtcore_version.h" )
51-
file(STRINGS "${EMBREE_INCLUDE_DIR}/embree3/rtcore_version.h" TMP REGEX "^#define RTC_VERSION_MAJOR.*$")
50+
if (EMBREE_INCLUDE_DIR AND EXISTS "${EMBREE_INCLUDE_DIR}/embree4/rtcore_version.h" )
51+
file(STRINGS "${EMBREE_INCLUDE_DIR}/embree4/rtcore_version.h" TMP REGEX "^#define RTC_VERSION_MAJOR.*$")
5252
string(REGEX MATCHALL "[0-9]+" MAJOR ${TMP})
53-
file(STRINGS "${EMBREE_INCLUDE_DIR}/embree3/rtcore_version.h" TMP REGEX "^#define RTC_VERSION_MINOR.*$")
53+
file(STRINGS "${EMBREE_INCLUDE_DIR}/embree4/rtcore_version.h" TMP REGEX "^#define RTC_VERSION_MINOR.*$")
5454
string(REGEX MATCHALL "[0-9]+" MINOR ${TMP})
55-
file(STRINGS "${EMBREE_INCLUDE_DIR}/embree3/rtcore_version.h" TMP REGEX "^#define RTC_VERSION_PATCH.*$")
55+
file(STRINGS "${EMBREE_INCLUDE_DIR}/embree4/rtcore_version.h" TMP REGEX "^#define RTC_VERSION_PATCH.*$")
5656
string(REGEX MATCHALL "[0-9]+" PATCH ${TMP})
5757

5858
set (EMBREE_VERSION ${MAJOR}.${MINOR}.${PATCH})

pxr/imaging/plugin/hdEmbree/context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "pxr/base/gf/matrix4f.h"
1515
#include "pxr/base/vt/array.h"
1616

17-
#include <embree3/rtcore.h>
17+
#include <embree4/rtcore.h>
1818

1919
PXR_NAMESPACE_OPEN_SCOPE
2020

pxr/imaging/plugin/hdEmbree/mesh.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ void HdEmbreeMesh::_EmbreeCullFaces(const RTCFilterFunctionNArguments* args)
203203
default: break;
204204
}
205205
if (cull) {
206-
// This is how you reject a hit in embree3 instead of setting
206+
// This is how you reject a hit in embree3/4 instead of setting
207207
// geomId to invalid on the ray
208208
args->valid[i] = 0;
209209
}

pxr/imaging/plugin/hdEmbree/mesh.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
#include "pxr/imaging/plugin/hdEmbree/meshSamplers.h"
1717

18-
#include <embree3/rtcore.h>
19-
#include <embree3/rtcore_ray.h>
18+
#include <embree4/rtcore.h>
19+
#include <embree4/rtcore_ray.h>
2020

2121
PXR_NAMESPACE_OPEN_SCOPE
2222

pxr/imaging/plugin/hdEmbree/meshSamplers.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#include "pxr/imaging/hd/meshUtil.h"
1313
#include "pxr/base/vt/types.h"
1414

15-
#include <embree3/rtcore.h>
16-
#include <embree3/rtcore_geometry.h>
15+
#include <embree4/rtcore.h>
16+
#include <embree4/rtcore_geometry.h>
1717

1818
#include <bitset>
1919

pxr/imaging/plugin/hdEmbree/pch.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@
8383
#undef toupper
8484
#endif
8585
#endif // PXR_PYTHON_SUPPORT_ENABLED
86-
#include <embree3/rtcore.h>
87-
#include <embree3/rtcore_geometry.h>
88-
#include <embree3/rtcore_ray.h>
86+
#include <embree4/rtcore.h>
87+
#include <embree4/rtcore_geometry.h>
88+
#include <embree4/rtcore_ray.h>
8989
#include <tbb/blocked_range.h>
9090
#include <tbb/cache_aligned_allocator.h>
9191
#include <tbb/concurrent_hash_map.h>

pxr/imaging/plugin/hdEmbree/renderDelegate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "pxr/base/tf/staticTokens.h"
1515

1616
#include <mutex>
17-
#include <embree3/rtcore.h>
17+
#include <embree4/rtcore.h>
1818

1919
PXR_NAMESPACE_OPEN_SCOPE
2020

pxr/imaging/plugin/hdEmbree/renderParam.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "pxr/imaging/hd/renderDelegate.h"
1212
#include "pxr/imaging/hd/renderThread.h"
1313

14-
#include <embree3/rtcore.h>
14+
#include <embree4/rtcore.h>
1515

1616
PXR_NAMESPACE_OPEN_SCOPE
1717

pxr/imaging/plugin/hdEmbree/renderer.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -637,9 +637,7 @@ HdEmbreeRenderer::_TraceRay(unsigned int x, unsigned int y,
637637
rayHit.ray.flags = 0;
638638
_PopulateRayHit(&rayHit, origin, dir, 0.0f);
639639
{
640-
RTCIntersectContext context;
641-
rtcInitIntersectContext(&context);
642-
rtcIntersect1(_scene, &context, &rayHit);
640+
rtcIntersect1(_scene, &rayHit);
643641
//
644642
// there is something odd about how this is used in Embree. Is it reversed
645643
// here and then when it it used in
@@ -979,9 +977,7 @@ HdEmbreeRenderer::_ComputeAmbientOcclusion(GfVec3f const& position,
979977
shadow.flags = 0;
980978
_PopulateRay(&shadow, position, shadowDir, 0.001f);
981979
{
982-
RTCIntersectContext context;
983-
rtcInitIntersectContext(&context);
984-
rtcOccluded1(_scene,&context,&shadow);
980+
rtcOccluded1(_scene,&shadow);
985981
}
986982

987983
// Record this AO ray's contribution to the occlusion factor: a

pxr/imaging/plugin/hdEmbree/renderer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
#include "pxr/base/gf/matrix4d.h"
1616
#include "pxr/base/gf/rect2i.h"
1717

18-
#include <embree3/rtcore.h>
19-
#include <embree3/rtcore_ray.h>
18+
#include <embree4/rtcore.h>
19+
#include <embree4/rtcore_ray.h>
2020

2121
#include <random>
2222
#include <atomic>

0 commit comments

Comments
 (0)