Blender V5.0
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
7#include "kernel/svm/util.h"
8
10
12 ccl_private float *stack,
13 const uint in_normal_offset,
14 const uint out_normal_offset,
15 const uint out_dot_offset,
16 int offset)
17{
18 /* read extra data */
19 const uint4 node1 = read_node(kg, &offset);
20 const float3 normal = stack_load_float3(stack, in_normal_offset);
21
22 float3 direction;
23 direction.x = __int_as_float(node1.x);
24 direction.y = __int_as_float(node1.y);
25 direction.z = __int_as_float(node1.z);
26 direction = normalize(direction);
27
28 if (stack_valid(out_normal_offset)) {
29 stack_store_float3(stack, out_normal_offset, direction);
30 }
31
32 if (stack_valid(out_dot_offset)) {
33 stack_store_float(stack, out_dot_offset, dot(direction, normalize(normal)));
34 }
35 return offset;
36}
37
unsigned int uint
dot(value.rgb, luminance_coefficients)") DEFINE_VALUE("REDUCE(lhs
ccl_device_inline void stack_store_float(ccl_private float *stack, const uint a, const float f)
ccl_device_inline uint4 read_node(KernelGlobals kg, ccl_private int *const offset)
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_NAMESPACE_BEGIN ccl_device_inline float3 stack_load_float3(const ccl_private float *stack, const uint a)
#define ccl_private
const ThreadKernelGlobalsCPU * KernelGlobals
#define ccl_device_noinline
#define CCL_NAMESPACE_END
#define __int_as_float(x)
VecBase< float, D > normalize(VecOp< float, D >) RET
CCL_NAMESPACE_BEGIN ccl_device_noinline int svm_node_normal(KernelGlobals kg, ccl_private float *stack, const uint in_normal_offset, const uint out_normal_offset, const uint out_dot_offset, int offset)
Definition normal.h:11
float z
Definition sky_math.h:136
float y
Definition sky_math.h:136
float x
Definition sky_math.h:136
uint x
Definition types_uint4.h:13
uint y
Definition types_uint4.h:13
uint z
Definition types_uint4.h:13