Replaced templates by float
*Since only valid template parameters were float and double, the whole template aspect has been removed. Double precision would only be used in extremely rare occasions (applications needing high precision and slow performances), it is not relevant to template the whole module for it. Former-commit-id: fc6dd028189c608a6a7b4c312b3e5e3f53a01fd7
This commit is contained in:
53
src/Nazara/Noise/MappedNoiseBase.cpp
Normal file
53
src/Nazara/Noise/MappedNoiseBase.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
// 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/Core/StringStream.hpp>
|
||||
#include <Nazara/Math/Basic.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Noise/Config.hpp>
|
||||
#include <stdexcept>
|
||||
#include <Nazara/Noise/Debug.hpp>
|
||||
#include <Nazara/Noise/MappedNoiseBase.hpp>
|
||||
|
||||
NzMappedNoiseBase::NzMappedNoiseBase() : m_gain(1.f), m_offset(0.f), m_resolution(30.f)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
float NzMappedNoiseBase::GetGain() const
|
||||
{
|
||||
return m_gain;
|
||||
}
|
||||
|
||||
float NzMappedNoiseBase::GetOffset() const
|
||||
{
|
||||
return m_offset;
|
||||
}
|
||||
|
||||
float NzMappedNoiseBase::GetResolution() const
|
||||
{
|
||||
return m_resolution;
|
||||
}
|
||||
|
||||
void NzMappedNoiseBase::SetGain(float gain)
|
||||
{
|
||||
m_gain = gain;
|
||||
}
|
||||
|
||||
void NzMappedNoiseBase::SetOffset(float offset)
|
||||
{
|
||||
m_offset = offset;
|
||||
}
|
||||
|
||||
void NzMappedNoiseBase::SetResolution(float resolution)
|
||||
{
|
||||
if (NzNumberEquals(resolution, 0.f))
|
||||
{
|
||||
NzStringStream ss;
|
||||
ss << __FILE__ << ':' << __LINE__ << " : resolution cannot be 0.0f";
|
||||
|
||||
throw std::domain_error(ss.ToString());
|
||||
}
|
||||
m_resolution = resolution;
|
||||
}
|
||||
Reference in New Issue
Block a user