Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/intern/noise.c
| Show First 20 Lines • Show All 1,630 Lines • ▼ Show 20 Lines | switch (noisebasis) { | ||||
| default: { | default: { | ||||
| noisefunc = orgBlenderNoiseS; | noisefunc = orgBlenderNoiseS; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| float signal = powf(offset - fabsf(noisefunc(x, y, z)), 2); | float signal = powf(offset - fabsf(noisefunc(x, y, z)), 2); | ||||
| float result = signal; | float result = signal; | ||||
| for (int i = 1; i < (int)octaves; i++) { | |||||
| float pwHL = powf(lacunarity, -H); | float pwHL = powf(lacunarity, -H); | ||||
| float pwr = pwHL; /* starts with i=1 instead of 0 */ | float pwr = pwHL; /* starts with i=1 instead of 0 */ | ||||
| for (int i = 1; i < (int)octaves; i++) { | |||||
| x *= lacunarity; | x *= lacunarity; | ||||
| y *= lacunarity; | y *= lacunarity; | ||||
| z *= lacunarity; | z *= lacunarity; | ||||
| float weight = signal * gain; | float weight = signal * gain; | ||||
| if (weight > 1.0f) { | if (weight > 1.0f) { | ||||
| weight = 1.0f; | weight = 1.0f; | ||||
| } | } | ||||
| else if (weight < 0.0f) { | else if (weight < 0.0f) { | ||||
| ▲ Show 20 Lines • Show All 103 Lines • Show Last 20 Lines | |||||