Blender V5.3
gpu_shader_material_output_material.bsl.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2019-2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
8
9[[node]]
10void node_output_material_surface(Closure surface, Closure &out_surface)
11{
12 out_surface = surface;
13}
14
15[[node]]
17{
18 out_volume = volume;
19}
20
21[[node]]
22void node_output_material_displacement(float3 displacement, float3 &out_displacement)
23{
24 out_displacement = displacement;
25}
26
27[[node]]
28void node_output_material_thickness(float thickness,
30 ShadingData &sd,
31 float &out_thickness)
32{
33 const ObjectMatrices obj = kg.object_matrices_get(sd);
34
35 float3 ob_scale;
36 ob_scale.x = length(obj.model[0].xyz);
37 ob_scale.y = length(obj.model[1].xyz);
38 ob_scale.z = length(obj.model[2].xyz);
39
40 float3 thickness_vec = abs(max(thickness, 0.0f) * ob_scale);
41 /* Contrary to displacement we need to output a scalar quantity.
42 * We arbitrarily choose to output the axis with the minimum extent since it is the axis along
43 * which the object is usually viewed at. */
44 out_thickness = min(min(thickness_vec.x, thickness_vec.y), thickness_vec.z);
45}
btScalar max
#define resource_table
#define abs
float length(VecOp< float, D >) RET
void node_output_material_surface(Closure surface, Closure &out_surface)
void node_output_material_volume(Closure volume, Closure &out_volume)
void node_output_material_displacement(float3 displacement, float3 &out_displacement)
void node_output_material_thickness(float thickness, KernelGlobals &kg, ShadingData &sd, float &out_thickness)
#define min(a, b)
Definition sort.cc:38
float z
Definition sky_math.h:136
float y
Definition sky_math.h:136
float x
Definition sky_math.h:136