This repository has been archived on 2023-10-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blender-archive/source/blender/draw/engines/eevee/shaders/volumetric_geom.glsl
Campbell Barton 9b89de2571 Cleanup: consistent use of tags: NOTE/TODO/FIXME/XXX
Also use doxy style function reference `#` prefix chars when
referencing identifiers.
2021-07-04 00:43:40 +10:00

81 lines
1.2 KiB
GLSL

#pragma BLENDER_REQUIRE(common_view_lib.glsl)
#ifdef MESH_SHADER
/* TODO: tight slices. */
layout(triangles) in;
layout(triangle_strip, max_vertices = 3) out;
#else /* World */
layout(triangles) in;
layout(triangle_strip, max_vertices = 3) out;
#endif
in vec4 vPos[];
flat out int slice;
RESOURCE_ID_VARYING
#ifdef MESH_SHADER
/* TODO: tight slices. */
void main()
{
gl_Layer = slice = int(vPos[0].z);
PASS_RESOURCE_ID
# ifdef USE_ATTR
pass_attr(0);
# endif
gl_Position = vPos[0].xyww;
EmitVertex();
# ifdef USE_ATTR
pass_attr(1);
# endif
gl_Position = vPos[1].xyww;
EmitVertex();
# ifdef USE_ATTR
pass_attr(2);
# endif
gl_Position = vPos[2].xyww;
EmitVertex();
EndPrimitive();
}
#else /* World */
/* This is just a pass-through geometry shader that send the geometry
* to the layer corresponding to its depth. */
void main()
{
gl_Layer = slice = int(vPos[0].z);
PASS_RESOURCE_ID
# ifdef USE_ATTR
pass_attr(0);
# endif
gl_Position = vPos[0].xyww;
EmitVertex();
# ifdef USE_ATTR
pass_attr(1);
# endif
gl_Position = vPos[1].xyww;
EmitVertex();
# ifdef USE_ATTR
pass_attr(2);
# endif
gl_Position = vPos[2].xyww;
EmitVertex();
EndPrimitive();
}
#endif