Add light support (WIP)
This commit is contained in:
@@ -34,6 +34,8 @@ namespace Nz
|
||||
|
||||
BoundingVolume& ExtendTo(const BoundingVolume& volume);
|
||||
|
||||
bool Intersect(const Box<T>& box) const;
|
||||
|
||||
bool IsFinite() const;
|
||||
bool IsInfinite() const;
|
||||
bool IsNull() const;
|
||||
|
||||
@@ -169,11 +169,28 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool BoundingVolume<T>::Intersect(const Box<T>& box) const
|
||||
{
|
||||
switch (extend)
|
||||
{
|
||||
case Extend::Infinite:
|
||||
return true;
|
||||
|
||||
case Extend::Finite:
|
||||
return aabb.Intersect(box);
|
||||
|
||||
case Extend::Null:
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Checks whether the volume is finite
|
||||
* \return true if extend is Extend::Finite
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
bool BoundingVolume<T>::IsFinite() const
|
||||
{
|
||||
|
||||
@@ -459,17 +459,12 @@ namespace Nz
|
||||
{
|
||||
T left = std::max(x, box.x);
|
||||
T right = std::min(x + width, box.x + box.width);
|
||||
if (left >= right)
|
||||
return false;
|
||||
|
||||
T top = std::max(y, box.y);
|
||||
T bottom = std::min(y + height, box.y + box.height);
|
||||
if (top >= bottom)
|
||||
return false;
|
||||
|
||||
T up = std::max(z, box.z);
|
||||
T down = std::min(z + depth, box.z + box.depth);
|
||||
if (up >= down)
|
||||
|
||||
if (left >= right || top >= bottom || up >= down)
|
||||
return false;
|
||||
|
||||
if (intersection)
|
||||
|
||||
Reference in New Issue
Block a user