Blender V5.3
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
8
9[[node]]
10void invert_z(float3 v, float3 &outv)
11{
12 v.z = -v.z;
13 outv = v;
14}
15
16[[node]]
17void 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]]
25void vector_copy(float3 normal, float3 &outnormal)
26{
27 outnormal = normal;
28}
void invert_z(float3 v, float3 &outv)
void vector_copy(float3 normal, float3 &outnormal)
void vector_normalize(float3 normal, float3 &outnormal)
float dot(VecOp< float, D >, VecOp< float, D >) RET
constexpr T inversesqrt(T) RET