Files
o3de/Gems/GradientSignal/Code/Include/GradientSignal/PerlinImprovedNoise.h
T
Steve Pham 38261d0800 Shorten copyright headers by splitting into 2 lines (#2213)
* Updated all copyright headers to split the longer original copyright line into 2 shorter lines

Signed-off-by: Steve Pham <spham@amazon.com>
2021-07-16 15:25:48 -07:00

48 lines
1.3 KiB
C++

/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <AzCore/std/containers/array.h>
#include <AzCore/Memory/Memory.h>
#include <AzCore/Memory/SystemAllocator.h>
namespace GradientSignal
{
/**
* Implementation of the Perlin improved noise algorithm
* Perlin noise can be used for any sort of wave-like deterministic patterns
*/
class PerlinImprovedNoise final
{
public:
AZ_CLASS_ALLOCATOR(PerlinImprovedNoise, AZ::SystemAllocator, 0);
/**
* Prepares the permutation table with a given random seed
*/
PerlinImprovedNoise(int seed);
/**
* Creates a Perlin 'natural' noise factor values based on a position with smoothing parameters
*/
float GenerateOctaveNoise(float x, float y, float z, int octaves, float persistence, float initialFrequency = 1.0f);
/**
* Creates a Perlin noise factor value based on a position
*/
float GenerateNoise(float x, float y, float z);
protected:
void PrepareTable(int seed);
private:
AZStd::array<int, 512> m_permutationTable;
};
} // namespace GradientSignal