Extend AABB class
This commit is contained in:
@@ -35,6 +35,12 @@ namespace OpenVulkano::Math
|
||||
this->min = min;
|
||||
this->max = max;
|
||||
}
|
||||
|
||||
void Init(const Math::Vector3f& point, float radius)
|
||||
{
|
||||
min = point - radius;
|
||||
max = point + radius;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Initiates the AABB from some other AABB
|
||||
@@ -83,6 +89,16 @@ namespace OpenVulkano::Math
|
||||
return !(other.min.x > max.x || other.max.x < min.x || other.min.y > max.y ||
|
||||
other.max.y < min.y || other.min.z > max.z || other.max.z < min.z);
|
||||
}
|
||||
|
||||
[[nodiscard]] bool InBounds(const Math::Vector3f& position) const
|
||||
{
|
||||
return min >= position && position <= max;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool Inside(const Math::Vector3f& position) const
|
||||
{
|
||||
return min > position && position < max;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Resets the AABB to min=Inf, max=-Inf, same as Init()
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace OpenVulkano
|
||||
{}
|
||||
|
||||
VertexInputParameter(size_t location, uint32_t binding, DataFormat format, uint32_t offset)
|
||||
: location(location), binding(binding), format(format), offset(offset)
|
||||
: location(static_cast<uint32_t>(location)), binding(binding), format(format), offset(offset)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user