From 5bfb27ea419e6aec4a53eeadffc8733f905cf1f4 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Wed, 7 Nov 2012 23:11:55 -0500 Subject: [PATCH] increased temporary storage for intersections (possibly revert this later on), clipping support for removing unwanted animation segments --- include/mitsuba/render/skdtree.h | 4 ++-- src/shapes/deformable.cpp | 28 ++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/include/mitsuba/render/skdtree.h b/include/mitsuba/render/skdtree.h index efc302dd..e6f25f9d 100644 --- a/include/mitsuba/render/skdtree.h +++ b/include/mitsuba/render/skdtree.h @@ -32,9 +32,9 @@ #if defined(SINGLE_PRECISION) /// 32 byte temporary storage for intersection computations -#define MTS_KD_INTERSECTION_TEMP 32 -#else #define MTS_KD_INTERSECTION_TEMP 64 +#else +#define MTS_KD_INTERSECTION_TEMP 128 #endif MTS_NAMESPACE_BEGIN diff --git a/src/shapes/deformable.cpp b/src/shapes/deformable.cpp index fa793a9a..4f82ff41 100644 --- a/src/shapes/deformable.cpp +++ b/src/shapes/deformable.cpp @@ -315,13 +315,37 @@ public: Log(EInfo, "Point cache has %i frames and %i vertices", frameCount, m_vertexCount); + Float clipStart = props.getFloat("clipStart", 0), + clipEnd = props.getFloat("clipEnd", 0); + + std::vector frameTimes; + std::vector positions; + for (uint32_t i=0; ireadSingle()); + frameTimes.push_back((Float) mStream->readSingle()); for (uint32_t i=0; i(mStream->getCurrentData())); + positions.push_back(reinterpret_cast(mStream->getCurrentData())); mStream->skip(m_vertexCount * 3 * sizeof(float)); } + + if (clipStart != clipEnd) { + m_positions.reserve(positions.size()); + m_frameTimes.reserve(frameTimes.size()); + for (uint32_t i=0; i= clipStart && frameTimes[i] <= clipEnd) { + m_frameTimes.push_back(frameTimes[i]); + m_positions.push_back(positions[i]); + } + } + if (m_frameTimes.empty()) + Log(EError, "After clipping to the time range [%f, %f] no frames were left!", + clipStart, clipEnd); + Log(EInfo, "Clipped away %u/%u frames", frameCount - (uint32_t) m_frameTimes.size(), frameCount); + } else { + m_positions = positions; + m_frameTimes = frameTimes; + } } Deformable(Stream *stream, InstanceManager *manager)