summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-12-31 14:03:53 -0800
committerVito Caputo <vcaputo@pengaru.com>2023-12-31 14:33:32 -0800
commit724af6edee317eb281ffb847f5ea4282e5db6431 (patch)
treedd554826544397c3937dd7e3655572b81f0e6b7a
parentefa9704c684ecad98341799245458844e7577010 (diff)
libs/din: remove unnecessary floorf() from din()
These are being assigned to ints to index the grid and will become rounded down through truncation anyways. This little change brings a ~20% FPS boost in modules/swab on an i7 x230.
-rw-r--r--src/libs/din/din.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libs/din/din.c b/src/libs/din/din.c
index 1cb0b97..481c5a5 100644
--- a/src/libs/din/din.c
+++ b/src/libs/din/din.c
@@ -113,9 +113,9 @@ float din(const din_t *din, v3f_t *coordinate)
coordinate->y = .5f + (coordinate->y * .5f + .5f) * (float)(din->height - 2);
coordinate->z = .5f + (coordinate->z * .5f + .5f) * (float)(din->depth - 2);
- x0 = floorf(coordinate->x);
- y0 = floorf(coordinate->y);
- z0 = floorf(coordinate->z);
+ x0 = coordinate->x;
+ y0 = coordinate->y;
+ z0 = coordinate->z;
x1 = x0 + 1;
y1 = y0 + 1;
© All Rights Reserved