Modifications for the new architecture

to fullfill mixer implementation requirements
*Added FBM2D, first complex noise class of the new architecture
*Removed NoiseMachine, because was redundant and not fitting with the new
architecture
*Minor changes to almost every other noise class (mostly adding 'this->')
everywhere an inherited member from template base class was called from
the inherited class
This commit is contained in:
Remi Beges
2012-10-02 19:55:35 +02:00
parent a41a2ddcb3
commit 3f8e3cfb60
21 changed files with 295 additions and 994 deletions

View File

@@ -1,62 +0,0 @@
// Copyright (C) 2012 Rémi Bèges
// This file is part of the "Nazara Engine".
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Noise/ComplexNoiseBase.hpp>
#include <cmath>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Noise/Config.hpp>
#include <Nazara/Noise/Debug.hpp>
NzComplexNoiseBase::NzComplexNoiseBase()
{
m_parametersModified = true;
m_lacunarity = 5.0f;
m_hurst = 1.2f;
m_octaves = 3.0f;
}
void NzComplexNoiseBase::SetLacunarity(float lacunarity)
{
if(lacunarity != m_lacunarity)
{
m_lacunarity = lacunarity;
m_parametersModified = true;
}
}
void NzComplexNoiseBase::SetHurstParameter(float h)
{
if(h != m_hurst)
{
m_hurst = h;
m_parametersModified = true;
}
}
void NzComplexNoiseBase::SetOctavesNumber(float octaves)
{
if(octaves != m_octaves && octaves < 30)
{
m_octaves = octaves;
m_parametersModified = true;
}
}
void NzComplexNoiseBase::RecomputeExponentArray()
{
if(m_parametersModified)
{
float frequency = 1.0;
m_sum = 0.f;
for (int i(0) ; i < m_octaves; ++i)
{
exponent_array[i] = std::pow( frequency, -m_hurst );
frequency *= m_lacunarity;
m_sum += exponent_array[i];
}
m_parametersModified = false;
}
}