public void TestToUShort() { //below range Assert.AreEqual(0, IntegerUtils.ToUShort(-1)); Assert.AreEqual(0, IntegerUtils.ToUShort(0)); Assert.AreEqual(0, IntegerUtils.ToUShort(0.999f / 0x10000)); Assert.AreEqual(1, IntegerUtils.ToUShort(1.001f / 0x10000)); Assert.AreEqual(1, IntegerUtils.ToUShort(1.999f / 0x10000)); Assert.AreEqual(ushort.MaxValue, IntegerUtils.ToUShort(1 - 1e-6f)); Assert.AreEqual(ushort.MaxValue, IntegerUtils.ToUShort(1)); //above range Assert.AreEqual(ushort.MaxValue, IntegerUtils.ToUShort(2)); }
public static uint Pack(OcclusionInfo occlusionInfo) { return(IntegerUtils.Pack( IntegerUtils.ToUShort(occlusionInfo.Front), IntegerUtils.ToUShort(occlusionInfo.Back))); }