|
22 | 22 | #include <chrono>
|
23 | 23 | #include <thread>
|
24 | 24 |
|
| 25 | +namespace { |
| 26 | + |
| 27 | +PXR_NAMESPACE_USING_DIRECTIVE |
| 28 | + |
| 29 | +// ------------------------------------------------------------------------- |
| 30 | +// General Ray Utilities |
| 31 | +// ------------------------------------------------------------------------- |
| 32 | + |
| 33 | +inline GfVec3f |
| 34 | +_CalculateHitPosition(RTCRayHit const& rayHit) |
| 35 | +{ |
| 36 | + return GfVec3f(rayHit.ray.org_x + rayHit.ray.tfar * rayHit.ray.dir_x, |
| 37 | + rayHit.ray.org_y + rayHit.ray.tfar * rayHit.ray.dir_y, |
| 38 | + rayHit.ray.org_z + rayHit.ray.tfar * rayHit.ray.dir_z); |
| 39 | +} |
| 40 | + |
| 41 | +} // anonymous namespace |
| 42 | + |
25 | 43 | PXR_NAMESPACE_OPEN_SCOPE
|
26 | 44 |
|
27 | 45 | HdEmbreeRenderer::HdEmbreeRenderer()
|
@@ -762,9 +780,7 @@ HdEmbreeRenderer::_ComputeDepth(RTCRayHit const& rayHit,
|
762 | 780 | }
|
763 | 781 |
|
764 | 782 | if (clip) {
|
765 |
| - GfVec3f hitPos = GfVec3f(rayHit.ray.org_x + rayHit.ray.tfar * rayHit.ray.dir_x, |
766 |
| - rayHit.ray.org_y + rayHit.ray.tfar * rayHit.ray.dir_y, |
767 |
| - rayHit.ray.org_z + rayHit.ray.tfar * rayHit.ray.dir_z); |
| 783 | + GfVec3f hitPos = _CalculateHitPosition(rayHit); |
768 | 784 |
|
769 | 785 | hitPos = GfVec3f(_viewMatrix.Transform(hitPos));
|
770 | 786 | hitPos = GfVec3f(_projMatrix.Transform(hitPos));
|
@@ -874,9 +890,7 @@ HdEmbreeRenderer::_ComputeColor(RTCRayHit const& rayHit,
|
874 | 890 | rtcGetGeometryUserData(rtcGetGeometry(instanceContext->rootScene,rayHit.hit.geomID)));
|
875 | 891 |
|
876 | 892 | // Compute the worldspace location of the rayHit hit.
|
877 |
| - GfVec3f hitPos = GfVec3f(rayHit.ray.org_x + rayHit.ray.tfar * rayHit.ray.dir_x, |
878 |
| - rayHit.ray.org_y + rayHit.ray.tfar * rayHit.ray.dir_y, |
879 |
| - rayHit.ray.org_z + rayHit.ray.tfar * rayHit.ray.dir_z); |
| 893 | + GfVec3f hitPos = _CalculateHitPosition(rayHit); |
880 | 894 |
|
881 | 895 | // If a normal primvar is present (e.g. from smooth shading), use that
|
882 | 896 | // for shading; otherwise use the flat face normal.
|
|
0 commit comments