n/f/fbm: accumulate frequency directly on point
avoids (minimal) extra multiplications.
This commit is contained in:
parent
6278902e3e
commit
4f7a3d790f
@ -60,14 +60,15 @@ namespace util { namespace noise { namespace fractal {
|
|||||||
fbm<T,B>::operator() (util::point<2,T> p) const
|
fbm<T,B>::operator() (util::point<2,T> p) const
|
||||||
{
|
{
|
||||||
T total = 0;
|
T total = 0;
|
||||||
T f = this->m_frequency;
|
T scale = this->m_invAH;
|
||||||
T a = this->m_invAH;
|
|
||||||
|
p *= this->m_frequency;
|
||||||
|
|
||||||
for (size_t i = 0; i < this->m_octaves; ++i) {
|
for (size_t i = 0; i < this->m_octaves; ++i) {
|
||||||
total += this->m_basis (p * f) * a;
|
total += this->m_basis (p) * scale;
|
||||||
|
|
||||||
f *= this->m_lacunarity;
|
p *= this->m_lacunarity;
|
||||||
a *= this->m_invGH;
|
scale *= this->m_invGH;
|
||||||
}
|
}
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
|
Loading…
Reference in New Issue
Block a user