17 #ifndef __UTIL_TRANSFORM_H__
18 #define __UTIL_TRANSFORM_H__
20 #ifndef __KERNEL_GPU__
34 #ifndef __KERNEL_GPU__
59 #if defined(__KERNEL_SSE__) && defined(__KERNEL_SSE2__)
63 x = _mm_loadu_ps(&
t->x.x);
64 y = _mm_loadu_ps(&
t->y.x);
65 z = _mm_loadu_ps(&
t->z.x);
66 w = _mm_set_ps(1.0f, 0.0f, 0.0f, 0.0f);
68 _MM_TRANSPOSE4_PS(
x,
y,
z,
w);
70 ssef tmp = shuffle<0>(aa) *
x;
71 tmp =
madd(shuffle<1>(aa),
y, tmp);
72 tmp =
madd(shuffle<2>(aa),
z, tmp);
78 a.x *
t->y.x +
a.y *
t->y.y +
a.z *
t->y.z +
t->y.w,
79 a.x *
t->z.x +
a.y *
t->z.y +
a.z *
t->z.z +
t->z.w);
87 #if defined(__KERNEL_SSE__) && defined(__KERNEL_SSE2__)
90 x = _mm_loadu_ps(&
t->x.x);
91 y = _mm_loadu_ps(&
t->y.x);
92 z = _mm_loadu_ps(&
t->z.x);
95 _MM_TRANSPOSE4_PS(
x,
y,
z,
w);
97 ssef tmp = shuffle<0>(aa) *
x;
98 tmp =
madd(shuffle<1>(aa),
y, tmp);
99 tmp =
madd(shuffle<2>(aa),
z, tmp);
104 a.x *
t->y.x +
a.y *
t->y.y +
a.z *
t->y.z,
105 a.x *
t->z.x +
a.y *
t->z.y +
a.z *
t->z.z);
153 float cx =
cosf(euler.
x);
154 float cy =
cosf(euler.
y);
155 float cz =
cosf(euler.
z);
156 float sx =
sinf(euler.
x);
157 float sy =
sinf(euler.
y);
158 float sz =
sinf(euler.
z);
165 t.x.y = sy * sx * cz - cx * sz;
166 t.y.y = sy * sx * sz + cx * cz;
169 t.x.z = sy * cx * cz + sx * sz;
170 t.y.z = sy * cx * sz - sx * cz;
173 t.x.w =
t.y.w =
t.z.w = 0.0f;
184 return make_transform(dx.
x, dx.
y, dx.
z, 0.0f, dy.
x, dy.
y, dy.
z, 0.0f,
N.x,
N.y,
N.z, 0.0f);
187 #ifndef __KERNEL_GPU__
220 return make_transform(1, 0, 0,
t.x, 0, 1, 0,
t.y, 0, 0, 1,
t.z);
230 return make_transform(s.
x, 0, 0, 0, 0, s.
y, 0, 0, 0, 0, s.
z, 0);
247 axis.
x * axis.
y *
t - s * axis.
z,
248 axis.
x * axis.
z *
t + s * axis.
y,
251 axis.
y * axis.
x *
t + s * axis.
z,
252 axis.
y * axis.
y *
t +
c,
253 axis.
y * axis.
z *
t - s * axis.
x,
256 axis.
z * axis.
x *
t - s * axis.
y,
257 axis.
z * axis.
y *
t + s * axis.
x,
258 axis.
z * axis.
z *
t +
c,
292 t->x[column] = value.
x;
293 t->y[column] = value.
y;
294 t->z[column] = value.
z;
328 return (
dot(
cross(c0, c1), c2) < 0.0f);
344 return make_transform(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
354 #ifdef __KERNEL_OPTIX__
359 float costheta =
dot(
q1, q2);
363 if (costheta > 0.9995f) {
369 float theta =
acosf(
clamp(costheta, -1.0f, 1.0f));
371 float thetap = theta *
t;
372 return q1 *
cosf(thetap) + qperp *
sinf(thetap);
383 float det =
M.x.x * (
M.z.z *
M.y.y -
M.z.y *
M.y.z) -
M.y.x * (
M.z.z *
M.x.y -
M.z.y *
M.x.z) +
384 M.z.x * (
M.y.z *
M.x.y -
M.y.y *
M.x.z);
389 det =
M.x.x * (
M.z.z *
M.y.y -
M.z.y *
M.y.z) -
M.y.x * (
M.z.z *
M.x.y -
M.z.y *
M.x.z) +
390 M.z.x * (
M.y.z *
M.x.y -
M.y.y *
M.x.z);
392 det = (det != 0.0f) ? 1.0f / det : 0.0f;
395 M.z.y *
M.x.z -
M.z.z *
M.x.y,
396 M.y.z *
M.x.y -
M.y.y *
M.x.z);
398 M.z.z *
M.x.x -
M.z.x *
M.x.z,
399 M.y.x *
M.x.z -
M.y.z *
M.x.x);
401 M.z.x *
M.x.y -
M.z.y *
M.x.x,
402 M.y.y *
M.x.x -
M.y.x *
M.x.y);
415 float q0,
q1, q2, q3, qda, qdb, qdc, qaa, qab, qac, qbb, qbc, qcc;
443 dot(rotation_x, scale_x),
dot(rotation_x, scale_y),
dot(rotation_x, scale_z), decomp->
y.x);
445 dot(rotation_y, scale_x),
dot(rotation_y, scale_y),
dot(rotation_y, scale_z), decomp->
y.y);
447 dot(rotation_z, scale_x),
dot(rotation_z, scale_y),
dot(rotation_z, scale_z), decomp->
y.z);
457 int maxstep = numsteps - 1;
458 int step =
min((
int)(
time * maxstep), maxstep - 1);
459 float t =
time * maxstep - step;
467 decomp.
y = (1.0f -
t) *
a->y +
t * b->y;
468 decomp.
z = (1.0f -
t) *
a->z +
t * b->z;
469 decomp.
w = (1.0f -
t) *
a->w +
t * b->w;
486 #ifndef __KERNEL_GPU__
506 #ifdef __KERNEL_OPENCL__
508 # define OPENCL_TRANSFORM_ADDRSPACE_GLUE(a, b) a##b
509 # define OPENCL_TRANSFORM_ADDRSPACE_DECLARE(function) \
510 ccl_device_inline float3 OPENCL_TRANSFORM_ADDRSPACE_GLUE(function, _addrspace)( \
511 ccl_addr_space const Transform *t, const float3 a) \
513 Transform private_tfm = *t; \
514 return function(&private_tfm, a); \
521 # undef OPENCL_TRANSFORM_ADDRSPACE_DECLARE
522 # undef OPENCL_TRANSFORM_ADDRSPACE_GLUE
523 # define transform_point_auto transform_point_addrspace
524 # define transform_direction_auto transform_direction_addrspace
525 # define transform_direction_transposed_auto transform_direction_transposed_addrspace
527 # define transform_point_auto transform_point
528 # define transform_direction_auto transform_direction
529 # define transform_direction_transposed_auto transform_direction_transposed
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble z
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
#define ccl_device_inline
#define CCL_NAMESPACE_END
#define make_float4(x, y, z, w)
#define make_float3(x, y, z)
__forceinline avxf cross(const avxf &a, const avxf &b)
__forceinline const avxf madd(const avxf &a, const avxf &b, const avxf &c)
Ternary Operators.
ccl_device_inline float3 float4_to_float3(const float4 a)
ccl_device_inline int clamp(int a, int mn, int mx)
ccl_device_inline float2 normalize(const float2 &a)
ccl_device_inline float dot(const float2 &a, const float2 &b)
ccl_device_inline float len_squared(const float3 a)
ccl_device_inline bool isfinite4_safe(float4 v)
ccl_device_inline float4 zero_float4()
ccl_device_inline void print_float4(const char *label, const float4 &a)