Blender  V2.93
svm_mapping_util.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2014 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 
21 {
22  Transform rotationTransform = euler_to_transform(rotation);
23  switch (type) {
25  return transform_direction(&rotationTransform, (vector * scale)) + location;
28  transform_direction_transposed(&rotationTransform, (vector - location)), scale);
30  return transform_direction(&rotationTransform, (vector * scale));
32  return safe_normalize(
33  transform_direction(&rotationTransform, safe_divide_float3_float3(vector, scale)));
34  default:
35  return make_float3(0.0f, 0.0f, 0.0f);
36  }
37 }
38 
@ 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
#define CCL_NAMESPACE_END
#define make_float3(x, y, z)
CCL_NAMESPACE_BEGIN ccl_device float3 svm_mapping(NodeMappingType type, float3 vector, float3 location, float3 rotation, float3 scale)
NodeMappingType
Definition: svm_types.h:358
ccl_device_inline float2 safe_normalize(const float2 &a)
ccl_device_inline float3 safe_divide_float3_float3(const float3 a, const float3 b)
ccl_device_inline Transform euler_to_transform(const float3 euler)
ccl_device_inline float3 transform_direction(const Transform *t, const float3 a)
ccl_device_inline float3 transform_direction_transposed(const Transform *t, const float3 a)