medium bugfixes

metadata
Wenzel Jakob 2011-04-17 16:47:02 +02:00
parent 9afac73a70
commit 627201a172
2 changed files with 12 additions and 7 deletions

View File

@ -24,7 +24,7 @@
// Uncomment to enable nearest-neighbor direction interpolation
//#define VINTERP_NEAREST_NEIGHBOR
// #define VINTERP_NEAREST_NEIGHBOR
// Uncomment to enable linear direction interpolation (usually a bad idea)
//#define VINTERP_LINEAR
@ -413,13 +413,14 @@ public:
(((fz < .5) ? z1 : z2) * m_res.y +
((fy < .5) ? y1 : y2)) * m_res.x +
((fx < .5) ? x1 : x2)].toVector();
};
}
break;
case EQuantizedDirections: {
value = lookupQuantizedDirection(
(((fz < .5) ? z1 : z2) * m_res.y +
((fy < .5) ? y1 : y2)) * m_res.x +
((fx < .5) ? x1 : x2));
((fx < .5) ? x1 : x2)).toVector();
}
break;
default:
return Vector(0.0f);

View File

@ -74,19 +74,19 @@ public:
stream->setByteOrder(Stream::ELittleEndian);
Float xmin = stream->readSingle(), ymin = stream->readSingle(), zmin = stream->readSingle();
Float xmax = stream->readSingle(), ymax = stream->readSingle(), zmax = stream->readSingle();
m_aabb = AABB(Point(xmin, ymin, zmin), Point(xmax, ymax, zmax));
AABB aabb = AABB(Point(xmin, ymin, zmin), Point(xmax, ymax, zmax));
m_res = Vector3i(stream);
m_filename = filename;
size_t nCells = m_res.x*m_res.y*m_res.z;
m_blocks = new VolumeDataSource*[nCells];
memset(m_blocks, 0, nCells*sizeof(VolumeDataSource *));
Vector extents = m_aabb.getExtents();
Vector extents = aabb.getExtents();
m_worldToVolume = m_volumeToWorld.inverse();
m_worldToGrid = Transform::scale(Vector(
(m_res[0]) / extents[0],
(m_res[1]) / extents[1],
(m_res[2]) / extents[2])
) * Transform::translate(-Vector(m_aabb.min)) * m_worldToVolume;
) * Transform::translate(-Vector(aabb.min)) * m_worldToVolume;
m_supportsFloatLookups = true;
m_supportsVectorLookups = true;
@ -117,7 +117,11 @@ public:
++numBlocks;
}
Log(EInfo, "%i blocks total, %s, stepSize=%f, resolution=%s", numBlocks,
m_aabb.toString().c_str(), m_stepSize, m_res.toString().c_str());
aabb.toString().c_str(), m_stepSize, m_res.toString().c_str());
m_aabb.reset();
for (int i=0; i<8; ++i)
m_aabb.expandBy(m_volumeToWorld(aabb.getCorner(i)));
}
bool supportsFloatLookups() const {