Welcome to mirror list, hosted at ThFree Co, Russian Federation.

overlay_paint_info.hh « infos « shaders « overlay « engines « draw « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 08b421de3e6752610949f9912ed263511f94d7d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/* SPDX-License-Identifier: GPL-2.0-or-later */

#include "gpu_shader_create_info.hh"

/* -------------------------------------------------------------------- */
/** \name OVERLAY_shader_paint_face.
 *
 * Used for face selection mode in Weight, Vertex and Texture Paint.
 * \{ */

GPU_SHADER_CREATE_INFO(overlay_paint_face)
    .do_static_compilation(true)
    .vertex_in(0, Type::VEC3, "pos")
    .vertex_in(1, Type::VEC4, "nor") /* Select flag on the 4th component. */
    .push_constant(Type::VEC4, "ucolor")
    .fragment_out(0, Type::VEC4, "fragColor")
    .vertex_source("overlay_paint_face_vert.glsl")
    .fragment_source("overlay_uniform_color_frag.glsl")
    .additional_info("draw_modelmat");

GPU_SHADER_CREATE_INFO(overlay_paint_face_clipped)
    .additional_info("overlay_paint_face")
    .additional_info("drw_clipped")
    .do_static_compilation(true);

/** \} */

/* -------------------------------------------------------------------- */
/** \name OVERLAY_shader_paint_point.
 *
 * Used for vertex selection mode in Weight and Vertex Paint.
 * \{ */

GPU_SHADER_INTERFACE_INFO(overlay_overlay_paint_point_iface, "").smooth(Type::VEC4, "finalColor");

GPU_SHADER_CREATE_INFO(overlay_paint_point)
    .do_static_compilation(true)
    .vertex_in(0, Type::VEC3, "pos")
    .vertex_in(1, Type::VEC4, "nor") /* Select flag on the 4th component. */
    .vertex_out(overlay_overlay_paint_point_iface)
    .fragment_out(0, Type::VEC4, "fragColor")
    .vertex_source("overlay_paint_point_vert.glsl")
    .fragment_source("overlay_point_varying_color_frag.glsl")
    .additional_info("draw_modelmat", "draw_globals");

GPU_SHADER_CREATE_INFO(overlay_paint_point_clipped)
    .additional_info("overlay_paint_point")
    .additional_info("drw_clipped")
    .do_static_compilation(true);

/** \} */

/* -------------------------------------------------------------------- */
/** \name OVERLAY_shader_paint_texture.
 *
 * Used in Texture Paint mode for the Stencil Image Masking.
 * \{ */

GPU_SHADER_INTERFACE_INFO(overlay_paint_texture_iface, "").smooth(Type::VEC2, "uv_interp");

GPU_SHADER_CREATE_INFO(overlay_paint_texture)
    .do_static_compilation(true)
    .vertex_in(0, Type::VEC3, "pos")
    .vertex_in(1, Type::VEC2, "mu") /* Masking uv map. */
    .vertex_out(overlay_paint_texture_iface)
    .sampler(0, ImageType::FLOAT_2D, "maskImage")
    .push_constant(Type::VEC3, "maskColor")
    .push_constant(Type::FLOAT, "opacity") /* `1.0` by default. */
    .push_constant(Type::BOOL, "maskInvertStencil")
    .push_constant(Type::BOOL, "maskImagePremultiplied")
    .fragment_out(0, Type::VEC4, "fragColor")
    .vertex_source("overlay_paint_texture_vert.glsl")
    .fragment_source("overlay_paint_texture_frag.glsl")
    .additional_info("draw_modelmat");

GPU_SHADER_CREATE_INFO(overlay_paint_texture_clipped)
    .additional_info("overlay_paint_texture")
    .additional_info("drw_clipped")
    .do_static_compilation(true);

/** \} */

/* -------------------------------------------------------------------- */
/** \name OVERLAY_shader_paint_vertcol.
 *
 * It should be used to draw a Vertex Paint overlay. But it is currently unreachable.
 * \{ */

GPU_SHADER_INTERFACE_INFO(overlay_paint_vertcol_iface, "").smooth(Type::VEC3, "finalColor");

GPU_SHADER_CREATE_INFO(overlay_paint_vertcol)
    .do_static_compilation(true)
    .vertex_in(0, Type::VEC3, "pos")
    .vertex_in(1, Type::VEC3, "ac") /* Active color. */
    .vertex_out(overlay_paint_vertcol_iface)
    .push_constant(Type::FLOAT, "opacity")      /* `1.0` by default. */
    .push_constant(Type::BOOL, "useAlphaBlend") /* `false` by default. */
    .fragment_out(0, Type::VEC4, "fragColor")
    .vertex_source("overlay_paint_vertcol_vert.glsl")
    .fragment_source("overlay_paint_vertcol_frag.glsl")
    .additional_info("draw_modelmat");

GPU_SHADER_CREATE_INFO(overlay_paint_vertcol_clipped)
    .additional_info("overlay_paint_vertcol")
    .additional_info("drw_clipped")
    .do_static_compilation(true);

/** \} */

/* -------------------------------------------------------------------- */
/** \name OVERLAY_shader_paint_weight.
 *
 * Used to display Vertex Weights.
 * `overlay paint weight` is for wireframe display mode.
 * \{ */

GPU_SHADER_INTERFACE_INFO(overlay_paint_weight_iface, "")
    .smooth(Type::VEC2, "weight_interp") /* (weight, alert) */
    .smooth(Type::FLOAT, "color_fac");

GPU_SHADER_CREATE_INFO(overlay_paint_weight)
    .do_static_compilation(true)
    .vertex_in(0, Type::FLOAT, "weight")
    .vertex_in(1, Type::VEC3, "pos")
    .vertex_in(2, Type::VEC3, "nor")
    .vertex_out(overlay_paint_weight_iface)
    .sampler(0, ImageType::FLOAT_1D, "colorramp")
    .push_constant(Type::FLOAT, "opacity")     /* `1.0` by default. */
    .push_constant(Type::BOOL, "drawContours") /* `false` by default. */
    .fragment_out(0, Type::VEC4, "fragColor")
    .vertex_source("overlay_paint_weight_vert.glsl")
    .fragment_source("overlay_paint_weight_frag.glsl")
    .additional_info("draw_modelmat", "draw_globals");

GPU_SHADER_CREATE_INFO(overlay_paint_weight_fake_shading)
    .additional_info("overlay_paint_weight")
    .define("FAKE_SHADING")
    .push_constant(Type::VEC3, "light_dir")
    .do_static_compilation(true);

GPU_SHADER_CREATE_INFO(overlay_paint_weight_clipped)
    .additional_info("overlay_paint_weight")
    .additional_info("drw_clipped")
    .do_static_compilation(true);

GPU_SHADER_CREATE_INFO(overlay_paint_weight_fake_shading_clipped)
    .additional_info("overlay_paint_weight_fake_shading")
    .additional_info("drw_clipped")
    .do_static_compilation(true);

/** \} */

/* -------------------------------------------------------------------- */
/** \name OVERLAY_shader_paint_wire.
 *
 * Used in face selection mode to display edges of selected faces in Weight, Vertex and Texture
 * paint modes.
 * \{ */

GPU_SHADER_INTERFACE_INFO(overlay_paint_wire_iface, "").flat(Type::VEC4, "finalColor");

GPU_SHADER_CREATE_INFO(overlay_paint_wire)
    .do_static_compilation(true)
    .vertex_in(0, Type::VEC3, "pos")
    .vertex_in(1, Type::VEC4, "nor") /* flag stored in w */
    .vertex_out(overlay_paint_wire_iface)
    .push_constant(Type::BOOL, "useSelect")
    .fragment_out(0, Type::VEC4, "fragColor")
    .vertex_source("overlay_paint_wire_vert.glsl")
    .fragment_source("overlay_varying_color.glsl")
    .additional_info("draw_modelmat", "draw_globals");

GPU_SHADER_CREATE_INFO(overlay_paint_wire_clipped)
    .additional_info("overlay_paint_vertcol")
    .additional_info("drw_clipped")
    .do_static_compilation(true);

/** \} */