1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-26 12:18:51 -05:00

Fix numeric conversion warnings in example

This commit is contained in:
Camilla Löwy 2021-06-07 22:34:33 +02:00
parent 114776a246
commit df15a33e10

View File

@ -292,12 +292,12 @@ static void generate_heightmap__circle(float* center_x, float* center_y,
{ {
float sign; float sign;
/* random value for element in between [0-1.0] */ /* random value for element in between [0-1.0] */
*center_x = (MAP_SIZE * rand()) / (1.0f * RAND_MAX); *center_x = (MAP_SIZE * rand()) / (float) RAND_MAX;
*center_y = (MAP_SIZE * rand()) / (1.0f * RAND_MAX); *center_y = (MAP_SIZE * rand()) / (float) RAND_MAX;
*size = (MAX_CIRCLE_SIZE * rand()) / (1.0f * RAND_MAX); *size = (MAX_CIRCLE_SIZE * rand()) / (float) RAND_MAX;
sign = (1.0f * rand()) / (1.0f * RAND_MAX); sign = (1.0f * rand()) / (float) RAND_MAX;
sign = (sign < DISPLACEMENT_SIGN_LIMIT) ? -1.0f : 1.0f; sign = (sign < DISPLACEMENT_SIGN_LIMIT) ? -1.0f : 1.0f;
*displacement = (sign * (MAX_DISPLACEMENT * rand())) / (1.0f * RAND_MAX); *displacement = (sign * (MAX_DISPLACEMENT * rand())) / (float) RAND_MAX;
} }
/* Run the specified number of iterations of the generation process for the /* Run the specified number of iterations of the generation process for the