summaryrefslogtreecommitdiff
path: root/src/noise.cpp
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2015-07-24 21:03:50 +0200
committerLoic Blot <loic.blot@unix-experience.fr>2015-07-24 21:48:02 +0200
commitaab7c83d0229c2c7aa3b60de3ca1b1a4eb326b55 (patch)
tree1388eed6a5a78294f6ba93fd80511e9b18025af8 /src/noise.cpp
parent2eb329cc6362958537737c2a82ae593c7ba5d30a (diff)
downloadminetest-aab7c83d0229c2c7aa3b60de3ca1b1a4eb326b55.tar.gz
minetest-aab7c83d0229c2c7aa3b60de3ca1b1a4eb326b55.tar.bz2
minetest-aab7c83d0229c2c7aa3b60de3ca1b1a4eb326b55.zip
Remove some old dead code. Fix some Clang warnings in SRP (ng->N... will
always evaluate to true.
Diffstat (limited to 'src/noise.cpp')
-rw-r--r--src/noise.cpp47
1 files changed, 0 insertions, 47 deletions
diff --git a/src/noise.cpp b/src/noise.cpp
index 5b08eb942..443c405ce 100644
--- a/src/noise.cpp
+++ b/src/noise.cpp
@@ -192,14 +192,6 @@ inline float biLinearInterpolation(
{
float tx = easeCurve(x);
float ty = easeCurve(y);
-#if 0
- return (
- v00 * (1 - tx) * (1 - ty) +
- v10 * tx * (1 - ty) +
- v01 * (1 - tx) * ty +
- v11 * tx * ty
- );
-#endif
float u = linearInterpolation(v00, v10, tx);
float v = linearInterpolation(v01, v11, tx);
return linearInterpolation(u, v, ty);
@@ -225,18 +217,6 @@ float triLinearInterpolation(
float tx = easeCurve(x);
float ty = easeCurve(y);
float tz = easeCurve(z);
-#if 0
- return (
- v000 * (1 - tx) * (1 - ty) * (1 - tz) +
- v100 * tx * (1 - ty) * (1 - tz) +
- v010 * (1 - tx) * ty * (1 - tz) +
- v110 * tx * ty * (1 - tz) +
- v001 * (1 - tx) * (1 - ty) * tz +
- v101 * tx * (1 - ty) * tz +
- v011 * (1 - tx) * ty * tz +
- v111 * tx * ty * tz
- );
-#endif
float u = biLinearInterpolationNoEase(v000, v100, v010, v110, tx, ty);
float v = biLinearInterpolationNoEase(v001, v101, v011, v111, tx, ty);
return linearInterpolation(u, v, tz);
@@ -252,33 +232,6 @@ float triLinearInterpolationNoEase(
return linearInterpolation(u, v, z);
}
-
-#if 0
-float noise2d_gradient(float x, float y, int seed)
-{
- // Calculate the integer coordinates
- int x0 = (x > 0.0 ? (int)x : (int)x - 1);
- int y0 = (y > 0.0 ? (int)y : (int)y - 1);
- // Calculate the remaining part of the coordinates
- float xl = x - (float)x0;
- float yl = y - (float)y0;
- // Calculate random cosine lookup table indices for the integer corners.
- // They are looked up as unit vector gradients from the lookup table.
- int n00 = (int)((noise2d(x0, y0, seed)+1)*8);
- int n10 = (int)((noise2d(x0+1, y0, seed)+1)*8);
- int n01 = (int)((noise2d(x0, y0+1, seed)+1)*8);
- int n11 = (int)((noise2d(x0+1, y0+1, seed)+1)*8);
- // Make a dot product for the gradients and the positions, to get the values
- float s = dotProduct(cos_lookup[n00], cos_lookup[(n00+12)%16], xl, yl);
- float u = dotProduct(-cos_lookup[n10], cos_lookup[(n10+12)%16], 1.-xl, yl);
- float v = dotProduct(cos_lookup[n01], -cos_lookup[(n01+12)%16], xl, 1.-yl);
- float w = dotProduct(-cos_lookup[n11], -cos_lookup[(n11+12)%16], 1.-xl, 1.-yl);
- // Interpolate between the values
- return biLinearInterpolation(s,u,v,w,xl,yl);
-}
-#endif
-
-
float noise2d_gradient(float x, float y, int seed, bool eased)
{
// Calculate the integer coordinates