Blender  V3.3
overlay_armature_info.hh
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
4 
5 GPU_SHADER_CREATE_INFO(overlay_frag_output)
6  .fragment_out(0, Type::VEC4, "fragColor")
7  .fragment_out(1, Type::VEC4, "lineOutput");
8 
9 GPU_SHADER_INTERFACE_INFO(overlay_armature_wire_iface, "")
10  .flat(Type::VEC4, "finalColor")
11  .flat(Type::VEC2, "edgeStart")
12  .no_perspective(Type::VEC2, "edgePos");
13 
15  .push_constant(Type::FLOAT, "alpha")
16  .additional_info("draw_view");
17 
18 /* -------------------------------------------------------------------- */
22 GPU_SHADER_CREATE_INFO(overlay_armature_sphere_outline)
23  .do_static_compilation(true)
24  .vertex_in(0, Type::VEC2, "pos")
25  /* Per instance. */
26  .vertex_in(1, Type::MAT4, "inst_obmat")
27  .vertex_out(overlay_armature_wire_iface)
28  .vertex_source("overlay_armature_sphere_outline_vert.glsl")
29  .fragment_source("overlay_armature_wire_frag.glsl")
30  .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals");
31 
32 GPU_SHADER_CREATE_INFO(overlay_armature_sphere_outline_clipped)
33  .do_static_compilation(true)
34  .additional_info("overlay_armature_sphere_outline", "drw_clipped");
35 
36 GPU_SHADER_INTERFACE_INFO(overlay_armature_sphere_solid_iface, "")
37  .flat(Type::VEC3, "finalStateColor")
38  .flat(Type::VEC3, "finalBoneColor")
39  .flat(Type::MAT4, "sphereMatrix")
40  .smooth(Type::VEC3, "viewPosition");
41 
42 GPU_SHADER_CREATE_INFO(overlay_armature_sphere_solid)
43  .do_static_compilation(true)
44  .vertex_in(0, Type::VEC2, "pos")
45  /* Per instance. */
46  .vertex_in(1, Type::VEC4, "color")
47  .vertex_in(2, Type::MAT4, "inst_obmat")
48  // .depth_layout(DepthLayout::GREATER) /* TODO */
49  .vertex_out(overlay_armature_sphere_solid_iface)
50  .vertex_source("overlay_armature_sphere_solid_vert.glsl")
51  .fragment_source("overlay_armature_sphere_solid_frag.glsl")
52  .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals");
53 
54 GPU_SHADER_CREATE_INFO(overlay_armature_sphere_solid_clipped)
55  .do_static_compilation(true)
56  .additional_info("overlay_armature_sphere_solid", "drw_clipped");
57 
60 /* -------------------------------------------------------------------- */
64 GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_outline_iface, "geom_in")
65  .smooth(Type::VEC4, "pPos")
66  .smooth(Type::VEC3, "vPos")
67  .smooth(Type::VEC2, "ssPos")
68  .smooth(Type::VEC2, "ssNor")
69  .smooth(Type::VEC4, "vColSize")
70  .flat(Type::INT, "inverted");
71 
72 GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline)
73  .do_static_compilation(true)
74  .vertex_in(0, Type::VEC3, "pos")
75  .vertex_in(1, Type::VEC3, "snor")
76  /* Per instance. */
77  .vertex_in(2, Type::VEC4, "color")
78  .vertex_in(3, Type::MAT4, "inst_obmat")
79  .vertex_out(overlay_armature_shape_outline_iface)
80  .geometry_layout(PrimitiveIn::LINES_ADJACENCY, PrimitiveOut::LINE_STRIP, 2)
81  .geometry_out(overlay_armature_wire_iface)
82  .vertex_source("overlay_armature_shape_outline_vert.glsl")
83  .geometry_source("overlay_armature_shape_outline_geom.glsl")
84  .fragment_source("overlay_armature_wire_frag.glsl")
85  .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals");
86 
87 GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline_clipped)
88  .do_static_compilation(true)
89  .additional_info("overlay_armature_shape_outline", "drw_clipped");
90 
91 GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_solid_iface, "")
92  .smooth(Type::VEC4, "finalColor")
93  .flat(Type::INT, "inverted");
94 
95 GPU_SHADER_CREATE_INFO(overlay_armature_shape_solid)
96  .do_static_compilation(true)
97  .vertex_in(0, Type::VEC3, "pos")
98  .vertex_in(1, Type::VEC3, "nor")
99  /* Per instance. */
100  .vertex_in(2, Type::MAT4, "inst_obmat")
101  .depth_write(DepthWrite::GREATER)
102  .vertex_out(overlay_armature_shape_solid_iface)
103  .vertex_source("overlay_armature_shape_solid_vert.glsl")
104  .fragment_source("overlay_armature_shape_solid_frag.glsl")
105  .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals");
106 
107 GPU_SHADER_CREATE_INFO(overlay_armature_shape_solid_clipped)
108  .do_static_compilation(true)
109  .additional_info("overlay_armature_shape_solid", "drw_clipped");
110 
111 GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire)
112  .do_static_compilation(true)
113  .vertex_in(0, Type::VEC3, "pos")
114  .vertex_in(1, Type::VEC3, "nor")
115  /* Per instance. */
116  .vertex_in(2, Type::MAT4, "inst_obmat")
117  .vertex_out(overlay_armature_wire_iface)
118  .vertex_source("overlay_armature_shape_wire_vert.glsl")
119  .fragment_source("overlay_armature_wire_frag.glsl")
120  .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals");
121 
122 GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_clipped)
123  .do_static_compilation(true)
124  .additional_info("overlay_armature_shape_wire", "drw_clipped");
125 
128 /* -------------------------------------------------------------------- */
132 GPU_SHADER_CREATE_INFO(overlay_armature_envelope_outline)
133  .do_static_compilation(true)
134  .vertex_in(0, Type::VEC2, "pos0")
135  .vertex_in(1, Type::VEC2, "pos1")
136  .vertex_in(2, Type::VEC2, "pos2")
137  /* Per instance. */
138  .vertex_in(3, Type::VEC4, "headSphere")
139  .vertex_in(4, Type::VEC4, "tailSphere")
140  .vertex_in(5, Type::VEC4, "outlineColorSize")
141  .vertex_in(6, Type::VEC3, "xAxis")
142  .vertex_out(overlay_armature_wire_iface)
143  .vertex_source("overlay_armature_envelope_outline_vert.glsl")
144  .fragment_source("overlay_armature_wire_frag.glsl")
145  .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals");
146 
147 GPU_SHADER_CREATE_INFO(overlay_armature_envelope_outline_clipped)
148  .do_static_compilation(true)
149  .additional_info("overlay_armature_envelope_outline", "drw_clipped");
150 
151 GPU_SHADER_INTERFACE_INFO(overlay_armature_envelope_solid_iface, "")
152  .flat(Type::VEC3, "finalStateColor")
153  .flat(Type::VEC3, "finalBoneColor")
154  .smooth(Type::VEC3, "normalView");
155 
156 GPU_SHADER_CREATE_INFO(overlay_armature_envelope_solid)
157  .do_static_compilation(true)
158  .vertex_in(0, Type::VEC3, "pos")
159  /* Per instance. Assumed to be in world coordinate already. */
160  .vertex_in(1, Type::VEC4, "headSphere")
161  .vertex_in(2, Type::VEC4, "tailSphere")
162  .vertex_in(3, Type::VEC3, "xAxis")
163  .vertex_in(4, Type::VEC3, "stateColor")
164  .vertex_in(5, Type::VEC3, "boneColor")
165  .vertex_out(overlay_armature_envelope_solid_iface)
166  .push_constant(Type::BOOL, "isDistance")
167  .vertex_source("overlay_armature_envelope_solid_vert.glsl")
168  .fragment_source("overlay_armature_envelope_solid_frag.glsl")
169  .additional_info("overlay_frag_output", "overlay_armature_common");
170 
171 GPU_SHADER_CREATE_INFO(overlay_armature_envelope_solid_clipped)
172  .do_static_compilation(true)
173  .additional_info("overlay_armature_envelope_solid", "drw_clipped");
174 
177 /* -------------------------------------------------------------------- */
181 GPU_SHADER_INTERFACE_INFO(overlay_armature_stick_iface, "")
182  .no_perspective(Type::FLOAT, "colorFac")
183  .flat(Type::VEC4, "finalWireColor")
184  .flat(Type::VEC4, "finalInnerColor");
185 
186 GPU_SHADER_CREATE_INFO(overlay_armature_stick)
187  .do_static_compilation(true)
188  /* Bone aligned screen space. */
189  .vertex_in(0, Type::VEC2, "pos")
190  .vertex_in(1, Type::UINT, "flag")
191  /* Per instance. Assumed to be in world coordinate already. */
192  .vertex_in(2, Type::VEC3, "boneStart")
193  .vertex_in(3, Type::VEC3, "boneEnd")
194  /* alpha encode if we do wire. If 0.0 we don't. */
195  .vertex_in(4, Type::VEC4, "wireColor")
196  .vertex_in(5, Type::VEC4, "boneColor")
197  .vertex_in(6, Type::VEC4, "headColor")
198  .vertex_in(7, Type::VEC4, "tailColor")
199  .define("do_wire", "(wireColor.a > 0.0)")
200  .vertex_out(overlay_armature_stick_iface)
201  .vertex_source("overlay_armature_stick_vert.glsl")
202  .fragment_source("overlay_armature_stick_frag.glsl")
203  .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals");
204 
205 GPU_SHADER_CREATE_INFO(overlay_armature_stick_clipped)
206  .do_static_compilation(true)
207  .additional_info("overlay_armature_stick", "drw_clipped");
208 
211 /* -------------------------------------------------------------------- */
215 GPU_SHADER_CREATE_INFO(overlay_armature_dof)
216  .vertex_in(0, Type::VEC2, "pos")
217  /* Per instance. Assumed to be in world coordinate already. */
218  .vertex_in(1, Type::VEC4, "color")
219  .vertex_in(2, Type::MAT4, "inst_obmat")
220  .vertex_out(overlay_armature_wire_iface)
221  .vertex_source("overlay_armature_dof_vert.glsl")
222  .additional_info("overlay_frag_output", "overlay_armature_common", "draw_globals");
223 
224 GPU_SHADER_CREATE_INFO(overlay_armature_dof_wire)
225  .do_static_compilation(true)
226  .fragment_source("overlay_armature_dof_solid_frag.glsl")
227  .additional_info("overlay_armature_dof");
228 
229 GPU_SHADER_CREATE_INFO(overlay_armature_dof_wire_clipped)
230  .do_static_compilation(true)
231  .additional_info("overlay_armature_dof_wire", "drw_clipped");
232 
233 GPU_SHADER_CREATE_INFO(overlay_armature_dof_solid)
234  .do_static_compilation(true)
235  .fragment_source("overlay_armature_dof_solid_frag.glsl")
236  .additional_info("overlay_armature_dof");
237 
238 GPU_SHADER_CREATE_INFO(overlay_armature_dof_solid_clipped)
239  .do_static_compilation(true)
240  .additional_info("overlay_armature_dof_solid", "drw_clipped");
241 
244 /* -------------------------------------------------------------------- */
248 GPU_SHADER_CREATE_INFO(overlay_armature_wire)
249  .do_static_compilation(true)
250  .vertex_in(0, Type::VEC3, "pos")
251  .vertex_in(1, Type::VEC4, "color")
252  .push_constant(Type::FLOAT, "alpha")
253  .vertex_out(overlay_armature_wire_iface)
254  .vertex_source("overlay_armature_wire_vert.glsl")
255  .fragment_source("overlay_armature_wire_frag.glsl")
256  .additional_info("overlay_frag_output", "draw_mesh", "draw_globals");
257 
258 GPU_SHADER_CREATE_INFO(overlay_armature_wire_clipped)
259  .do_static_compilation(true)
260  .additional_info("overlay_armature_wire", "drw_clipped");
261 
typedef UINT(API *GHOST_WIN32_GetDpiForWindow)(HWND)
#define GPU_SHADER_INTERFACE_INFO(_interface, _inst_name)
#define GPU_SHADER_CREATE_INFO(_info)
pos overlay_armature_common
@ FLOAT