forked from Mirrorlandia_minetest/minetest
Improve Clouds::render mathematics
This commit is contained in:
parent
5698e2baf8
commit
a603a76787
@ -162,30 +162,25 @@ void Clouds::render()
|
||||
|
||||
bool *grid = new bool[cloud_radius_i * 2 * cloud_radius_i * 2];
|
||||
|
||||
for(s16 zi=-cloud_radius_i; zi<cloud_radius_i; zi++)
|
||||
for(s16 xi=-cloud_radius_i; xi<cloud_radius_i; xi++)
|
||||
{
|
||||
u32 i = (zi+cloud_radius_i)*cloud_radius_i*2 + xi+cloud_radius_i;
|
||||
float cloud_size_noise = cloud_size / BS / 200;
|
||||
|
||||
for(s16 zi = -cloud_radius_i; zi < cloud_radius_i; zi++) {
|
||||
u32 si = (zi + cloud_radius_i) * cloud_radius_i * 2 + cloud_radius_i;
|
||||
|
||||
for(s16 xi = -cloud_radius_i; xi < cloud_radius_i; xi++) {
|
||||
u32 i = si + xi;
|
||||
|
||||
v2s16 p_in_noise_i(
|
||||
xi + center_of_drawing_in_noise_i.X,
|
||||
zi + center_of_drawing_in_noise_i.Y
|
||||
);
|
||||
|
||||
#if 0
|
||||
double noise = noise2d_perlin_abs(
|
||||
(float)p_in_noise_i.X*cloud_size/BS/200,
|
||||
(float)p_in_noise_i.Y*cloud_size/BS/200,
|
||||
m_seed, 3, 0.4);
|
||||
grid[i] = (noise >= 0.80);
|
||||
#endif
|
||||
#if 1
|
||||
double noise = noise2d_perlin(
|
||||
(float)p_in_noise_i.X*cloud_size/BS/200,
|
||||
(float)p_in_noise_i.Y*cloud_size/BS/200,
|
||||
(float)p_in_noise_i.X * cloud_size_noise,
|
||||
(float)p_in_noise_i.Y * cloud_size_noise,
|
||||
m_seed, 3, 0.5);
|
||||
grid[i] = (noise >= 0.4);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#define GETINDEX(x, z, radius) (((z)+(radius))*(radius)*2 + (x)+(radius))
|
||||
|
Loading…
Reference in New Issue
Block a user