summaryrefslogtreecommitdiffstats
path: root/thirdparty/embree/kernels/common/scene_triangle_mesh.h
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/embree/kernels/common/scene_triangle_mesh.h')
-rw-r--r--thirdparty/embree/kernels/common/scene_triangle_mesh.h41
1 files changed, 37 insertions, 4 deletions
diff --git a/thirdparty/embree/kernels/common/scene_triangle_mesh.h b/thirdparty/embree/kernels/common/scene_triangle_mesh.h
index ad3f602fde..0d28219b96 100644
--- a/thirdparty/embree/kernels/common/scene_triangle_mesh.h
+++ b/thirdparty/embree/kernels/common/scene_triangle_mesh.h
@@ -129,6 +129,18 @@ namespace embree
return vertices[itime].getPtr(i);
}
+ /*! returns i'th vertex of for specified time */
+ __forceinline Vec3fa vertex(size_t i, float time) const
+ {
+ float ftime;
+ const size_t itime = timeSegment(time, ftime);
+ const float t0 = 1.0f - ftime;
+ const float t1 = ftime;
+ Vec3fa v0 = vertex(i, itime+0);
+ Vec3fa v1 = vertex(i, itime+1);
+ return madd(Vec3fa(t0),v0,t1*v1);
+ }
+
/*! calculates the bounds of the i'th triangle */
__forceinline BBox3fa bounds(size_t i) const
{
@@ -260,8 +272,8 @@ namespace embree
public:
BufferView<Triangle> triangles; //!< array of triangles
BufferView<Vec3fa> vertices0; //!< fast access to first vertex buffer
- vector<BufferView<Vec3fa>> vertices; //!< vertex array for each timestep
- vector<RawBufferView> vertexAttribs; //!< vertex attributes
+ Device::vector<BufferView<Vec3fa>> vertices = device; //!< vertex array for each timestep
+ Device::vector<RawBufferView> vertexAttribs = device; //!< vertex attributes
};
namespace isa
@@ -271,7 +283,11 @@ namespace embree
TriangleMeshISA (Device* device)
: TriangleMesh(device) {}
- PrimInfo createPrimRefArray(mvector<PrimRef>& prims, const range<size_t>& r, size_t k, unsigned int geomID) const
+ LBBox3fa vlinearBounds(size_t primID, const BBox1f& time_range) const {
+ return linearBounds(primID,time_range);
+ }
+
+ PrimInfo createPrimRefArray(PrimRef* prims, const range<size_t>& r, size_t k, unsigned int geomID) const
{
PrimInfo pinfo(empty);
for (size_t j=r.begin(); j<r.end(); j++)
@@ -298,7 +314,24 @@ namespace embree
}
return pinfo;
}
-
+
+ PrimInfo createPrimRefArrayMB(PrimRef* prims, const BBox1f& time_range, const range<size_t>& r, size_t k, unsigned int geomID) const
+ {
+ PrimInfo pinfo(empty);
+ const BBox1f t0t1 = BBox1f::intersect(getTimeRange(), time_range);
+ if (t0t1.empty()) return pinfo;
+
+ for (size_t j = r.begin(); j < r.end(); j++) {
+ LBBox3fa lbounds = empty;
+ if (!linearBounds(j, t0t1, lbounds))
+ continue;
+ const PrimRef prim(lbounds.bounds(), geomID, unsigned(j));
+ pinfo.add_center2(prim);
+ prims[k++] = prim;
+ }
+ return pinfo;
+ }
+
PrimInfoMB createPrimRefMBArray(mvector<PrimRefMB>& prims, const BBox1f& t0t1, const range<size_t>& r, size_t k, unsigned int geomID) const
{
PrimInfoMB pinfo(empty);