Blender
V5.3
source
blender
gpu
shaders
nodes
gpu_shader_common_math_utils.bsl.hh
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2019-2023 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
5
#pragma once
6
7
#include "
gpu_shader_compat.hh
"
8
9
[[
node
]]
10
void
invert_z
(
float3
v,
float3
&outv)
11
{
12
v.z = -v.z;
13
outv = v;
14
}
15
16
[[
node
]]
17
void
vector_normalize
(
float3
normal,
float3
&outnormal)
18
{
19
/* Match the safe normalize function in Cycles by defaulting to float3(0.0f) */
20
float
length_sqr =
dot
(normal, normal);
21
outnormal = (length_sqr > 1e-35f) ? normal *
inversesqrt
(length_sqr) :
float3
(0.0f);
22
}
23
24
[[
node
]]
25
void
vector_copy
(
float3
normal,
float3
&outnormal)
26
{
27
outnormal = normal;
28
}
invert_z
void invert_z(float3 v, float3 &outv)
Definition
gpu_shader_common_math_utils.bsl.hh:10
vector_copy
void vector_copy(float3 normal, float3 &outnormal)
Definition
gpu_shader_common_math_utils.bsl.hh:25
vector_normalize
void vector_normalize(float3 normal, float3 &outnormal)
Definition
gpu_shader_common_math_utils.bsl.hh:17
gpu_shader_compat.hh
node
#define node
Definition
gpu_shader_cxx_attribute.hh:142
dot
float dot(VecOp< float, D >, VecOp< float, D >) RET
inversesqrt
constexpr T inversesqrt(T) RET
float3
Definition
sky_math.h:135
Generated on
for Blender by
doxygen
1.18.0