diff --git a/include/mitsuba/render/skdtree.h b/include/mitsuba/render/skdtree.h index de3fd8f1..18406173 100644 --- a/include/mitsuba/render/skdtree.h +++ b/include/mitsuba/render/skdtree.h @@ -269,7 +269,7 @@ protected: } else { const Shape *shape = m_shapes[shapeIdx]; if (shape->rayIntersect(ray, mint, maxt, t, - reinterpret_cast(temp) + 8)) { + reinterpret_cast(temp) + 2*sizeof(IndexType))) { cache->shapeIndex = shapeIdx; cache->primIndex = KNoTriangleFlag; return true; @@ -291,7 +291,7 @@ protected: uint32_t shapeIndex = ta.shapeIndex; const Shape *shape = m_shapes[shapeIndex]; if (shape->rayIntersect(ray, mint, maxt, t, - reinterpret_cast(temp) + 8)) { + reinterpret_cast(temp) + 2*sizeof(IndexType))) { cache->shapeIndex = shapeIndex; cache->primIndex = KNoTriangleFlag; return true; @@ -428,7 +428,7 @@ protected: its.time = ray.time; } else { shape->fillIntersectionRecord(ray, - reinterpret_cast(temp) + 8, its); + reinterpret_cast(temp) + 2*sizeof(IndexType), its); } } diff --git a/src/librender/skdtree.cpp b/src/librender/skdtree.cpp index dcc01cfb..89087539 100644 --- a/src/librender/skdtree.cpp +++ b/src/librender/skdtree.cpp @@ -189,7 +189,7 @@ bool ShapeKDTree::rayIntersect(const Ray &ray, Float &t, ConstShapePtr &shape, Intersection its; its.t = t; shape->fillIntersectionRecord(ray, - reinterpret_cast(temp) + 8, its); + reinterpret_cast(temp) + 2*sizeof(IndexType), its); n = its.geoFrame.n; uv = its.uv; if (its.shape) @@ -330,7 +330,7 @@ void ShapeKDTree::rayIntersectPacket(const RayPacket4 &packet, if (shape->rayIntersect(ray, searchStart.f[i], searchEnd.f[i], t, reinterpret_cast(temp) - + i * MTS_KD_INTERSECTION_TEMP + 8)) { + + i * MTS_KD_INTERSECTION_TEMP + 2*sizeof(IndexType))) { its.t.f[i] = t; its.shapeIndex.i[i] = kdTri.shapeIndex; its.primIndex.i[i] = KNoTriangleFlag;