From 50c993437678ea91dd02e0809426449906e46626 Mon Sep 17 00:00:00 2001 From: David Williams Date: Sat, 29 Dec 2012 17:02:07 +0000 Subject: [PATCH] Bringing minor improvements from Cubiquity's PolyVox into the main branch. --- library/PolyVoxCore/include/PolyVoxCore/Impl/Utility.h | 4 ++-- library/PolyVoxCore/include/PolyVoxCore/Interpolation.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/library/PolyVoxCore/include/PolyVoxCore/Impl/Utility.h b/library/PolyVoxCore/include/PolyVoxCore/Impl/Utility.h index 2053c351..77dac7a4 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Impl/Utility.h +++ b/library/PolyVoxCore/include/PolyVoxCore/Impl/Utility.h @@ -40,12 +40,12 @@ namespace PolyVox inline int32_t roundTowardsNegInf(float r) { - return (r > 0.0) ? static_cast(r) : static_cast(r - 1.0f); + return (r >= 0.0) ? static_cast(r) : static_cast(r - 1.0f); } inline int32_t roundToNearestInteger(float r) { - return (r > 0.0) ? static_cast(r + 0.5f) : static_cast(r - 0.5f); + return (r >= 0.0) ? static_cast(r + 0.5f) : static_cast(r - 0.5f); } template diff --git a/library/PolyVoxCore/include/PolyVoxCore/Interpolation.h b/library/PolyVoxCore/include/PolyVoxCore/Interpolation.h index 5c76fe47..09c063c9 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Interpolation.h +++ b/library/PolyVoxCore/include/PolyVoxCore/Interpolation.h @@ -36,7 +36,7 @@ namespace PolyVox assert((x >= 0.0f) && (x <= 1.0f)); //Interpolate along X - Type v0_1 = v0 + x * (v1 - v0); + Type v0_1 = (v1 - v0) * x + v0; return v0_1; }