Added asserts to catch invalid material/density values.
This commit is contained in:
parent
29bded222f
commit
8943822046
@ -75,8 +75,19 @@ namespace PolyVox
|
|||||||
Type getDensity() const { return m_uDensity; }
|
Type getDensity() const { return m_uDensity; }
|
||||||
Type getMaterial() const { return m_uMaterial; }
|
Type getMaterial() const { return m_uMaterial; }
|
||||||
|
|
||||||
void setDensity(Type uDensity) { m_uDensity = uDensity; }
|
void setDensity(Type uDensity)
|
||||||
void setMaterial(Type uMaterial) { m_uMaterial = uMaterial; }
|
{
|
||||||
|
POLYVOX_ASSERT(uDensity >= getMinDensity(), "Density out of range");
|
||||||
|
POLYVOX_ASSERT(uDensity <= getMaxDensity(), "Density out of range");
|
||||||
|
m_uDensity = uDensity;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setMaterial(Type uMaterial)
|
||||||
|
{
|
||||||
|
POLYVOX_ASSERT(uMaterial >= 0, "Material out of range");
|
||||||
|
POLYVOX_ASSERT(uMaterial <= (0x01 << NoOfMaterialBits) - 1, "Material out of range");
|
||||||
|
m_uMaterial = uMaterial;
|
||||||
|
}
|
||||||
|
|
||||||
static Type getMaxDensity() { return (0x01 << NoOfDensityBits) - 1; }
|
static Type getMaxDensity() { return (0x01 << NoOfDensityBits) - 1; }
|
||||||
static Type getMinDensity() { return 0; }
|
static Type getMinDensity() { return 0; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user