Blender V5.3
gpu_shader_material_wireframe.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_wireframe(float size, const ShadingData &sd, float &fac)
11{
12 float3 barys = sd.barycentric_coords.xyy;
13 barys.z = 1.0f - barys.x - barys.y;
14
15 size *= 0.5f;
16 float3 s = step(-size, -barys * sd.barycentric_dists);
17
18 fac = max(s.x, max(s.y, s.z));
19}
20
21[[node]]
24 const ShadingData &sd,
25 float &fac)
26{
27 float3 barys = sd.barycentric_coords.xyy;
28 barys.z = 1.0f - barys.x - barys.y;
29
30#if defined(GPU_FRAGMENT_SHADER) || defined(GLSL_CPP_STUBS)
31 size *= (1.0f / 3.0f);
32 float3 dx = gpu_dfdx(barys) * derivative_scale_get(kg);
33 float3 dy = gpu_dfdy(barys) * derivative_scale_get(kg);
34 float3 deltas = sqrt(dx * dx + dy * dy);
35
36 float3 s = step(-deltas * size, -barys);
37
38 fac = max(s.x, max(s.y, s.z));
39#else
40 fac = 1.0f;
41#endif
42}
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
btScalar max
float derivative_scale_get(KernelGlobals &kg)
#define resource_table
T gpu_dfdx(T) RET
#define sqrt
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
T gpu_dfdy(T) RET
void node_wireframe_screenspace(float size, KernelGlobals &kg, const ShadingData &sd, float &fac)
void node_wireframe(float size, const ShadingData &sd, float &fac)
packed_float3 barycentric_dists
packed_float2 barycentric_coords
float z
Definition sky_math.h:136
float y
Definition sky_math.h:136
float x
Definition sky_math.h:136