diff options
author | Hans Goudey <h.goudey@me.com> | 2021-02-12 22:25:45 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-02-12 22:25:45 +0300 |
commit | d4fd06d6ce89113310bb769f4777c9a4d77cb155 (patch) | |
tree | f94c3e05a65bca55a0e54f4c1fb72d9e23734e17 /source/blender/blenlib/BLI_hash.h | |
parent | d7c2c889a688067dab280fc137ad4c3c7ce4cb2b (diff) |
Geometry Nodes: Add operation setting to attribute randomize node
This commit adds a drop-down to the attribute randomize node to support
a few operations on the values of existing attributes: "Replace/Create"
(the existing behavior), "Add", "Subtract", and "Multiply".
At this point, the operations are limited by what is simple to implement.
More could be added in the future, but there isn't a strong use case
for more complex operations anyway, and a second math node can be used.
Differential Revision: https://developer.blender.org/D10269
Diffstat (limited to 'source/blender/blenlib/BLI_hash.h')
-rw-r--r-- | source/blender/blenlib/BLI_hash.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_hash.h b/source/blender/blenlib/BLI_hash.h index d687e805323..cfd39ea3cf8 100644 --- a/source/blender/blenlib/BLI_hash.h +++ b/source/blender/blenlib/BLI_hash.h @@ -90,6 +90,16 @@ BLI_INLINE unsigned int BLI_hash_string(const char *str) return i; } +BLI_INLINE float BLI_hash_int_2d_to_float(uint32_t kx, uint32_t ky) +{ + return (float)BLI_hash_int_2d(kx, ky) / (float)0xFFFFFFFFu; +} + +BLI_INLINE float BLI_hash_int_3d_to_float(uint32_t kx, uint32_t ky, uint32_t kz) +{ + return (float)BLI_hash_int_3d(kx, ky, kz) / (float)0xFFFFFFFFu; +} + BLI_INLINE unsigned int BLI_hash_int(unsigned int k) { return BLI_hash_int_2d(k, 0); |