4 #ifndef __UTIL_MATH_FLOAT3_H__
5 #define __UTIL_MATH_FLOAT3_H__
7 #ifndef __UTIL_MATH_H__
8 # error "Do not include this file directly, include util/types.h instead."
17 #if !defined(__KERNEL_METAL__)
83 return float3(_mm_setzero_ps());
94 #if defined(__KERNEL_METAL__)
105 # ifdef __KERNEL_SSE__
106 return float3(_mm_xor_ps(
a.m128, _mm_castsi128_ps(_mm_set1_epi32(0x80000000))));
114 # ifdef __KERNEL_SSE__
115 return float3(_mm_mul_ps(
a.m128,
b.m128));
123 # ifdef __KERNEL_SSE__
124 return float3(_mm_mul_ps(
a.m128, _mm_set1_ps(f)));
132 # if defined(__KERNEL_SSE__)
133 return float3(_mm_mul_ps(_mm_set1_ps(f),
a.m128));
141 # if defined(__KERNEL_SSE__)
142 return float3(_mm_div_ps(_mm_set1_ps(f),
a.m128));
150 # if defined(__KERNEL_SSE__)
151 return float3(_mm_div_ps(
a.m128, _mm_set1_ps(f)));
159 # if defined(__KERNEL_SSE__)
160 return float3(_mm_div_ps(
a.m128,
b.m128));
173 # ifdef __KERNEL_SSE__
174 return float3(_mm_add_ps(
a.m128,
b.m128));
187 # ifdef __KERNEL_SSE__
188 return float3(_mm_sub_ps(
a.m128,
b.m128));
221 float invf = 1.0f / f;
225 # if !(defined(__KERNEL_METAL__) || defined(__KERNEL_CUDA__))
253 # ifdef __KERNEL_SSE__
254 return (_mm_movemask_ps(_mm_cmpeq_ps(
a.m128,
b.m128)) & 7) == 7;
256 return (
a.x ==
b.x &&
a.y ==
b.y &&
a.z ==
b.z);
272 # if defined(__KERNEL_SSE41__) && defined(__KERNEL_SSE__)
273 return _mm_cvtss_f32(_mm_dp_ps(
a,
b, 0x7F));
275 return a.x *
b.x +
a.y *
b.y +
a.z *
b.z;
281 # if defined(__KERNEL_SSE41__) && defined(__KERNEL_SSE__)
282 return _mm_cvtss_f32(_mm_hadd_ps(_mm_mul_ps(
a,
b),
b));
284 return a.x *
b.x +
a.y *
b.y;
290 # ifdef __KERNEL_SSE__
291 return float3(shuffle<1, 2, 0, 3>(
292 msub(ssef(
a), shuffle<1, 2, 0, 3>(ssef(
b)), shuffle<1, 2, 0, 3>(ssef(
a)) * ssef(
b))));
300 # if defined(__KERNEL_SSE41__) && defined(__KERNEL_SSE__)
301 __m128
norm = _mm_sqrt_ps(_mm_dp_ps(
a.m128,
a.m128, 0x7F));
310 # ifdef __KERNEL_SSE__
311 return float3(_mm_min_ps(
a.m128,
b.m128));
319 # ifdef __KERNEL_SSE__
320 return float3(_mm_max_ps(
a.m128,
b.m128));
333 # ifdef __KERNEL_SSE__
334 # ifdef __KERNEL_NEON__
335 return float3(vabsq_f32(
a.m128));
337 __m128
mask = _mm_castsi128_ps(_mm_set1_epi32(0x7fffffff));
347 # ifdef __KERNEL_SSE__
356 # ifdef __KERNEL_SSE__
357 return float3(_mm_floor_ps(
a));
365 # ifdef __KERNEL_SSE__
374 return a +
t * (
b -
a);
379 # ifdef __KERNEL_SSE__
381 return float3(_mm_div_ps(_mm_set_ps1(1.0f),
a.m128));
416 #if defined(__KERNEL_SSE41__) && defined(__KERNEL_SSE__)
417 return _mm_cvtss_f32(_mm_sqrt_ss(_mm_dp_ps(
a.m128,
a.m128, 0x7F)));
428 #if !defined(__KERNEL_METAL__)
432 return incident - 2.0f * unit_normal *
dot(incident, unit_normal);
468 return (
t != 0.0f) ?
a * (1.0f /
t) :
a;
474 return (*
t != 0.0f) ?
a / (*t) :
a;
480 (
b.y != 0.0f) ?
a.y /
b.y : 0.0f,
481 (
b.z != 0.0f) ?
a.z /
b.z : 0.0f);
491 return a +
t * (
b -
a);
501 #ifdef __KERNEL_SSE__
504 return (
a.x == 0.0f &&
a.y == 0.0f &&
a.z == 0.0f);
510 #if defined(__KERNEL_SSE__) && defined(__KERNEL_NEON__)
513 return vaddvq_f32(
t);
515 return (
a.x +
a.y +
a.z);
526 #if defined(__KERNEL_METAL__)
_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
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a vector
__forceinline bool all(const avxb &b)
__forceinline const avxf msub(const avxf &a, const avxf &b, const avxf &c)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE btScalar norm() const
Return the norm (length) of the vector.
#define ccl_device_inline
#define CCL_NAMESPACE_END
IconTextureDrawCall normal
ccl_device_inline float dot(const float3 &a, const float3 &b)
ccl_device_inline float3 operator+(const float3 &a, const float f)
ccl_device_inline float3 safe_normalize(const float3 a)
ccl_device_inline bool is_zero(const float3 a)
ccl_device_inline float3 operator*(const float3 &a, const float3 &b)
ccl_device_inline bool isequal(const float3 a, const float3 b)
ccl_device_inline float3 normalize(const float3 &a)
ccl_device_inline float distance(const float3 &a, const float3 &b)
ccl_device_inline float3 refract(const float3 incident, const float3 normal, const float eta)
ccl_device_inline float3 one_float3()
ccl_device_inline float3 exp(float3 v)
ccl_device_inline float reduce_min(float3 a)
ccl_device_inline float3 faceforward(const float3 vector, const float3 incident, const float3 reference)
ccl_device_inline float3 normalize_len(const float3 a, ccl_private float *t)
ccl_device_inline float3 operator*=(float3 &a, const float3 &b)
ccl_device_inline float3 ceil(const float3 &a)
ccl_device_inline bool operator!=(const float3 &a, const float3 &b)
ccl_device_inline float3 project(const float3 v, const float3 v_proj)
ccl_device_inline float3 sqr(float3 a)
ccl_device_inline float3 max(const float3 &a, const float3 &b)
ccl_device_inline float3 mix(const float3 &a, const float3 &b, float t)
ccl_device_inline float3 rcp(const float3 &a)
ccl_device_inline float3 operator+=(float3 &a, const float3 &b)
ccl_device_inline float reduce_add(const float3 a)
ccl_device_inline float reduce_max(float3 a)
ccl_device_inline float3 zero_float3()
ccl_device_inline bool operator==(const float3 &a, const float3 &b)
ccl_device_inline float3 fabs(const float3 &a)
ccl_device_inline float dot_xy(const float3 &a, const float3 &b)
ccl_device_inline float average(const float3 a)
ccl_device_inline float3 min(const float3 &a, const float3 &b)
ccl_device_inline float3 operator/(const float f, const float3 &a)
ccl_device_inline float3 saturate(float3 a)
ccl_device_inline float3 floor(const float3 &a)
ccl_device_inline float3 safe_divide(const float3 a, const float3 b)
CCL_NAMESPACE_BEGIN ccl_device_inline float3 operator-(const float3 &a)
ccl_device_inline float3 sqrt(const float3 &a)
ccl_device_inline bool isfinite_safe(float3 v)
ccl_device_inline float3 safe_normalize_len(const float3 a, ccl_private float *t)
ccl_device_inline float3 operator/=(float3 &a, const float3 &b)
ccl_device_inline float3 pow(float3 v, float e)
ccl_device_inline float3 cross(const float3 &a, const float3 &b)
ccl_device_inline float3 interp(float3 a, float3 b, float t)
ccl_device_inline float3 operator-=(float3 &a, const float3 &b)
ccl_device_inline float3 log(float3 v)
ccl_device_inline float3 clamp(const float3 &a, const float3 &mn, const float3 &mx)
ccl_device_inline float len_squared(const float3 a)
ccl_device_inline float len(const float3 a)
ccl_device_inline float3 ensure_finite(float3 v)
ccl_device_inline float3 reflect(const float3 incident, const float3 normal)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
ccl_device_inline float saturatef(float a)