diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2021-05-18 16:43:06 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2021-05-18 16:43:06 +0300 |
commit | 7aa7cc4ca14546722509dbe04cd0bcdca3df07b6 (patch) | |
tree | 6dc9d1c7e4336c1139012ff1597027c497ffafe2 /source/blender/blenkernel | |
parent | 2b660e825b46131789d67a730773c8d56be4c229 (diff) | |
parent | a9da73ab95f07b7965df133edb6f32429ccb7302 (diff) |
Merge branch 'blender-v2.93-release'
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/ocean.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c index d2f4d0702ed..9d53dad8d03 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -911,8 +911,12 @@ void BKE_ocean_init(struct Ocean *o, for (i = 0; i < o->_M; i++) { for (j = 0; j < o->_N; j++) { /* This ensures we get a value tied to the surface location, avoiding dramatic surface - * change with changing resolution. */ - int new_seed = seed + BLI_hash_int_2d(o->_kx[i] * 360.0f, o->_kz[j] * 360.0f); + * change with changing resolution. + * Explicitly cast to signed int first to ensure consistent behavior on all processors, + * since behavior of float to unsigned int cast is undefined in C. */ + const int hash_x = o->_kx[i] * 360.0f; + const int hash_z = o->_kz[j] * 360.0f; + int new_seed = seed + BLI_hash_int_2d(hash_x, hash_z); BLI_rng_seed(rng, new_seed); float r1 = gaussRand(rng); |