fix annoying win32 template static member linkage errors
parent
f2f4f94bdf
commit
e394456621
|
@ -41,7 +41,7 @@ class InstanceManager;
|
||||||
class InterpolatedSpectrum;
|
class InterpolatedSpectrum;
|
||||||
class LocalWorker;
|
class LocalWorker;
|
||||||
class Logger;
|
class Logger;
|
||||||
class Matrix4x4;
|
struct Matrix4x4;
|
||||||
class MemoryStream;
|
class MemoryStream;
|
||||||
class Mutex;
|
class Mutex;
|
||||||
class NetworkedObject;
|
class NetworkedObject;
|
||||||
|
|
|
@ -61,6 +61,7 @@ MTS_NAMESPACE_BEGIN
|
||||||
*
|
*
|
||||||
* \sa GenericKDTree
|
* \sa GenericKDTree
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class MTS_EXPORT_RENDER KDTree : public GenericKDTree<AABB, KDTree> {
|
class MTS_EXPORT_RENDER KDTree : public GenericKDTree<AABB, KDTree> {
|
||||||
friend class GenericKDTree<AABB, KDTree>;
|
friend class GenericKDTree<AABB, KDTree>;
|
||||||
friend class Instance;
|
friend class Instance;
|
||||||
|
@ -353,6 +354,37 @@ protected:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Plain shadow ray query (used by the 'instance' plugin)
|
||||||
|
inline bool rayIntersect(const Ray &ray, Float _mint, Float _maxt) const {
|
||||||
|
Float mint, maxt, tempT = std::numeric_limits<Float>::infinity();
|
||||||
|
if (m_aabb.rayIntersect(ray, mint, maxt)) {
|
||||||
|
if (_mint > mint) mint = _mint;
|
||||||
|
if (_maxt < maxt) maxt = _maxt;
|
||||||
|
|
||||||
|
if (EXPECT_TAKEN(maxt > mint)) {
|
||||||
|
if (rayIntersectHavran<true>(ray, mint, maxt, tempT, NULL))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Plain intersection query (used by the 'instance' plugin)
|
||||||
|
inline bool rayIntersect(const Ray &ray, Float _mint, Float _maxt, Float &t, void *temp) const {
|
||||||
|
Float mint, maxt, tempT = std::numeric_limits<Float>::infinity();
|
||||||
|
if (m_aabb.rayIntersect(ray, mint, maxt)) {
|
||||||
|
if (_mint > mint) mint = _mint;
|
||||||
|
if (_maxt < maxt) maxt = _maxt;
|
||||||
|
|
||||||
|
if (EXPECT_TAKEN(maxt > mint)) {
|
||||||
|
if (rayIntersectHavran<false>(ray, mint, maxt, tempT, temp)) {
|
||||||
|
t = tempT;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// Virtual destructor
|
/// Virtual destructor
|
||||||
virtual ~KDTree();
|
virtual ~KDTree();
|
||||||
|
|
|
@ -68,43 +68,19 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rayIntersect(const Ray &_ray, Float _mint,
|
bool rayIntersect(const Ray &_ray, Float mint,
|
||||||
Float _maxt, Float &t, void *temp) const {
|
Float maxt, Float &t, void *temp) const {
|
||||||
const KDTree *kdtree = m_shapeGroup->getKDTree();
|
const KDTree *kdtree = m_shapeGroup->getKDTree();
|
||||||
Ray ray;
|
Ray ray;
|
||||||
m_worldToObject(_ray, ray);
|
m_worldToObject(_ray, ray);
|
||||||
Float mint, maxt, tempT = std::numeric_limits<Float>::infinity();
|
return kdtree->rayIntersect(ray, mint, maxt, t, temp);
|
||||||
|
|
||||||
if (kdtree->m_aabb.rayIntersect(ray, mint, maxt)) {
|
|
||||||
if (_mint > mint) mint = _mint;
|
|
||||||
if (_maxt < maxt) maxt = _maxt;
|
|
||||||
|
|
||||||
if (EXPECT_TAKEN(maxt > mint)) {
|
|
||||||
if (kdtree->rayIntersectHavran<false>(ray, mint, maxt, tempT, temp)) {
|
|
||||||
t = tempT;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rayIntersect(const Ray &_ray, Float _mint, Float _maxt) const {
|
bool rayIntersect(const Ray &_ray, Float mint, Float maxt) const {
|
||||||
const KDTree *kdtree = m_shapeGroup->getKDTree();
|
const KDTree *kdtree = m_shapeGroup->getKDTree();
|
||||||
Ray ray;
|
Ray ray;
|
||||||
m_worldToObject(_ray, ray);
|
m_worldToObject(_ray, ray);
|
||||||
Float mint, maxt, tempT = std::numeric_limits<Float>::infinity();
|
return kdtree->rayIntersect(ray, mint, maxt);
|
||||||
|
|
||||||
if (kdtree->m_aabb.rayIntersect(ray, mint, maxt)) {
|
|
||||||
if (_mint > mint) mint = _mint;
|
|
||||||
if (_maxt < maxt) maxt = _maxt;
|
|
||||||
|
|
||||||
if (EXPECT_TAKEN(maxt > mint)) {
|
|
||||||
if (kdtree->rayIntersectHavran<true>(ray, mint, maxt, tempT, NULL))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void fillIntersectionRecord(const Ray &ray,
|
void fillIntersectionRecord(const Ray &ray,
|
||||||
|
|
Loading…
Reference in New Issue