Blender  V3.3
mapping_util.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #pragma once
5 
7 
10 {
11  Transform rotationTransform = euler_to_transform(rotation);
12  switch (type) {
14  return transform_direction(&rotationTransform, (vector * scale)) + location;
16  return safe_divide(transform_direction_transposed(&rotationTransform, (vector - location)),
17  scale);
19  return transform_direction(&rotationTransform, (vector * scale));
21  return safe_normalize(transform_direction(&rotationTransform, safe_divide(vector, scale)));
22  default:
23  return make_float3(0.0f, 0.0f, 0.0f);
24  }
25 }
26 
@ NODE_MAPPING_TYPE_POINT
@ NODE_MAPPING_TYPE_VECTOR
@ NODE_MAPPING_TYPE_TEXTURE
@ NODE_MAPPING_TYPE_NORMAL
_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 type
#define ccl_device
Definition: cuda/compat.h:32
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
ccl_device_inline Transform euler_to_transform(const float3 euler)
ccl_device_inline float3 transform_direction(ccl_private const Transform *t, const float3 a)
ccl_device_inline float3 transform_direction_transposed(ccl_private const Transform *t, const float3 a)
NodeMappingType
CCL_NAMESPACE_BEGIN ccl_device float3 svm_mapping(NodeMappingType type, float3 vector, float3 location, float3 rotation, float3 scale)
Definition: mapping_util.h:9
ccl_device_inline float2 safe_normalize(const float2 &a)
Definition: math_float2.h:201
#define make_float3(x, y, z)
Definition: metal/compat.h:204
T safe_divide(const T &a, const T &b)