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 /intern/cycles/util | |
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 'intern/cycles/util')
-rw-r--r-- | intern/cycles/util/util_hash.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/intern/cycles/util/util_hash.h b/intern/cycles/util/util_hash.h index a30b7fe288e..2307ca158f0 100644 --- a/intern/cycles/util/util_hash.h +++ b/intern/cycles/util/util_hash.h @@ -61,6 +61,11 @@ static inline uint hash_string(const char *str) } #endif +ccl_device_inline float hash_int_01(uint k) +{ + return (float)hash_int(k) * (1.0f/(float)0xFFFFFFFF); +} + CCL_NAMESPACE_END #endif /* __UTIL_HASH_H__ */ |