diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-01-24 22:19:48 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-01-29 19:07:08 +0300 |
commit | 1eeb846e781dac3f55d6c108d0fc4c3cfe88f4cc (patch) | |
tree | c80b01eb79df21ad995cb22831ac6012dc0fd1c1 /intern/cycles/util | |
parent | fb941679bb6e537a8fb1e1de69b5a446490e761b (diff) |
Fix Cycles viewport render not updating when tweaking displacement shader.
This was disabled to avoid updating the geometry every time when the
material includes displacement, because there was no way to distinguish
between surface shader and displacement updates.
As a solution, we now compute an MD5 hash of the nodes linked to the
displacement socket, and only update the mesh if that changes.
Differential Revision: https://developer.blender.org/D3018
Diffstat (limited to 'intern/cycles/util')
-rw-r--r-- | intern/cycles/util/util_md5.cpp | 7 | ||||
-rw-r--r-- | intern/cycles/util/util_md5.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/intern/cycles/util/util_md5.cpp b/intern/cycles/util/util_md5.cpp index 19168135f01..749760d84f0 100644 --- a/intern/cycles/util/util_md5.cpp +++ b/intern/cycles/util/util_md5.cpp @@ -310,6 +310,13 @@ void MD5Hash::append(const uint8_t *data, int nbytes) memcpy(buf, p, left); } +void MD5Hash::append(const string& str) +{ + if(str.size()) { + append((const uint8_t*)str.c_str(), str.size()); + } +} + bool MD5Hash::append_file(const string& filepath) { FILE *f = path_fopen(filepath, "rb"); diff --git a/intern/cycles/util/util_md5.h b/intern/cycles/util/util_md5.h index e4cd66c85b0..b043b591e67 100644 --- a/intern/cycles/util/util_md5.h +++ b/intern/cycles/util/util_md5.h @@ -41,6 +41,7 @@ public: ~MD5Hash(); void append(const uint8_t *data, int size); + void append(const string& str); bool append_file(const string& filepath); string get_hex(); |