Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-03-10 02:37:07 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-03-10 06:54:05 +0300
commit267d8923265a284c5d9a462e1d86305d613fcad8 (patch)
tree7e0bd31d403a4d878ec65aaac3883bbfea67cc20 /intern/cycles/render/mesh.cpp
parent6c4ddfc5d9833b6c4f0ae3da93645556fee97caf (diff)
Code refactor: motion blur cleanups, preparing for next commit.
Diffstat (limited to 'intern/cycles/render/mesh.cpp')
-rw-r--r--intern/cycles/render/mesh.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp
index 71cbf5c24b6..9166d3bcd5e 100644
--- a/intern/cycles/render/mesh.cpp
+++ b/intern/cycles/render/mesh.cpp
@@ -1117,6 +1117,32 @@ bool Mesh::has_true_displacement() const
return false;
}
+float Mesh::motion_time(int step) const
+{
+ return (motion_steps > 1) ? 2.0f * step / (motion_steps - 1) - 1.0f : 0.0f;
+}
+
+int Mesh::motion_step(float time) const
+{
+ if(motion_steps > 1) {
+ int attr_step = 0;
+
+ for(int step = 0; step < motion_steps; step++) {
+ float step_time = motion_time(step);
+ if(step_time == time) {
+ return attr_step;
+ }
+
+ /* Center step is stored in a separate attribute. */
+ if(step != motion_steps / 2) {
+ attr_step++;
+ }
+ }
+ }
+
+ return -1;
+}
+
bool Mesh::need_build_bvh() const
{
return !transform_applied || has_surface_bssrdf;