Blender
V5.3
source
blender
gpu
shaders
material
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
7
#include "
gpu_shader_material_interface.bsl.hh
"
8
9
[[
node
]]
10
void
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
]]
22
void
node_wireframe_screenspace
(
float
size
,
23
[[
resource_table
]]
KernelGlobals
&kg,
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
}
size
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition
btDbvt.cpp:52
max
btScalar max
Definition
btHeightfieldTerrainShape.h:79
derivative_scale_get
float derivative_scale_get(KernelGlobals &kg)
Definition
eevee_nodetree_lib.bsl.hh:861
resource_table
#define resource_table
Definition
gpu_shader_cxx_attribute.hh:128
node
#define node
Definition
gpu_shader_cxx_attribute.hh:142
gpu_dfdx
T gpu_dfdx(T) RET
sqrt
#define sqrt
Definition
gpu_shader_cxx_builtin.hh:118
step
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
gpu_dfdy
T gpu_dfdy(T) RET
gpu_shader_material_interface.bsl.hh
node_wireframe_screenspace
void node_wireframe_screenspace(float size, KernelGlobals &kg, const ShadingData &sd, float &fac)
Definition
gpu_shader_material_wireframe.bsl.hh:22
node_wireframe
void node_wireframe(float size, const ShadingData &sd, float &fac)
Definition
gpu_shader_material_wireframe.bsl.hh:10
KernelGlobals
Definition
eevee_nodetree_lib.bsl.hh:141
ShadingData
Definition
eevee_nodetree_lib.bsl.hh:56
ShadingData::barycentric_dists
packed_float3 barycentric_dists
Definition
eevee_nodetree_lib.bsl.hh:71
ShadingData::barycentric_coords
packed_float2 barycentric_coords
Definition
eevee_nodetree_lib.bsl.hh:70
float3
Definition
sky_math.h:135
float3::z
float z
Definition
sky_math.h:136
float3::y
float y
Definition
sky_math.h:136
float3::x
float x
Definition
sky_math.h:136
Generated on
for Blender by
doxygen
1.18.0