Blender  V3.3
intern/cycles/util/transform.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #ifndef __UTIL_TRANSFORM_H__
5 #define __UTIL_TRANSFORM_H__
6 
7 #ifndef __KERNEL_GPU__
8 # include <string.h>
9 #endif
10 
11 #include "util/math.h"
12 #include "util/types.h"
13 
14 #ifndef __KERNEL_GPU__
15 # include "util/system.h"
16 #endif
17 
19 
20 /* Affine transformation, stored as 4x3 matrix. */
21 
22 typedef struct Transform {
23  float4 x, y, z;
24 
25 #ifndef __KERNEL_GPU__
26  float4 operator[](int i) const
27  {
28  return *(&x + i);
29  }
31  {
32  return *(&x + i);
33  }
34 #endif
36 
37 /* Transform decomposed in rotation/translation/scale. we use the same data
38  * structure as Transform, and tightly pack decomposition into it. first the
39  * rotation (4), then translation (3), then 3x3 scale matrix (9). */
40 
41 typedef struct DecomposedTransform {
42  float4 x, y, z, w;
44 
46 
47 #include "util/transform_inverse.h"
48 
50 
51 /* Functions */
52 
53 #ifdef __KERNEL_METAL__
54 /* transform_point specialized for ccl_global */
56 {
57  ccl_global const float3x3 &b(*(ccl_global const float3x3 *)t);
58  return (a * b).xyz + make_float3(t->x.w, t->y.w, t->z.w);
59 }
60 #endif
61 
63 {
64  /* TODO(sergey): Disabled for now, causes crashes in certain cases. */
65 #if defined(__KERNEL_SSE__) && defined(__KERNEL_SSE2__)
66  ssef x, y, z, w, aa;
67  aa = a.m128;
68 
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);
73 
74  _MM_TRANSPOSE4_PS(x, y, z, w);
75 
76  ssef tmp = 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);
80 
81  return float3(tmp.m128);
82 #elif defined(__KERNEL_METAL__)
83  ccl_private const float3x3 &b(*(ccl_private const float3x3 *)t);
84  return (a * b).xyz + make_float3(t->x.w, t->y.w, t->z.w);
85 #else
86  float3 c = make_float3(a.x * t->x.x + a.y * t->x.y + a.z * t->x.z + t->x.w,
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);
89 
90  return c;
91 #endif
92 }
93 
95 {
96 #if defined(__KERNEL_SSE__) && defined(__KERNEL_SSE2__)
97  ssef x, y, z, w, aa;
98  aa = a.m128;
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();
103 
104  _MM_TRANSPOSE4_PS(x, y, z, w);
105 
106  ssef tmp = shuffle<2>(aa) * z;
107  tmp = madd(shuffle<1>(aa), y, tmp);
108  tmp = madd(shuffle<0>(aa), x, tmp);
109 
110  return float3(tmp.m128);
111 #elif defined(__KERNEL_METAL__)
112  ccl_private const float3x3 &b(*(ccl_private const float3x3 *)t);
113  return (a * b).xyz;
114 #else
115  float3 c = make_float3(a.x * t->x.x + a.y * t->x.y + a.z * t->x.z,
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);
118 
119  return c;
120 #endif
121 }
122 
124  const float3 a)
125 {
126  float3 x = make_float3(t->x.x, t->y.x, t->z.x);
127  float3 y = make_float3(t->x.y, t->y.y, t->z.y);
128  float3 z = make_float3(t->x.z, t->y.z, t->z.z);
129 
130  return make_float3(dot(x, a), dot(y, a), dot(z, a));
131 }
132 
134  float b,
135  float c,
136  float d,
137  float e,
138  float f,
139  float g,
140  float h,
141  float i,
142  float j,
143  float k,
144  float l)
145 {
146  Transform t;
147 
148  t.x.x = a;
149  t.x.y = b;
150  t.x.z = c;
151  t.x.w = d;
152  t.y.x = e;
153  t.y.y = f;
154  t.y.z = g;
155  t.y.w = h;
156  t.z.x = i;
157  t.z.y = j;
158  t.z.z = k;
159  t.z.w = l;
160 
161  return t;
162 }
163 
165 {
166  float cx = cosf(euler.x);
167  float cy = cosf(euler.y);
168  float cz = cosf(euler.z);
169  float sx = sinf(euler.x);
170  float sy = sinf(euler.y);
171  float sz = sinf(euler.z);
172 
173  Transform t;
174  t.x.x = cy * cz;
175  t.y.x = cy * sz;
176  t.z.x = -sy;
177 
178  t.x.y = sy * sx * cz - cx * sz;
179  t.y.y = sy * sx * sz + cx * cz;
180  t.z.y = cy * sx;
181 
182  t.x.z = sy * cx * cz + sx * sz;
183  t.y.z = sy * cx * sz - sx * cz;
184  t.z.z = cy * cx;
185 
186  t.x.w = t.y.w = t.z.w = 0.0f;
187  return t;
188 }
189 
190 /* Constructs a coordinate frame from a normalized normal. */
192 {
193  const float3 dx0 = cross(make_float3(1.0f, 0.0f, 0.0f), N);
194  const float3 dx1 = cross(make_float3(0.0f, 1.0f, 0.0f), N);
195  const float3 dx = normalize((dot(dx0, dx0) > dot(dx1, dx1)) ? dx0 : dx1);
196  const float3 dy = normalize(cross(N, dx));
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);
198 }
199 
200 #ifndef __KERNEL_GPU__
201 
203 {
204  Transform zero = {zero_float4(), zero_float4(), zero_float4()};
205  return zero;
206 }
207 
209 {
210  float4 c_x = make_float4(b.x.x, b.y.x, b.z.x, 0.0f);
211  float4 c_y = make_float4(b.x.y, b.y.y, b.z.y, 0.0f);
212  float4 c_z = make_float4(b.x.z, b.y.z, b.z.z, 0.0f);
213  float4 c_w = make_float4(b.x.w, b.y.w, b.z.w, 1.0f);
214 
215  Transform t;
216  t.x = make_float4(dot(a.x, c_x), dot(a.x, c_y), dot(a.x, c_z), dot(a.x, c_w));
217  t.y = make_float4(dot(a.y, c_x), dot(a.y, c_y), dot(a.y, c_z), dot(a.y, c_w));
218  t.z = make_float4(dot(a.z, c_x), dot(a.z, c_y), dot(a.z, c_z), dot(a.z, c_w));
219 
220  return t;
221 }
222 
224 {
225  print_float4(label, t.x);
226  print_float4(label, t.y);
227  print_float4(label, t.z);
228  printf("\n");
229 }
230 
232 {
233  return make_transform(1, 0, 0, t.x, 0, 1, 0, t.y, 0, 0, 1, t.z);
234 }
235 
237 {
238  return transform_translate(make_float3(x, y, z));
239 }
240 
242 {
243  return make_transform(s.x, 0, 0, 0, 0, s.y, 0, 0, 0, 0, s.z, 0);
244 }
245 
247 {
248  return transform_scale(make_float3(x, y, z));
249 }
250 
252 {
253  float s = sinf(angle);
254  float c = cosf(angle);
255  float t = 1.0f - c;
256 
257  axis = normalize(axis);
258 
259  return make_transform(axis.x * axis.x * t + c,
260  axis.x * axis.y * t - s * axis.z,
261  axis.x * axis.z * t + s * axis.y,
262  0.0f,
263 
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,
267  0.0f,
268 
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,
272  0.0f);
273 }
274 
275 /* Euler is assumed to be in XYZ order. */
277 {
278  return transform_rotate(euler.z, make_float3(0.0f, 0.0f, 1.0f)) *
279  transform_rotate(euler.y, make_float3(0.0f, 1.0f, 0.0f)) *
280  transform_rotate(euler.x, make_float3(1.0f, 0.0f, 0.0f));
281 }
282 
284 {
285  return transform_scale(1.0f, 1.0f, 1.0f);
286 }
287 
289 {
290  return memcmp(&A, &B, sizeof(Transform)) == 0;
291 }
292 
294 {
295  return !(A == B);
296 }
297 
299  const Transform &B,
300  const float threshold)
301 {
302  for (int x = 0; x < 3; x++) {
303  for (int y = 0; y < 4; y++) {
304  if (fabsf(A[x][y] - B[x][y]) > threshold) {
305  return false;
306  }
307  }
308  }
309 
310  return true;
311 }
312 
314 {
315  return make_float3(t->x[column], t->y[column], t->z[column]);
316 }
317 
319 {
320  t->x[column] = value.x;
321  t->y[column] = value.y;
322  t->z[column] = value.z;
323 }
324 
326 
328 {
329  /* the epsilon here is quite arbitrary, but this function is only used for
330  * surface area and bump, where we expect it to not be so sensitive */
331  float eps = 1e-6f;
332 
333  float sx = len_squared(float4_to_float3(tfm.x));
334  float sy = len_squared(float4_to_float3(tfm.y));
335  float sz = len_squared(float4_to_float3(tfm.z));
336  float stx = len_squared(transform_get_column(&tfm, 0));
337  float sty = len_squared(transform_get_column(&tfm, 1));
338  float stz = len_squared(transform_get_column(&tfm, 2));
339 
340  if (fabsf(sx - sy) < eps && fabsf(sx - sz) < eps && fabsf(sx - stx) < eps &&
341  fabsf(sx - sty) < eps && fabsf(sx - stz) < eps) {
342  scale = sx;
343  return true;
344  }
345 
346  return false;
347 }
348 
350 {
351  float3 c0 = transform_get_column(&tfm, 0);
352  float3 c1 = transform_get_column(&tfm, 1);
353  float3 c2 = transform_get_column(&tfm, 2);
354 
355  return (dot(cross(c0, c1), c2) < 0.0f);
356 }
357 
359 {
360  Transform ntfm = tfm;
361 
365 
366  return ntfm;
367 }
368 
370 {
371  return make_transform(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
372 }
373 
374 #endif
375 
376 /* Motion Transform */
377 
379 {
380  /* Optix and MetalRT are using lerp to interpolate motion transformations. */
381 #if defined(__KERNEL_GPU_RAYTRACING__)
382  return normalize((1.0f - t) * q1 + t * q2);
383 #else /* defined(__KERNEL_GPU_RAYTRACING__) */
384  /* NOTE: this does not ensure rotation around shortest angle, q1 and q2
385  * are assumed to be matched already in transform_motion_decompose */
386  float costheta = dot(q1, q2);
387 
388  /* possible optimization: it might be possible to precompute theta/qperp */
389 
390  if (costheta > 0.9995f) {
391  /* linear interpolation in degenerate case */
392  return normalize((1.0f - t) * q1 + t * q2);
393  }
394  else {
395  /* slerp */
396  float theta = acosf(clamp(costheta, -1.0f, 1.0f));
397  float4 qperp = normalize(q2 - q1 * costheta);
398  float thetap = theta * t;
399  return q1 * cosf(thetap) + qperp * sinf(thetap);
400  }
401 #endif /* defined(__KERNEL_GPU_RAYTRACING__) */
402 }
403 
404 #ifndef __KERNEL_GPU__
405 void transform_inverse_cpu_sse41(const Transform &tfm, Transform &itfm);
406 void transform_inverse_cpu_avx2(const Transform &tfm, Transform &itfm);
407 #endif
408 
410 {
411  /* Optimized transform implementations. */
412 #ifndef __KERNEL_GPU__
413  if (system_cpu_support_avx2()) {
414  Transform itfm;
415  transform_inverse_cpu_avx2(tfm, itfm);
416  return itfm;
417  }
418  else if (system_cpu_support_sse41()) {
419  Transform itfm;
420  transform_inverse_cpu_sse41(tfm, itfm);
421  return itfm;
422  }
423 #endif
424 
425  return transform_inverse_impl(tfm);
426 }
427 
429  ccl_private const DecomposedTransform *decomp)
430 {
431  /* rotation */
432  float q0, q1, q2, q3, qda, qdb, qdc, qaa, qab, qac, qbb, qbc, qcc;
433 
434  q0 = M_SQRT2_F * decomp->x.w;
435  q1 = M_SQRT2_F * decomp->x.x;
436  q2 = M_SQRT2_F * decomp->x.y;
437  q3 = M_SQRT2_F * decomp->x.z;
438 
439  qda = q0 * q1;
440  qdb = q0 * q2;
441  qdc = q0 * q3;
442  qaa = q1 * q1;
443  qab = q1 * q2;
444  qac = q1 * q3;
445  qbb = q2 * q2;
446  qbc = q2 * q3;
447  qcc = q3 * q3;
448 
449  float3 rotation_x = make_float3(1.0f - qbb - qcc, -qdc + qab, qdb + qac);
450  float3 rotation_y = make_float3(qdc + qab, 1.0f - qaa - qcc, -qda + qbc);
451  float3 rotation_z = make_float3(-qdb + qac, qda + qbc, 1.0f - qaa - qbb);
452 
453  /* scale */
454  float3 scale_x = make_float3(decomp->y.w, decomp->z.z, decomp->w.y);
455  float3 scale_y = make_float3(decomp->z.x, decomp->z.w, decomp->w.z);
456  float3 scale_z = make_float3(decomp->z.y, decomp->w.x, decomp->w.w);
457 
458  /* compose with translation */
459  tfm->x = make_float4(
460  dot(rotation_x, scale_x), dot(rotation_x, scale_y), dot(rotation_x, scale_z), decomp->y.x);
461  tfm->y = make_float4(
462  dot(rotation_y, scale_x), dot(rotation_y, scale_y), dot(rotation_y, scale_z), decomp->y.y);
463  tfm->z = make_float4(
464  dot(rotation_z, scale_x), dot(rotation_z, scale_y), dot(rotation_z, scale_z), decomp->y.z);
465 }
466 
467 /* Interpolate from array of decomposed transforms. */
469  ccl_global const DecomposedTransform *motion,
470  uint numsteps,
471  float time)
472 {
473  /* Figure out which steps we need to interpolate. */
474  int maxstep = numsteps - 1;
475  int step = min((int)(time * maxstep), maxstep - 1);
476  float t = time * maxstep - step;
477 
478  ccl_global const DecomposedTransform *a = motion + step;
479  ccl_global const DecomposedTransform *b = motion + step + 1;
480 
481  /* Interpolate rotation, translation and scale. */
482  DecomposedTransform decomp;
483  decomp.x = quat_interpolate(a->x, b->x, t);
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;
487 
488  /* Compose rotation, translation, scale into matrix. */
489  transform_compose(tfm, &decomp);
490 }
491 
493 {
494  return isfinite_safe(tfm->x) && isfinite_safe(tfm->y) && isfinite_safe(tfm->z);
495 }
496 
498 {
499  return isfinite_safe(decomp->x) && isfinite_safe(decomp->y) && isfinite_safe(decomp->z) &&
500  isfinite_safe(decomp->w);
501 }
502 
503 #ifndef __KERNEL_GPU__
504 
505 class BoundBox2D;
506 
508 {
509  return memcmp(&A, &B, sizeof(DecomposedTransform)) == 0;
510 }
511 
513 void transform_motion_decompose(DecomposedTransform *decomp, const Transform *motion, size_t size);
515 
516 #endif
517 
518 /* TODO: This can be removed when we know if no devices will require explicit
519  * address space qualifiers for this case. */
520 
521 #define transform_point_auto transform_point
522 #define transform_direction_auto transform_direction
523 #define transform_direction_transposed_auto transform_direction_transposed
524 
526 
527 #endif /* __UTIL_TRANSFORM_H__ */
unsigned int uint
Definition: BLI_sys_types.h:67
_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
float float4[4]
float float3[3]
__forceinline const avxf madd(const avxf &a, const avxf &b, const avxf &c)
Ternary Operators.
Definition: avxf.h:321
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
#define A
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition: btVector3.h:356
#define sinf(x)
Definition: cuda/compat.h:102
#define cosf(x)
Definition: cuda/compat.h:101
#define ccl_device
Definition: cuda/compat.h:32
#define ccl_private
Definition: cuda/compat.h:48
#define ccl_device_inline
Definition: cuda/compat.h:34
#define ccl_global
Definition: cuda/compat.h:43
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
double time
const char * label
Transform transform_transposed_inverse(const Transform &a)
Definition: transform.cpp:110
ccl_device_inline Transform make_transform_frame(float3 N)
ccl_device_inline Transform euler_to_transform(const float3 euler)
ccl_device_inline Transform transform_identity()
ccl_device_inline void print_transform(const char *label, const Transform &t)
ccl_device void transform_motion_array_interpolate(ccl_private Transform *tfm, ccl_global const DecomposedTransform *motion, uint numsteps, float time)
ccl_device_inline Transform transform_empty()
ccl_device_inline Transform transform_rotate(float angle, float3 axis)
ccl_device_inline bool transform_equal_threshold(const Transform &A, const Transform &B, const float threshold)
ccl_device_inline void transform_set_column(Transform *t, int column, float3 value)
ccl_device_inline float4 quat_interpolate(float4 q1, float4 q2, float t)
void transform_inverse_cpu_avx2(const Transform &tfm, Transform &itfm)
ccl_device_inline Transform transform_euler(float3 euler)
ccl_device_inline bool transform_decomposed_isfinite_safe(ccl_private DecomposedTransform *decomp)
ccl_device_inline float3 transform_get_column(const Transform *t, int column)
struct DecomposedTransform DecomposedTransform
ccl_device_inline bool transform_negative_scale(const Transform &tfm)
float4 transform_to_quat(const Transform &tfm)
Definition: transform.cpp:118
ccl_device_inline Transform make_transform(float a, float b, float c, float d, float e, float f, float g, float h, float i, float j, float k, float l)
ccl_device_inline bool transform_isfinite_safe(ccl_private Transform *tfm)
ccl_device_inline Transform transform_translate(float3 t)
void transform_motion_decompose(DecomposedTransform *decomp, const Transform *motion, size_t size)
Definition: transform.cpp:246
ccl_device_inline Transform transform_inverse(const Transform tfm)
ccl_device_inline Transform transform_zero()
ccl_device_inline float3 transform_direction(ccl_private const Transform *t, const float3 a)
ccl_device_inline Transform transform_scale(float3 s)
ccl_device_inline bool transform_uniform_scale(const Transform &tfm, float &scale)
void transform_inverse_cpu_sse41(const Transform &tfm, Transform &itfm)
Transform transform_from_viewplane(BoundBox2D &viewplane)
Definition: transform.cpp:282
CCL_NAMESPACE_BEGIN struct Transform Transform
ccl_device_inline bool operator!=(const Transform &A, const Transform &B)
ccl_device_inline bool operator==(const Transform &A, const Transform &B)
ccl_device_inline Transform transform_clear_scale(const Transform &tfm)
ccl_device_inline float3 transform_direction_transposed(ccl_private const Transform *t, const float3 a)
ccl_device_inline void transform_compose(ccl_private Transform *tfm, ccl_private const DecomposedTransform *decomp)
CCL_NAMESPACE_END CCL_NAMESPACE_BEGIN ccl_device_inline float3 transform_point(ccl_private const Transform *t, const float3 a)
ccl_device_inline Transform operator*(const Transform a, const Transform b)
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)
Definition: math_float3.h:423
ccl_device_inline float4 zero_float4()
Definition: math_float4.h:92
#define N
#define B
#define acosf(x)
Definition: metal/compat.h:222
#define make_float4(x, y, z, w)
Definition: metal/compat.h:205
#define fabsf(x)
Definition: metal/compat.h:219
#define make_float3(x, y, z)
Definition: metal/compat.h:204
static unsigned c
Definition: RandGen.cpp:83
static unsigned a[3]
Definition: RandGen.cpp:78
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)
const btScalar eps
Definition: poly34.cpp:11
#define min(a, b)
Definition: sort.c:35
float4 operator[](int i) const
float4 & operator[](int i)
float z
float y
float x
bool system_cpu_support_avx2()
Definition: system.cpp:251
bool system_cpu_support_sse41()
Definition: system.cpp:242
ccl_device_inline Transform transform_inverse_impl(const Transform tfm)
ccl_device_inline void print_float4(const char *label, const float4 &a)
#define M_SQRT2_F
Definition: util/math.h:68
ccl_device_inline bool isfinite_safe(float f)
Definition: util/math.h:353
ccl_device_inline float3 float4_to_float3(const float4 a)
Definition: util/math.h:500