mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 00:32:57 -04:00
pnmimage: Add offset parameters to PNMImage::perlin_noise_fill()
This commit is contained in:
parent
6777f19162
commit
a1538b4f7c
@ -1980,13 +1980,14 @@ quantize(size_t max_colors) {
|
|||||||
* PerlinNoise2 class in mathutil.
|
* PerlinNoise2 class in mathutil.
|
||||||
*/
|
*/
|
||||||
void PNMImage::
|
void PNMImage::
|
||||||
perlin_noise_fill(float sx, float sy, int table_size, unsigned long seed) {
|
perlin_noise_fill(float sx, float sy, int table_size, unsigned long seed,
|
||||||
|
float ox, float oy) {
|
||||||
float x, y;
|
float x, y;
|
||||||
float noise;
|
float noise;
|
||||||
PerlinNoise2 perlin (sx * _x_size, sy * _y_size, table_size, seed);
|
PerlinNoise2 perlin (sx * _x_size, sy * _y_size, table_size, seed);
|
||||||
for (x = 0; x < _x_size; ++x) {
|
for (x = 0; x < _x_size; ++x) {
|
||||||
for (y = 0; y < _y_size; ++y) {
|
for (y = 0; y < _y_size; ++y) {
|
||||||
noise = perlin.noise(x, y);
|
noise = perlin.noise(x + ox, y + oy);
|
||||||
set_xel(x, y, 0.5 * (noise + 1.0));
|
set_xel(x, y, 0.5 * (noise + 1.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -258,7 +258,8 @@ PUBLISHED:
|
|||||||
void make_histogram(Histogram &hist);
|
void make_histogram(Histogram &hist);
|
||||||
void quantize(size_t max_colors);
|
void quantize(size_t max_colors);
|
||||||
BLOCKING void perlin_noise_fill(float sx, float sy, int table_size = 256,
|
BLOCKING void perlin_noise_fill(float sx, float sy, int table_size = 256,
|
||||||
unsigned long seed = 0);
|
unsigned long seed = 0,
|
||||||
|
float ox = 0, float oy = 0);
|
||||||
void perlin_noise_fill(StackedPerlinNoise2 &perlin);
|
void perlin_noise_fill(StackedPerlinNoise2 &perlin);
|
||||||
|
|
||||||
void remix_channels(const LMatrix4 &conv);
|
void remix_channels(const LMatrix4 &conv);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user