diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-02-14 16:32:38 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-02-14 16:55:46 +0300 |
commit | f6107af4cf4d907495e2e9c18e5866fd1d420650 (patch) | |
tree | ebac5a9d08145af572e5400c0697156797b73130 /source/blender/blenlib/BLI_hash.h | |
parent | c8e661706fcdd88f1cf371f2e5e4eb76bf09fda3 (diff) |
Cycles: change Index output of Hair and Particle Info to Random, in 0..1 range.
These are used for randomization, so it's convenient if the index is already
hashed and consistent with the Object Info node.
Diffstat (limited to 'source/blender/blenlib/BLI_hash.h')
-rw-r--r-- | source/blender/blenlib/BLI_hash.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_hash.h b/source/blender/blenlib/BLI_hash.h index e849e5f8f61..8b797820722 100644 --- a/source/blender/blenlib/BLI_hash.h +++ b/source/blender/blenlib/BLI_hash.h @@ -63,4 +63,9 @@ BLI_INLINE unsigned int BLI_hash_int(unsigned int k) return BLI_hash_int_2d(k, 0); } +BLI_INLINE float BLI_hash_int_01(unsigned int k) +{ + return (float)BLI_hash_int(k) * (1.0f/(float)0xFFFFFFFF); +} + #endif // __BLI_HASH_H__ |