diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-09-28 00:37:24 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-09-28 00:37:24 +0400 |
commit | cdee3435c67abebb633cb09410c4a87d42ff61e3 (patch) | |
tree | 9647e36a3661caab918e7726a5971b58b444d403 /intern/cycles/util | |
parent | 136d27b350355232ebe4d0a13427777445334b05 (diff) |
Cycles: internal changes that should have no effect on user level yet, added
shader flags for various purposes, and some code for light types other than
points.
Diffstat (limited to 'intern/cycles/util')
-rw-r--r-- | intern/cycles/util/util_math.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h index c0418b3d8fd..38e90f0b2b2 100644 --- a/intern/cycles/util/util_math.h +++ b/intern/cycles/util/util_math.h @@ -780,6 +780,19 @@ __device_inline float triangle_area(const float3 v1, const float3 v2, const floa #endif +/* Orthonormal vectors */ + +__device_inline void make_orthonormals(const float3 N, float3 *a, float3 *b) +{ + if(N.x != N.y || N.x != N.z) + *a = make_float3(N.z-N.y, N.x-N.z, N.y-N.x); //(1,1,1)x N + else + *a = make_float3(N.z-N.y, N.x+N.z, -N.y-N.x); //(-1,1,1)x N + + *a = normalize(*a); + *b = cross(N, *a); +} + CCL_NAMESPACE_END #endif /* __UTIL_MATH_H__ */ |