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@pandora.be>2011-09-02 20:15:18 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-09-02 20:15:18 +0400
commit67030aaf84229b4d0dc52fbe07e91c2c9d320b0d (patch)
tree9b8d2402b3dd92134d78d1661d678effd8a70ecd /intern/cycles/util
parent1135875ab1501ff38184b91dc541aa8a2fe89c92 (diff)
Cycles: optimizations for instances in scene updates before render starts,
should load a non-trivial mesh instanced many times quite a bit faster now.
Diffstat (limited to 'intern/cycles/util')
-rw-r--r--intern/cycles/util/util_transform.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/intern/cycles/util/util_transform.h b/intern/cycles/util/util_transform.h
index e904674a981..998d4161ebf 100644
--- a/intern/cycles/util/util_transform.h
+++ b/intern/cycles/util/util_transform.h
@@ -205,6 +205,30 @@ __device_inline float3 transform_get_column(const Transform *t, int column)
Transform transform_inverse(const Transform& a);
+__device_inline bool transform_uniform_scale(const Transform& tfm, float& scale)
+{
+ /* the epsilon here is quite arbitrary, but this function is only used for
+ surface area and bump, where we except it to not be so sensitive */
+ Transform ttfm = transform_transpose(tfm);
+ float eps = 1e-7f;
+
+ float sx = len(float4_to_float3(tfm.x));
+ float sy = len(float4_to_float3(tfm.y));
+ float sz = len(float4_to_float3(tfm.z));
+ float stx = len(float4_to_float3(ttfm.x));
+ float sty = len(float4_to_float3(ttfm.y));
+ float stz = len(float4_to_float3(ttfm.z));
+
+ if(fabsf(sx - sy) < eps && fabsf(sx - sz) < eps &&
+ fabsf(sx - stx) < eps && fabsf(sx - sty) < eps &&
+ fabsf(sx - stz) < eps) {
+ scale = sx;
+ return true;
+ }
+
+ return false;
+}
+
#endif
CCL_NAMESPACE_END