4 #ifndef __UTIL_TRANSFORM_H__
5 #define __UTIL_TRANSFORM_H__
14 #ifndef __KERNEL_GPU__
25 #ifndef __KERNEL_GPU__
53 #ifdef __KERNEL_METAL__
65 #if defined(__KERNEL_SSE__) && defined(__KERNEL_SSE2__)
69 x = _mm_loadu_ps(&
t->x.x);
70 y = _mm_loadu_ps(&
t->y.x);
71 z = _mm_loadu_ps(&
t->z.x);
72 w = _mm_set_ps(1.0f, 0.0f, 0.0f, 0.0f);
74 _MM_TRANSPOSE4_PS(
x,
y,
z,
w);
77 tmp =
madd(shuffle<2>(aa),
z, tmp);
78 tmp =
madd(shuffle<1>(aa),
y, tmp);
79 tmp =
madd(shuffle<0>(aa),
x, tmp);
82 #elif defined(__KERNEL_METAL__)
87 a.x *
t->y.x +
a.y *
t->y.y +
a.z *
t->y.z +
t->y.w,
88 a.x *
t->z.x +
a.y *
t->z.y +
a.z *
t->z.z +
t->z.w);
96 #if defined(__KERNEL_SSE__) && defined(__KERNEL_SSE2__)
99 x = _mm_loadu_ps(&
t->x.x);
100 y = _mm_loadu_ps(&
t->y.x);
101 z = _mm_loadu_ps(&
t->z.x);
102 w = _mm_setzero_ps();
104 _MM_TRANSPOSE4_PS(
x,
y,
z,
w);
106 ssef tmp = shuffle<2>(aa) *
z;
107 tmp =
madd(shuffle<1>(aa),
y, tmp);
108 tmp =
madd(shuffle<0>(aa),
x, tmp);
111 #elif defined(__KERNEL_METAL__)
116 a.x *
t->y.x +
a.y *
t->y.y +
a.z *
t->y.z,
117 a.x *
t->z.x +
a.y *
t->z.y +
a.z *
t->z.z);
166 float cx =
cosf(euler.
x);
167 float cy =
cosf(euler.
y);
168 float cz =
cosf(euler.
z);
171 float sz =
sinf(euler.
z);
178 t.x.y =
sy *
sx * cz - cx * sz;
179 t.y.y =
sy *
sx * sz + cx * cz;
182 t.x.z =
sy * cx * cz +
sx * sz;
183 t.y.z =
sy * cx * sz -
sx * cz;
186 t.x.w =
t.y.w =
t.z.w = 0.0f;
197 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);
200 #ifndef __KERNEL_GPU__
233 return make_transform(1, 0, 0,
t.x, 0, 1, 0,
t.y, 0, 0, 1,
t.z);
243 return make_transform(s.
x, 0, 0, 0, 0, s.
y, 0, 0, 0, 0, s.
z, 0);
260 axis.
x * axis.
y *
t - s * axis.
z,
261 axis.
x * axis.
z *
t + s * axis.
y,
264 axis.
y * axis.
x *
t + s * axis.
z,
265 axis.
y * axis.
y *
t +
c,
266 axis.
y * axis.
z *
t - s * axis.
x,
269 axis.
z * axis.
x *
t - s * axis.
y,
270 axis.
z * axis.
y *
t + s * axis.
x,
271 axis.
z * axis.
z *
t +
c,
302 for (
int x = 0;
x < 3;
x++) {
303 for (
int y = 0;
y < 4;
y++) {
320 t->x[column] = value.
x;
321 t->y[column] = value.
y;
322 t->z[column] = value.
z;
355 return (
dot(
cross(c0, c1), c2) < 0.0f);
371 return make_transform(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
381 #if defined(__KERNEL_GPU_RAYTRACING__)
386 float costheta =
dot(
q1, q2);
390 if (costheta > 0.9995f) {
396 float theta =
acosf(
clamp(costheta, -1.0f, 1.0f));
398 float thetap = theta *
t;
399 return q1 *
cosf(thetap) + qperp *
sinf(thetap);
404 #ifndef __KERNEL_GPU__
412 #ifndef __KERNEL_GPU__
432 float q0,
q1, q2, q3, qda, qdb, qdc, qaa, qab, qac, qbb, qbc, qcc;
460 dot(rotation_x, scale_x),
dot(rotation_x, scale_y),
dot(rotation_x, scale_z), decomp->y.x);
462 dot(rotation_y, scale_x),
dot(rotation_y, scale_y),
dot(rotation_y, scale_z), decomp->y.y);
464 dot(rotation_z, scale_x),
dot(rotation_z, scale_y),
dot(rotation_z, scale_z), decomp->y.z);
474 int maxstep = numsteps - 1;
475 int step =
min((
int)(
time * maxstep), maxstep - 1);
476 float t =
time * maxstep - step;
484 decomp.
y = (1.0f -
t) *
a->y +
t *
b->y;
485 decomp.
z = (1.0f -
t) *
a->z +
t *
b->z;
486 decomp.
w = (1.0f -
t) *
a->w +
t *
b->w;
503 #ifndef __KERNEL_GPU__
521 #define transform_point_auto transform_point
522 #define transform_direction_auto transform_direction
523 #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
__forceinline const avxf madd(const avxf &a, const avxf &b, const avxf &c)
Ternary Operators.
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
ccl_gpu_kernel_postfix ccl_global float int int int int float threshold
ccl_gpu_kernel_postfix ccl_global float int int sy
ccl_gpu_kernel_postfix ccl_global float int sx
ccl_device_inline float len_squared(const float3 a)
ccl_device_inline float4 zero_float4()
T dot(const vec_base< T, Size > &a, const vec_base< T, Size > &b)
vec_base< T, 3 > cross(const vec_base< T, 3 > &a, const vec_base< T, 3 > &b)
T clamp(const T &a, const T &min, const T &max)
vec_base< T, Size > normalize(const vec_base< T, Size > &v)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
static const pxr::TfToken g("g", pxr::TfToken::Immortal)
bool system_cpu_support_avx2()
bool system_cpu_support_sse41()
ccl_device_inline void print_float4(const char *label, const float4 &a)
ccl_device_inline bool isfinite_safe(float f)
ccl_device_inline float3 float4_to_float3(const float4 a)