perlin_noise.h Source File - ClanLib SDK
Description: perlin_noise.h Source File

perlin_noise.h
1/*
2** ClanLib SDK
3** Copyright (c) 1997-2020 The ClanLib Team
4**
5** This software is provided 'as-is', without any express or implied
6** warranty. In no event will the authors be held liable for any damages
7** arising from the use of this software.
8**
9** Permission is granted to anyone to use this software for any purpose,
10** including commercial applications, and to alter it and redistribute it
11** freely, subject to the following restrictions:
12**
13** 1. The origin of this software must not be misrepresented; you must not
14** claim that you wrote the original software. If you use this software
15** in a product, an acknowledgment in the product documentation would be
16** appreciated but is not required.
17** 2. Altered source versions must be plainly marked as such, and must not be
18** misrepresented as being the original software.
19** 3. This notice may not be removed or altered from any source distribution.
20**
21** Note: Some of the libraries ClanLib may link to may have additional
22** requirements or restrictions.
23**
24** File Author(s):
25**
26** Mark Page
27*/
28
29#pragma once
30
31#include <memory>
32#include "pixel_buffer.h"
33
34namespace clan
35{
38
39 class PerlinNoise_Impl;
40
42 class PerlinNoise
43 {
44 public:
46 PerlinNoise();
47
49 virtual ~PerlinNoise();
50
60 PixelBuffer create_noise1d(float start_x, float end_x);
61
70 PixelBuffer create_noise2d(float start_x, float end_x, float start_y, float end_y);
71
81 PixelBuffer create_noise3d(float start_x, float end_x, float start_y, float end_y, float z_position);
82
93 PixelBuffer create_noise4d(float start_x, float end_x, float start_y, float end_y, float z_position, float w_position);
94
96 Size get_size() const;
97
99 TextureFormat get_format() const;
100
102 float get_amplitude() const;
103
105 int get_octaves() const;
106
113 void set_permutations(const unsigned char *table, unsigned int size = 256);
114
121 void set_size(int width = 256, int height = 256);
122
129 void set_size(const Size &size);
130
138 void set_format(TextureFormat texture_format = TextureFormat::rgb8);
139
145 void set_amplitude(float amplitude = 1.0f);
146
152 void set_octaves(int octaves = 1);
153
154 private:
155 std::shared_ptr<PerlinNoise_Impl> impl;
156 };
157
159}
clan::PerlinNoise
Perlin Noise Generator class.
Definition perlin_noise.h:43
clan::PerlinNoise::get_format
TextureFormat get_format() const
Get the format of the output pixelbuffer.
clan::PerlinNoise::get_amplitude
float get_amplitude() const
Get the amplitude of the perlin noise.
clan::PerlinNoise::create_noise2d
PixelBuffer create_noise2d(float start_x, float end_x, float start_y, float end_y)
Create the perlin noise.
clan::PerlinNoise::get_octaves
int get_octaves() const
Get the number of octaves of the perlin noise.
clan::PerlinNoise::set_size
void set_size(int width=256, int height=256)
Set the size of the output pixelbuffer.
clan::PerlinNoise::PerlinNoise
PerlinNoise()
Constructor.
clan::PerlinNoise::get_size
Size get_size() const
Get the size of the output pixelbuffer.
clan::PerlinNoise::set_permutations
void set_permutations(const unsigned char *table, unsigned int size=256)
Set the permutation table.
clan::PerlinNoise::set_amplitude
void set_amplitude(float amplitude=1.0f)
Set the amplitude of the perlin noise.
clan::PerlinNoise::create_noise3d
PixelBuffer create_noise3d(float start_x, float end_x, float start_y, float end_y, float z_position)
Create the perlin noise.
clan::PerlinNoise::set_size
void set_size(const Size &size)
Set the size of the output pixelbuffer.
clan::PerlinNoise::~PerlinNoise
virtual ~PerlinNoise()
Destructor.
clan::PerlinNoise::set_format
void set_format(TextureFormat texture_format=TextureFormat::rgb8)
Set the format of the output pixelbuffer.
clan::PerlinNoise::set_octaves
void set_octaves(int octaves=1)
Set the number of octaves of the perlin noise.
clan::PerlinNoise::create_noise1d
PixelBuffer create_noise1d(float start_x, float end_x)
Create the perlin noise.
clan::PerlinNoise::create_noise4d
PixelBuffer create_noise4d(float start_x, float end_x, float start_y, float end_y, float z_position, float w_position)
Create the perlin noise.
clan::PixelBuffer
Pixel data container.
Definition pixel_buffer.h:68
clan::Size
2D (width,height) size structure - Integer
Definition size.h:171
clan::TextureFormat
TextureFormat
Texture format.
Definition texture_format.h:39
clan::TextureFormat::rgb8
@ rgb8
clan
Definition clanapp.h:36