Added HybridMultiF 3D & 4D
*new constructors for simple noises *minor bufixes Former-commit-id: 2f1e9b6b54087e79b3ac52fefc9bbd67fd45c0eb
This commit is contained in:
@@ -30,23 +30,23 @@ float NzHybridMultiFractal2D::GetValue(float x, float y, float resolution)
|
||||
{
|
||||
this->RecomputeExponentArray();
|
||||
|
||||
float offset = 1.0f;
|
||||
m_offset = 1.0f;
|
||||
|
||||
m_value = (m_source->GetValue(x,y,resolution) + offset) * m_exponent_array[0];
|
||||
float weight = m_value;
|
||||
float signal;
|
||||
m_value = (m_source->GetValue(x,y,resolution) + m_offset) * m_exponent_array[0];
|
||||
m_weight = m_value;
|
||||
m_signal = 0.f;
|
||||
|
||||
resolution *= m_lacunarity;
|
||||
|
||||
for(int i(1) ; i < m_octaves; ++i)
|
||||
{
|
||||
if(weight > 1.0)
|
||||
weight = 1.0;
|
||||
if(m_weight > 1.0)
|
||||
m_weight = 1.0;
|
||||
|
||||
signal = (m_source->GetValue(x,y,resolution) + offset) * m_exponent_array[i];
|
||||
m_value += weight * signal;
|
||||
m_signal = (m_source->GetValue(x,y,resolution) + m_offset) * m_exponent_array[i];
|
||||
m_value += m_weight * m_signal;
|
||||
|
||||
weight *= signal;
|
||||
m_weight *= m_signal;
|
||||
|
||||
resolution *= m_lacunarity;
|
||||
}
|
||||
@@ -56,7 +56,7 @@ float NzHybridMultiFractal2D::GetValue(float x, float y, float resolution)
|
||||
if(remainder != 0)
|
||||
m_value += m_remainder * m_source->GetValue(x,y,resolution) * m_exponent_array[static_cast<int>(m_octaves-1)];
|
||||
|
||||
return m_value/this->m_sum;
|
||||
return m_value/this->m_sum - m_offset;
|
||||
}
|
||||
|
||||
NzHybridMultiFractal2D::~NzHybridMultiFractal2D()
|
||||
|
||||
Reference in New Issue
Block a user