Blender V5.3
normal.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
8#include "kernel/svm/util.h"
9
11
14{
15 const float3 normal = stack_load(stack, node.in_normal);
16
17 float3 direction = make_float3(node.direction_x, node.direction_y, node.direction_z);
18 direction = normalize(direction);
19
20 if (stack_valid(node.out_normal_offset)) {
21 stack_store_float3(stack, node.out_normal_offset, direction);
22 }
23
24 if (stack_valid(node.out_dot_offset)) {
25 stack_store_float(stack, node.out_dot_offset, dot(direction, normalize(normal)));
26 }
27}
28
ccl_device_inline void stack_store_float(ccl_private float *stack, const uint a, const float f)
ccl_device_inline void stack_store_float3(ccl_private float *stack, const uint a, const float3 f)
ccl_device_inline bool stack_valid(const uint a)
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
ccl_device_forceinline float3 make_float3(const float x, const float y, const float z)
VecBase< float, D > normalize(VecOp< float, D >) RET
float dot(VecOp< float, D >, VecOp< float, D >) RET
CCL_NAMESPACE_BEGIN ccl_device_noinline void svm_node_normal(ccl_private float *ccl_restrict stack, const ccl_global SVMNodeNormal &ccl_restrict node)
Definition normal.h:12