projects
/
zefram
/
minetest
/
minetest_engine.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7fcf153
)
Replace pow() with multiplikation to improve speed
author
PilzAdam
<adam-k@outlook.com>
Fri, 2 Nov 2012 15:24:57 +0000
(16:24 +0100)
committer
PilzAdam
<adam-k@outlook.com>
Fri, 2 Nov 2012 15:24:57 +0000
(16:24 +0100)
src/mapgen.cpp
patch
|
blob
|
history
src/noise.cpp
patch
|
blob
|
history
diff --git
a/src/mapgen.cpp
b/src/mapgen.cpp
index 67e92f4498bca02d0f458a64cb818e7b498fa760..77b133020d7a094f64f87037c523e950687045a2 100644
(file)
--- a/
src/mapgen.cpp
+++ b/
src/mapgen.cpp
@@
-1228,7
+1228,7
@@
double base_rock_level_2d(u64 seed, v2s16 p)
0.5+(float)p.X/125., 0.5+(float)p.Y/125.,
seed-932, 5, 0.7);
b = rangelim(b, 0.0, 1000.0);
- b =
pow(b, 7)
;
+ b =
b*b*b*b*b*b*b
;
b *= 5;
b = rangelim(b, 0.5, 1000.0);
// Values 1.5...100 give quite horrible looking slopes
diff --git
a/src/noise.cpp
b/src/noise.cpp
index 4a7fc87e7a36651de11bc5af90b8e99b618c3dd9..e75fbf4bd27e688b1499ad95f61c4fc903e75b47 100644
(file)
--- a/
src/noise.cpp
+++ b/
src/noise.cpp
@@
-37,7
+37,7
@@
double dotProduct(double vx, double vy, double wx, double wy){
}
double easeCurve(double t){
- return
6*pow(t,5)-15*pow(t,4)+10*pow(t,3
);
+ return
t * t * t * (6. * t * t - 15. * t + 10.
);
}
double linearInterpolation(double x0, double x1, double t){