increased temporary storage for intersections (possibly revert this later on), clipping support for removing unwanted animation segments
parent
dbf62f906b
commit
5bfb27ea41
|
@ -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
|
||||
|
|
|
@ -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<Float> frameTimes;
|
||||
std::vector<float *> positions;
|
||||
|
||||
for (uint32_t i=0; i<frameCount; ++i)
|
||||
m_frameTimes.push_back((Float) mStream->readSingle());
|
||||
frameTimes.push_back((Float) mStream->readSingle());
|
||||
|
||||
for (uint32_t i=0; i<frameCount; ++i) {
|
||||
m_positions.push_back(reinterpret_cast<float *>(mStream->getCurrentData()));
|
||||
positions.push_back(reinterpret_cast<float *>(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<frameCount; ++i) {
|
||||
if (frameTimes[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)
|
||||
|
|
Loading…
Reference in New Issue