From d4fd06d6ce89113310bb769f4777c9a4d77cb155 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Fri, 12 Feb 2021 13:25:45 -0600 Subject: 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 --- source/blender/blenlib/BLI_hash.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source/blender/blenlib/BLI_hash.h') 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); -- cgit v1.2.3