Blender V5.3
svm/mapping.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#pragma once
6
9#include "kernel/svm/util.h"
10
12
13/* Mapping Node */
14
15template<typename Float3Type>
18{
19 const float3 location = stack_load(stack, node.location);
20 const float3 rotation = stack_load(stack, node.rotation);
21 const float3 scale = stack_load(stack, node.scale);
22
23 const Float3Type vector = stack_load<Float3Type>(stack, node.vector);
24 const Float3Type result = svm_mapping(node.mapping_type, vector, location, rotation, scale);
25 stack_store(stack, node.result_offset, result);
26}
27
28/* Texture Mapping */
29
30template<typename Float3Type>
32 ccl_private float *ccl_restrict stack,
34{
35 const Float3Type v = stack_load<Float3Type>(stack, node.vec_offset);
36 const Transform tfm = make_transform(node.tfm);
37
38 const Float3Type r = transform_point(&tfm, v);
39 stack_store(stack, node.out_offset, r);
40}
41
44{
45 const float3 v = stack_load_float3(stack, node.vec_offset);
46
47 const float3 mn = node.mn;
48 const float3 mx = node.mx;
49
50 const float3 r = min(max(mn, v), mx);
51 stack_store_float3(stack, node.out_offset, r);
52}
53
btScalar max
ccl_device_inline float3 stack_load_float3(const ccl_private float *stack, const uint a)
ccl_device_inline void stack_store_float3(ccl_private float *stack, const uint a, const float3 f)
ccl_device_inline void stack_store(ccl_private float *stack, const uint a, const float f)
ccl_device_inline T stack_load(const ccl_private float *stack, const uint a)
#define ccl_restrict
#define ccl_private
#define ccl_global
#define ccl_device_noinline
#define CCL_NAMESPACE_END
float3x3 scale(float3x3 mat, float2 scale)
float3 transform_point(float3x3 mat, float3 point)
CCL_NAMESPACE_BEGIN ccl_device Float3Type svm_mapping(NodeMappingType type, const Float3Type vector, const float3 location, const float3 rotation, const float3 scale)
#define min(a, b)
Definition sort.cc:38
ccl_device_noinline void svm_node_texture_mapping(ccl_private float *ccl_restrict stack, const ccl_global SVMNodeTextureMapping &ccl_restrict node)
Definition svm/mapping.h:31
ccl_device_noinline void svm_node_min_max(ccl_private float *ccl_restrict stack, const ccl_global SVMNodeMinMax &ccl_restrict node)
Definition svm/mapping.h:42
CCL_NAMESPACE_BEGIN ccl_device_noinline void svm_node_mapping(ccl_private float *ccl_restrict stack, const ccl_global SVMNodeMapping &ccl_restrict node)
Definition svm/mapping.h:16
ccl_device_inline Transform make_transform(const float a, const float b, const float c, const float d, const float e, const float f, const float g, const float h, const float i, const float j, const float k, const float l)
Definition transform.h:185