Skip to content
Snippets Groups Projects
Commit 5334a178 authored by Drake Arconis's avatar Drake Arconis
Browse files

Minor cleanup

parent dd3d53b9
No related branches found
No related tags found
No related merge requests found
......@@ -139,12 +139,9 @@ namespace LLPredicate
Rule()
{}
// <alchemy> Fix for linux compiler
// I don't know why this works on MSVC
void require(ENUM e)
void require(ENUM e, bool match)
{
//mRule.set(e, require);
mRule.set(e);
mRule.set(e, match);
}
void allow(ENUM e)
......
......@@ -87,6 +87,40 @@ struct LLUnit
: mValue(value)
{}
LL_FORCE_INLINE static self_t convert(self_t v)
{
return v;
}
template<typename FROM_STORAGE_TYPE>
LL_FORCE_INLINE static self_t convert(LLUnit<FROM_STORAGE_TYPE, UNITS> v)
{
self_t result;
result.mValue = (STORAGE_TYPE)v.value();
return result;
}
template<typename FROM_UNITS>
LL_FORCE_INLINE static self_t convert(LLUnit<STORAGE_TYPE, FROM_UNITS> v)
{
self_t result;
STORAGE_TYPE divisor = ll_convert_units(v, result);
result.mValue /= divisor;
return result;
}
template<typename FROM_STORAGE_TYPE, typename FROM_UNITS>
LL_FORCE_INLINE static self_t convert(LLUnit<FROM_STORAGE_TYPE, FROM_UNITS> v)
{
typedef typename LLResultTypePromote<FROM_STORAGE_TYPE, STORAGE_TYPE>::type_t result_storage_t;
LLUnit<result_storage_t, UNITS> result;
result_storage_t divisor = ll_convert_units(v, result);
result.value(result.value() / divisor);
return self_t(result.value());
}
// unit initialization and conversion
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE LLUnit(LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other)
......@@ -183,38 +217,6 @@ struct LLUnit
return mValue >= convert(other).value();
}
LL_FORCE_INLINE static self_t convert(self_t v)
{
return v;
}
template<typename FROM_STORAGE_TYPE>
LL_FORCE_INLINE static self_t convert(LLUnit<FROM_STORAGE_TYPE, UNITS> v)
{
self_t result;
result.mValue = (STORAGE_TYPE)v.value();
return result;
}
template<typename FROM_UNITS>
LL_FORCE_INLINE static self_t convert(LLUnit<STORAGE_TYPE, FROM_UNITS> v)
{
self_t result;
STORAGE_TYPE divisor = ll_convert_units(v, result);
result.mValue /= divisor;
return result;
}
template<typename FROM_STORAGE_TYPE, typename FROM_UNITS>
LL_FORCE_INLINE static self_t convert(LLUnit<FROM_STORAGE_TYPE, FROM_UNITS> v)
{
typedef typename LLResultTypePromote<FROM_STORAGE_TYPE, STORAGE_TYPE>::type_t result_storage_t;
LLUnit<result_storage_t, UNITS> result;
result_storage_t divisor = ll_convert_units(v, result);
result.value(result.value() / divisor);
return self_t(result.value());
}
protected:
storage_t mValue;
};
......@@ -269,7 +271,7 @@ struct LLUnitImplicit : public LLUnit<STORAGE_TYPE, UNITS>
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE void operator += (LLUnitImplicit<OTHER_STORAGE_TYPE, OTHER_UNITS> other)
{
base_t::mValue += this->convert(other).value();
base_t::mValue += base_t::convert(other).value();
}
using base_t::operator -=;
......@@ -283,19 +285,19 @@ struct LLUnitImplicit : public LLUnit<STORAGE_TYPE, UNITS>
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE void operator -= (LLUnitImplicit<OTHER_STORAGE_TYPE, OTHER_UNITS> other)
{
base_t::mValue -= this->convert(other).value();
base_t::mValue -= base_t::convert(other).value();
}
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE bool operator == (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
{
return base_t::mValue == this->convert(other).value();
return base_t::mValue == base_t::convert(other).value();
}
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE bool operator == (LLUnitImplicit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
{
return base_t::mValue == this->convert(other).value();
return base_t::mValue == base_t::convert(other).value();
}
template<typename STORAGE_T>
......@@ -307,13 +309,13 @@ struct LLUnitImplicit : public LLUnit<STORAGE_TYPE, UNITS>
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE bool operator != (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
{
return base_t::mValue != this->convert(other).value();
return base_t::mValue != convert(other).value();
}
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE bool operator != (LLUnitImplicit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
{
return base_t::mValue != this->convert(other).value();
return base_t::mValue != base_t::convert(other).value();
}
template<typename STORAGE_T>
......@@ -325,13 +327,13 @@ struct LLUnitImplicit : public LLUnit<STORAGE_TYPE, UNITS>
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE bool operator < (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
{
return base_t::mValue < this->convert(other).value();
return base_t::mValue < base_t::convert(other).value();
}
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE bool operator < (LLUnitImplicit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
{
return base_t::mValue < this->convert(other).value();
return base_t::mValue < base_t::convert(other).value();
}
template<typename STORAGE_T>
......@@ -343,13 +345,13 @@ struct LLUnitImplicit : public LLUnit<STORAGE_TYPE, UNITS>
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE bool operator <= (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
{
return base_t::mValue <= this->convert(other).value();
return base_t::mValue <= base_t::convert(other).value();
}
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE bool operator <= (LLUnitImplicit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
{
return base_t::mValue <= this->convert(other).value();
return base_t::mValue <= base_t::convert(other).value();
}
template<typename STORAGE_T>
......@@ -361,13 +363,13 @@ struct LLUnitImplicit : public LLUnit<STORAGE_TYPE, UNITS>
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE bool operator > (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
{
return base_t::mValue > this->convert(other).value();
return base_t::mValue > base_t::convert(other).value();
}
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE bool operator > (LLUnitImplicit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
{
return base_t::mValue > this->convert(other).value();
return base_t::mValue > base_t::convert(other).value();
}
template<typename STORAGE_T>
......@@ -379,13 +381,13 @@ struct LLUnitImplicit : public LLUnit<STORAGE_TYPE, UNITS>
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE bool operator >= (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
{
return base_t::mValue >= this->convert(other).value();
return base_t::mValue >= base_t::convert(other).value();
}
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE bool operator >= (LLUnitImplicit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const
{
return base_t::mValue >= this->convert(other).value();
return base_t::mValue >= base_t::convert(other).value();
}
template<typename STORAGE_T>
......
......@@ -353,8 +353,8 @@ public:
//is it here?
if (isInside(data->getPositionGroup()))
{
if ((((getElementCount() < gOctreeMaxCapacity || getSize()[0] <= gOctreeMinSize) && contains(data->getBinRadius())) ||
(data->getBinRadius() > getSize()[0] && parent && parent->getElementCount() >= gOctreeMaxCapacity)))
if (((getElementCount() < gOctreeMaxCapacity || ((getSize()[0] <= gOctreeMinSize) && contains(data->getBinRadius()))) ||
((data->getBinRadius() > getSize()[0] && parent && parent->getElementCount() >= gOctreeMaxCapacity))))
{ //it belongs here
mData.push_back(NULL);
mData[mElementCount] = data;
......@@ -476,7 +476,7 @@ public:
mDataEnd = &mData[0];
}
this->notifyRemoval(data);
BaseType::notifyRemoval(data);
checkAlive();
}
......@@ -806,10 +806,10 @@ public:
return false;
}
if (this->getSize()[0] > data->getBinRadius() && this->isInside(data->getPositionGroup()))
if (this->getSize()[0] > data->getBinRadius() && oct_node::isInside(data->getPositionGroup()))
{
//we got it, just act like a branch
oct_node* node = this->getNodeAt(data);
oct_node* node = oct_node::getNodeAt(data);
if (node == this)
{
LLOctreeNode<T>::insert(data);
......@@ -822,7 +822,7 @@ public:
else if (this->getChildCount() == 0)
{
//first object being added, just wrap it up
while (!(this->getSize()[0] > data->getBinRadius() && this->isInside(data->getPositionGroup())))
while (!(this->getSize()[0] > data->getBinRadius() && oct_node::isInside(data->getPositionGroup())))
{
LLVector4a center, size;
center = this->getCenter();
......@@ -837,7 +837,7 @@ public:
}
else
{
while (!(this->getSize()[0] > data->getBinRadius() && this->isInside(data->getPositionGroup())))
while (!(this->getSize()[0] > data->getBinRadius() && oct_node::isInside(data->getPositionGroup())))
{
//the data is outside the root node, we need to grow
LLVector4a center(this->getCenter());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment