Blender V4.5
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 ShaderData *sd,
13 ccl_private float *stack,
14 const uint in_normal_offset,
15 const uint out_normal_offset,
16 const uint out_dot_offset,
17 int offset)
18{
19 /* read extra data */
20 const uint4 node1 = read_node(kg, &offset);
21 const float3 normal = stack_load_float3(stack, in_normal_offset);
22
23 float3 direction;
24 direction.x = __int_as_float(node1.x);
25 direction.y = __int_as_float(node1.y);
26 direction.z = __int_as_float(node1.z);
27 direction = normalize(direction);
28
29 if (stack_valid(out_normal_offset)) {
30 stack_store_float3(stack, out_normal_offset, direction);
31 }
32
33 if (stack_valid(out_dot_offset)) {
34 stack_store_float(stack, out_dot_offset, dot(direction, normalize(normal)));
35 }
36 return offset;
37}
38
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 ShaderData *sd, 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_float3.h:27
float y
Definition sky_float3.h:27
float x
Definition sky_float3.h:27
uint x
Definition types_uint4.h:13
uint y
Definition types_uint4.h:13
uint z
Definition types_uint4.h:13